Py fix for trunk to pepper merge.
[blender.git] / release / scripts / startup / bl_ui / properties_data_armature.py
index 7aa1dee2721beecf6ab02ce075f49ae17391b269..9a76ed81530e33308976a50314fec84b7ece9d8e 100644 (file)
 
 # <pep8 compliant>
 import bpy
+from bpy.types import Panel, Menu
 from rna_prop_ui import PropertyPanel
 
+
 class ArmatureButtonsPanel():
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
@@ -30,7 +32,7 @@ class ArmatureButtonsPanel():
         return context.armature
 
 
-class DATA_PT_context_arm(ArmatureButtonsPanel, bpy.types.Panel):
+class DATA_PT_context_arm(ArmatureButtonsPanel, Panel):
     bl_label = ""
     bl_options = {'HIDE_HEADER'}
 
@@ -47,7 +49,7 @@ class DATA_PT_context_arm(ArmatureButtonsPanel, bpy.types.Panel):
             layout.template_ID(space, "pin_id")
 
 
-class DATA_PT_skeleton(ArmatureButtonsPanel, bpy.types.Panel):
+class DATA_PT_skeleton(ArmatureButtonsPanel, Panel):
     bl_label = "Skeleton"
 
     def draw(self, context):
@@ -69,8 +71,11 @@ class DATA_PT_skeleton(ArmatureButtonsPanel, bpy.types.Panel):
         flow.prop(arm, "use_deform_envelopes", text="Envelopes")
         flow.prop(arm, "use_deform_preserve_volume", text="Quaternion")
 
+        if context.scene.render.engine == "BLENDER_GAME":
+            col = layout.column()
+            col.prop(arm, "vert_deformer")
 
-class DATA_PT_display(ArmatureButtonsPanel, bpy.types.Panel):
+class DATA_PT_display(ArmatureButtonsPanel, Panel):
     bl_label = "Display"
 
     def draw(self, context):
@@ -95,7 +100,16 @@ class DATA_PT_display(ArmatureButtonsPanel, bpy.types.Panel):
         col.prop(arm, "use_deform_delay", text="Delay Refresh")
 
 
-class DATA_PT_bone_groups(ArmatureButtonsPanel, bpy.types.Panel):
+class DATA_PT_bone_group_specials(Menu):
+    bl_label = "Bone Group Specials"
+
+    def draw(self, context):
+        layout = self.layout
+
+        layout.operator("pose.group_sort", icon='SORTALPHA')
+
+
+class DATA_PT_bone_groups(ArmatureButtonsPanel, Panel):
     bl_label = "Bone Groups"
 
     @classmethod
@@ -107,16 +121,25 @@ class DATA_PT_bone_groups(ArmatureButtonsPanel, bpy.types.Panel):
 
         ob = context.object
         pose = ob.pose
+        group = pose.bone_groups.active
 
         row = layout.row()
-        row.template_list(pose, "bone_groups", pose.bone_groups, "active_index", rows=2)
+
+        rows = 2
+        if group:
+            rows = 5
+        row.template_list(pose, "bone_groups", pose.bone_groups, "active_index", rows=rows)
 
         col = row.column(align=True)
         col.active = (ob.proxy is None)
         col.operator("pose.group_add", icon='ZOOMIN', text="")
         col.operator("pose.group_remove", icon='ZOOMOUT', text="")
+        col.menu("DATA_PT_bone_group_specials", icon='DOWNARROW_HLT', text="")
+        if group:
+            col.separator()
+            col.operator("pose.group_move", icon='TRIA_UP', text="").direction = 'UP'
+            col.operator("pose.group_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
 
-        group = pose.bone_groups.active
         if group:
             col = layout.column()
             col.active = (ob.proxy is None)
@@ -146,7 +169,7 @@ class DATA_PT_bone_groups(ArmatureButtonsPanel, bpy.types.Panel):
         sub.operator("pose.group_deselect", text="Deselect")
 
 
-class DATA_PT_pose_library(ArmatureButtonsPanel, bpy.types.Panel):
+class DATA_PT_pose_library(ArmatureButtonsPanel, Panel):
     bl_label = "Pose Library"
     bl_options = {'DEFAULT_CLOSED'}
 
@@ -185,7 +208,7 @@ class DATA_PT_pose_library(ArmatureButtonsPanel, bpy.types.Panel):
 
 
 # TODO: this panel will soon be depreceated too
-class DATA_PT_ghost(ArmatureButtonsPanel, bpy.types.Panel):
+class DATA_PT_ghost(ArmatureButtonsPanel, Panel):
     bl_label = "Ghost"
 
     def draw(self, context):
@@ -212,7 +235,7 @@ class DATA_PT_ghost(ArmatureButtonsPanel, bpy.types.Panel):
         col.prop(arm, "show_only_ghost_selected", text="Selected Only")
 
 
-class DATA_PT_iksolver_itasc(ArmatureButtonsPanel, bpy.types.Panel):
+class DATA_PT_iksolver_itasc(ArmatureButtonsPanel, Panel):
     bl_label = "iTaSC parameters"
     bl_options = {'DEFAULT_CLOSED'}
 
@@ -264,7 +287,8 @@ from bl_ui.properties_animviz import (
     OnionSkinButtonsPanel,
     )
 
-class DATA_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel):
+
+class DATA_PT_motion_paths(MotionPathButtonsPanel, Panel):
     #bl_label = "Bones Motion Paths"
     bl_context = "data"
 
@@ -287,7 +311,7 @@ class DATA_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel):
         split.operator("pose.paths_clear", text="Clear Paths")
 
 
-class DATA_PT_onion_skinning(OnionSkinButtonsPanel):  # , bpy.types.Panel): # inherit from panel when ready
+class DATA_PT_onion_skinning(OnionSkinButtonsPanel):  # , Panel): # inherit from panel when ready
     #bl_label = "Bones Onion Skinning"
     bl_context = "data"
 
@@ -297,14 +321,14 @@ class DATA_PT_onion_skinning(OnionSkinButtonsPanel):  # , bpy.types.Panel): # in
         return (context.object) and (context.armature)
 
     def draw(self, context):
-        layout = self.layout
-
         ob = context.object
-
         self.draw_settings(context, ob.pose.animation_visualisation, bones=True)
 
 
-class DATA_PT_custom_props_arm(ArmatureButtonsPanel, PropertyPanel, bpy.types.Panel):
+class DATA_PT_custom_props_arm(ArmatureButtonsPanel, PropertyPanel, Panel):
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
     _context_path = "object.data"
     _property_type = bpy.types.Armature
+
+if __name__ == "__main__":  # only for live edit.
+    bpy.utils.register_module(__name__)