[Bf-blender-cvs] [e2346f73784] temp-dynamic-overrides: Dynamic Override Property: Mode

Dalai Felinto noreply at git.blender.org
Thu May 10 00:57:14 CEST 2018


Commit: e2346f73784a1c5c04495983c18cbed6033f65e4
Author: Dalai Felinto
Date:   Thu May 10 00:43:23 2018 +0200
Branches: temp-dynamic-overrides
https://developer.blender.org/rBe2346f73784a1c5c04495983c18cbed6033f65e4

Dynamic Override Property: Mode

ID props won't have these options showing in the UI, but there is no need
to have them stored in the DNA since we need to know the prop type to know
which rna prop to show in the UI.

Also more UI changes.

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

M	release/scripts/startup/bl_ui/properties_view_layer.py
M	source/blender/makesrna/intern/rna_layer.c

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

diff --git a/release/scripts/startup/bl_ui/properties_view_layer.py b/release/scripts/startup/bl_ui/properties_view_layer.py
index e51bb4afa4a..3a58962034a 100644
--- a/release/scripts/startup/bl_ui/properties_view_layer.py
+++ b/release/scripts/startup/bl_ui/properties_view_layer.py
@@ -119,16 +119,11 @@ class VIEWLAYER_OT_overrides(ViewLayerButtonsPanel, Panel):
         row.label(text="Scene Properties")
 
         if scene.show_view_layer_overrides_scene_property:
-            for dyn_prop in override_set.scene_properties:
-                box = layout.box()
-                row = box.row()
-                row.prop(dyn_prop, "use", text="")
-                subrow = row.row()
-                subrow.active = dyn_prop.use
-                subrow.label(text=dyn_prop.name, icon='NONE')
-                #subrow.prop(dyn_prop, "override_mode", text="")
-                subrow.prop(dyn_prop, "value_int", text="")
-                row.label(icon='ZOOMOUT')
+            if override_set.scene_properties:
+                for i, dyn_prop in enumerate(override_set.scene_properties):
+                    self._draw_property(layout, dyn_prop, i, 'SCENE')
+            else:
+                layout.label(text="No scene property")
 
         row = layout.row(align=True)
         row.prop(scene, "show_view_layer_overrides_affected_collections", emboss=False, text="")
@@ -149,18 +144,24 @@ class VIEWLAYER_OT_overrides(ViewLayerButtonsPanel, Panel):
         row.label(text="Collection Properties")
 
         if scene.show_view_layer_overrides_collections_property:
-            for i, dyn_prop in enumerate(override_set.collection_properties):
-                box = layout.box()
-                row = box.row()
-                row.prop(dyn_prop, "use", text="")
-                subrow = row.row()
-                subrow.active = dyn_prop.use
-                subrow.label(text=dyn_prop.name, icon='NONE')
-                #subrow.prop(dyn_prop, "override_mode", text="")
-                subrow.prop(dyn_prop, "value_int", text="")
-                ops = row.operator("scene.view_layer_override_remove", text="", icon='ZOOMOUT', emboss=False)
-                ops.index = i
-                ops.property_type = 'COLLECTION'
+            if override_set.collection_properties:
+                for i, dyn_prop in enumerate(override_set.collection_properties):
+                    self._draw_property(layout, dyn_prop, i, 'COLLECTION')
+            else:
+                layout.label(text="No collection property")
+
+    def _draw_property(self, layout, dyn_prop, index, property_type):
+        box = layout.box()
+        row = box.row()
+        row.prop(dyn_prop, "use", text="")
+        subrow = row.row()
+        subrow.active = dyn_prop.use
+        subrow.label(text=dyn_prop.name, icon='NONE')
+        subrow.prop(dyn_prop, "override_mode", text="")
+        subrow.prop(dyn_prop, "value_int", text="")
+        ops = row.operator("scene.view_layer_override_remove", text="", icon='ZOOMOUT', emboss=False)
+        ops.index = index
+        ops.property_type = property_type
 
 
 classes = (
diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c
index 8b3b1ddb2ad..ffbcb27be5a 100644
--- a/source/blender/makesrna/intern/rna_layer.c
+++ b/source/blender/makesrna/intern/rna_layer.c
@@ -2084,6 +2084,12 @@ static void rna_def_dynamic_override_property(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
+	static const EnumPropertyItem rna_enum_dynamic_override_mode_items[] = {
+		{DYN_OVERRIDE_MODE_REPLACE, "REPLACE", 0, "Replace", ""},
+		{DYN_OVERRIDE_MODE_MULTIPLY, "MULTIPLY", 0, "Multiply", ""},
+		{0, NULL, 0, NULL, NULL}
+	};
+
 	srna = RNA_def_struct(brna, "DynamicOverrideProperty", NULL);
 	RNA_def_struct_ui_text(srna, "Dynamic Override Property", "Properties overridden by override set");
 
@@ -2107,6 +2113,12 @@ static void rna_def_dynamic_override_property(BlenderRNA *brna)
 	                         "Whether the property affects the entire scene or the collection objects only");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
+	prop = RNA_def_property(srna, "override_mode", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_items(prop, rna_enum_dynamic_override_mode_items);
+	RNA_def_property_ui_text(prop, "Override Mode",
+	                         "Method of override the original values");
+	RNA_def_property_update(prop, NC_SCENE | ND_DYN_OVERRIDES, NULL);
+
 	/* Accessors for the different value types. */
 	prop = RNA_def_property(srna, "value_int", PROP_INT, PROP_NONE);
 	RNA_def_property_int_funcs(prop,



More information about the Bf-blender-cvs mailing list