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
This commit is contained in:
Joshua Leung 2016-02-09 02:18:05 +13:00
parent 770319bbd2
commit 3419ffdf49
2 changed files with 40 additions and 21 deletions

View File

@ -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->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_HANDLES) {
ale->update &= ~ANIM_UPDATE_HANDLES;
if (fcu)
calchandles_fcurve(fcu);
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);
}
}
if (ale->update & ANIM_UPDATE_DEPS) {
ale->update &= ~ANIM_UPDATE_DEPS;
ANIM_list_elem_update(ac->scene, ale);
}
BLI_assert(ale->update == 0);
}
}

View File

@ -902,16 +902,16 @@ static bool delete_action_keys(bAnimContext *ac)
ale->key_data = NULL;
}
}
if (changed) {
ale->update |= ANIM_UPDATE_DEFAULT;
changed_final = true;
}
}
ANIM_animdata_update(ac, &anim_data);
ANIM_animdata_freelist(&anim_data);
return changed_final;
}