UI: move mesh-weights from panels to menus

Also de-duplicate edit/object mode menus.
This commit is contained in:
Campbell Barton
2018-04-24 16:54:38 +02:00
parent 354dbdde01
commit 00d4e99955
5 changed files with 43 additions and 58 deletions

View File

@@ -100,6 +100,19 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel):
'POSE': [
*_tools_transform,
],
'PAINT_WEIGHT': [
# TODO, override brush events
(
("Linear Gradient", None, None, (
("paint.weight_gradient", dict(type='LINEAR'),
dict(type='EVT_TWEAK_A', value='ANY')),
)),
("Radial Gradient", None, None, (
("paint.weight_gradient", dict(type='RADIAL'),
dict(type='EVT_TWEAK_A', value='ANY')),
)),
),
],
'EDIT_ARMATURE': [
*_tools_transform,
("Roll", None, None, (

View File

@@ -1956,17 +1956,18 @@ class VIEW3D_MT_vertex_group(Menu):
class VIEW3D_MT_paint_weight(Menu):
bl_label = "Weights"
def draw(self, context):
layout = self.layout
@staticmethod
def draw_generic(layout, is_editmode=False):
layout.menu("VIEW3D_MT_undo_redo")
if not is_editmode:
layout.menu("VIEW3D_MT_undo_redo")
layout.separator()
layout.separator()
layout.operator("paint.weight_from_bones", text="Assign Automatic From Bones").type = 'AUTOMATIC'
layout.operator("paint.weight_from_bones", text="Assign From Bone Envelopes").type = 'ENVELOPES'
layout.operator("paint.weight_from_bones", text="Assign Automatic From Bones").type = 'AUTOMATIC'
layout.operator("paint.weight_from_bones", text="Assign From Bone Envelopes").type = 'ENVELOPES'
layout.separator()
layout.separator()
layout.operator("object.vertex_group_normalize_all", text="Normalize All")
layout.operator("object.vertex_group_normalize", text="Normalize")
@@ -1983,16 +1984,22 @@ class VIEW3D_MT_paint_weight(Menu):
layout.operator("object.vertex_group_levels", text="Levels")
layout.operator("object.vertex_group_smooth", text="Smooth")
props = layout.operator("object.data_transfer", text="Transfer Weights")
props.use_reverse_transfer = True
props.data_type = 'VGROUP_WEIGHTS'
if not is_editmode:
props = layout.operator("object.data_transfer", text="Transfer Weights")
props.use_reverse_transfer = True
props.data_type = 'VGROUP_WEIGHTS'
layout.operator("object.vertex_group_limit_total", text="Limit Total")
layout.operator("object.vertex_group_fix", text="Fix Deforms")
layout.separator()
layout.operator("paint.weight_set")
if not is_editmode:
layout.separator()
layout.operator("paint.weight_set")
def draw(self, context):
self.draw_generic(self.layout, is_editmode=False);
class VIEW3D_MT_sculpt(Menu):
@@ -2468,6 +2475,7 @@ class VIEW3D_MT_edit_mesh(Menu):
layout.separator()
layout.menu("VIEW3D_MT_edit_mesh_normals")
layout.menu("VIEW3D_MT_edit_mesh_weights")
layout.menu("VIEW3D_MT_edit_mesh_clean")
layout.separator()
@@ -2774,6 +2782,13 @@ class VIEW3D_MT_edit_mesh_normals(Menu):
layout.operator("mesh.flip_normals")
class VIEW3D_MT_edit_mesh_weights(Menu):
bl_label = "Weights"
def draw(self, context):
VIEW3D_MT_paint_weight.draw_generic(self.layout, is_editmode=True)
class VIEW3D_MT_edit_mesh_clean(Menu):
bl_label = "Clean Up"
@@ -3886,6 +3901,7 @@ classes = (
VIEW3D_MT_edit_mesh_edges_data,
VIEW3D_MT_edit_mesh_faces,
VIEW3D_MT_edit_mesh_normals,
VIEW3D_MT_edit_mesh_weights,
VIEW3D_MT_edit_mesh_clean,
VIEW3D_MT_edit_mesh_delete,
VIEW3D_MT_edit_mesh_showhide,

View File

@@ -282,32 +282,6 @@ class VIEW3D_PT_tools_meshedit(View3DPanel, Panel):
col.operator("mesh.remove_doubles")
class VIEW3D_PT_tools_meshweight(View3DPanel, Panel):
bl_category = "Tools"
bl_context = "mesh_edit"
bl_label = "Weight Tools"
bl_options = {'DEFAULT_CLOSED'}
# Used for Weight-Paint mode and Edit-Mode
@staticmethod
def draw_generic(layout):
col = layout.column()
col.operator("object.vertex_group_normalize_all", text="Normalize All")
col.operator("object.vertex_group_normalize", text="Normalize")
col.operator("object.vertex_group_mirror", text="Mirror")
col.operator("object.vertex_group_invert", text="Invert")
col.operator("object.vertex_group_clean", text="Clean")
col.operator("object.vertex_group_quantize", text="Quantize")
col.operator("object.vertex_group_levels", text="Levels")
col.operator("object.vertex_group_smooth", text="Smooth")
col.operator("object.vertex_group_limit_total", text="Limit Total")
col.operator("object.vertex_group_fix", text="Fix Deforms")
def draw(self, context):
layout = self.layout
self.draw_generic(layout)
class VIEW3D_PT_tools_shading(View3DPanel, Panel):
bl_category = "Shading / UVs"
bl_context = "mesh_edit"
@@ -1579,22 +1553,6 @@ class VIEW3D_PT_tools_brush_appearance(Panel, View3DPaintPanel):
# ********** default tools for weight-paint ****************
class VIEW3D_PT_tools_weightpaint(View3DPanel, Panel):
bl_category = "Tools"
bl_context = "weightpaint"
bl_label = "Weight Tools"
def draw(self, context):
layout = self.layout
VIEW3D_PT_tools_meshweight.draw_generic(layout)
col = layout.column()
col.operator("paint.weight_gradient")
props = col.operator("object.data_transfer", text="Transfer Weights")
props.use_reverse_transfer = True
props.data_type = 'VGROUP_WEIGHTS'
class VIEW3D_PT_tools_weightpaint_symmetry(Panel, View3DPaintPanel):
bl_category = "Tools"
bl_context = "weightpaint"
@@ -1909,7 +1867,6 @@ classes = (
VIEW3D_PT_tools_rigid_body,
VIEW3D_PT_tools_transform_mesh,
VIEW3D_PT_tools_meshedit,
VIEW3D_PT_tools_meshweight,
VIEW3D_PT_tools_shading,
VIEW3D_PT_tools_uvs,
VIEW3D_PT_tools_meshedit_options,
@@ -1941,7 +1898,6 @@ classes = (
VIEW3D_PT_sculpt_options,
VIEW3D_PT_sculpt_symmetry,
VIEW3D_PT_tools_brush_appearance,
VIEW3D_PT_tools_weightpaint,
VIEW3D_PT_tools_weightpaint_symmetry,
VIEW3D_PT_tools_weightpaint_options,
VIEW3D_PT_tools_vertexpaint,