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:
authorCampbell Barton <ideasman42@gmail.com>2012-11-02 13:41:26 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-11-02 13:41:26 +0400
commita31449edaddc1be80676c77babf079a9f137c42d (patch)
tree30bf1759a51f5def43dc000d6af7112642404770 /source/blender/makesrna/intern/rna_nla.c
parent2944d42c262d9d4459e356dc8b8fbad1c53c2054 (diff)
all remove functions now invalidate the RNA objects passed, to help script authors to avoid bugs with accessing removed data.
Diffstat (limited to 'source/blender/makesrna/intern/rna_nla.c')
-rw-r--r--source/blender/makesrna/intern/rna_nla.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c
index 8378cb92e20..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"
@@ -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 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)