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
This commit is contained in:
Juanfran Matheu 2021-01-07 09:29:36 -08:00 committed by Harley Acheson
parent 3db975f30d
commit e3d9241a05
1 changed files with 9 additions and 0 deletions

View File

@ -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