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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-09-24 04:39:01 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-09-24 04:39:01 +0400
commit05f8e53d3361f1f043f7dcf520671d3fa3a79e32 (patch)
treeeff6b4f5028472557f85b29f72c9957a8a620566 /source
parent3921f0528cc73d64e11da095903c961b1969b46e (diff)
bugfix [#23965] Segmentation fault when using bpy_struct.keyframe_insert() with nested custom property
Diffstat (limited to 'source')
-rw-r--r--source/blender/makesrna/intern/makesrna.c14
-rw-r--r--source/blender/makesrna/intern/rna_ID.c17
-rw-r--r--source/blender/makesrna/intern/rna_access.c11
-rw-r--r--source/blender/makesrna/intern/rna_internal.h1
4 files changed, 31 insertions, 12 deletions
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index 8a68c460573..38a5b2587ff 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -395,7 +395,7 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
{
char *func;
- if(prop->flag & PROP_IDPROPERTY)
+ if(prop->flag & PROP_IDPROPERTY && manualfunc==NULL)
return NULL;
if(!manualfunc) {
@@ -576,7 +576,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
if(!(prop->flag & PROP_EDITABLE))
return NULL;
- if(prop->flag & PROP_IDPROPERTY)
+ if(prop->flag & PROP_IDPROPERTY && manualfunc==NULL)
return NULL;
if(!manualfunc) {
@@ -744,7 +744,7 @@ static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA
{
char *func= NULL;
- if(prop->flag & PROP_IDPROPERTY)
+ if(prop->flag & PROP_IDPROPERTY && manualfunc==NULL)
return NULL;
if(prop->type == PROP_STRING) {
@@ -802,7 +802,7 @@ static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA *
{
char *func, *getfunc;
- if(prop->flag & PROP_IDPROPERTY)
+ if(prop->flag & PROP_IDPROPERTY && manualfunc==NULL)
return NULL;
if(!manualfunc) {
@@ -860,7 +860,7 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property
{
char *func;
- if(prop->flag & PROP_IDPROPERTY)
+ if(prop->flag & PROP_IDPROPERTY && manualfunc==NULL)
return NULL;
if(!manualfunc) {
@@ -952,7 +952,7 @@ static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *p
{
char *func, *getfunc;
- if(prop->flag & PROP_IDPROPERTY)
+ if(prop->flag & PROP_IDPROPERTY && manualfunc==NULL)
return NULL;
if(!manualfunc)
@@ -978,7 +978,7 @@ static char *rna_def_property_end_func(FILE *f, StructRNA *srna, PropertyRNA *pr
{
char *func;
- if(prop->flag & PROP_IDPROPERTY)
+ if(prop->flag & PROP_IDPROPERTY && manualfunc==NULL)
return NULL;
func= rna_alloc_function_name(srna->identifier, prop->identifier, "end");
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index b9ef92cdca1..4321f8aa711 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -252,6 +252,18 @@ void rna_ID_user_clear(ID *id)
id->flag &= ~LIB_FAKEUSER;
}
+static void rna_IDPArray_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+{
+ IDProperty *prop= (IDProperty *)ptr->data;
+ rna_iterator_array_begin(iter, IDP_IDPArray(prop), sizeof(IDProperty), prop->len, 0, NULL);
+}
+
+static int rna_IDPArray_length(PointerRNA *ptr)
+{
+ IDProperty *prop= (IDProperty *)ptr->data;
+ return prop->len;
+}
+
#else
static void rna_def_ID_properties(BlenderRNA *brna)
@@ -302,6 +314,11 @@ static void rna_def_ID_properties(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EXPORT|PROP_IDPROPERTY);
RNA_def_property_struct_type(prop, "IDPropertyGroup");
+ prop= RNA_def_property(srna, "idp_array", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "IDPropertyGroup");
+ RNA_def_property_collection_funcs(prop, "rna_IDPArray_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_IDPArray_length", 0, 0);
+ RNA_def_property_flag(prop, PROP_EXPORT|PROP_IDPROPERTY);
+
// never tested, maybe its useful to have this?
#if 0
prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 856f34e5660..ae44cb1db7c 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -364,7 +364,8 @@ static PropertyRNA *typemap[IDP_NUMTYPES] =
(PropertyRNA*)&rna_IDProperty_float,
NULL, NULL, NULL,
(PropertyRNA*)&rna_IDProperty_group, NULL,
- (PropertyRNA*)&rna_IDProperty_double};
+ (PropertyRNA*)&rna_IDProperty_double,
+ (PropertyRNA*)&rna_IDProperty_idp_array};
static PropertyRNA *arraytypemap[IDP_NUMTYPES] =
{NULL, (PropertyRNA*)&rna_IDProperty_int_array,
@@ -2066,7 +2067,7 @@ void RNA_property_collection_begin(PointerRNA *ptr, PropertyRNA *prop, Collectio
void RNA_property_collection_next(CollectionPropertyIterator *iter)
{
- CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)iter->prop;
+ CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)rna_ensure_property(iter->prop);
if(iter->idprop) {
rna_iterator_array_next(iter);
@@ -2080,7 +2081,7 @@ void RNA_property_collection_next(CollectionPropertyIterator *iter)
void RNA_property_collection_end(CollectionPropertyIterator *iter)
{
- CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)iter->prop;
+ CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)rna_ensure_property(iter->prop);
if(iter->idprop)
rna_iterator_array_end(iter);
@@ -2272,7 +2273,7 @@ int RNA_property_collection_lookup_index(PointerRNA *ptr, PropertyRNA *prop, Poi
int RNA_property_collection_lookup_int(PointerRNA *ptr, PropertyRNA *prop, int key, PointerRNA *r_ptr)
{
- CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
+ CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)rna_ensure_property(prop);
if(cprop->lookupint) {
/* we have a callback defined, use it */
@@ -2302,7 +2303,7 @@ int RNA_property_collection_lookup_int(PointerRNA *ptr, PropertyRNA *prop, int k
int RNA_property_collection_lookup_string(PointerRNA *ptr, PropertyRNA *prop, const char *key, PointerRNA *r_ptr)
{
- CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
+ CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)rna_ensure_property(prop);
if(cprop->lookupstring) {
/* we have a callback defined, use it */
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h
index 07103564d46..2bfe86a15ee 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -285,6 +285,7 @@ extern FloatPropertyRNA rna_IDProperty_float;
extern FloatPropertyRNA rna_IDProperty_float_array;
extern PointerPropertyRNA rna_IDProperty_group;
extern CollectionPropertyRNA rna_IDProperty_collection;
+extern CollectionPropertyRNA rna_IDProperty_idp_array;
extern FloatPropertyRNA rna_IDProperty_double;
extern FloatPropertyRNA rna_IDProperty_double_array;