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.
This commit is contained in:
Dalai Felinto 2018-10-12 17:42:06 -03:00
parent 3ffc2a8330
commit 478446e3a4
Notes: blender-bot 2023-02-14 06:00:53 +01:00
Referenced by issue #54650, Multi-Object-Mode: Pose Tools
1 changed files with 33 additions and 66 deletions

View File

@ -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))
return OPERATOR_CANCELLED;
if (ELEM(NULL, ob, scene)) {
continue;
}
/* 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);
/* notifiers for updates */
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
changed_multi = true;
}
MEM_freeN(objects);
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;
}