[Bf-blender-cvs] [3f4a81232a2] blender2.8: UI: expose radial gradient as option

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


Commit: 3f4a81232a2ab3da4802c77c0b7dcbe49f223cbd
Author: Campbell Barton
Date:   Tue May 1 12:46:25 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB3f4a81232a2ab3da4802c77c0b7dcbe49f223cbd

UI: expose radial gradient as option

Was a separate tool, use option so we can extend more easily.

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

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

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

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index 2f0af9ebcb3..c621e27ae00 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -635,28 +635,20 @@ class _defs_weight_paint:
         )
 
     @ToolDef.from_fn
-    def gradient_linear():
-        return dict(
-            text="Linear Gradient",
-            icon="ops.paint.weight_gradient.linear",
-            widget=None,
-            keymap=(
-                ("paint.weight_gradient", dict(type='LINEAR'),
-                 dict(type='EVT_TWEAK_A', value='ANY')),
-            ),
-        )
+    def gradient():
+        def draw_settings(context, layout):
+            wm = context.window_manager
+            props = wm.operator_properties_last("paint.weight_gradient")
+            layout.prop(props, "type")
 
-    @ToolDef.from_fn
-    def gradient_radial():
         return dict(
-            text="Radial Gradient",
-            icon="ops.paint.weight_gradient.radial",
+            text="Gradient",
+            icon="ops.paint.weight_gradient",
             widget=None,
             keymap=(
-                ("paint.weight_gradient",
-                 dict(type='RADIAL'),
-                 dict(type='EVT_TWEAK_A', value='ANY')),
+                ("paint.weight_gradient", dict(), dict(type='EVT_TWEAK_A', value='ANY')),
             ),
+            draw_settings=draw_settings,
         )
 
 
@@ -800,10 +792,7 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel):
             # TODO, override brush events
             *_tools_select,
             None,
-            (
-                _defs_weight_paint.gradient_linear,
-                _defs_weight_paint.gradient_radial,
-            ),
+            _defs_weight_paint.gradient,
         ],
     }



More information about the Bf-blender-cvs mailing list