[Bf-blender-cvs] [b657e9875ce] blender2.8: Tool System: use enum for gp sculpt/weight paint

Campbell Barton noreply at git.blender.org
Tue Nov 13 06:54:36 CET 2018


Commit: b657e9875cefa3b5e05964f023ad843fe7e24ebb
Author: Campbell Barton
Date:   Tue Nov 13 16:52:39 2018 +1100
Branches: blender2.8
https://developer.blender.org/rBb657e9875cefa3b5e05964f023ad843fe7e24ebb

Tool System: use enum for gp sculpt/weight paint

Fixes T57525

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

M	release/scripts/presets/keyconfig/keymap_data/blender_default.py
M	release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M	release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
M	source/blender/editors/gpencil/gpencil_brush.c
M	source/blender/makesrna/RNA_enum_types.h
M	source/blender/makesrna/intern/rna_sculpt_paint.c
M	source/blender/windowmanager/intern/wm_toolsystem.c

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

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 4ebf98ad5cb..839236324ea 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -2984,10 +2984,12 @@ def km_grease_pencil_stroke_sculpt_mode(params):
         # Selection
         *_grease_pencil_selection(params),
         # Painting
+        ("gpencil.brush_paint", {"type": 'LEFTMOUSE', "value": 'PRESS'},
+         {"properties": [("wait_for_input", False)]}),
         ("gpencil.brush_paint", {"type": 'LEFTMOUSE', "value": 'PRESS', "ctrl": True},
-         {"properties": [("wait_for_input", False), ("keep_brush", True)]}),
+         {"properties": [("wait_for_input", False)]}),
         ("gpencil.brush_paint", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True},
-         {"properties": [("wait_for_input", False), ("keep_brush", True)]}),
+         {"properties": [("wait_for_input", False)]}),
         # Brush strength
         ("wm.radial_control", {"type": 'F', "value": 'PRESS', "shift": True},
          {"properties": [("data_path_primary", 'tool_settings.gpencil_sculpt.brush.strength')]}),
@@ -3016,9 +3018,9 @@ def km_grease_pencil_stroke_weight_mode(params):
         *_grease_pencil_selection(params),
         # Painting
         ("gpencil.brush_paint", {"type": 'LEFTMOUSE', "value": 'PRESS', "ctrl": True},
-         {"properties": [("wait_for_input", False), ("keep_brush", True)]}),
+         {"properties": [("wait_for_input", False)]}),
         ("gpencil.brush_paint", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True},
-         {"properties": [("wait_for_input", False), ("keep_brush", True)]}),
+         {"properties": [("wait_for_input", False)]}),
         # Brush strength
         ("wm.radial_control", {"type": 'F', "value": 'PRESS', "shift": True},
          {"properties": [("data_path_primary", 'tool_settings.gpencil_sculpt.weight_brush.strength')]}),
diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index 2c56e6d2178..ff92b3731c3 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -247,10 +247,10 @@ class GreasePencilStrokeSculptPanel:
         layout.use_property_decorate = False
 
         settings = context.tool_settings.gpencil_sculpt
-        tool = settings.tool
+        tool = settings.sculpt_tool
         brush = settings.brush
 
-        layout.template_icon_view(settings, "tool", show_labels=True)
+        layout.template_icon_view(settings, "sculpt_tool", show_labels=True)
 
         row = layout.row(align=True)
         row.prop(brush, "size", slider=True)
@@ -271,7 +271,7 @@ class GreasePencilStrokeSculptPanel:
             row = layout.row(align=True)
             row.prop_enum(brush, "direction", value='ADD', text="Pinch")
             row.prop_enum(brush, "direction", value='SUBTRACT', text="Inflate")
-        elif settings.tool == 'TWIST':
+        elif tool == 'TWIST':
             row = layout.row(align=True)
             row.prop_enum(brush, "direction", value='ADD', text="CCW")
             row.prop_enum(brush, "direction", value='SUBTRACT', text="CW")
@@ -283,7 +283,7 @@ class GreasePencilSculptOptionsPanel:
     @classmethod
     def poll(cls, context):
         settings = context.tool_settings.gpencil_sculpt
-        tool = settings.tool
+        tool = settings.sculpt_tool
 
         return bool(tool in {'SMOOTH', 'RANDOMIZE', 'SMOOTH'})
 
@@ -294,7 +294,7 @@ class GreasePencilSculptOptionsPanel:
         layout.use_property_decorate = False
 
         settings = context.tool_settings.gpencil_sculpt
-        tool = settings.tool
+        tool = settings.sculpt_tool
         brush = settings.brush
 
         if tool in {'SMOOTH', 'RANDOMIZE'}:
@@ -350,7 +350,7 @@ class GreasePencilAppearancePanel:
         elif ob.mode in {'GPENCIL_SCULPT', 'GPENCIL_WEIGHT'}:
             settings = context.tool_settings.gpencil_sculpt
             brush = settings.brush
-            tool = settings.tool
+            tool = settings.sculpt_tool
 
             col = layout.column(align=True)
             col.prop(brush, "use_cursor", text="Show Brush")
@@ -361,7 +361,7 @@ class GreasePencilAppearancePanel:
             elif tool == 'PINCH':
                 col.prop(brush, "cursor_color_add", text="Pinch")
                 col.prop(brush, "cursor_color_sub", text="Inflate")
-            elif settings.tool == 'TWIST':
+            elif tool == 'TWIST':
                 col.prop(brush, "cursor_color_add", text="CCW")
                 col.prop(brush, "cursor_color_sub", text="CW")
             else:
@@ -572,7 +572,7 @@ class GPENCIL_MT_pie_sculpt(Menu):
         # W - Launch Sculpt Mode
         col = pie.column()
         # col.label(text="Tool:")
-        col.prop(settings, "tool", text="")
+        col.prop(settings, "sculpt_tool", text="")
         col.operator("gpencil.brush_paint", text="Sculpt", icon='SCULPTMODE_HLT')
 
         # E - Common Settings
@@ -582,7 +582,7 @@ class GPENCIL_MT_pie_sculpt(Menu):
         row.prop(brush, "strength", slider=True)
         # row.prop(brush, "use_pressure_strength", text="", icon_only=True)
         col.prop(brush, "use_falloff")
-        if settings.tool in {'SMOOTH', 'RANDOMIZE'}:
+        if settings.sculpt_tool in {'SMOOTH', 'RANDOMIZE'}:
             row = col.row(align=True)
             row.prop(settings, "use_edit_position", text="Position", icon='MESH_DATA', toggle=True)
             row.prop(settings, "use_edit_strength", text="Strength", icon='COLOR', toggle=True)
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index 0af74da7d71..affb5439af1 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -1389,7 +1389,7 @@ class _defs_gpencil_sculpt:
         if ob and ob.mode == 'GPENCIL_SCULPT':
             tool_settings = context.tool_settings
             settings = tool_settings.gpencil_sculpt
-            tool = settings.tool
+            tool = settings.sculpt_tool
             brush = settings.brush
 
             layout.prop(brush, "size", slider=True)
@@ -1402,130 +1402,16 @@ class _defs_gpencil_sculpt:
                 row.separator()
                 row.prop(brush, "direction", expand=True, text="")
 
-    @ToolDef.from_fn.with_args(draw_settings=draw_settings_common)
-    def smooth(*, draw_settings):
-        return dict(
-            text="Smooth",
-            icon="ops.gpencil.sculpt_smooth",
-            widget=None,
-            keymap=(
-                ("gpencil.brush_paint",
-                 dict(mode='SMOOTH', wait_for_input=False),
-                 dict(type='EVT_TWEAK_A', value='ANY')),
-            ),
-            draw_settings=draw_settings,
-        )
-
-    @ToolDef.from_fn.with_args(draw_settings=draw_settings_common)
-    def thickness(*, draw_settings):
-        return dict(
-            text="Thickness",
-            icon="ops.gpencil.sculpt_thickness",
-            widget=None,
-            keymap=(
-                ("gpencil.brush_paint",
-                 dict(mode='THICKNESS', wait_for_input=False),
-                 dict(type='EVT_TWEAK_A', value='ANY')),
-            ),
-            draw_settings=draw_settings,
-        )
-
-    @ToolDef.from_fn.with_args(draw_settings=draw_settings_common)
-    def strength(*, draw_settings):
-        return dict(
-            text="Strength",
-            icon="ops.gpencil.sculpt_strength",
-            widget=None,
-            keymap=(
-                ("gpencil.brush_paint",
-                 dict(mode='STRENGTH', wait_for_input=False),
-                 dict(type='EVT_TWEAK_A', value='ANY')),
-            ),
-            draw_settings=draw_settings,
-        )
-
-    @ToolDef.from_fn.with_args(draw_settings=draw_settings_common)
-    def grab(*, draw_settings):
-        return dict(
-            text="Grab",
-            icon="ops.gpencil.sculpt_grab",
-            widget=None,
-            keymap=(
-                ("gpencil.brush_paint",
-                 dict(mode='GRAB', wait_for_input=False),
-                 dict(type='EVT_TWEAK_A', value='ANY')),
-            ),
-            draw_settings=draw_settings,
-        )
-
-    @ToolDef.from_fn.with_args(draw_settings=draw_settings_common)
-    def push(*, draw_settings):
-        return dict(
-            text="Push",
-            icon="ops.gpencil.sculpt_push",
-            widget=None,
-            keymap=(
-                ("gpencil.brush_paint",
-                 dict(mode='PUSH', wait_for_input=False),
-                 dict(type='EVT_TWEAK_A', value='ANY')),
-            ),
-            draw_settings=draw_settings,
-        )
-
-    @ToolDef.from_fn.with_args(draw_settings=draw_settings_common)
-    def twist(*, draw_settings):
-        return dict(
-            text="Twist",
-            icon="ops.gpencil.sculpt_twist",
-            widget=None,
-            keymap=(
-                ("gpencil.brush_paint",
-                 dict(mode='TWIST', wait_for_input=False),
-                 dict(type='EVT_TWEAK_A', value='ANY')),
-            ),
-            draw_settings=draw_settings,
-        )
-
-    @ToolDef.from_fn.with_args(draw_settings=draw_settings_common)
-    def pinch(*, draw_settings):
-        return dict(
-            text="Pinch",
-            icon="ops.gpencil.sculpt_pinch",
-            widget=None,
-            keymap=(
-                ("gpencil.brush_paint",
-                 dict(mode='PINCH', wait_for_input=False),
-                 dict(type='EVT_TWEAK_A', value='ANY')),
-            ),
-            draw_settings=draw_settings,
-        )
-
-    @ToolDef.from_fn.with_args(draw_settings=draw_settings_common)
-    def randomize(*, draw_settings):
-        return dict(
-            text="Randomize",
-            icon="ops.gpencil.sculpt_randomize",
-            widget=None,
-            keymap=(
-                ("gpen

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list