Fix T80697: children_recursive returns edit-bones from non edit-bone

Bone.children_recursive would return edit-bones when in edit-mode
irrespective of the type of the bone.

Check the type of self instead of the existence of edit-bones.
This commit is contained in:
Campbell Barton
2020-09-12 11:41:21 +10:00
parent b00820c04d
commit a7dc6647ae

View File

@@ -352,16 +352,15 @@ class _GenericBone:
@property
def _other_bones(self):
id_data = self.id_data
id_data_type = type(id_data)
if id_data_type == bpy_types.Object:
bones = id_data.pose.bones
elif id_data_type == bpy_types.Armature:
bones = id_data.edit_bones
if not bones: # not in edit mode
bones = id_data.bones
return bones
# `id_data` is an 'Object' for `PosePone`, otherwise it's an `Armature`.
if isinstance(self, PoseBone):
return id_data.pose.bones
if isinstance(self, EditBone):
return id_data.edit_bones
if isinstance(self, Bone):
return id_data.bones
raise RuntimeError("Invalid type %r" % self)
class PoseBone(StructRNA, _GenericBone, metaclass=StructMetaPropGroup):