[Bf-extensions-cvs] [0bd045eb] master: brush menus, Fix: T52409

meta-androcto noreply at git.blender.org
Tue Aug 15 23:20:34 CEST 2017


Commit: 0bd045ebafa881fa7637cff77a7f20bcb635c857
Author: meta-androcto
Date:   Wed Aug 16 07:20:14 2017 +1000
Branches: master
https://developer.blender.org/rBA0bd045ebafa881fa7637cff77a7f20bcb635c857

brush menus, Fix: T52409

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

M	space_view3d_brush_menus/dyntopo_menu.py

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

diff --git a/space_view3d_brush_menus/dyntopo_menu.py b/space_view3d_brush_menus/dyntopo_menu.py
index 1e7a5600..ff746df3 100644
--- a/space_view3d_brush_menus/dyntopo_menu.py
+++ b/space_view3d_brush_menus/dyntopo_menu.py
@@ -42,78 +42,96 @@ class DynTopoMenu(Menu):
                                         "Enable Dynamic Topology")
 
 
-    class DynDetailMenu(Menu):
-        bl_label = "Detail Size"
-        bl_idname = "VIEW3D_MT_sv3_dyn_detail"
-     
-        def init(self):
-            settings = (("40", 40),
-                        ("30", 30),
-                        ("20", 20),
+class DynDetailMenu(Menu):
+    bl_label = "Detail Size"
+    bl_idname = "VIEW3D_MT_sv3_dyn_detail"
+
+    def init(self):
+        settings = (("40", 40),
+                    ("30", 30),
+                    ("20", 20),
+                    ("10", 10),
+                    ("5", 5),
+                    ("1", 1))
+
+        if bpy.context.tool_settings.sculpt.detail_type_method == 'RELATIVE':
+            datapath = "tool_settings.sculpt.detail_size"
+            slider_setting = "detail_size"
+
+        elif bpy.context.tool_settings.sculpt.detail_type_method == 'CONSTANT':
+            datapath = "tool_settings.sculpt.constant_detail"
+            slider_setting = "constant_detail"
+        else:
+            datapath = "tool_settings.sculpt.detail_percent"
+            slider_setting = "detail_percent"
+            settings = (("100", 100),
+                        ("75", 75),
+                        ("50", 50),
+                        ("25", 25),
                         ("10", 10),
-                        ("5", 5),
-                        ("1", 1))
-     
-            if bpy.context.tool_settings.sculpt.detail_type_method == 'RELATIVE':
-                datapath = "tool_settings.sculpt.detail_size"
-                slider_setting = "detail_size"
-     
-            elif bpy.context.tool_settings.sculpt.detail_type_method == 'CONSTANT':
-                datapath = "tool_settings.sculpt.constant_detail"
-                slider_setting = "constant_detail"
-            else:
-                datapath = "tool_settings.sculpt.detail_percent"
-                slider_setting = "detail_percent"
-                settings = (("100", 100),
-                            ("75", 75),
-                            ("50", 50),
-                            ("25", 25),
-                            ("10", 10),
-                            ("5", 5))
-     
-            return settings, datapath, slider_setting
-     
-    class DetailMethodMenu(Menu):
-        bl_label = "Detail Method"
-        bl_idname = "VIEW3D_MT_sv3_detail_method_menu"
-     
-        def draw(self, context):
-            layout = self.layout
-            refine_path = "tool_settings.sculpt.detail_refine_method"
-            type_path = "tool_settings.sculpt.detail_type_method"
-     
-            refine_items = (("Subdivide Edges", 'SUBDIVIDE'),
-                            ("Collapse Edges", 'COLLAPSE'),
-                            ("Subdivide Collapse", 'SUBDIVIDE_COLLAPSE'))
-     
-            type_items = (("Relative Detail", 'RELATIVE'),
-                          ("Constant Detail", 'CONSTANT'),
-                          ("Brush Detail", 'BRUSH'))
-
-            layout.row().label("Refine")
-            layout.row().separator()
+                        ("5", 5))
 
-            # add the refine menu items
-            for item in refine_items:
-                utils_core.menuprop(
-                        layout.row(), item[0], item[1],
-                        refine_path, disable=True,
-                        icon='RADIOBUT_OFF',
-                        disable_icon='RADIOBUT_ON'
-                        )
+        return settings, datapath, slider_setting
 
-            layout.row().label("")
+    def draw(self, context):
+        settings, datapath, slider_setting = self.init()
+        layout = self.layout
 
-            layout.row().label("Type")
-            layout.row().separator()
+        # add the top slider
+        layout.row().prop(context.tool_settings.sculpt,
+                             slider_setting, slider=True)
+        layout.row().separator()
+
+        # add the rest of the menu items
+        for i in range(len(settings)):
+            utils_core.menuprop(
+                    layout.row(), settings[i][0], settings[i][1], datapath,
+                    icon='RADIOBUT_OFF', disable=True,
+                    disable_icon='RADIOBUT_ON'
+                    )
+
+
+class DetailMethodMenu(Menu):
+    bl_label = "Detail Method"
+    bl_idname = "VIEW3D_MT_sv3_detail_method_menu"
+
+    def draw(self, context):
+        layout = self.layout
+        refine_path = "tool_settings.sculpt.detail_refine_method"
+        type_path = "tool_settings.sculpt.detail_type_method"
+
+        refine_items = (("Subdivide Edges", 'SUBDIVIDE'),
+                        ("Collapse Edges", 'COLLAPSE'),
+                        ("Subdivide Collapse", 'SUBDIVIDE_COLLAPSE'))
+
+        type_items = (("Relative Detail", 'RELATIVE'),
+                      ("Constant Detail", 'CONSTANT'),
+                      ("Brush Detail", 'BRUSH'))
+
+        layout.row().label("Refine")
+        layout.row().separator()
+
+        # add the refine menu items
+        for item in refine_items:
+            utils_core.menuprop(
+                    layout.row(), item[0], item[1],
+                    refine_path, disable=True,
+                    icon='RADIOBUT_OFF',
+                    disable_icon='RADIOBUT_ON'
+                    )
+
+        layout.row().label("")
+
+        layout.row().label("Type")
+        layout.row().separator()
 
-            # add the type menu items
-            for item in type_items:
-                utils_core.menuprop(
-                        layout.row(), item[0], item[1],
-                        type_path, disable=True,
-                        icon='RADIOBUT_OFF', disable_icon='RADIOBUT_ON'
-                        )
+        # add the type menu items
+        for item in type_items:
+            utils_core.menuprop(
+                    layout.row(), item[0], item[1],
+                    type_path, disable=True,
+                    icon='RADIOBUT_OFF', disable_icon='RADIOBUT_ON'
+                    )
 
 
 class SymmetrizeMenu(Menu):



More information about the Bf-extensions-cvs mailing list