diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2018-11-12 16:17:57 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2018-11-12 16:18:33 +0300 |
commit | aee0446b6bdc6ff384e9d66a917f6cb06f620c0a (patch) | |
tree | f2cfd422a9415248c33118743d0d2c7427bf44d4 /source/blender/makesrna/intern/rna_nla.c | |
parent | 36a3a40033298227cfc55f59580e03863c09699d (diff) |
Add a lot of update tagging to operations with NLA tracks and strips.
Diffstat (limited to 'source/blender/makesrna/intern/rna_nla.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_nla.c | 30 |
1 files changed, 23 insertions, 7 deletions
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); |