diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-07-18 11:45:56 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-07-18 12:12:09 +0300 |
commit | c6c9e168e272a0fe31b9a6f8704adb067fb9f88f (patch) | |
tree | a34bc4047ed2de935b58616f305c60ffaa152a27 /source/blender/editors/object/object_constraint.c | |
parent | 20c725ed62f86aebf555221731c8e7b7dbd05120 (diff) |
Fix T58447: Unselected bone used for constraint target
Diffstat (limited to 'source/blender/editors/object/object_constraint.c')
-rw-r--r-- | source/blender/editors/object/object_constraint.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 9c23daab923..5ef133e87de 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -34,6 +34,7 @@ #include "BLT_translation.h" #include "DNA_anim_types.h" +#include "DNA_armature_types.h" #include "DNA_constraint_types.h" #include "DNA_curve_types.h" #include "DNA_scene_types.h" @@ -1815,10 +1816,15 @@ static bool get_new_constraint_target( */ if ((ob->type == OB_ARMATURE) && (ob->mode & OB_MODE_POSE) && (!only_curve && !only_mesh)) { - /* just use the active bone, and assume that it is visible + usable */ - *tar_ob = ob; - *tar_pchan = BKE_pose_channel_active(ob); - found = true; + + /* Only use the object & bone if the bone is visible & selected + * since we may have multiple objects in pose mode at once. */ + bPoseChannel *pchan = BKE_pose_channel_active_or_first_selected(ob); + if (pchan != NULL) { + *tar_pchan = pchan; + *tar_ob = ob; + found = true; + } break; } |