Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2018-10-17 01:20:01 +0300
committerDalai Felinto <dfelinto@gmail.com>2018-10-17 01:20:01 +0300
commit418c16bd3b799a95f9dc4d458213c60fba42626c (patch)
tree53f489730666f4b3a0dca59ef2b9afebe854e15a /source/blender
parent647218af07dab9d3abd9c3a058701ea36c87930d (diff)
Multi-Objects: POSE_OT_constraints_copy (refactor)
This was already supporting multiple objects, but I changed it to use the API we are using elsewhere.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/object/object_constraint.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index cfb781fcc28..0956bd4bf36 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -1497,8 +1497,6 @@ 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)) {
@@ -1506,23 +1504,25 @@ static int pose_constraint_copy_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- /* copy all constraints from active posebone to all selected posebones */
- 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;
+ Object *prev_ob = NULL;
+ /* copy all constraints from active posebone to all selected posebones */
+ CTX_DATA_BEGIN_WITH_ID(C, bPoseChannel *, chan, selected_pose_bones, Object *, ob)
+ {
/* 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;
- BKE_pose_tag_recalc(bmain, ob->pose);
- DEG_id_tag_update((ID *)ob, OB_RECALC_DATA);
+ if (prev_ob != ob) {
+ BKE_pose_tag_recalc(bmain, ob->pose);
+ DEG_id_tag_update((ID *)ob, OB_RECALC_DATA);
+ prev_ob = ob;
+ }
}
}
- BLI_freelistN(&lb);
+ CTX_DATA_END;
/* force depsgraph to get recalculated since new relationships added */
DEG_relations_tag_update(bmain);