add PoseBone.children convenience attribute.
authorCampbell Barton <ideasman42@gmail.com>
Sat, 28 Sep 2013 12:05:59 +0000 (12:05 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 28 Sep 2013 12:05:59 +0000 (12:05 +0000)
release/scripts/modules/bpy_types.py

index 819d3e112ff5cb27205c0e571eee3e4b89b39d1a..f7af297a0e0a0021f2be0e648d6052c7ae17202e 100644 (file)
@@ -306,6 +306,15 @@ class _GenericBone:
 class PoseBone(StructRNA, _GenericBone, metaclass=StructMetaPropGroup):
     __slots__ = ()
 
+    @property
+    def children(self):
+        obj = self.id_data
+        pbones = obj.pose.bones
+        self_bone = self.bone
+
+        return tuple(pbones[bone.name] for bone in obj.data.bones
+                     if bone.parent == self_bone)
+
 
 class Bone(StructRNA, _GenericBone, metaclass=StructMetaPropGroup):
     __slots__ = ()