[Bf-blender-cvs] [909c0bd0433] master: UI: expose mirror/symmetry options int the tob-bar

Campbell Barton noreply at git.blender.org
Tue May 21 07:21:18 CEST 2019


Commit: 909c0bd0433222bcdb8661c3ecdf6026150557f0
Author: Campbell Barton
Date:   Tue May 21 15:04:21 2019 +1000
Branches: master
https://developer.blender.org/rB909c0bd0433222bcdb8661c3ecdf6026150557f0

UI: expose mirror/symmetry options int the tob-bar

D4895 by @billreynish with edits.

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

M	release/scripts/startup/bl_ui/space_view3d.py
M	release/scripts/startup/bl_ui/space_view3d_toolbar.py
M	source/blender/makesrna/intern/rna_scene.c

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

diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 782bf016b2a..5b8daa7ebea 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -115,40 +115,76 @@ class VIEW3D_HT_tool_header(Header):
 
     def draw_mode_settings(self, context):
         layout = self.layout
+        mode_string = context.mode
 
-        # Active Tool
-        # -----------
-        from .space_toolsystem_common import ToolSelectPanelHelper
-        tool = ToolSelectPanelHelper.tool_active_from_context(context)
-        tool_mode = context.mode if tool is None else tool.mode
-
-        if tool_mode == 'SCULPT':
+        def row_for_mirror():
+            row = layout.row(align=True)
+            row.label(icon='MOD_MIRROR')
+            sub = row.row(align=True)
+            sub.scale_x = 0.6
+            return sub
+
+        if mode_string == 'EDIT_MESH':
+            sub = row_for_mirror()
+            sub.prop(context.object.data, "use_mirror_x", text="X", toggle=True)
+            tool_settings = context.tool_settings
+            layout.prop(tool_settings, "use_mesh_automerge", text="")
+        elif mode_string == 'EDIT_ARMATURE':
+            sub = row_for_mirror()
+            sub.prop(context.object.data, "use_mirror_x", text="X", toggle=True)
+        elif mode_string == 'POSE':
+            sub = row_for_mirror()
+            sub.prop(context.object.pose, "use_mirror_x", text="X", toggle=True)
+        elif mode_string == 'PAINT_WEIGHT':
+            sub = row_for_mirror()
+            sub.prop(context.object.data, "use_mirror_x", text="X", toggle=True)
+        elif mode_string == 'SCULPT':
+            sub = row_for_mirror()
+            sculpt = context.tool_settings.sculpt
+            sub.prop(sculpt, "use_symmetry_x", text="X", toggle=True)
+            sub.prop(sculpt, "use_symmetry_y", text="Y", toggle=True)
+            sub.prop(sculpt, "use_symmetry_z", text="Z", toggle=True)
+        elif mode_string == 'PAINT_TEXTURE':
+            sub = row_for_mirror()
+            ipaint = context.tool_settings.image_paint
+            sub.prop(ipaint, "use_symmetry_x", text="X", toggle=True)
+            sub.prop(ipaint, "use_symmetry_y", text="Y", toggle=True)
+            sub.prop(ipaint, "use_symmetry_z", text="Z", toggle=True)
+        elif mode_string == 'PAINT_VERTEX':
+            sub = row_for_mirror()
+            vpaint = context.tool_settings.vertex_paint
+            sub.prop(vpaint, "use_symmetry_x", text="X", toggle=True)
+            sub.prop(vpaint, "use_symmetry_y", text="Y", toggle=True)
+            sub.prop(vpaint, "use_symmetry_z", text="Z", toggle=True)
+
+        # Expand panels from the side-bar as popovers.
+        if mode_string == 'SCULPT':
             layout.popover_group(space_type='VIEW_3D', region_type='UI', context=".sculpt_mode", category="Tool")
-        elif tool_mode == 'PAINT_VERTEX':
+        elif mode_string == 'PAINT_VERTEX':
             layout.popover_group(space_type='VIEW_3D', region_type='UI', context=".vertexpaint", category="Tool")
-        elif tool_mode == 'PAINT_WEIGHT':
+        elif mode_string == 'PAINT_WEIGHT':
             layout.popover_group(space_type='VIEW_3D', region_type='UI', context=".weightpaint", category="Tool")
-        elif tool_mode == 'PAINT_TEXTURE':
+        elif mode_string == 'PAINT_TEXTURE':
             layout.popover_group(space_type='VIEW_3D', region_type='UI', context=".imagepaint", category="Tool")
-        elif tool_mode == 'EDIT_TEXT':
+        elif mode_string == 'EDIT_TEXT':
             layout.popover_group(space_type='VIEW_3D', region_type='UI', context=".text_edit", category="Tool")
-        elif tool_mode == 'EDIT_ARMATURE':
+        elif mode_string == 'EDIT_ARMATURE':
             layout.popover_group(space_type='VIEW_3D', region_type='UI', context=".armature_edit", category="Tool")
-        elif tool_mode == 'EDIT_METABALL':
+        elif mode_string == 'EDIT_METABALL':
             layout.popover_group(space_type='VIEW_3D', region_type='UI', context=".mball_edit", category="Tool")
-        elif tool_mode == 'EDIT_LATTICE':
+        elif mode_string == 'EDIT_LATTICE':
             layout.popover_group(space_type='VIEW_3D', region_type='UI', context=".lattice_edit", category="Tool")
-        elif tool_mode == 'EDIT_CURVE':
+        elif mode_string == 'EDIT_CURVE':
             layout.popover_group(space_type='VIEW_3D', region_type='UI', context=".curve_edit", category="Tool")
-        elif tool_mode == 'EDIT_MESH':
+        elif mode_string == 'EDIT_MESH':
             layout.popover_group(space_type='VIEW_3D', region_type='UI', context=".mesh_edit", category="Tool")
-        elif tool_mode == 'POSE':
+        elif mode_string == 'POSE':
             layout.popover_group(space_type='VIEW_3D', region_type='UI', context=".posemode", category="Tool")
-        elif tool_mode == 'PARTICLE':
+        elif mode_string == 'PARTICLE':
             layout.popover_group(space_type='VIEW_3D', region_type='UI', context=".particlemode", category="Tool")
-        elif tool_mode == 'OBJECT':
+        elif mode_string == 'OBJECT':
             layout.popover_group(space_type='VIEW_3D', region_type='UI', context=".objectmode", category="Tool")
-        elif tool_mode in {'PAINT_GPENCIL', 'EDIT_GPENCIL', 'SCULPT_GPENCIL', 'WEIGHT_GPENCIL'}:
+        elif mode_string in {'PAINT_GPENCIL', 'EDIT_GPENCIL', 'SCULPT_GPENCIL', 'WEIGHT_GPENCIL'}:
             # Grease pencil layer.
             gpl = context.active_gpencil_layer
             if gpl and gpl.info is not None:
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 91852aa8e57..d5b94156545 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -106,7 +106,7 @@ class VIEW3D_PT_tools_meshedit_options(View3DPanel, Panel):
         row.prop(mesh, "use_mirror_topology")
 
         layout.prop(tool_settings, "use_edge_path_live_unwrap")
-        layout.prop(tool_settings, "use_mesh_automerge")
+        layout.prop(tool_settings, "use_mesh_automerge", toggle=False)
 
         layout.prop(tool_settings, "double_threshold")
 
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index f861cf8cb1b..a4e060d55ef 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -2858,6 +2858,7 @@ static void rna_def_tool_settings(BlenderRNA *brna)
   RNA_def_property_boolean_sdna(prop, NULL, "automerge", 0);
   RNA_def_property_ui_text(
       prop, "AutoMerge Editing", "Automatically merge vertices moved to the same location");
+  RNA_def_property_ui_icon(prop, ICON_AUTOMERGE_OFF, -1);
   RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
 
   prop = RNA_def_property(srna, "use_snap", PROP_BOOLEAN, PROP_NONE);



More information about the Bf-blender-cvs mailing list