diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_nla.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_nla.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c index 4ff1365427e..574f06e9107 100644 --- a/source/blender/makesrna/intern/rna_nla.c +++ b/source/blender/makesrna/intern/rna_nla.c @@ -27,6 +27,7 @@ #include <stdlib.h> +#include "RNA_access.h" #include "RNA_define.h" #include "rna_internal.h" @@ -302,7 +303,7 @@ static NlaStrip *rna_NlaStrip_new(NlaTrack *track, bContext *C, ReportList *repo NlaStrip *strip = add_nlastrip(action); if (strip == NULL) { - BKE_reportf(reports, RPT_ERROR, "Unable to create new strip"); + BKE_report(reports, RPT_ERROR, "Unable to create new strip"); return NULL; } @@ -310,8 +311,8 @@ static NlaStrip *rna_NlaStrip_new(NlaTrack *track, bContext *C, ReportList *repo strip->start = start; if (BKE_nlastrips_add_strip(&track->strips, strip) == 0) { - BKE_reportf(reports, RPT_ERROR, - "Unable to add strip. Track doesn't have any space to accommodate this new strip"); + BKE_report(reports, RPT_ERROR, + "Unable to add strip (the track does not have any space to accommodate this new strip)"); free_nlastrip(NULL, strip); return NULL; } @@ -345,16 +346,18 @@ static NlaStrip *rna_NlaStrip_new(NlaTrack *track, bContext *C, ReportList *repo return strip; } -static void rna_NlaStrip_remove(NlaTrack *track, bContext *C, ReportList *reports, NlaStrip *strip) +static void rna_NlaStrip_remove(NlaTrack *track, bContext *C, ReportList *reports, PointerRNA *strip_ptr) { + NlaStrip *strip = strip_ptr->data; if (BLI_findindex(&track->strips, strip) == -1) { - BKE_reportf(reports, RPT_ERROR, "NLA's Strip '%s' not found in track '%s'", strip->name, track->name); + BKE_reportf(reports, RPT_ERROR, "NLA strip '%s' not found in track '%s'", strip->name, track->name); return; } - else { - free_nlastrip(&track->strips, strip); - WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_REMOVED, NULL); - } + + free_nlastrip(&track->strips, strip); + RNA_POINTER_INVALIDATE(strip_ptr); + + WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_REMOVED, NULL); } /* Set the 'solo' setting for the given NLA-track, making sure that it is the only one @@ -639,7 +642,8 @@ static void rna_api_nlatrack_strips(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_flag(func, 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_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); + RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); + RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); } static void rna_def_nlatrack(BlenderRNA *brna) |