diff options
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d.py | 64 |
1 files changed, 42 insertions, 22 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 05d6ca7b337..4627a4ed6a2 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -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 @@ class VIEW3D_HT_header(Header): 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,6 +1016,45 @@ class VIEW3D_MT_object_game(Menu): 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 @@ class VIEW3D_MT_sculpt(Menu): toolsettings = context.tool_settings sculpt = toolsettings.sculpt - brush = toolsettings.sculpt.brush layout.operator("ed.undo") layout.operator("ed.redo") @@ -1130,22 +1171,6 @@ class VIEW3D_MT_sculpt(Menu): 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") @@ -1153,11 +1178,6 @@ class VIEW3D_MT_sculpt(Menu): 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 ********** |