[Bf-blender-cvs] [7baa8d2e8f0] blender2.8: Multi-Objects: POSE_OT_ik_add + POSE_OT_constraint_add_with_targets

Dalai Felinto noreply at git.blender.org
Wed Oct 17 02:10:41 CEST 2018


Commit: 7baa8d2e8f07328fbb187e82f477e56950c25c46
Author: Dalai Felinto
Date:   Tue Oct 16 20:34:02 2018 -0300
Branches: blender2.8
https://developer.blender.org/rB7baa8d2e8f07328fbb187e82f477e56950c25c46

Multi-Objects: POSE_OT_ik_add + POSE_OT_constraint_add_with_targets

You can now add the target from the non-active armature when they are
both in pose mode.

There were different ways of going about those operators:

* We could create one constraint on each active bone of each object.
  That wouldn't follow what creating constraints from the UI does
  though.

* We could change the selection/active order and create a constraint for
  all the selected bones, to the active bone. However this would change
  the design of changing only the active bone (which also is the one we
  see in the buttons editor).

But in the end I think it makes more sense to let users set a constraint
from a charactor to a prop in a handy way.

This is pretty much what we had in 2.7x. There we would go for the
selected objects, if no selected bone was found in the active object.
In 2.8, however, we need this change to make things working as
before/intended.

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

M	source/blender/editors/object/object_constraint.c

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

diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 0956bd4bf36..982e588b414 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -1639,8 +1639,12 @@ static bool get_new_constraint_target(bContext *C, int con_type, Object **tar_ob
 	/* if the active Object is Armature, and we can search for bones, do so... */
 	if ((obact->type == OB_ARMATURE) && (only_ob == false)) {
 		/* search in list of selected Pose-Channels for target */
-		CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones)
+		CTX_DATA_BEGIN_WITH_ID (C, bPoseChannel *, pchan, selected_pose_bones, Object *, ob)
 		{
+			if (ob != obact) {
+				continue;
+			}
+
 			/* just use the first one that we encounter, as long as it is not the active one */
 			if (pchan != pchanact) {
 				*tar_ob = obact;



More information about the Bf-blender-cvs mailing list