diff options
-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 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_animation.c | 39 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_nla.c | 30 |
8 files changed, 131 insertions, 26 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) { diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index 43a89df0ed0..6c0ce6b124e 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -77,21 +77,26 @@ const EnumPropertyItem rna_enum_keying_flag_items[] = { #include "BKE_nla.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_build.h" #include "DNA_object_types.h" +#include "ED_anim_api.h" + #include "WM_api.h" -static void rna_AnimData_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) +static void rna_AnimData_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { ID *id = ptr->id.data; - AnimData *adt = ptr->data; - /* tag for refresh so that scheduled updates (e.g. action changed) will - * get computed and reflected in the scene [#34869] - */ - adt->recalc |= ADT_RECALC_ANIM; - DEG_id_tag_update(id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); + ANIM_id_update(bmain, id); +} + +static void rna_AnimData_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + DEG_relations_tag_update(bmain); + + rna_AnimData_update(bmain, scene, ptr); } static int rna_AnimData_action_editable(PointerRNA *ptr, const char **UNUSED(r_info)) @@ -512,16 +517,19 @@ static void rna_KeyingSet_paths_clear(KeyingSet *keyingset, ReportList *reports) } /* needs wrapper function to push notifier */ -static NlaTrack *rna_NlaTrack_new(AnimData *adt, bContext *C, NlaTrack *track) +static NlaTrack *rna_NlaTrack_new(ID *id, AnimData *adt, Main *bmain, bContext *C, NlaTrack *track) { NlaTrack *new_track = BKE_nlatrack_add(adt, track); WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_ADDED, NULL); + DEG_relations_tag_update(bmain); + DEG_id_tag_update_ex(bmain, id, DEG_TAG_TIME | DEG_TAG_COPY_ON_WRITE); + return new_track; } -static void rna_NlaTrack_remove(AnimData *adt, bContext *C, ReportList *reports, PointerRNA *track_ptr) +static void rna_NlaTrack_remove(ID *id, AnimData *adt, Main *bmain, bContext *C, ReportList *reports, PointerRNA *track_ptr) { NlaTrack *track = track_ptr->data; @@ -534,6 +542,9 @@ static void rna_NlaTrack_remove(AnimData *adt, bContext *C, ReportList *reports, RNA_POINTER_INVALIDATE(track_ptr); WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_REMOVED, NULL); + + DEG_relations_tag_update(bmain); + DEG_id_tag_update_ex(bmain, id, DEG_TAG_TIME | DEG_TAG_COPY_ON_WRITE); } static PointerRNA rna_NlaTrack_active_get(PointerRNA *ptr) @@ -958,7 +969,7 @@ static void rna_api_animdata_nla_tracks(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_struct_ui_text(srna, "NLA Tracks", "Collection of NLA Tracks"); func = RNA_def_function(srna, "new", "rna_NlaTrack_new"); - RNA_def_function_flag(func, FUNC_USE_CONTEXT); + RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_CONTEXT); RNA_def_function_ui_description(func, "Add a new NLA Track"); RNA_def_pointer(func, "prev", "NlaTrack", "", "NLA Track to add the new one after"); /* return type */ @@ -966,7 +977,7 @@ static void rna_api_animdata_nla_tracks(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_return(func, parm); func = RNA_def_function(srna, "remove", "rna_NlaTrack_remove"); - RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_CONTEXT); + RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS | FUNC_USE_MAIN | FUNC_USE_CONTEXT); RNA_def_function_ui_description(func, "Remove a NLA Track"); parm = RNA_def_pointer(func, "track", "NlaTrack", "", "NLA Track to remove"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); @@ -1053,7 +1064,7 @@ static void rna_def_animdata(BlenderRNA *brna) RNA_def_property_pointer_funcs(prop, NULL, "rna_AnimData_action_set", NULL, "rna_Action_id_poll"); RNA_def_property_editable_func(prop, "rna_AnimData_action_editable"); RNA_def_property_ui_text(prop, "Action", "Active Action for this data-block"); - RNA_def_property_update(prop, NC_ANIMATION | ND_NLA_ACTCHANGE, "rna_AnimData_update"); + RNA_def_property_update(prop, NC_ANIMATION | ND_NLA_ACTCHANGE, "rna_AnimData_dependency_update"); /* Active Action Settings */ prop = RNA_def_property(srna, "action_extrapolation", PROP_ENUM, PROP_NONE); @@ -1091,13 +1102,13 @@ static void rna_def_animdata(BlenderRNA *brna) prop = RNA_def_property(srna, "use_nla", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ADT_NLA_EVAL_OFF); RNA_def_property_ui_text(prop, "NLA Evaluation Enabled", "NLA stack is evaluated when evaluating this block"); - RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL); /* this will do? */ + RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, "rna_AnimData_update"); /* this will do? */ prop = RNA_def_property(srna, "use_tweak_mode", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ADT_NLA_EDIT_ON); RNA_def_property_boolean_funcs(prop, NULL, "rna_AnimData_tweakmode_set"); RNA_def_property_ui_text(prop, "Use NLA Tweak Mode", "Whether to enable or disable tweak mode in NLA"); - RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL); + RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, "rna_AnimData_update"); } /* --- */ diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c index 48be6421f36..444438a230c 100644 --- a/source/blender/makesrna/intern/rna_nla.c +++ b/source/blender/makesrna/intern/rna_nla.c @@ -57,6 +57,9 @@ #include "ED_anim_api.h" +#include "DEG_depsgraph_build.h" +#include "DEG_depsgraph.h" + /* temp constant defined for these funcs only... */ #define NLASTRIP_MIN_LEN_THRESH 0.1f @@ -104,11 +107,18 @@ static char *rna_NlaStrip_path(PointerRNA *ptr) return BLI_strdup(""); } -static void rna_NlaStrip_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) +static void rna_NlaStrip_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { ID *id = ptr->id.data; - ANIM_id_update(scene, id); + ANIM_id_update(bmain, id); +} + +static void rna_NlaStrip_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + DEG_relations_tag_update(bmain); + + rna_NlaStrip_update(bmain, scene, ptr); } static void rna_NlaStrip_transform_update(Main *bmain, Scene *scene, PointerRNA *ptr) @@ -367,7 +377,7 @@ static FCurve *rna_NlaStrip_fcurve_find(NlaStrip *strip, ReportList *reports, co } -static NlaStrip *rna_NlaStrip_new(NlaTrack *track, bContext *C, ReportList *reports, const char *UNUSED(name), +static NlaStrip *rna_NlaStrip_new(ID *id, NlaTrack *track, Main *bmain, bContext *C, ReportList *reports, const char *UNUSED(name), int start, bAction *action) { NlaStrip *strip = BKE_nlastrip_new(action); @@ -413,10 +423,13 @@ static NlaStrip *rna_NlaStrip_new(NlaTrack *track, bContext *C, ReportList *repo WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_ADDED, NULL); + DEG_relations_tag_update(bmain); + DEG_id_tag_update_ex(bmain, id, DEG_TAG_TIME | DEG_TAG_COPY_ON_WRITE); + return strip; } -static void rna_NlaStrip_remove(NlaTrack *track, bContext *C, ReportList *reports, PointerRNA *strip_ptr) +static void rna_NlaStrip_remove(ID *id, NlaTrack *track, Main *bmain, bContext *C, ReportList *reports, PointerRNA *strip_ptr) { NlaStrip *strip = strip_ptr->data; if (BLI_findindex(&track->strips, strip) == -1) { @@ -428,6 +441,9 @@ static void rna_NlaStrip_remove(NlaTrack *track, bContext *C, ReportList *report RNA_POINTER_INVALIDATE(strip_ptr); WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_REMOVED, NULL); + + DEG_relations_tag_update(bmain); + DEG_id_tag_update_ex(bmain, id, DEG_TAG_TIME | DEG_TAG_COPY_ON_WRITE); } /* Set the 'solo' setting for the given NLA-track, making sure that it is the only one @@ -602,7 +618,7 @@ static void rna_def_nlastrip(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT); RNA_def_property_editable_func(prop, "rna_NlaStrip_action_editable"); RNA_def_property_ui_text(prop, "Action", "Action referenced by this strip"); - RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update"); + RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_dependency_update"); /* Action extents */ prop = RNA_def_property(srna, "action_frame_start", PROP_FLOAT, PROP_TIME); @@ -735,7 +751,7 @@ static void rna_api_nlatrack_strips(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_struct_ui_text(srna, "Nla Strips", "Collection of Nla Strips"); func = RNA_def_function(srna, "new", "rna_NlaStrip_new"); - RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); + RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_CONTEXT | FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Add a new Action-Clip strip to the track"); parm = RNA_def_string(func, "name", "NlaStrip", 0, "", "Name for the NLA Strips"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); @@ -749,7 +765,7 @@ static void rna_api_nlatrack_strips(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_return(func, parm); func = RNA_def_function(srna, "remove", "rna_NlaStrip_remove"); - RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); + RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_CONTEXT | FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Remove a NLA Strip"); parm = RNA_def_pointer(func, "strip", "NlaStrip", "", "NLA Strip to remove"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); |