diff options
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/animation/anim_deps.c | 12 | ||||
-rw-r--r-- | source/blender/editors/include/ED_anim_api.h | 2 | ||||
-rw-r--r-- | source/blender/editors/space_nla/CMakeLists.txt | 1 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_channels.c | 24 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_edit.c | 47 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_generics.c | 2 |
6 files changed, 83 insertions, 5 deletions
diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c index bfc3caecfee..2ed5d35b613 100644 --- a/source/blender/editors/animation/anim_deps.c +++ b/source/blender/editors/animation/anim_deps.c @@ -84,6 +84,12 @@ void ANIM_list_elem_update(Main *bmain, Scene *scene, bAnimListElem *ale) } } + /* Tag copy on the main object if updating anything directly inside AnimData */ + if (ELEM(ale->type, ANIMTYPE_ANIMDATA, ANIMTYPE_NLAACTION, ANIMTYPE_NLATRACK, ANIMTYPE_NLACURVE)) { + DEG_id_tag_update(id, DEG_TAG_TIME | DEG_TAG_COPY_ON_WRITE); + return; + } + /* update data */ fcu = (ale->datatype == ALE_FCURVE) ? ale->key_data : NULL; @@ -108,7 +114,7 @@ void ANIM_list_elem_update(Main *bmain, Scene *scene, bAnimListElem *ale) /* tags the given ID block for refreshes (if applicable) due to * Animation Editor editing */ -void ANIM_id_update(Scene *UNUSED(scene), ID *id) +void ANIM_id_update(Main *bmain, ID *id) { if (id) { AnimData *adt = BKE_animdata_from_id(id); @@ -118,7 +124,7 @@ void ANIM_id_update(Scene *UNUSED(scene), ID *id) adt->recalc |= ADT_RECALC_ANIM; /* set recalc flags */ - DEG_id_tag_update(id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); // XXX or do we want something more restrictive? + DEG_id_tag_update_ex(bmain, id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); // XXX or do we want something more restrictive? } } @@ -433,7 +439,7 @@ void ANIM_animdata_update(bAnimContext *ac, ListBase *anim_data) ANIM_list_elem_update(ac->bmain, ac->scene, ale); } } - else if (ale->datatype == ALE_NLASTRIP) { + else if (ELEM(ale->type, ANIMTYPE_ANIMDATA, ANIMTYPE_NLAACTION, ANIMTYPE_NLATRACK, ANIMTYPE_NLACURVE)) { if (ale->update & ANIM_UPDATE_DEPS) { ale->update &= ~ANIM_UPDATE_DEPS; ANIM_list_elem_update(ac->bmain, ac->scene, ale); diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index ae86e4a5fbf..a2be7622537 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -688,7 +688,7 @@ float ANIM_unit_mapping_get_factor(struct Scene *scene, struct ID *id, struct FC /* --------- anim_deps.c, animation updates -------- */ -void ANIM_id_update(struct Scene *scene, struct ID *id); +void ANIM_id_update(struct Main *bmain, struct ID *id); void ANIM_list_elem_update(struct Main *bmain, struct Scene *scene, bAnimListElem *ale); /* data -> channels syncing */ 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); diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index cc7dccbb874..5cc98e52da2 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -491,7 +491,7 @@ static void recalcData_nla(TransInfo *t) * BUT only if realtime updates are enabled */ if ((snla->flag & SNLA_NOREALTIMEUPDATES) == 0) - ANIM_id_update(t->scene, tdn->id); + ANIM_id_update(CTX_data_main(t->context), tdn->id); /* if canceling transform, just write the values without validating, then move on */ if (t->state == TRANS_CANCEL) { |