[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32090] trunk/blender/source/blender/ makesrna/intern: bugfix [#23965] Segmentation fault when using bpy_struct. keyframe_insert() with nested custom property
Campbell Barton
ideasman42 at gmail.com
Fri Sep 24 02:39:01 CEST 2010
Revision: 32090
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32090
Author: campbellbarton
Date: 2010-09-24 02:39:01 +0200 (Fri, 24 Sep 2010)
Log Message:
-----------
bugfix [#23965] Segmentation fault when using bpy_struct.keyframe_insert() with nested custom property
Modified Paths:
--------------
trunk/blender/source/blender/makesrna/intern/makesrna.c
trunk/blender/source/blender/makesrna/intern/rna_ID.c
trunk/blender/source/blender/makesrna/intern/rna_access.c
trunk/blender/source/blender/makesrna/intern/rna_internal.h
Modified: trunk/blender/source/blender/makesrna/intern/makesrna.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/makesrna.c 2010-09-23 23:45:14 UTC (rev 32089)
+++ trunk/blender/source/blender/makesrna/intern/makesrna.c 2010-09-24 00:39:01 UTC (rev 32090)
@@ -395,7 +395,7 @@
{
char *func;
- if(prop->flag & PROP_IDPROPERTY)
+ if(prop->flag & PROP_IDPROPERTY && manualfunc==NULL)
return NULL;
if(!manualfunc) {
@@ -576,7 +576,7 @@
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 @@
{
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 @@
{
char *func, *getfunc;
- if(prop->flag & PROP_IDPROPERTY)
+ if(prop->flag & PROP_IDPROPERTY && manualfunc==NULL)
return NULL;
if(!manualfunc) {
@@ -860,7 +860,7 @@
{
char *func;
- if(prop->flag & PROP_IDPROPERTY)
+ if(prop->flag & PROP_IDPROPERTY && manualfunc==NULL)
return NULL;
if(!manualfunc) {
@@ -952,7 +952,7 @@
{
char *func, *getfunc;
- if(prop->flag & PROP_IDPROPERTY)
+ if(prop->flag & PROP_IDPROPERTY && manualfunc==NULL)
return NULL;
if(!manualfunc)
@@ -978,7 +978,7 @@
{
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");
Modified: trunk/blender/source/blender/makesrna/intern/rna_ID.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_ID.c 2010-09-23 23:45:14 UTC (rev 32089)
+++ trunk/blender/source/blender/makesrna/intern/rna_ID.c 2010-09-24 00:39:01 UTC (rev 32090)
@@ -252,6 +252,18 @@
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 @@
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);
Modified: trunk/blender/source/blender/makesrna/intern/rna_access.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_access.c 2010-09-23 23:45:14 UTC (rev 32089)
+++ trunk/blender/source/blender/makesrna/intern/rna_access.c 2010-09-24 00:39:01 UTC (rev 32090)
@@ -364,7 +364,8 @@
(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_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_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_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_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 */
Modified: trunk/blender/source/blender/makesrna/intern/rna_internal.h
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_internal.h 2010-09-23 23:45:14 UTC (rev 32089)
+++ trunk/blender/source/blender/makesrna/intern/rna_internal.h 2010-09-24 00:39:01 UTC (rev 32090)
@@ -285,6 +285,7 @@
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;
More information about the Bf-blender-cvs
mailing list