[Bf-blender-cvs] [647218af07d] blender2.8: Multi-Objects: POSE_OT_constraints_clear

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


Commit: 647218af07dab9d3abd9c3a058701ea36c87930d
Author: Dalai Felinto
Date:   Tue Oct 16 18:41:45 2018 -0300
Branches: blender2.8
https://developer.blender.org/rB647218af07dab9d3abd9c3a058701ea36c87930d

Multi-Objects: POSE_OT_constraints_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 841f59ca191..cfb781fcc28 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -1421,13 +1421,19 @@ void CONSTRAINT_OT_move_up(wmOperatorType *ot)
 static int pose_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op))
 {
 	Main *bmain = CTX_data_main(C);
-	Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
+	Object *prev_ob = NULL;
 
 	/* free constraints for all selected bones */
-	CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones)
+	CTX_DATA_BEGIN_WITH_ID (C, bPoseChannel *, pchan, selected_pose_bones, Object *, ob)
 	{
 		BKE_constraints_free(&pchan->constraints);
 		pchan->constflag &= ~(PCHAN_HAS_IK | PCHAN_HAS_SPLINEIK | PCHAN_HAS_CONST);
+
+		if (prev_ob != ob) {
+			DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
+			WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, ob);
+			prev_ob = ob;
+		}
 	}
 	CTX_DATA_END;
 
@@ -1436,10 +1442,6 @@ static int pose_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op))
 
 	/* note, calling BIK_clear_data() isn't needed here */
 
-	/* do updates */
-	DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
-	WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, ob);
-
 	return OPERATOR_FINISHED;
 }



More information about the Bf-blender-cvs mailing list