Fix T42255: "Copy Constraints" operator has to tag the affected object
authorLukas Tönne <lukas.toenne@gmail.com>
Wed, 5 Nov 2014 13:51:02 +0000 (14:51 +0100)
committerLukas Tönne <lukas.toenne@gmail.com>
Wed, 5 Nov 2014 13:53:17 +0000 (14:53 +0100)
and pose for depsgraph.

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

source/blender/editors/object/object_constraint.c

index 7c11b3e9879c672b473ad825613e94c70beb1a18..80d63ccb4466a4c7f24054975db94751a24617fc 100644 (file)
@@ -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);