[Bf-blender-cvs] [478446e3a45] blender2.8: Revert "Multi-Objects: POSE_OT_paths_*"

Dalai Felinto noreply at git.blender.org
Fri Oct 12 22:44:45 CEST 2018


Commit: 478446e3a45c5eff7aed238b92e5d3d7cf671c7a
Author: Dalai Felinto
Date:   Fri Oct 12 17:42:06 2018 -0300
Branches: blender2.8
https://developer.blender.org/rB478446e3a45c5eff7aed238b92e5d3d7cf671c7a

Revert "Multi-Objects: POSE_OT_paths_*"

This reverts commit 178530cc50e2fb4bd3faf4fff22392a58688bed1.

Those operators are called from the UI, which only takes into
consideration the active object for the parameters and whether to call
reset, update or calculate.

We can re-revert if needs be.

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

M	source/blender/editors/armature/pose_edit.c

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

diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c
index 961bc4d9175..46e417f6452 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -279,18 +279,14 @@ static int pose_calculate_paths_invoke(bContext *C, wmOperator *op, const wmEven
  */
 static int pose_calculate_paths_exec(bContext *C, wmOperator *op)
 {
-	ViewLayer *view_layer = CTX_data_view_layer(C);
+	Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
 	Scene *scene = CTX_data_scene(C);
 
-	uint objects_len = 0;
-	Object **objects = BKE_view_layer_array_from_objects_in_mode_unique_data(view_layer, &objects_len, OB_MODE_POSE);
-	for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
-		Object *ob = BKE_object_pose_armature_get(objects[ob_index]);
-
-		if (ELEM(NULL, ob, ob->pose)) {
-			continue;
-		}
+	if (ELEM(NULL, ob, ob->pose))
+		return OPERATOR_CANCELLED;
 
+	/* grab baking settings from operator settings */
+	{
 		bAnimVizSettings *avs = &ob->pose->avs;
 		PointerRNA avs_ptr;
 
@@ -301,40 +297,29 @@ static int pose_calculate_paths_exec(bContext *C, wmOperator *op)
 		RNA_enum_set(&avs_ptr, "bake_location", RNA_enum_get(op->ptr, "bake_location"));
 	}
 
-	/* Set up path data for bones being calculated. */
-	CTX_DATA_BEGIN_WITH_ID (C, bPoseChannel *, pchan, selected_pose_bones, Object *, ob)
+	/* set up path data for bones being calculated */
+	CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones)
 	{
-		/* Verify makes sure that the selected bone has a bone with the appropriate settings. */
+		/* verify makes sure that the selected bone has a bone with the appropriate settings */
 		animviz_verify_motionpaths(op->reports, scene, ob, pchan);
 	}
 	CTX_DATA_END;
 
-
-	for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
-		Object *ob = BKE_object_pose_armature_get(objects[ob_index]);
-
-		if (ELEM(NULL, ob, ob->pose)) {
-			continue;
-		}
-
 #ifdef DEBUG_TIME
-		TIMEIT_START(recalc_pose_paths);
+	TIMEIT_START(recalc_pose_paths);
 #endif
 
-		/* Calculate the bones that now have motionpaths... */
-		/* TODO: only make for the selected bones? */
-		ED_pose_recalculate_paths(C, scene, ob, false);
+	/* calculate the bones that now have motionpaths... */
+	/* TODO: only make for the selected bones? */
+	ED_pose_recalculate_paths(C, scene, ob, false);
 
 #ifdef DEBUG_TIME
-		TIMEIT_END(recalc_pose_paths);
+	TIMEIT_END(recalc_pose_paths);
 #endif
 
-		/* Notifiers for updates. */
-		WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
-
-	}
+	/* notifiers for updates */
+	WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
 
-	MEM_freeN(objects);
 	return OPERATOR_FINISHED;
 }
 
@@ -379,31 +364,20 @@ static bool pose_update_paths_poll(bContext *C)
 
 static int pose_update_paths_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	ViewLayer *view_layer = CTX_data_view_layer(C);
+	Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
 	Scene *scene = CTX_data_scene(C);
-	bool changed_multi = false;
-
-	uint objects_len = 0;
-	Object **objects = BKE_view_layer_array_from_objects_in_mode_unique_data(view_layer, &objects_len, OB_MODE_POSE);
-	for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
-		Object *ob = BKE_object_pose_armature_get(objects[ob_index]);
 
-		if (ELEM(NULL, ob, scene)) {
-			continue;
-		}
+	if (ELEM(NULL, ob, scene))
+		return OPERATOR_CANCELLED;
 
-		/* Calculate the bones that now have motionpaths... */
-		/* TODO: only make for the selected bones? */
-		ED_pose_recalculate_paths(C, scene, ob, false);
+	/* calculate the bones that now have motionpaths... */
+	/* TODO: only make for the selected bones? */
+	ED_pose_recalculate_paths(C, scene, ob, false);
 
-		/* notifiers for updates */
-		WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
-
-		changed_multi = true;
-	}
-	MEM_freeN(objects);
+	/* notifiers for updates */
+	WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
 
-	return changed_multi ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
+	return OPERATOR_FINISHED;
 }
 
 void POSE_OT_paths_update(wmOperatorType *ot)
@@ -456,26 +430,19 @@ static void ED_pose_clear_paths(Object *ob, bool only_selected)
 /* operator callback - wrapper for the backend function  */
 static int pose_clear_paths_exec(bContext *C, wmOperator *op)
 {
-	ViewLayer *view_layer = CTX_data_view_layer(C);
-	const bool only_selected = RNA_boolean_get(op->ptr, "only_selected");
+	Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
+	bool only_selected = RNA_boolean_get(op->ptr, "only_selected");
 
-	uint objects_len = 0;
-	Object **objects = BKE_view_layer_array_from_objects_in_mode_unique_data(view_layer, &objects_len, OB_MODE_POSE);
-	for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
-		Object *ob = BKE_object_pose_armature_get(objects[ob_index]);
+	/* only continue if there's an object */
+	if (ELEM(NULL, ob, ob->pose))
+		return OPERATOR_CANCELLED;
 
-		/* Only continue if there's an object. */
-		if (ELEM(NULL, ob, ob->pose)) {
-			continue;
-		}
+	/* use the backend function for this */
+	ED_pose_clear_paths(ob, only_selected);
 
-		/* Use the backend function for this. */
-		ED_pose_clear_paths(ob, only_selected);
+	/* notifiers for updates */
+	WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
 
-		/* Notifiers for updates. */
-		WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
-	}
-	MEM_freeN(objects);
 	return OPERATOR_FINISHED;
 }



More information about the Bf-blender-cvs mailing list