diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-10-17 00:30:27 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-10-17 00:30:27 +0300 |
commit | f3153f1c7f57c054ecc7d0f986c6afc1d70ffb7d (patch) | |
tree | d17971d21a5fc1fc96b981fae4a7627d060e7e13 /source/blender | |
parent | 540f37003c012df4d17fdece6d278211ca989e9b (diff) |
Multi-Objects: POSE_OT_ik_clear
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/object/object_constraint.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index fdb267c796e..841f59ca191 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -2059,10 +2059,10 @@ void POSE_OT_ik_add(wmOperatorType *ot) /* remove IK constraints from selected bones */ static int pose_ik_clear_exec(bContext *C, wmOperator *UNUSED(op)) { - Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); + Object *prev_ob = NULL; /* only remove IK Constraints */ - CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) + CTX_DATA_BEGIN_WITH_ID (C, bPoseChannel *, pchan, selected_pose_bones, Object *, ob) { bConstraint *con, *next; @@ -2074,14 +2074,18 @@ static int pose_ik_clear_exec(bContext *C, wmOperator *UNUSED(op)) } } pchan->constflag &= ~(PCHAN_HAS_IK | PCHAN_HAS_TARGET); - } - CTX_DATA_END; - /* refresh depsgraph */ - DEG_id_tag_update(&ob->id, OB_RECALC_DATA); + if (prev_ob != ob) { + prev_ob = ob; - /* note, notifier might evolve */ - WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, ob); + /* Refresh depsgraph. */ + DEG_id_tag_update(&ob->id, OB_RECALC_DATA); + + /* Note, notifier might evolve. */ + WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, ob); + } + } + CTX_DATA_END; return OPERATOR_FINISHED; } |