[Bf-blender-cvs] [3361be9] master: Fix T42255: "Copy Constraints" operator has to tag the affected object and pose for depsgraph.

Lukas Tönne noreply at git.blender.org
Wed Nov 5 14:53:25 CET 2014


Commit: 3361be9b6b00ff26977eef4f52172be65ec32032
Author: Lukas Tönne
Date:   Wed Nov 5 14:51:02 2014 +0100
Branches: master
https://developer.blender.org/rB3361be9b6b00ff26977eef4f52172be65ec32032

Fix T42255: "Copy Constraints" operator has to tag the affected object
and pose for depsgraph.

Otherwise the update order can be incorrect until the next sort is
executed.

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

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 7c11b3e..80d63cc 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -1399,6 +1399,8 @@ static int pose_constraint_copy_exec(bContext *C, wmOperator *op)
 {
 	Main *bmain = CTX_data_main(C);
 	bPoseChannel *pchan = CTX_data_active_pose_bone(C);
+	ListBase lb;
+	CollectionPointerLink *link;
 	
 	/* don't do anything if bone doesn't exist or doesn't have any constraints */
 	if (ELEM(NULL, pchan, pchan->constraints.first)) {
@@ -1407,16 +1409,22 @@ static int pose_constraint_copy_exec(bContext *C, wmOperator *op)
 	}
 	
 	/* copy all constraints from active posebone to all selected posebones */
-	CTX_DATA_BEGIN (C, bPoseChannel *, chan, selected_pose_bones)
-	{
+	CTX_data_selected_pose_bones(C, &lb);
+	for (link = lb.first; link; link = link->next) {
+		Object *ob = link->ptr.id.data;
+		bPoseChannel *chan = link->ptr.data;
+		
 		/* if we're not handling the object we're copying from, copy all constraints over */
 		if (pchan != chan) {
 			BKE_constraints_copy(&chan->constraints, &pchan->constraints, true);
 			/* update flags (need to add here, not just copy) */
 			chan->constflag |= pchan->constflag;
+			
+			ob->pose->flag |= POSE_RECALC;
+			DAG_id_tag_update((ID *)ob, OB_RECALC_DATA);
 		}
 	}
-	CTX_DATA_END;
+	BLI_freelistN(&lb);
 	
 	/* force depsgraph to get recalculated since new relationships added */
 	DAG_relations_tag_update(bmain);




More information about the Bf-blender-cvs mailing list