Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2018-11-12 16:17:57 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2018-11-12 16:18:33 +0300
commitaee0446b6bdc6ff384e9d66a917f6cb06f620c0a (patch)
treef2cfd422a9415248c33118743d0d2c7427bf44d4 /source/blender/editors/space_nla
parent36a3a40033298227cfc55f59580e03863c09699d (diff)
Add a lot of update tagging to operations with NLA tracks and strips.
Diffstat (limited to 'source/blender/editors/space_nla')
-rw-r--r--source/blender/editors/space_nla/CMakeLists.txt1
-rw-r--r--source/blender/editors/space_nla/nla_channels.c24
-rw-r--r--source/blender/editors/space_nla/nla_edit.c47
3 files changed, 72 insertions, 0 deletions
diff --git a/source/blender/editors/space_nla/CMakeLists.txt b/source/blender/editors/space_nla/CMakeLists.txt
index c8c64a79945..a6b80a9a587 100644
--- a/source/blender/editors/space_nla/CMakeLists.txt
+++ b/source/blender/editors/space_nla/CMakeLists.txt
@@ -23,6 +23,7 @@ set(INC
../../blenkernel
../../blenlib
../../blentranslation
+ ../../depsgraph
../../gpu
../../makesdna
../../makesrna
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c
index 002eeea9746..132a296d5a3 100644
--- a/source/blender/editors/space_nla/nla_channels.c
+++ b/source/blender/editors/space_nla/nla_channels.c
@@ -60,6 +60,9 @@
#include "WM_api.h"
#include "WM_types.h"
+#include "DEG_depsgraph.h"
+#include "DEG_depsgraph_build.h"
+
#include "UI_view2d.h"
#include "nla_intern.h" // own include
@@ -235,6 +238,7 @@ static int mouse_nla_channels(bContext *C, bAnimContext *ac, float x, int channe
/* notifier flags - channel was edited */
notifierFlags |= (ND_ANIMCHAN | NA_EDITED);
+ ale->update |= ANIM_UPDATE_DEPS;
}
else if (x <= ((NLACHANNEL_BUTTON_WIDTH * 2) + offset)) {
/* toggle 'solo' */
@@ -242,6 +246,7 @@ static int mouse_nla_channels(bContext *C, bAnimContext *ac, float x, int channe
/* notifier flags - channel was edited */
notifierFlags |= (ND_ANIMCHAN | NA_EDITED);
+ ale->update |= ANIM_UPDATE_DEPS;
}
else if (nlaedit_is_tweakmode_on(ac) == 0) {
/* set selection */
@@ -284,6 +289,7 @@ static int mouse_nla_channels(bContext *C, bAnimContext *ac, float x, int channe
/* changes to NLA-Action occurred */
notifierFlags |= ND_NLA_ACTCHANGE;
+ ale->update |= ANIM_UPDATE_DEPS;
}
/* OR rest of name... */
else {
@@ -301,6 +307,7 @@ static int mouse_nla_channels(bContext *C, bAnimContext *ac, float x, int channe
/* changes to NLA-Action occurred */
notifierFlags |= ND_NLA_ACTCHANGE;
+ ale->update |= ANIM_UPDATE_DEPS;
}
else {
/* select/deselect */
@@ -330,6 +337,7 @@ static int mouse_nla_channels(bContext *C, bAnimContext *ac, float x, int channe
}
/* free channels */
+ ANIM_animdata_update(ac, &anim_data);
ANIM_animdata_freelist(&anim_data);
/* return the notifier-flags set */
@@ -411,6 +419,7 @@ void NLA_OT_channels_click(wmOperatorType *ot)
static int nlachannels_pushdown_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
+ ID *id = NULL;
AnimData *adt = NULL;
int channel_index = RNA_int_get(op->ptr, "channel_index");
@@ -429,6 +438,7 @@ static int nlachannels_pushdown_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
else {
+ id = adt_ptr.id.data;
adt = adt_ptr.data;
}
}
@@ -457,6 +467,7 @@ static int nlachannels_pushdown_exec(bContext *C, wmOperator *op)
/* grab AnimData from the channel */
adt = ale->adt;
+ id = ale->id;
/* we don't need anything here anymore, so free it all */
ANIM_animdata_freelist(&anim_data);
@@ -479,6 +490,8 @@ static int nlachannels_pushdown_exec(bContext *C, wmOperator *op)
else {
/* 'push-down' action - only usable when not in TweakMode */
BKE_nla_action_pushdown(adt);
+
+ DEG_id_tag_update_ex(CTX_data_main(C), id, DEG_TAG_TIME | DEG_TAG_COPY_ON_WRITE);
}
/* set notifier that things have changed */
@@ -597,18 +610,21 @@ bool nlaedit_add_tracks_existing(bAnimContext *ac, bool above_sel)
if (above_sel) {
/* just add a new one above this one */
BKE_nlatrack_add(adt, nlt);
+ ale->update = ANIM_UPDATE_DEPS;
added = true;
}
else if ((lastAdt == NULL) || (adt != lastAdt)) {
/* add one track to the top of the owning AnimData's stack, then don't add anymore to this stack */
BKE_nlatrack_add(adt, NULL);
lastAdt = adt;
+ ale->update = ANIM_UPDATE_DEPS;
added = true;
}
}
}
/* free temp data */
+ ANIM_animdata_update(ac, &anim_data);
ANIM_animdata_freelist(&anim_data);
return added;
@@ -637,11 +653,13 @@ bool nlaedit_add_tracks_empty(bAnimContext *ac)
if (BLI_listbase_is_empty(&adt->nla_tracks)) {
/* add new track to this AnimData block then */
BKE_nlatrack_add(adt, NULL);
+ ale->update = ANIM_UPDATE_DEPS;
added = true;
}
}
/* cleanup */
+ ANIM_animdata_update(ac, &anim_data);
ANIM_animdata_freelist(&anim_data);
return added;
@@ -665,6 +683,8 @@ static int nlaedit_add_tracks_exec(bContext *C, wmOperator *op)
/* done? */
if (op_done) {
+ DEG_relations_tag_update(CTX_data_main(C));
+
/* set notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
@@ -732,12 +752,16 @@ static int nlaedit_delete_tracks_exec(bContext *C, wmOperator *UNUSED(op))
/* call delete on this track - deletes all strips too */
BKE_nlatrack_free(&adt->nla_tracks, nlt, true);
+ ale->update = ANIM_UPDATE_DEPS;
}
}
/* free temp data */
+ ANIM_animdata_update(&ac, &anim_data);
ANIM_animdata_freelist(&anim_data);
+ DEG_relations_tag_update(ac.bmain);
+
/* set notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c
index edbdefdcf22..387560c3f6c 100644
--- a/source/blender/editors/space_nla/nla_edit.c
+++ b/source/blender/editors/space_nla/nla_edit.c
@@ -67,6 +67,8 @@
#include "WM_api.h"
#include "WM_types.h"
+#include "DEG_depsgraph_build.h"
+
#include "UI_interface.h"
#include "UI_resources.h"
#include "UI_view2d.h"
@@ -90,9 +92,12 @@ void ED_nla_postop_refresh(bAnimContext *ac)
for (ale = anim_data.first; ale; ale = ale->next) {
/* performing auto-blending, extend-mode validation, etc. */
BKE_nla_validate_state(ale->data);
+
+ ale->update |= ANIM_UPDATE_DEPS;
}
/* free temp memory */
+ ANIM_animdata_update(ac, &anim_data);
ANIM_animdata_freelist(&anim_data);
}
@@ -144,9 +149,12 @@ static int nlaedit_enable_tweakmode_exec(bContext *C, wmOperator *op)
BKE_nlatrack_solo_toggle(adt, nlt);
}
}
+
+ ale->update |= ANIM_UPDATE_DEPS;
}
/* free temp data */
+ ANIM_animdata_update(&ac, &anim_data);
ANIM_animdata_freelist(&anim_data);
/* if we managed to enter tweakmode on at least one AnimData block,
@@ -223,9 +231,12 @@ bool nlaedit_disable_tweakmode(bAnimContext *ac, bool do_solo)
/* to be sure that we're doing everything right, just exit tweakmode... */
BKE_nla_tweakmode_exit(adt);
+
+ ale->update |= ANIM_UPDATE_DEPS;
}
/* free temp data */
+ ANIM_animdata_update(ac, &anim_data);
ANIM_animdata_freelist(&anim_data);
/* if we managed to enter tweakmode on at least one AnimData block,
@@ -669,6 +680,8 @@ static int nlaedit_add_actionclip_exec(bContext *C, wmOperator *op)
/* refresh auto strip properties */
ED_nla_postop_refresh(&ac);
+ DEG_relations_tag_update(ac.bmain);
+
/* set notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
@@ -939,9 +952,12 @@ static int nlaedit_add_meta_exec(bContext *C, wmOperator *UNUSED(op))
if (strip->flag & NLASTRIP_FLAG_SELECT)
BKE_nlastrip_validate_name(adt, strip);
}
+
+ ale->update |= ANIM_UPDATE_DEPS;
}
/* free temp data */
+ ANIM_animdata_update(&ac, &anim_data);
ANIM_animdata_freelist(&anim_data);
/* set notifier that things have changed */
@@ -991,9 +1007,12 @@ static int nlaedit_remove_meta_exec(bContext *C, wmOperator *UNUSED(op))
/* clear all selected meta-strips, regardless of whether they are temporary or not */
BKE_nlastrips_clear_metas(&nlt->strips, 1, 0);
+
+ ale->update |= ANIM_UPDATE_DEPS;
}
/* free temp data */
+ ANIM_animdata_update(&ac, &anim_data);
ANIM_animdata_freelist(&anim_data);
/* set notifier that things have changed */
@@ -1087,6 +1106,10 @@ static int nlaedit_duplicate_exec(bContext *C, wmOperator *op)
/* refresh auto strip properties */
ED_nla_postop_refresh(&ac);
+ if (!linked) {
+ DEG_relations_tag_update(ac.bmain);
+ }
+
/* set notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
@@ -1178,6 +1201,8 @@ static int nlaedit_delete_exec(bContext *C, wmOperator *UNUSED(op))
/* refresh auto strip properties */
ED_nla_postop_refresh(&ac);
+ DEG_relations_tag_update(ac.bmain);
+
/* set notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
@@ -1765,11 +1790,14 @@ static int nlaedit_sync_actlen_exec(bContext *C, wmOperator *op)
/* adjust the strip extents in response to this */
BKE_nlastrip_recalculate_bounds(strip);
+
+ ale->update |= ANIM_UPDATE_DEPS;
}
}
}
/* free temp data */
+ ANIM_animdata_update(&ac, &anim_data);
ANIM_animdata_freelist(&anim_data);
/* set notifier that things have changed */
@@ -1808,6 +1836,7 @@ static int nlaedit_make_single_user_exec(bContext *C, wmOperator *UNUSED(op))
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
+ bool copied = false;
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
@@ -1841,14 +1870,22 @@ static int nlaedit_make_single_user_exec(bContext *C, wmOperator *UNUSED(op))
/* switch to the new copy */
strip->act = new_action;
+
+ ale->update |= ANIM_UPDATE_DEPS;
+ copied = true;
}
}
}
}
/* free temp data */
+ ANIM_animdata_update(&ac, &anim_data);
ANIM_animdata_freelist(&anim_data);
+ if (copied) {
+ DEG_relations_tag_update(ac.bmain);
+ }
+
/* set notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
@@ -1898,6 +1935,7 @@ static int nlaedit_apply_scale_exec(bContext *C, wmOperator *UNUSED(op))
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
+ bool copied = false;
KeyframeEditData ked = {{NULL}};
@@ -1927,6 +1965,8 @@ static int nlaedit_apply_scale_exec(bContext *C, wmOperator *UNUSED(op))
/* set this as the new referenced action, decrementing the users of the old one */
id_us_min(&strip->act->id);
strip->act = act;
+
+ copied = true;
}
/* setup iterator, and iterate over all the keyframes in the action, applying this scaling */
@@ -1939,13 +1979,20 @@ static int nlaedit_apply_scale_exec(bContext *C, wmOperator *UNUSED(op))
*/
strip->scale = 1.0f;
calc_action_range(strip->act, &strip->actstart, &strip->actend, 0);
+
+ ale->update |= ANIM_UPDATE_DEPS;
}
}
}
/* free temp data */
+ ANIM_animdata_update(&ac, &anim_data);
ANIM_animdata_freelist(&anim_data);
+ if (copied) {
+ DEG_relations_tag_update(ac.bmain);
+ }
+
/* set notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);