GPencil: Add always empty frame when add new layer

The dopesheet needs to have a frame to display the channel, so an empty frame is created in the current frame.

See T66505 for details of why an empty channel cannot be displayed.
This commit is contained in:
Antonio Vazquez 2020-04-16 22:43:41 +02:00
parent 9029690a5d
commit 27e39cc533
1 changed files with 2 additions and 4 deletions

View File

@ -241,10 +241,8 @@ static int gp_layer_add_exec(bContext *C, wmOperator *op)
if ((ob != NULL) && (ob->type == OB_GPENCIL)) {
gpd = (bGPdata *)ob->data;
bGPDlayer *gpl = BKE_gpencil_layer_addnew(gpd, DATA_("GP_Layer"), true);
ScrArea *area = CTX_wm_area(C);
/* In dopesheet add a new frame. */
if ((gpl != NULL) && (area->spacetype == SPACE_ACTION)) {
/* Add a new frame to make it visible in Dopesheet. */
if (gpl != NULL) {
gpl->actframe = BKE_gpencil_layer_frame_get(gpl, CFRA, GP_GETFRAME_ADD_NEW);
}
}