Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-03-16 18:32:56 +0300
committerJacques Lucke <jacques@blender.org>2021-03-16 18:32:56 +0300
commit8212697830dfa651803005a3c309182a9241887c (patch)
tree3388becf819e71724386eae13c5342b123512c92 /release/scripts/startup/bl_ui/space_view3d.py
parentffa0420ae7aa4594e4e03719c5485ab79e4ceb62 (diff)
support default weighttemp-asset-tools-prototype
Diffstat (limited to 'release/scripts/startup/bl_ui/space_view3d.py')
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 8d2abbff79a..178a42ee8ef 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -7523,6 +7523,7 @@ class VIEW3D_PT_asset_tools(Panel):
group_name = asset_tool.weight_group_name
props = layout.operator("asset.setup_weight_paint_tool", text=group_name)
props.vertex_group_name = group_name
+ props.default_weight = asset_tool.default_weight
for socket in node_group.inputs[1:]:
layout.prop(modifier, f'["{socket.identifier}"]', text=socket.name)
@@ -7534,6 +7535,7 @@ class ASSET_OT_setup_weight_paint_tool(bpy.types.Operator):
bl_description = "Setup weight paint tool"
vertex_group_name: bpy.props.StringProperty()
+ default_weight: bpy.props.FloatProperty(default=1.0)
@classmethod
def poll(cls, context):
@@ -7542,13 +7544,16 @@ class ASSET_OT_setup_weight_paint_tool(bpy.types.Operator):
def execute(self, context):
ob = context.active_object
+ if ob.mode != 'WEIGHT_PAINT':
+ bpy.ops.object.mode_set(mode='WEIGHT_PAINT')
+
name = self.vertex_group_name
if not name in ob.vertex_groups:
- ob.vertex_groups.new(name=name)
+ group = ob.vertex_groups.new(name=name)
+ group.add(list(range(len(ob.data.vertices))), self.default_weight, 'REPLACE')
+
ob.vertex_groups.active = ob.vertex_groups[name]
- if ob.mode != 'WEIGHT_PAINT':
- bpy.ops.object.mode_set(mode='WEIGHT_PAINT')
return {'FINISHED'}