[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33461] trunk/blender/release/scripts/ui/ properties_data_bone.py: minor changes to bone UI script.

Campbell Barton ideasman42 at gmail.com
Sat Dec 4 07:21:10 CET 2010


Revision: 33461
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33461
Author:   campbellbarton
Date:     2010-12-04 07:21:08 +0100 (Sat, 04 Dec 2010)

Log Message:
-----------
minor changes to bone UI script.

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/properties_data_bone.py

Modified: trunk/blender/release/scripts/ui/properties_data_bone.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_data_bone.py	2010-12-04 05:34:16 UTC (rev 33460)
+++ trunk/blender/release/scripts/ui/properties_data_bone.py	2010-12-04 06:21:08 UTC (rev 33461)
@@ -56,22 +56,9 @@
         ob = context.object
         bone = context.bone
 
-        if not bone:
-            bone = context.edit_bone
-            row = layout.row()
-            row.column().prop(bone, "head")
-            row.column().prop(bone, "tail")
+        if bone:
+            pchan = ob.pose.bones[bone.name]
 
-            col = row.column()
-            sub = col.column(align=True)
-            sub.label(text="Roll:")
-            sub.prop(bone, "roll", text="")
-            sub.label()
-            sub.prop(bone, "lock")
-
-        else:
-            pchan = ob.pose.bones[context.bone.name]
-
             row = layout.row()
             col = row.column()
             col.prop(pchan, "location")
@@ -92,7 +79,20 @@
 
             layout.prop(pchan, "rotation_mode")
 
+        else:
+            bone = context.edit_bone
+            row = layout.row()
+            row.column().prop(bone, "head")
+            row.column().prop(bone, "tail")
 
+            col = row.column()
+            sub = col.column(align=True)
+            sub.label(text="Roll:")
+            sub.prop(bone, "roll", text="")
+            sub.label()
+            sub.prop(bone, "lock")
+
+
 class BONE_PT_transform_locks(BoneButtonsPanel, bpy.types.Panel):
     bl_label = "Transform Locks"
     bl_options = {'DEFAULT_CLOSED'}
@@ -106,7 +106,7 @@
 
         ob = context.object
         bone = context.bone
-        pchan = ob.pose.bones[context.bone.name]
+        pchan = ob.pose.bones[bone.name]
 
         row = layout.row()
         col = row.column()
@@ -135,11 +135,11 @@
         bone = context.bone
         arm = context.armature
 
-        if not bone:
+        if bone:
+            pchan = ob.pose.bones[bone.name]
+        else:
             bone = context.edit_bone
             pchan = None
-        else:
-            pchan = ob.pose.bones[context.bone.name]
 
         split = layout.split()
 
@@ -178,31 +178,33 @@
         return context.bone
 
     def draw(self, context):
+        # note. this works ok in editmode but isnt
+        # all that useful so disabling for now.
         layout = self.layout
 
         ob = context.object
         bone = context.bone
 
-        if not bone:
+        if bone:
+            pchan = ob.pose.bones[bone.name]
+        else:
             bone = context.edit_bone
             pchan = None
-        else:
-            pchan = ob.pose.bones[context.bone.name]
 
-        if ob and pchan:
-
+        if bone:
             split = layout.split()
 
             col = split.column()
             col.prop(bone, "show_wire", text="Wireframe")
             col.prop(bone, "hide", text="Hide")
 
-            col = split.column()
+            if pchan:
+                col = split.column()
 
-            col.label(text="Custom Shape:")
-            col.prop(pchan, "custom_shape", text="")
-            if pchan.custom_shape:
-                col.prop_search(pchan, "custom_shape_transform", ob.pose, "bones", text="At")
+                col.label(text="Custom Shape:")
+                col.prop(pchan, "custom_shape", text="")
+                if pchan.custom_shape:
+                    col.prop_search(pchan, "custom_shape_transform", ob.pose, "bones", text="At")
 
 
 class BONE_PT_inverse_kinematics(BoneButtonsPanel, bpy.types.Panel):
@@ -216,9 +218,9 @@
     def draw(self, context):
         layout = self.layout
 
-        ob = context.object
-        bone = context.bone
-        pchan = ob.pose.bones[bone.name]
+        pchan = context.active_pose_bone
+        # incase pose bone context is pinned don't use 'context.object'
+        ob = pchan.id_data
 
         row = layout.row()
         row.prop(ob.pose, "ik_solver")





More information about the Bf-blender-cvs mailing list