add menus for vertex group and shape key panels, functionality wasnt communicated well with icons and getting cluttered.

also made 'transfer shape' script copy into the active object to match 'join as shape', which was quite confusing before.
This commit is contained in:
Campbell Barton 2010-02-05 14:29:05 +00:00
parent 61755860ea
commit 2973ffbb49
4 changed files with 50 additions and 19 deletions

@ -140,7 +140,7 @@ class SubdivisionSet(bpy.types.Operator):
class ShapeTransfer(bpy.types.Operator):
'''Copy the active objects current shape to other selected objects with the same number of verts'''
'''Copy another selected objects active shape to this one by applying the relative offsets.'''
bl_idname = "object.shape_key_transfer"
bl_label = "Transfer Shape Key"
@ -199,8 +199,10 @@ class ShapeTransfer(bpy.types.Operator):
continue
target_normals = me_nos(me_other.verts)
# target_coords = me_cos(me_other.verts)
target_coords = me_cos(me_other.shape_keys.keys[0].data)
if me_other.shape_keys:
target_coords = me_cos(me_other.shape_keys.keys[0].data)
else:
target_coords = me_cos(me_other.verts)
ob_add_shape(ob_other, orig_key_name)
@ -306,12 +308,22 @@ class ShapeTransfer(bpy.types.Operator):
def execute(self, context):
C = bpy.context
ob_act = C.active_object
if ob_act.active_shape_key is None:
self.report({'ERROR'}, "Active object has no shape key")
return {'CANCELLED'}
objects = [ob for ob in C.selected_editable_objects if ob != ob_act]
return self._main(ob_act, objects, self.properties.mode, self.properties.use_clamp)
if 1: # swap from/to, means we cant copy to many at once.
if len(objects) != 1:
self.report({'ERROR'}, "Expected one other selected mesh object to copy from")
return {'CANCELLED'}
ob_act, objects = objects[0], [ob_act]
if ob_act.type != 'MESH':
self.report({'ERROR'}, "Other object is not a mesh.")
return {'CANCELLED'}
if ob_act.active_shape_key is None:
self.report({'ERROR'}, "Other object has no shape key")
return {'CANCELLED'}
return self._main(ob_act, objects, self.properties.mode, self.properties.use_clamp)
class JoinUVs(bpy.types.Operator):
'''Copy UV Layout to objects with matching geometry'''

@ -23,6 +23,29 @@ from rna_prop_ui import PropertyPanel
narrowui = 180
class MESH_MT_vertex_group_specials(bpy.types.Menu):
bl_label = "Vertex Group Specials"
def draw(self, context):
layout = self.layout
layout.operator("object.vertex_group_sort", icon='SORTALPHA')
layout.operator("object.vertex_group_copy", icon='COPY_ID')
layout.operator("object.vertex_group_copy_to_linked", icon='LINK_AREA')
layout.operator("object.vertex_group_mirror", icon='ARROW_LEFTRIGHT')
class MESH_MT_shape_key_specials(bpy.types.Menu):
bl_label = "Shape Key Specials"
def draw(self, context):
layout = self.layout
layout.operator("object.shape_key_transfer", icon='COPY_ID') # icon is not ideal
layout.operator("object.join_shapes", icon='COPY_ID') # icon is not ideal
layout.operator("object.shape_key_mirror", icon='ARROW_LEFTRIGHT')
class DataButtonsPanel(bpy.types.Panel):
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
@ -121,11 +144,7 @@ class DATA_PT_vertex_groups(DataButtonsPanel):
col = row.column(align=True)
col.operator("object.vertex_group_add", icon='ZOOMIN', text="")
col.operator("object.vertex_group_remove", icon='ZOOMOUT', text="")
col.operator("object.vertex_group_sort", icon='SORTALPHA', text="")
col.operator("object.vertex_group_copy", icon='COPY_ID', text="")
if ob.data.users > 1:
col.operator("object.vertex_group_copy_to_linked", icon='LINK_AREA', text="")
col.menu("MESH_MT_vertex_group_specials", icon='DOWNARROW_HLT', text="")
if group:
row = layout.row()
@ -178,6 +197,7 @@ class DATA_PT_shape_keys(DataButtonsPanel):
sub = col.column(align=True)
sub.operator("object.shape_key_add", icon='ZOOMIN', text="")
sub.operator("object.shape_key_remove", icon='ZOOMOUT', text="")
sub.menu("MESH_MT_shape_key_specials", icon='DOWNARROW_HLT', text="")
if kb:
col.separator()
@ -206,13 +226,10 @@ class DATA_PT_shape_keys(DataButtonsPanel):
subsub.prop(ob, "shape_key_lock", text="")
subsub.prop(kb, "mute", text="")
sub.prop(ob, "shape_key_edit_mode", text="")
sub = row.row(align=True)
sub.operator("object.shape_key_transfer", icon='COPY_ID', text="") # icon is not ideal
sub.operator("object.shape_key_mirror", icon='ARROW_LEFTRIGHT', text="")
sub = row.row()
sub.operator("object.shape_key_clear", icon='X', text="")
row = layout.row()
row.prop(kb, "name")
@ -286,6 +303,9 @@ class DATA_PT_vertex_colors(DataButtonsPanel):
if lay:
layout.prop(lay, "name")
bpy.types.register(MESH_MT_vertex_group_specials)
bpy.types.register(MESH_MT_shape_key_specials)
bpy.types.register(DATA_PT_context_mesh)
bpy.types.register(DATA_PT_normals)
bpy.types.register(DATA_PT_settings)

@ -44,7 +44,7 @@ class MATERIAL_MT_sss_presets(bpy.types.Menu):
class MATERIAL_MT_specials(bpy.types.Menu):
bl_label = "Material Options"
bl_label = "Material Specials"
def draw(self, context):
layout = self.layout

@ -671,7 +671,6 @@ class VIEW3D_MT_object(bpy.types.Menu):
layout.separator()
layout.operator("object.join_shapes")
layout.operator("object.join_uvs")
layout.operator("object.join")