[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33750] trunk/blender/release/scripts/ui/ properties_data_bone.py: fixes for pinning bones & pose ui, could easily get error messages and invalid situations.
Campbell Barton
ideasman42 at gmail.com
Fri Dec 17 18:51:43 CET 2010
Revision: 33750
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33750
Author: campbellbarton
Date: 2010-12-17 18:51:43 +0100 (Fri, 17 Dec 2010)
Log Message:
-----------
fixes for pinning bones & pose ui, could easily get error messages and invalid situations.
when pinned there is no pose bone.
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-17 17:17:05 UTC (rev 33749)
+++ trunk/blender/release/scripts/ui/properties_data_bone.py 2010-12-17 17:51:43 UTC (rev 33750)
@@ -50,13 +50,21 @@
class BONE_PT_transform(BoneButtonsPanel, bpy.types.Panel):
bl_label = "Transform"
+ @classmethod
+ def poll(cls, context):
+ if context.edit_bone:
+ return True
+
+ ob = context.object
+ return ob and ob.mode == 'POSE' and context.bone
+
def draw(self, context):
layout = self.layout
ob = context.object
bone = context.bone
- if bone:
+ if bone and ob:
pchan = ob.pose.bones[bone.name]
row = layout.row()
@@ -79,7 +87,7 @@
layout.prop(pchan, "rotation_mode")
- else:
+ elif context.edit_bone:
bone = context.edit_bone
row = layout.row()
row.column().prop(bone, "head")
@@ -99,7 +107,8 @@
@classmethod
def poll(cls, context):
- return context.bone
+ ob = context.object
+ return ob and ob.mode == 'POSE' and context.bone
def draw(self, context):
layout = self.layout
@@ -134,12 +143,12 @@
ob = context.object
bone = context.bone
arm = context.armature
+ pchan = None
if ob and bone:
pchan = ob.pose.bones[bone.name]
- else:
+ elif bone is None:
bone = context.edit_bone
- pchan = None
split = layout.split()
@@ -184,12 +193,12 @@
ob = context.object
bone = context.bone
+ pchan = None
if ob and bone:
pchan = ob.pose.bones[bone.name]
- else:
+ elif bone is None:
bone = context.edit_bone
- pchan = None
if bone:
split = layout.split()
@@ -213,14 +222,15 @@
@classmethod
def poll(cls, context):
- return context.active_pose_bone
+ ob = context.object
+ return ob and ob.mode == 'POSE' and context.bone
def draw(self, context):
layout = self.layout
- pchan = context.active_pose_bone
- # incase pose bone context is pinned don't use 'context.object'
- ob = pchan.id_data
+ ob = context.object
+ bone = context.bone
+ pchan = ob.pose.bones[bone.name]
row = layout.row()
row.prop(ob.pose, "ik_solver")
More information about the Bf-blender-cvs
mailing list