[Bf-blender-cvs] [f3153f1c7f5] blender2.8: Multi-Objects: POSE_OT_ik_clear

Dalai Felinto noreply at git.blender.org
Wed Oct 17 00:43:27 CEST 2018


Commit: f3153f1c7f57c054ecc7d0f986c6afc1d70ffb7d
Author: Dalai Felinto
Date:   Tue Oct 16 18:30:27 2018 -0300
Branches: blender2.8
https://developer.blender.org/rBf3153f1c7f57c054ecc7d0f986c6afc1d70ffb7d

Multi-Objects: POSE_OT_ik_clear

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

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 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;
 }



More information about the Bf-blender-cvs mailing list