diff options
author | Joshua Leung <aligorith@gmail.com> | 2016-02-08 16:18:05 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2016-02-08 16:45:35 +0300 |
commit | 3419ffdf498cd5ba27433bd64d9da3939a4b13d2 (patch) | |
tree | 45c713c9eada9883bb982be4e52d56170f30b884 /source/blender/editors/animation | |
parent | 770319bbd2be1cc79f3f67f98e6f125d013beddc (diff) |
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
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r-- | source/blender/editors/animation/anim_deps.c | 55 |
1 files changed, 37 insertions, 18 deletions
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); } } |