[Bf-blender-cvs] [374a8b9da50] blender2.8: Multi-Objects: Implement/Fix POSE_OT_select_constraint_target

Dalai Felinto noreply at git.blender.org
Fri Oct 19 14:43:19 CEST 2018


Commit: 374a8b9da50bdc3c40cef9394065d5394bb91f33
Author: Dalai Felinto
Date:   Fri Oct 19 09:38:21 2018 -0300
Branches: blender2.8
https://developer.blender.org/rB374a8b9da50bdc3c40cef9394065d5394bb91f33

Multi-Objects: Implement/Fix POSE_OT_select_constraint_target

This operator had an initial multi-objects implementation.
However it would not select target bones across different selected objects.

===================================================================

M	source/blender/editors/armature/pose_select.c

===================================================================

diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c
index b50c44e6a6b..85b66c9ef46 100644
--- a/source/blender/editors/armature/pose_select.c
+++ b/source/blender/editors/armature/pose_select.c
@@ -504,9 +504,8 @@ static int pose_select_constraint_target_exec(bContext *C, wmOperator *UNUSED(op
 {
 	bConstraint *con;
 	int found = 0;
-	Object *ob_prev = NULL;
 
-	CTX_DATA_BEGIN_WITH_ID (C, bPoseChannel *, pchan, visible_pose_bones, Object *, ob)
+	CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones)
 	{
 		if (pchan->bone->flag & BONE_SELECTED) {
 			for (con = pchan->constraints.first; con; con = con->next) {
@@ -518,16 +517,19 @@ static int pose_select_constraint_target_exec(bContext *C, wmOperator *UNUSED(op
 					cti->get_constraint_targets(con, &targets);
 
 					for (ct = targets.first; ct; ct = ct->next) {
-						if ((ct->tar == ob) && (ct->subtarget[0])) {
+						Object *ob = ct->tar;
+
+						/* Any armature that is also in pose mode should be selected. */
+						if ((ct->subtarget[0] != '\0') &&
+						    (ob != NULL) &&
+						    (ob->type == OB_ARMATURE) &&
+						    (ob->mode == OB_MODE_POSE))
+						{
 							bPoseChannel *pchanc = BKE_pose_channel_find_name(ob->pose, ct->subtarget);
 							if ((pchanc) && !(pchanc->bone->flag & BONE_UNSELECTABLE)) {
 								pchanc->bone->flag |= BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL;
+								ED_pose_bone_select_tag_update(ob);
 								found = 1;
-
-								if (ob != ob_prev) {
-									ED_pose_bone_select_tag_update(ob);
-									ob_prev = ob;
-								}
 							}
 						}
 					}



More information about the Bf-blender-cvs mailing list