Fix T73960: GPencil can't convert while it is a separate from old strokes

The problem was the new object hadn't any layer active.
This commit is contained in:
Antonio Vazquez 2020-02-18 11:11:22 +01:00
parent 5343d0f494
commit abfdd1c697
Notes: blender-bot 2023-02-14 02:27:51 +01:00
Referenced by issue #73960, Grease Pencil can't convert to any type while it is a separate from old strokes
1 changed files with 7 additions and 0 deletions

View File

@ -4222,6 +4222,13 @@ static int gp_stroke_separate_exec(bContext *C, wmOperator *op)
}
}
/* Ensure destination object has one active layer. */
if (gpd_dst->layers.first != NULL) {
if (BKE_gpencil_layer_getactive(gpd_dst) == NULL) {
BKE_gpencil_layer_setactive(gpd_dst, gpd_dst->layers.first);
}
}
DEG_id_tag_update(&gpd_src->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
DEG_id_tag_update(&gpd_dst->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);