[Bf-blender-cvs] [e3d9241a053] master: UI: Show Weight Value with Sample Weight Tool
Juanfran Matheu
noreply at git.blender.org
Thu Jan 7 18:30:50 CET 2021
Commit: e3d9241a0532e8d4c76def38184f432aa271f3a0
Author: Juanfran Matheu
Date: Thu Jan 7 09:29:36 2021 -0800
Branches: master
https://developer.blender.org/rBe3d9241a0532e8d4c76def38184f432aa271f3a0
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
===================================================================
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 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
More information about the Bf-blender-cvs
mailing list