diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-04-03 16:20:44 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-04-03 16:20:44 +0400 |
commit | 9776176cc91e30810bbfd02f78a7c3a3b677d1fb (patch) | |
tree | 4b8105ee367aa578bfeaeaa47c028f0c2bd20145 /source/blender/editors/armature | |
parent | 012fe4646c07e50fcfec23c838249106f01da66d (diff) |
fix [#30340] bpy.ops.pose.select_hierarchy() doesn't work on disconnected parents/children
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r-- | source/blender/editors/armature/poseobject.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 6768c884868..9d84b236aad 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -407,8 +407,30 @@ static int pose_select_hierarchy_exec(bContext *C, wmOperator *op) } } else { /* direction == BONE_SELECT_CHILD */ + + /* the child member is only assigned to connected bones, see [#30340] */ +#if 0 if (pchan->child == NULL) continue; else chbone = pchan->child->bone; +#else + /* instead. find _any_ visible child bone, using the first one is a little arbitrary - campbell */ + chbone = pchan->child ? pchan->child->bone : NULL; + if (chbone == NULL) { + bPoseChannel *pchan_child; + + for (pchan_child = ob->pose->chanbase.first; pchan_child; pchan_child = pchan_child->next) { + /* possible we have multiple children, some invisible */ + if (PBONE_VISIBLE(arm, pchan_child->bone)) { + if (pchan_child->parent == pchan) { + chbone = pchan_child->bone; + break; + } + } + } + } + + if (chbone == NULL) continue; +#endif if (PBONE_VISIBLE(arm, chbone)) { if (!add_to_sel) curbone->flag &= ~BONE_SELECTED; |