From 3419ffdf498cd5ba27433bd64d9da3939a4b13d2 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 9 Feb 2016 02:18:05 +1300 Subject: Fix: ANIM_animdata_update() was not handling post-edit updates on GP channels This may have resulted in situations where the order of GP keyframes was incorrect (leading to some frames not being able to be found), or in some redraw problems when trying to delete GP keyframes (that I was getting earlier, but can't seem to reproduce now) TODO: We now need to hook up a proper api to do the GP key sorting --- source/blender/editors/animation/anim_deps.c | 55 +++++++++++++++++++--------- 1 file changed, 37 insertions(+), 18 deletions(-) (limited to 'source/blender/editors/animation/anim_deps.c') diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c index a38f5dbc8ea..5665ce59783 100644 --- a/source/blender/editors/animation/anim_deps.c +++ b/source/blender/editors/animation/anim_deps.c @@ -35,6 +35,7 @@ #include "DNA_anim_types.h" #include "DNA_armature_types.h" +#include "DNA_gpencil_types.h" #include "DNA_object_types.h" #include "DNA_node_types.h" #include "DNA_scene_types.h" @@ -46,6 +47,7 @@ #include "BKE_animsys.h" #include "BKE_action.h" #include "BKE_fcurve.h" +#include "BKE_gpencil.h" #include "BKE_context.h" #include "BKE_depsgraph.h" #include "BKE_global.h" @@ -351,7 +353,7 @@ void ANIM_animdata_update(bAnimContext *ac, ListBase *anim_data) { bAnimListElem *ale; - if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) { + if (ELEM(ac->datatype, ANIMCONT_MASK)) { #ifdef DEBUG /* quiet assert */ for (ale = anim_data->first; ale; ale = ale->next) { @@ -362,25 +364,42 @@ void ANIM_animdata_update(bAnimContext *ac, ListBase *anim_data) } for (ale = anim_data->first; ale; ale = ale->next) { - FCurve *fcu = ale->key_data; - - if (ale->update & ANIM_UPDATE_ORDER) { - ale->update &= ~ANIM_UPDATE_ORDER; - if (fcu) - sort_time_fcurve(fcu); - } - - if (ale->update & ANIM_UPDATE_HANDLES) { - ale->update &= ~ANIM_UPDATE_HANDLES; - if (fcu) - calchandles_fcurve(fcu); + if (ale->type == ANIMTYPE_GPLAYER) { + bGPDlayer *gpl = ale->data; + + if (ale->update & ANIM_UPDATE_ORDER) { + ale->update &= ~ANIM_UPDATE_ORDER; + if (gpl) { + //gpencil_sort_frames(gpl); + } + } + + if (ale->update & ANIM_UPDATE_DEPS) { + ale->update &= ~ANIM_UPDATE_DEPS; + ANIM_list_elem_update(ac->scene, ale); + } } - - if (ale->update & ANIM_UPDATE_DEPS) { - ale->update &= ~ANIM_UPDATE_DEPS; - ANIM_list_elem_update(ac->scene, ale); + else if (ale->datatype == ALE_FCURVE) { + FCurve *fcu = ale->key_data; + + if (ale->update & ANIM_UPDATE_ORDER) { + ale->update &= ~ANIM_UPDATE_ORDER; + if (fcu) + sort_time_fcurve(fcu); + } + + if (ale->update & ANIM_UPDATE_HANDLES) { + ale->update &= ~ANIM_UPDATE_HANDLES; + if (fcu) + calchandles_fcurve(fcu); + } + + if (ale->update & ANIM_UPDATE_DEPS) { + ale->update &= ~ANIM_UPDATE_DEPS; + ANIM_list_elem_update(ac->scene, ale); + } } - + BLI_assert(ale->update == 0); } } -- cgit v1.2.3