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>2010-11-10 03:51:34 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-11-10 03:51:34 +0300
commit5f69c0ec09d1f9f19e46c880f9d59016b11c547b (patch)
treebff409e46c2260d7a7de8e8a2492b106efb17984 /source/blender/makesrna
parent4c122988320d866b16a06ea4404d278bc8d13715 (diff)
string lookup for scene.object_bases, also removed some unused DNA vars.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_scene.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index bc778ff3256..c4a79c178a9 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -150,6 +150,8 @@ EnumPropertyItem image_type_items[] = {
#include "DNA_object_types.h"
#include "DNA_mesh_types.h"
+#include "RNA_access.h"
+
#include "MEM_guardedalloc.h"
#include "BKE_context.h"
@@ -180,6 +182,20 @@ EnumPropertyItem image_type_items[] = {
#include "RE_pipeline.h"
+static PointerRNA rna_Scene_object_bases_lookup_string(PointerRNA *ptr, const char *key)
+{
+ Scene *scene= (Scene*)ptr->data;
+ Base *base;
+
+ for(base= scene->base.first; base; base= base->next) {
+ if(strncmp(base->object->id.name+2, key, sizeof(base->object->id.name)-2)==0) {
+ return rna_pointer_inherit_refine(ptr, &RNA_ObjectBase, base);
+ }
+ }
+
+ return PointerRNA_NULL;
+}
+
static PointerRNA rna_Scene_objects_get(CollectionPropertyIterator *iter)
{
ListBaseIterator *internal= iter->internal;
@@ -3107,6 +3123,7 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "base", NULL);
RNA_def_property_struct_type(prop, "ObjectBase");
RNA_def_property_ui_text(prop, "Bases", "");
+ RNA_def_property_collection_funcs(prop, 0, 0, 0, 0, 0, 0, "rna_Scene_object_bases_lookup_string");
rna_def_scene_bases(brna, prop);
prop= RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);