diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2020-06-19 11:09:51 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2020-06-19 11:10:11 +0300 |
commit | b1ce4ca40c03ab2562863ef8056adc3b2aff5c10 (patch) | |
tree | 0f8f8c3fcdfc308cf9dbb1ddfe7ca73ef06030b1 /source/blender/editors/space_action | |
parent | fade37ff07ab3b62844068a1a5d60dd74ea787f6 (diff) |
Fix T77997: GPencil insert keyframe on timeline doen't update viewport
The reason was the datablock is changed but it was not tagged for depsgraph refresh.
In some cases it could be possible to tag several times the same datablock, but as this is not the case all the times and the number of tags is always very small, it doesn't worth a complex code to keep a memory list of the datablocks to tag.
Diffstat (limited to 'source/blender/editors/space_action')
-rw-r--r-- | source/blender/editors/space_action/action_edit.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index b390e4b56d6..aa44982ccc5 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -800,10 +800,17 @@ static void insert_gpencil_keys(bAnimContext *ac, short mode) add_frame_mode = GP_GETFRAME_ADD_NEW; } - /* insert gp frames */ + /* Insert gp frames. */ + bGPdata *gpd_old = NULL; for (ale = anim_data.first; ale; ale = ale->next) { + bGPdata *gpd = (bGPdata *)ale->id; bGPDlayer *gpl = (bGPDlayer *)ale->data; BKE_gpencil_layer_frame_get(gpl, CFRA, add_frame_mode); + /* Check if the gpd changes to tag only once. */ + if (gpd != gpd_old) { + BKE_gpencil_tag(gpd); + gpd_old = gpd; + } } ANIM_animdata_update(ac, &anim_data); @@ -839,6 +846,9 @@ static int actkeys_insertkey_exec(bContext *C, wmOperator *op) } /* set notifier that keyframes have changed */ + if (ac.datatype == ANIMCONT_GPENCIL) { + WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL); + } WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_ADDED, NULL); return OPERATOR_FINISHED; |