Revision: 26626
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26626
Author: campbellbarton
Date: 2010-02-05 15:29:05 +0100 (Fri, 05 Feb 2010)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/blender/release/scripts/op/object.py
trunk/blender/release/scripts/ui/properties_data_mesh.py
trunk/blender/release/scripts/ui/properties_material.py
trunk/blender/release/scripts/ui/space_view3d.py
Modified: trunk/blender/release/scripts/op/object.py
===================================================================
--- trunk/blender/release/scripts/op/object.py 2010-02-05 13:40:43 UTC (rev
26625)
+++ trunk/blender/release/scripts/op/object.py 2010-02-05 14:29:05 UTC (rev
26626)
@@ -140,7 +140,7 @@
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 @@
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,13 +308,23 @@
def execute(self, context):
C = bpy.context
ob_act = C.active_object
+ objects = [ob for ob in C.selected_editable_objects if ob != ob_act]
+
+ 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'}, "Active object has no shape key")
+ self.report({'ERROR'}, "Other 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)
+ 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'''
bl_idname = "object.join_uvs"
Modified: trunk/blender/release/scripts/ui/properties_data_mesh.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_data_mesh.py 2010-02-05
13:40:43 UTC (rev 26625)
+++ trunk/blender/release/scripts/ui/properties_data_mesh.py 2010-02-05
14:29:05 UTC (rev 26626)
@@ -23,6 +23,29 @@
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,12 +144,8 @@
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.menu("MESH_MT_vertex_group_specials", icon='DOWNARROW_HLT',
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="")
-
if group:
row = layout.row()
row.prop(group, "name")
@@ -178,6 +197,7 @@
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 @@
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 @@
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)
Modified: trunk/blender/release/scripts/ui/properties_material.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_material.py 2010-02-05
13:40:43 UTC (rev 26625)
+++ trunk/blender/release/scripts/ui/properties_material.py 2010-02-05
14:29:05 UTC (rev 26626)
@@ -44,7 +44,7 @@
class MATERIAL_MT_specials(bpy.types.Menu):
- bl_label = "Material Options"
+ bl_label = "Material Specials"
def draw(self, context):
layout = self.layout
Modified: trunk/blender/release/scripts/ui/space_view3d.py
===================================================================
--- trunk/blender/release/scripts/ui/space_view3d.py 2010-02-05 13:40:43 UTC
(rev 26625)
+++ trunk/blender/release/scripts/ui/space_view3d.py 2010-02-05 14:29:05 UTC
(rev 26626)
@@ -671,7 +671,6 @@
layout.separator()
- layout.operator("object.join_shapes")
layout.operator("object.join_uvs")
layout.operator("object.join")
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs