2.5 / RNA
authorElia Sarti <vekoon@gmail.com>
Sat, 25 Jul 2009 19:10:24 +0000 (19:10 +0000)
committerElia Sarti <vekoon@gmail.com>
Sat, 25 Jul 2009 19:10:24 +0000 (19:10 +0000)
Added RNA_pointer_set as counterpart for RNA_pointer_get (i.e. sets pointer property by name lookup)

source/blender/makesrna/RNA_access.h
source/blender/makesrna/intern/rna_access.c

index 2368f7be3deb8bf449dcc0bb2c0c13dbc3c741ad..d4532e78239ff82f1275814ce0ac30b876f5922b 100644 (file)
@@ -717,6 +717,7 @@ int RNA_string_length(PointerRNA *ptr, const char *name);
 void RNA_string_set(PointerRNA *ptr, const char *name, const char *value);
 
 PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name);
+void RNA_pointer_set(PointerRNA *ptr, const char *name, PointerRNA ptr_value);
 void RNA_pointer_add(PointerRNA *ptr, const char *name);
 
 void RNA_collection_begin(PointerRNA *ptr, const char *name, CollectionPropertyIterator *iter);
index 0a4cc2a023e84f7b49f631044baa2aa4c53ae80e..b0db6ae9de5b53fc844d2e0b8e9eb6a87859f75c 100644 (file)
@@ -2524,6 +2524,18 @@ PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
        }
 }
 
+void RNA_pointer_set(PointerRNA *ptr, const char *name, PointerRNA ptr_value)
+{
+       PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+
+       if(prop) {
+               RNA_property_pointer_set(ptr, prop, ptr_value);
+       }
+       else {
+               printf("RNA_pointer_set: %s.%s not found.\n", ptr->type->identifier, name);
+       }
+}
+
 void RNA_pointer_add(PointerRNA *ptr, const char *name)
 {
        PropertyRNA *prop= RNA_struct_find_property(ptr, name);