diff options
Diffstat (limited to 'source/blender/editors/animation/anim_deps.c')
-rw-r--r-- | source/blender/editors/animation/anim_deps.c | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c index c0543862265..5bffdfbcc4b 100644 --- a/source/blender/editors/animation/anim_deps.c +++ b/source/blender/editors/animation/anim_deps.c @@ -45,6 +45,7 @@ #include "BKE_animsys.h" #include "BKE_action.h" +#include "BKE_fcurve.h" #include "BKE_context.h" #include "BKE_depsgraph.h" #include "BKE_global.h" @@ -341,5 +342,49 @@ void ANIM_sync_animchannels_to_data(const bContext *C) } } - BLI_freelistN(&anim_data); + ANIM_animdata_freelist(&anim_data); +} + +void ANIM_animdata_update(bAnimContext *ac, ListBase *anim_data) +{ + bAnimListElem *ale; + + if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) + return; + + 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; + sort_time_fcurve(fcu); + } + + if (ale->update & ANIM_UPDATE_HANDLES) { + ale->update &= ~ANIM_UPDATE_HANDLES; + 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); + } +} + +void ANIM_animdata_freelist(ListBase *anim_data) +{ +#ifndef NDEBUG + bAnimListElem *ale, *ale_next; + for (ale = anim_data->first; ale; ale = ale_next) { + ale_next = ale->next; + BLI_assert(ale->update == 0); + MEM_freeN(ale); + } + BLI_listbase_clear(anim_data); +#else + BLI_freelistN(anim_data); +#endif } |