[Bf-blender-cvs] [f38fbc9bedb] blender2.8: UI: add weight paint sample tools

Campbell Barton noreply at git.blender.org
Tue May 1 12:21:21 CEST 2018


Commit: f38fbc9bedb37695c4936838c002a389c45e367e
Author: Campbell Barton
Date:   Tue May 1 12:20:53 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBf38fbc9bedb37695c4936838c002a389c45e367e

UI: add weight paint sample tools

Also use unified weight.

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

M	release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
M	release/scripts/startup/bl_ui/space_topbar.py

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

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index 5312aac4764..2f0af9ebcb3 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -612,11 +612,33 @@ class _defs_weight_paint:
             )
         )
 
+    @ToolDef.from_fn
+    def sample_weight():
+        return dict(
+            text="Sample Weight",
+            icon="ops.paint.weight_sample",
+            widget=None,
+            keymap=(
+                ("paint.weight_sample", dict(), dict(type='ACTIONMOUSE', value='PRESS')),
+            ),
+        )
+
+    @ToolDef.from_fn
+    def sample_weight_group():
+        return dict(
+            text="Sample Vertex Group",
+            icon="ops.paint.weight_sample_group",
+            widget=None,
+            keymap=(
+                ("paint.weight_sample_group", dict(), dict(type='ACTIONMOUSE', value='PRESS')),
+            ),
+        )
+
     @ToolDef.from_fn
     def gradient_linear():
         return dict(
             text="Linear Gradient",
-            icon=None,
+            icon="ops.paint.weight_gradient.linear",
             widget=None,
             keymap=(
                 ("paint.weight_gradient", dict(type='LINEAR'),
@@ -628,7 +650,7 @@ class _defs_weight_paint:
     def gradient_radial():
         return dict(
             text="Radial Gradient",
-            icon=None,
+            icon="ops.paint.weight_gradient.radial",
             widget=None,
             keymap=(
                 ("paint.weight_gradient",
@@ -771,9 +793,13 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel):
         ],
         'PAINT_WEIGHT': [
             _defs_weight_paint.generate_from_brushes,
-
+            None,
+            _defs_weight_paint.sample_weight,
+            _defs_weight_paint.sample_weight_group,
+            None,
             # TODO, override brush events
             *_tools_select,
+            None,
             (
                 _defs_weight_paint.gradient_linear,
                 _defs_weight_paint.gradient_radial,
diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py
index 519a9f5a9b9..0189f9fc100 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -224,7 +224,7 @@ class _draw_left_context_mode:
 
         from .properties_paint_common import UnifiedPaintPanel
 
-        layout.prop(brush, "weight")
+        UnifiedPaintPanel.prop_unified_weight(layout, context, brush, "weight", slider=True, text="Weight")
         UnifiedPaintPanel.prop_unified_size(layout, context, brush, "size", slider=True, text="Radius")
         UnifiedPaintPanel.prop_unified_strength(layout, context, brush, "strength", slider=True, text="Strength")



More information about the Bf-blender-cvs mailing list