Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@blender.org>2022-03-14 13:15:09 +0300
committerSybren A. Stüvel <sybren@blender.org>2022-03-14 13:17:45 +0300
commit7306417ae46a2cf2733849cd52e1bfb74af40f08 (patch)
tree0fb5e4289045b708b074a408c4fd7ca3c36e035e /source/blender/editors/object/object_edit.c
parent4045b3d7b685aeeb6003d3f90b4a41f6337b6159 (diff)
Revert "Animation: Sensible frame range for motion paths"
This reverts commit 1558b270e9fcbc2e23fa248b0e7e770dddae155c. An earlier commit (rB101fadcf6b93c) introduced some new functionality, which was overlooked in reviewing this commit & got broken. Will re-commit after the issue has been fixed. Ref: D13687
Diffstat (limited to 'source/blender/editors/object/object_edit.c')
-rw-r--r--source/blender/editors/object/object_edit.c108
1 files changed, 71 insertions, 37 deletions
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 0f47a692787..b25df4bab26 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -21,7 +21,6 @@
#include "BLT_translation.h"
-#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
#include "DNA_collection_types.h"
#include "DNA_curve_types.h"
@@ -74,7 +73,6 @@
#include "ED_curve.h"
#include "ED_gpencil.h"
#include "ED_image.h"
-#include "ED_keyframes_keylist.h"
#include "ED_lattice.h"
#include "ED_mball.h"
#include "ED_mesh.h"
@@ -1208,32 +1206,30 @@ static int object_calculate_paths_invoke(bContext *C, wmOperator *op, const wmEv
/* set default settings from existing/stored settings */
{
bAnimVizSettings *avs = &ob->avs;
- RNA_enum_set(op->ptr, "display_type", avs->path_type);
- RNA_enum_set(op->ptr, "range", avs->path_range);
+
+ RNA_int_set(op->ptr, "start_frame", avs->path_sf);
+ RNA_int_set(op->ptr, "end_frame", avs->path_ef);
}
/* show popup dialog to allow editing of range... */
/* FIXME: hard-coded dimensions here are just arbitrary. */
- return WM_operator_props_dialog_popup(C, op, 270);
+ return WM_operator_props_dialog_popup(C, op, 200);
}
/* Calculate/recalculate whole paths (avs.path_sf to avs.path_ef) */
static int object_calculate_paths_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
- short path_type = RNA_enum_get(op->ptr, "display_type");
- short path_range = RNA_enum_get(op->ptr, "range");
+ int start = RNA_int_get(op->ptr, "start_frame");
+ int end = RNA_int_get(op->ptr, "end_frame");
- /* set up path data for objects being calculated */
+ /* set up path data for bones being calculated */
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
- /* When operator is not invoked, dismiss the operator settings */
- if (op->flag & OP_IS_INVOKE) {
- bAnimVizSettings *avs = &ob->avs;
- /* grab baking settings from operator settings */
- avs->path_type = path_type;
- avs->path_range = path_range;
- }
- animviz_motionpath_compute_range(ob, scene);
+ bAnimVizSettings *avs = &ob->avs;
+
+ /* grab baking settings from operator settings */
+ avs->path_sf = start;
+ avs->path_ef = end;
/* verify that the selected object has the appropriate settings */
animviz_verify_motionpaths(op->reports, scene, ob, NULL);
@@ -1252,9 +1248,9 @@ static int object_calculate_paths_exec(bContext *C, wmOperator *op)
void OBJECT_OT_paths_calculate(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Calculate Object Motion Paths";
+ ot->name = "Calculate Object Paths";
ot->idname = "OBJECT_OT_paths_calculate";
- ot->description = "Generate motion paths for the selected objects";
+ ot->description = "Calculate motion paths for the selected objects";
/* api callbacks */
ot->invoke = object_calculate_paths_invoke;
@@ -1265,18 +1261,24 @@ void OBJECT_OT_paths_calculate(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- RNA_def_enum(ot->srna,
- "display_type",
- rna_enum_motionpath_display_type_items,
- MOTIONPATH_TYPE_RANGE,
- "Display type",
- "");
- RNA_def_enum(ot->srna,
- "range",
- rna_enum_motionpath_range_items,
- MOTIONPATH_RANGE_SCENE,
- "Computation Range",
- "");
+ RNA_def_int(ot->srna,
+ "start_frame",
+ 1,
+ MINAFRAME,
+ MAXFRAME,
+ "Start",
+ "First frame to calculate object paths on",
+ MINFRAME,
+ MAXFRAME / 2.0);
+ RNA_def_int(ot->srna,
+ "end_frame",
+ 250,
+ MINAFRAME,
+ MAXFRAME,
+ "End",
+ "Last frame to calculate object paths on",
+ MINFRAME,
+ MAXFRAME / 2.0);
}
/** \} */
@@ -1295,19 +1297,13 @@ static bool object_update_paths_poll(bContext *C)
return false;
}
-static int object_update_paths_exec(bContext *C, wmOperator *op)
+static int object_update_paths_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
if (scene == NULL) {
return OPERATOR_CANCELLED;
}
- CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
- animviz_motionpath_compute_range(ob, scene);
- /* verify that the selected object has the appropriate settings */
- animviz_verify_motionpaths(op->reports, scene, ob, NULL);
- }
- CTX_DATA_END;
/* calculate the paths for objects that have them (and are tagged to get refreshed) */
ED_objects_recalculate_paths_selected(C, scene, OBJECT_PATH_CALC_RANGE_FULL);
@@ -1458,6 +1454,44 @@ void OBJECT_OT_paths_clear(wmOperatorType *ot)
/** \} */
/* -------------------------------------------------------------------- */
+/** \name Update Motion Paths Range from Scene Operator
+ * \{ */
+
+static int object_update_paths_range_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ Scene *scene = CTX_data_scene(C);
+
+ /* Loop over all editable objects in scene. */
+ CTX_DATA_BEGIN (C, Object *, ob, editable_objects) {
+ /* use Preview Range or Full Frame Range - whichever is in use */
+ ob->avs.path_sf = PSFRA;
+ ob->avs.path_ef = PEFRA;
+
+ /* tag for updates */
+ DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE);
+ WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
+ }
+ CTX_DATA_END;
+
+ return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_paths_range_update(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Update Range from Scene";
+ ot->idname = "OBJECT_OT_paths_range_update";
+ ot->description = "Update frame range for motion paths from the Scene's current frame range";
+
+ /* callbacks */
+ ot->exec = object_update_paths_range_exec;
+ ot->poll = ED_operator_object_active_editable;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+/* -------------------------------------------------------------------- */
/** \name Object Shade Smooth/Flat Operator
* \{ */