diff options
author | Juanfran Matheu <jfmatheu> | 2021-01-07 20:29:36 +0300 |
---|---|---|
committer | Harley Acheson <harley.acheson@gmail.com> | 2021-01-07 20:29:36 +0300 |
commit | e3d9241a0532e8d4c76def38184f432aa271f3a0 (patch) | |
tree | cd4cafbb340f629b3f4e43cf3fd27b8b27ebcaaa /release/scripts/startup/bl_ui/space_toolsystem_toolbar.py | |
parent | 3db975f30dd327381dc1a0e08305460a1a12eba4 (diff) |
UI: Show Weight Value with Sample Weight Tool
While using the Sample Weight tool in Weight Paint mode, show weight value in tool header.
Differential Revision: https://developer.blender.org/D9432
Reviewed by Pablo Vazquez
Diffstat (limited to 'release/scripts/startup/bl_ui/space_toolsystem_toolbar.py')
-rw-r--r-- | release/scripts/startup/bl_ui/space_toolsystem_toolbar.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py index a5354ca6bbe..30d614f87c9 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py @@ -1514,12 +1514,21 @@ class _defs_weight_paint: @ToolDef.from_fn def sample_weight(): + def draw_settings(context, layout, tool): + if context.tool_settings.unified_paint_settings.use_unified_weight: + weight = context.tool_settings.unified_paint_settings.weight + elif context.tool_settings.weight_paint.brush: + weight = context.tool_settings.weight_paint.brush.weight + else: + return + layout.label(text="Weight: %.3f" % weight) return dict( idname="builtin.sample_weight", label="Sample Weight", icon="ops.paint.weight_sample", widget=None, keymap=(), + draw_settings=draw_settings ) @ToolDef.from_fn |