[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44164] trunk/blender/release/scripts/ startup/bl_ui/space_view3d.py: Sculpt/Paint UI: Add a new menu for brush options.

Nicholas Bishop nicholasbishop at gmail.com
Thu Feb 16 19:06:41 CET 2012


Revision: 44164
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44164
Author:   nicholasbishop
Date:     2012-02-16 18:06:38 +0000 (Thu, 16 Feb 2012)
Log Message:
-----------
Sculpt/Paint UI: Add a new menu for brush options.

For vertex/weight/texture paint, this has only the flags for using
unified size/strength. (Addresses TODO in code, before only sculpt
menu had these settings.)

For sculpt, moved the brush-related settings from the sculpt menu to
the brush menu.

Note that these menus are still very out of date (missing lots of
options), will address that in a different commit.

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/space_view3d.py

Modified: trunk/blender/release/scripts/startup/bl_ui/space_view3d.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_view3d.py	2012-02-16 17:43:23 UTC (rev 44163)
+++ trunk/blender/release/scripts/startup/bl_ui/space_view3d.py	2012-02-16 18:06:38 UTC (rev 44164)
@@ -19,6 +19,7 @@
 # <pep8 compliant>
 import bpy
 from bpy.types import Header, Menu, Panel
+from .properties_paint_common import UnifiedPaintPanel
 
 
 class VIEW3D_HT_header(Header):
@@ -51,6 +52,8 @@
             elif obj:
                 if mode_string not in {'PAINT_TEXTURE'}:
                     sub.menu("VIEW3D_MT_%s" % mode_string.lower())
+                if mode_string in {'SCULPT', 'PAINT_VERTEX', 'PAINT_WEIGHT', 'PAINT_TEXTURE'}:
+                    sub.menu("VIEW3D_MT_brush")
             else:
                 sub.menu("VIEW3D_MT_object")
 
@@ -1013,7 +1016,46 @@
 
         layout.operator("object.game_property_clear")
 
+        
+# ********** Brush menu **********
+class VIEW3D_MT_brush(Menu):
+    bl_label = "Brush"
 
+    def draw(self, context):
+        layout = self.layout
+
+        settings = UnifiedPaintPanel.paint_settings(context)
+        brush = settings.brush
+
+        ups = context.tool_settings.unified_paint_settings
+        layout.prop(ups, "use_unified_size", text="Unified Size")
+        layout.prop(ups, "use_unified_strength", text="Unified Strength")
+
+        # skip if no active brush
+        if not brush:
+            return
+
+        # TODO: still missing a lot of brush options here
+
+        # sculpt options
+        if context.sculpt_object:
+
+            sculpt_tool = brush.sculpt_tool
+
+            layout.separator()
+            layout.operator_menu_enum("brush.curve_preset", "shape", text='Curve Preset')
+            layout.separator()
+
+            if sculpt_tool != 'GRAB':
+                layout.prop_menu_enum(brush, "stroke_method")
+
+                if sculpt_tool in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}:
+                    layout.prop_menu_enum(brush, "direction")
+
+                if sculpt_tool == 'LAYER':
+                    layout.prop(brush, "use_persistent")
+                    layout.operator("sculpt.set_persistent_base")
+
 # ********** Vertex paint menu **********
 
 
@@ -1116,7 +1158,6 @@
 
         toolsettings = context.tool_settings
         sculpt = toolsettings.sculpt
-        brush = toolsettings.sculpt.brush
 
         layout.operator("ed.undo")
         layout.operator("ed.redo")
@@ -1130,34 +1171,13 @@
         layout.prop(sculpt, "lock_x")
         layout.prop(sculpt, "lock_y")
         layout.prop(sculpt, "lock_z")
-        layout.separator()
-        layout.operator_menu_enum("brush.curve_preset", "shape")
-        layout.separator()
 
-        if brush is not None:  # unlikely but can happen
-            sculpt_tool = brush.sculpt_tool
-
-            if sculpt_tool != 'GRAB':
-                layout.prop_menu_enum(brush, "stroke_method")
-
-                if sculpt_tool in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}:
-                    layout.prop_menu_enum(brush, "direction")
-
-                if sculpt_tool == 'LAYER':
-                    layout.prop(brush, "use_persistent")
-                    layout.operator("sculpt.set_persistent_base")
-
         layout.separator()
         layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
         layout.prop(sculpt, "show_low_resolution")
         layout.prop(sculpt, "show_brush")
         layout.prop(sculpt, "use_deform_only")
 
-        # TODO, make available from paint menu!
-        ups = context.tool_settings.unified_paint_settings
-        layout.separator()
-        layout.prop(ups, "use_unified_size")
-        layout.prop(ups, "use_unified_strength")
 
 # ********** Particle menu **********
 




More information about the Bf-blender-cvs mailing list