From fe7ea8a24c8a147078d033b76d9a37a84042368c Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Thu, 2 Apr 2020 16:52:43 +0200 Subject: [PATCH] Fix T75250: setting greasepencil active layer not refreshing the dopesheet This was only reported for the 'Change Active Layer' operator [which was not setting the channel as selected in the dopesheet], but this is also the case elsewhere [where BKE_gpencil_layer_active_set is used], namely: - gp_layer_remove_exec - gp_layer_copy_exec - gp_merge_layer_exec - gp_layer_change_exec - gp_layer_active_exec - gp_stroke_separate_exec We could set GP_LAYER_SELECT "by hand" in BKE_gpencil_layer_active_set(), but there is already animchan_sync_gplayer() that does that. For this, we need the NA_SELECTED notifier though. Maniphest Tasks: T75250 Differential Revision: https://developer.blender.org/D7311 --- source/blender/editors/gpencil/gpencil_data.c | 5 +++++ source/blender/editors/gpencil/gpencil_edit.c | 1 + 2 files changed, 6 insertions(+) diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c index 898facb86e8..a12f960c29e 100644 --- a/source/blender/editors/gpencil/gpencil_data.c +++ b/source/blender/editors/gpencil/gpencil_data.c @@ -331,6 +331,7 @@ static int gp_layer_remove_exec(bContext *C, wmOperator *op) /* notifiers */ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL); + WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_SELECTED, NULL); return OPERATOR_FINISHED; } @@ -478,6 +479,7 @@ static int gp_layer_copy_exec(bContext *C, wmOperator *UNUSED(op)) /* notifiers */ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL); + WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_SELECTED, NULL); return OPERATOR_FINISHED; } @@ -1228,6 +1230,7 @@ static int gp_merge_layer_exec(bContext *C, wmOperator *op) /* notifiers */ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL); + WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_SELECTED, NULL); return OPERATOR_FINISHED; } @@ -1291,6 +1294,7 @@ static int gp_layer_change_exec(bContext *C, wmOperator *op) /* updates */ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL); + WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_SELECTED, NULL); return OPERATOR_FINISHED; } @@ -1336,6 +1340,7 @@ static int gp_layer_active_exec(bContext *C, wmOperator *op) /* updates */ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL); + WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_SELECTED, NULL); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 91169b34e34..8c31df02a11 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -4364,6 +4364,7 @@ static int gp_stroke_separate_exec(bContext *C, wmOperator *op) DEG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, NULL); WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL); + WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_SELECTED, NULL); return OPERATOR_FINISHED; }