[Bf-blender-cvs] [c053f0a] gooseberry: UI cleanup and a bit nicer workflow by treating read/write mode like an enum toggle.

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


Commit: c053f0a53da80ecd5850d371e899eb0b62a3486d
Author: Lukas Tönne
Date:   Thu Mar 19 10:47:03 2015 +0100
Branches: gooseberry
https://developer.blender.org/rBc053f0a53da80ecd5850d371e899eb0b62a3486d

UI cleanup and a bit nicer workflow by treating read/write mode like
an enum toggle.

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

M	intern/cycles/blender/blender_mesh.cpp
M	release/scripts/startup/bl_ui/properties_object.py
M	source/blender/blenkernel/intern/depsgraph.c
M	source/blender/blenkernel/intern/object_dupli.c
M	source/blender/editors/io/io_cache_library.c
M	source/blender/makesdna/DNA_object_types.h
M	source/blender/makesrna/intern/rna_object.c

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

diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp
index a075024..174fd7e 100644
--- a/intern/cycles/blender/blender_mesh.cpp
+++ b/intern/cycles/blender/blender_mesh.cpp
@@ -670,7 +670,7 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tri
 	bool use_mesh_geometry = render_layer.use_surfaces || render_layer.use_hair;
 	Mesh *mesh;
 
-	BL::DupliObjectData b_dup_data = (b_ob_parent && b_ob_parent.use_dupli_cache())? b_ob_parent.find_dupli_cache(b_ob): BL::DupliObjectData(PointerRNA_NULL);
+	BL::DupliObjectData b_dup_data = (b_ob_parent && b_ob_parent.use_dupli_cache_read())? b_ob_parent.find_dupli_cache(b_ob): BL::DupliObjectData(PointerRNA_NULL);
 	bool need_update;
 	if (b_dup_data) {
 		MeshKey key = MeshKey(b_ob_parent, b_ob);
diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py
index 1a03a58..ac84e79 100644
--- a/release/scripts/startup/bl_ui/properties_object.py
+++ b/release/scripts/startup/bl_ui/properties_object.py
@@ -328,7 +328,7 @@ def cachelib_object_items(cachelib, ob):
 class OBJECT_PT_duplication(ObjectButtonsPanel, Panel):
     bl_label = "Duplication"
 
-    def draw_cachelib(self, context, layout, cachelib, objects):
+    def draw_cachelib(self, context, layout, ob, cachelib, objects):
         col = layout.column(align=True)
         colrow = col.row(align=True)
         colrow.label("Archive:")
@@ -338,6 +338,9 @@ class OBJECT_PT_duplication(ObjectButtonsPanel, Panel):
         props.use_clipboard = True
         col.prop(cachelib, "filepath", text="")
 
+        row = col.row(align=True)
+        row.prop(ob, "use_dupli_cache_read", text="Read", toggle=True)
+        row.prop(ob, "use_dupli_cache_write", text="Write", toggle=True)
         col.operator("cachelibrary.bake")
         col.prop(cachelib, "eval_mode", expand=False)
 
@@ -394,13 +397,10 @@ class OBJECT_PT_duplication(ObjectButtonsPanel, Panel):
             layout.prop(ob, "dupli_group", text="Group")
             row = layout.row(align=True)
             row.template_ID(ob, "cache_library", new="cachelibrary.new")
-            sub = row.row(align=True)
-            sub.active = ob.cache_library is not None
-            sub.prop(ob, "use_dupli_cache", text="Read", toggle=True)
 
             if ob.cache_library:
                 cache_objects = cachelib_objects(ob.cache_library, ob.dupli_group)
-                self.draw_cachelib(context, layout, ob.cache_library, cache_objects)
+                self.draw_cachelib(context, layout, ob, ob.cache_library, cache_objects)
 
 
 class OBJECT_PT_relations_extras(ObjectButtonsPanel, Panel):
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 4552e2b..0cb27ec 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -625,7 +625,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Main *bmain, Sc
 	 * when the duplicator is visible (even if group objects are not visible themselves).
 	 * It is not a true dependency, the duplicator does not in any way depend on group objects or data!
 	 */
-	if (ob->transflag & OB_DUPLI && !(ob->transflag & OB_DUPLI_USE_CACHE)) {
+	if (ob->transflag & OB_DUPLI && !(ob->transflag & OB_DUPLI_READ_CACHE)) {
 		if ((ob->transflag & OB_DUPLIGROUP) && ob->dup_group) {
 			GroupObject *go;
 			for (go = ob->dup_group->gobject.first; go; go = go->next) {
diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c
index bc409ff..d1dbf28 100644
--- a/source/blender/blenkernel/intern/object_dupli.c
+++ b/source/blender/blenkernel/intern/object_dupli.c
@@ -1397,7 +1397,7 @@ void BKE_object_dupli_cache_update(Scene *scene, Object *ob, EvaluationContext *
 	const eCacheLibrary_EvalMode eval_mode = eval_ctx->mode == DAG_EVAL_RENDER ? CACHE_LIBRARY_EVAL_RENDER : CACHE_LIBRARY_EVAL_VIEWPORT;
 	
 	bool is_dupligroup = (ob->transflag & OB_DUPLIGROUP) && ob->dup_group;
-	bool is_cached = (ob->transflag & OB_DUPLI_USE_CACHE) && ob->cache_library;
+	bool is_cached = (ob->transflag & OB_DUPLI_READ_CACHE) && ob->cache_library;
 	
 	/* cache is a group duplicator feature only */
 	if (is_dupligroup && is_cached) {
diff --git a/source/blender/editors/io/io_cache_library.c b/source/blender/editors/io/io_cache_library.c
index b946a4d..1cf7fda 100644
--- a/source/blender/editors/io/io_cache_library.c
+++ b/source/blender/editors/io/io_cache_library.c
@@ -231,7 +231,7 @@ static int cache_library_bake_poll(bContext *C)
 	/* re-baking cached results doesn't make much sense,
 	 * clarify workflow by enabling either reading or writing, but not both
 	 */
-	if (ob->transflag & OB_DUPLI_USE_CACHE)
+	if (ob->transflag & OB_DUPLI_READ_CACHE)
 		return false;
 	
 	return true;
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 25c5e9b..16c4aae 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -443,7 +443,7 @@ enum {
 	OB_RENDER_DUPLI     = 1 << 12,
 	OB_NO_CONSTRAINTS   = 1 << 13,  /* runtime constraints disable */
 	OB_NO_PSYS_UPDATE   = 1 << 14,  /* hack to work around particle issue */
-	OB_DUPLI_USE_CACHE  = 1 << 15,  /* use cache instead of object data */
+	OB_DUPLI_READ_CACHE = 1 << 15,  /* use cache instead of object data */
 
 	OB_DUPLI            = OB_DUPLIFRAMES | OB_DUPLIVERTS | OB_DUPLIGROUP | OB_DUPLIFACES | OB_DUPLIPARTS,
 };
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 4ef4d2f..4fdbc2e 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -2873,9 +2873,15 @@ static void rna_def_object(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Dupli Faces Scale", "Scale the DupliFace objects");
 	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
 
-	prop = RNA_def_property(srna, "use_dupli_cache", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLI_USE_CACHE);
-	RNA_def_property_ui_text(prop, "Use Dupli Cache", "Use caching instead of object data");
+	prop = RNA_def_property(srna, "use_dupli_cache_read", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLI_READ_CACHE);
+	RNA_def_property_ui_text(prop, "Read Dupli Cache", "Use cached data instead of object data");
+	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
+
+	/* note: inversion of use_dupli_cache_read, for enum-like mode switch */
+	prop = RNA_def_property(srna, "use_dupli_cache_write", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_negative_sdna(prop, NULL, "transflag", OB_DUPLI_READ_CACHE);
+	RNA_def_property_ui_text(prop, "Write Dupli Cache", "Enabling writing of dupli cache data");
 	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
 
 	prop = RNA_def_property(srna, "dupli_group", PROP_POINTER, PROP_NONE);




More information about the Bf-blender-cvs mailing list