[Bf-blender-cvs] [3419ffd] master: Fix: ANIM_animdata_update() was not handling post-edit updates on GP channels
Joshua Leung
noreply at git.blender.org
Mon Feb 8 14:47:06 CET 2016
Commit: 3419ffdf498cd5ba27433bd64d9da3939a4b13d2
Author: Joshua Leung
Date: Tue Feb 9 02:18:05 2016 +1300
Branches: master
https://developer.blender.org/rB3419ffdf498cd5ba27433bd64d9da3939a4b13d2
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
===================================================================
M source/blender/editors/animation/anim_deps.c
M source/blender/editors/space_action/action_edit.c
===================================================================
diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c
index a38f5db..5665ce5 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);
}
}
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index 35b3345..e595d5d 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -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;
}
More information about the Bf-blender-cvs
mailing list