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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-06-29 23:15:51 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-06-29 23:15:51 +0400
commite7928dd4b4b797295e2a3c6f73a57cb242c3423e (patch)
tree9db4afda53f2a7afbccdaf05faf4d221be7e0c7f /source/blender/makesrna/intern/rna_rna.c
parent9a7ea9664e27679935adaea3093630d7a6a30b5d (diff)
RNA
Implementation of RNA side of foreach_get/foreach_set, Campbell will do python code. Three functions for efficiently setting some property for all items in a collection. RNA_property_collection_raw_array gives access to the properties as an array with length, stride, and type specified, if this is possible, i.e. not when it uses a ListBase, or if a manual get/set function is implemented. Two other functions take a C array pointer and get/set it using the a collection + property name, using efficient array access if possible, and otherwise using slower RNA iterator. RNA_property_collection_raw_get RNA_property_collection_raw_set The number of type conversion required here got a bit out of hand, it could be more efficient still if checking for more cases, but function is already long enough. Example: http://www.pasteall.org/6362/c
Diffstat (limited to 'source/blender/makesrna/intern/rna_rna.c')
-rw-r--r--source/blender/makesrna/intern/rna_rna.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index 6fa275cec91..14db8ea3377 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -309,14 +309,16 @@ PointerRNA rna_builtin_properties_lookup_string(PointerRNA *ptr, const char *key
}
} while((srna=srna->base));
- group= RNA_struct_idproperties(ptr, 0);
-
- if(group) {
- for(idp=group->data.group.first; idp; idp=idp->next) {
- if(strcmp(idp->name, key) == 0) {
- propptr.type= &RNA_Property;
- propptr.data= idp;
- return propptr;
+ if(ptr->data) {
+ group= RNA_struct_idproperties(ptr, 0);
+
+ if(group) {
+ for(idp=group->data.group.first; idp; idp=idp->next) {
+ if(strcmp(idp->name, key) == 0) {
+ propptr.type= &RNA_Property;
+ propptr.data= idp;
+ return propptr;
+ }
}
}
}