diff options
author | Hans Goudey <h.goudey@me.com> | 2020-09-13 01:20:06 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-09-13 01:20:06 +0300 |
commit | d78a5f022db729d5d6890718418971912853d55e (patch) | |
tree | 40cbd0aec002d8caf2f4384fe56a85b66b65fbcc /release/scripts/modules | |
parent | b57cd0e3596d02f2a33a049ea4a9ef1da2c8cdf0 (diff) | |
parent | 1509d2ba7d126a7f02f18b89fd2b2647b515ca42 (diff) |
Merge branch 'master' into property-search-button-label-pointer
Diffstat (limited to 'release/scripts/modules')
-rw-r--r-- | release/scripts/modules/bpy_types.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index bf14d34ed20..1c31eaa39d0 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -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): |