Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-12-17 20:51:43 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-12-17 20:51:43 +0300
commit157082ecc9ad9d971111450f6b8cd172378af614 (patch)
treebb26397cd11e54fd485aa721a10263553da4b101 /release
parent7bca6bcf1f6765410b7559056d9f7d52e96cc57b (diff)
fixes for pinning bones & pose ui, could easily get error messages and invalid situations.
when pinned there is no pose bone.
Diffstat (limited to 'release')
-rw-r--r--release/scripts/ui/properties_data_bone.py32
1 files changed, 21 insertions, 11 deletions
diff --git a/release/scripts/ui/properties_data_bone.py b/release/scripts/ui/properties_data_bone.py
index 30a4c635f6f..61ce3f7503c 100644
--- a/release/scripts/ui/properties_data_bone.py
+++ b/release/scripts/ui/properties_data_bone.py
@@ -50,13 +50,21 @@ class BONE_PT_context_bone(BoneButtonsPanel, bpy.types.Panel):
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 @@ class BONE_PT_transform(BoneButtonsPanel, bpy.types.Panel):
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 @@ class BONE_PT_transform_locks(BoneButtonsPanel, bpy.types.Panel):
@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 @@ class BONE_PT_relations(BoneButtonsPanel, bpy.types.Panel):
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 @@ class BONE_PT_display(BoneButtonsPanel, bpy.types.Panel):
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 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, bpy.types.Panel):
@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")