[Bf-blender-cvs] [ad1fda1] gooseberry: Disabled collection properties for 'virtual' cache items in RNA.

Lukas Tönne noreply at git.blender.org
Mon Mar 23 13:02:04 CET 2015


Commit: ad1fda1823039a0efad87ca10d00acd2570e6111
Author: Lukas Tönne
Date:   Mon Mar 2 12:17:20 2015 +0100
Branches: gooseberry
https://developer.blender.org/rBad1fda1823039a0efad87ca10d00acd2570e6111

Disabled collection properties for 'virtual' cache items in RNA.

This requires a better design and is not so easy to implement properly
within the limits of RNA definition. These collections don't physically
exist in the DNA, they are mainly utilities for looping over
//potential// items in a cache library. For now the python code has to
be adapted to only show valid items, until the RNA provides a good
solution.

===================================================================

M	release/scripts/startup/bl_ui/properties_scene.py
M	source/blender/makesrna/intern/rna_cache_library.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py
index 2c9fc19..a92198e 100644
--- a/release/scripts/startup/bl_ui/properties_scene.py
+++ b/release/scripts/startup/bl_ui/properties_scene.py
@@ -473,15 +473,15 @@ class SCENE_PT_cache_manager(SceneButtonsPanel, Panel):
         row.operator("cachelibrary.bake")
 
         obfilter_string = context.scene.cache_library_filter.lower()
-        if obfilter_string:
-            obcaches = filter(lambda obcache: obfilter_string in obcache.object.name.lower(), cachelib.object_caches)
+        if not cachelib.group:
+            objects = []
+        elif obfilter_string:
+            objects = filter(lambda ob: obfilter_string in ob.name.lower(), cachelib.group.objects)
         else:
-            obcaches = cachelib.object_caches
+            objects = cachelib.group.objects
 
         first = True
-        for obcache in obcaches:
-            ob = obcache.object
-
+        for ob in objects:
             if first:
                 layout.separator()
                 first = False
diff --git a/source/blender/makesrna/intern/rna_cache_library.c b/source/blender/makesrna/intern/rna_cache_library.c
index d42f2f7..1398afc 100644
--- a/source/blender/makesrna/intern/rna_cache_library.c
+++ b/source/blender/makesrna/intern/rna_cache_library.c
@@ -96,6 +96,7 @@ static void rna_CacheLibrary_group_update(Main *main, Scene *scene, PointerRNA *
 
 /* ========================================================================= */
 
+#if 0 /* UNUSED */
 static PointerRNA rna_ObjectCache_object_get(PointerRNA *ptr)
 {
 	Object *ob = ptr->data;
@@ -104,8 +105,6 @@ static PointerRNA rna_ObjectCache_object_get(PointerRNA *ptr)
 	return rptr;
 }
 
-/* ========================================================================= */
-
 static void rna_CacheLibrary_object_caches_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
 	CacheLibraryObjectsIterator *internal = (CacheLibraryObjectsIterator *)(&iter->internal.listbase);
@@ -144,6 +143,7 @@ PointerRNA rna_CacheLibrary_object_caches_get(CollectionPropertyIterator *iter)
 	
 	return rptr;
 }
+#endif
 
 static PointerRNA rna_CacheLibrary_cache_item_find(CacheLibrary *cachelib, Object *ob, int type, int index)
 {
@@ -156,6 +156,7 @@ static PointerRNA rna_CacheLibrary_cache_item_find(CacheLibrary *cachelib, Objec
 
 /* ========================================================================= */
 
+#if 0 /* UNUSED */
 static void rna_ObjectCache_caches_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
 	CacheLibraryItemsIterator *internal = (CacheLibraryItemsIterator *)(&iter->internal.listbase);
@@ -195,6 +196,7 @@ PointerRNA rna_ObjectCache_caches_get(CollectionPropertyIterator *iter)
 	
 	return rptr;
 }
+#endif
 
 #else
 
@@ -248,6 +250,7 @@ static void rna_def_cache_item(BlenderRNA *brna)
 	RNA_def_function_output(func, parm);
 }
 
+#if 0 /* UNUSED */
 static void rna_def_object_cache(BlenderRNA *brna)
 {
 	StructRNA *srna;
@@ -268,6 +271,7 @@ static void rna_def_object_cache(BlenderRNA *brna)
 	                                  "rna_ObjectCache_caches_get", NULL, NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Caches", "Cacheable items for in an object cache");
 }
+#endif
 
 static void rna_def_cache_library(BlenderRNA *brna)
 {
@@ -294,11 +298,13 @@ static void rna_def_cache_library(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Group", "Cached object group");
 	RNA_def_property_update(prop, 0, "rna_CacheLibrary_group_update");
 	
+#if 0 /* UNUSED */
 	prop = RNA_def_property(srna, "object_caches", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "ObjectCache");
 	RNA_def_property_collection_funcs(prop, "rna_CacheLibrary_object_caches_begin", "rna_CacheLibrary_object_caches_next", "rna_CacheLibrary_object_caches_end",
 	                                  "rna_CacheLibrary_object_caches_get", NULL, NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Object Caches", "Cacheable objects inside the cache library group");
+#endif
 	
 	func = RNA_def_function(srna, "cache_item_find", "rna_CacheLibrary_cache_item_find");
 	RNA_def_function_ui_description(func, "Find item for an object cache item");
@@ -315,7 +321,9 @@ static void rna_def_cache_library(BlenderRNA *brna)
 void RNA_def_cache_library(BlenderRNA *brna)
 {
 	rna_def_cache_item(brna);
+#if 0 /* UNUSED */
 	rna_def_object_cache(brna);
+#endif
 	rna_def_cache_library(brna);
 }




More information about the Bf-blender-cvs mailing list