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
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
-rw-r--r--release/scripts/startup/bl_ui/properties_animviz.py68
-rw-r--r--release/scripts/startup/bl_ui/space_dopesheet.py4
-rw-r--r--release/scripts/startup/bl_ui/space_graph.py3
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py29
-rw-r--r--source/blender/blenkernel/intern/anim_visualization.c5
-rw-r--r--source/blender/draw/engines/overlay/overlay_motion_path.c4
-rw-r--r--source/blender/editors/animation/anim_motion_paths.c49
-rw-r--r--source/blender/editors/animation/keyframes_keylist.cc48
-rw-r--r--source/blender/editors/armature/pose_edit.c66
-rw-r--r--source/blender/editors/include/ED_anim_api.h9
-rw-r--r--source/blender/editors/include/ED_keyframes_keylist.h8
-rw-r--r--source/blender/editors/object/object_edit.c108
-rw-r--r--source/blender/editors/object/object_intern.h1
-rw-r--r--source/blender/editors/object/object_ops.c1
-rw-r--r--source/blender/editors/space_nla/nla_draw.c2
-rw-r--r--source/blender/makesdna/DNA_action_types.h12
-rw-r--r--source/blender/makesrna/RNA_enum_items.h2
-rw-r--r--source/blender/makesrna/intern/rna_animviz.c43
18 files changed, 164 insertions, 298 deletions
diff --git a/release/scripts/startup/bl_ui/properties_animviz.py b/release/scripts/startup/bl_ui/properties_animviz.py
index 629399084ba..548ce72c429 100644
--- a/release/scripts/startup/bl_ui/properties_animviz.py
+++ b/release/scripts/startup/bl_ui/properties_animviz.py
@@ -24,55 +24,55 @@ class MotionPathButtonsPanel:
layout.use_property_split = True
layout.use_property_decorate = False
- # Display Range
- col = layout.column(align=True)
- col.prop(mps, "type")
- col = layout.column(align=True)
+ row = layout.row(align=True)
+ row.prop(mps, "type")
+ if mps.type == 'RANGE':
+ if bones:
+ row.operator("pose.paths_range_update", text="", icon='TIME')
+ else:
+ row.operator("object.paths_range_update", text="", icon='TIME')
+
if mps.type == 'CURRENT_FRAME':
+ col = layout.column(align=True)
col.prop(mps, "frame_before", text="Frame Range Before")
col.prop(mps, "frame_after", text="After")
- col.prop(mps, "frame_step", text="Step")
-
- # Calculation Range
- col = layout.column(align=True)
- row = col.row(align=True)
- row.prop(mps, "range", text="Calculation Range")
+ col.prop(mps, "frame_step", text="Step")
+ elif mps.type == 'RANGE':
+ col = layout.column(align=True)
+ col.prop(mps, "frame_start", text="Frame Range Start")
+ col.prop(mps, "frame_end", text="End")
+ col.prop(mps, "frame_step", text="Step")
if mpath:
col = layout.column(align=True)
- row = col.row(align=True)
- row.enabled = False
- row.prop(mpath, "frame_start", text="Cached Range")
- row.prop(mpath, "frame_end", text="")
+ col.enabled = False
+ if bones:
+ col.prop(mpath, "frame_start", text="Bone Cache From")
+ else:
+ col.prop(mpath, "frame_start", text="Cache From")
+ col.prop(mpath, "frame_end", text="To")
col = layout.column(align=True)
- row = col.row(align=True)
+
if bones:
- row.operator("pose.paths_update", text="Update Paths", icon='BONE_DATA')
- row.operator("pose.paths_clear", text="", icon='X').only_selected = True
- row = col.row(align=True)
- row.operator("object.paths_update_visible", text="Update All Paths", icon='WORLD')
- row.operator("pose.paths_clear", text="", icon='X').only_selected = False
+ col.operator("pose.paths_update", text="Update Paths", icon='BONE_DATA')
else:
- row.operator("object.paths_update", text="Update Paths", icon='OBJECT_DATA')
- row.operator("object.paths_clear", text="", icon='X').only_selected = True
- row = col.row(align=True)
- row.operator("object.paths_update_visible", text="Update All Paths", icon='WORLD')
- row.operator("object.paths_clear", text="", icon='X').only_selected = False
+ col.operator("object.paths_update", text="Update Paths", icon='OBJECT_DATA')
else:
col = layout.column(align=True)
- col.label(text="No Motion Path generated yet", icon='ERROR')
+ col.label(text="Nothing to show yet...", icon='ERROR')
- # Don't invoke settings popup because settings are right above
- col.operator_context = 'EXEC_REGION_WIN'
if bones:
- col.operator(
- "pose.paths_calculate", text="Generate for selected bones", icon='BONE_DATA')
+ col.operator("pose.paths_calculate", text="Calculate...", icon='BONE_DATA')
else:
- col.operator("object.paths_calculate", text="Generate", icon='OBJECT_DATA')
- row = col.row(align=True)
- row.operator("object.paths_update_visible", text="Update All Paths", icon='WORLD')
- row.operator("object.paths_clear", text="", icon='X').only_selected = False
+ col.operator("object.paths_calculate", text="Calculate...", icon='OBJECT_DATA')
+
+ row = col.row(align=True)
+ row.operator("object.paths_update_visible", text="Update All Paths", icon='WORLD')
+ if bones:
+ row.operator("pose.paths_clear", text="", icon='X')
+ else:
+ row.operator("object.paths_clear", text="", icon='X')
class MotionPathButtonsPanel_display:
diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py
index 7b7fc9dcf77..8e328e7cf2b 100644
--- a/release/scripts/startup/bl_ui/space_dopesheet.py
+++ b/release/scripts/startup/bl_ui/space_dopesheet.py
@@ -663,10 +663,6 @@ class DOPESHEET_MT_context_menu(Menu):
layout.operator_menu_enum("action.mirror", "type", text="Mirror")
layout.operator_menu_enum("action.snap", "type", text="Snap")
- if st.mode == 'DOPESHEET':
- layout.separator()
- layout.menu("VIEW3D_MT_motion_path")
-
class DOPESHEET_MT_channel_context_menu(Menu):
bl_label = "Dope Sheet Channel Context Menu"
diff --git a/release/scripts/startup/bl_ui/space_graph.py b/release/scripts/startup/bl_ui/space_graph.py
index 6bc11d51ca0..6f9ef12c3b7 100644
--- a/release/scripts/startup/bl_ui/space_graph.py
+++ b/release/scripts/startup/bl_ui/space_graph.py
@@ -390,9 +390,6 @@ class GRAPH_MT_context_menu(Menu):
layout.operator_menu_enum("graph.mirror", "type", text="Mirror")
layout.operator_menu_enum("graph.snap", "type", text="Snap")
- layout.separator()
- layout.menu("VIEW3D_MT_motion_path")
-
class GRAPH_MT_pivot_pie(Menu):
bl_label = "Pivot Point"
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 61fbabc5c4e..2208f7f33e7 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -2390,25 +2390,6 @@ class VIEW3D_MT_object_clear(Menu):
layout.operator("object.origin_clear", text="Origin")
-class VIEW3D_MT_motion_path(Menu):
- bl_label = "Motion Paths"
-
- def draw(self, _context):
- layout = self.layout
- ob = _context.object
- if ob.mode == 'OBJECT':
- layout.operator("object.paths_calculate")
- layout.operator("object.paths_update")
- layout.operator("object.paths_update_visible")
- layout.operator("object.paths_clear", text="Clear all").only_selected = False
- layout.operator("object.paths_clear", text="Clear selected").only_selected = True
- elif ob.mode == 'POSE':
- layout.operator("pose.paths_calculate")
- layout.operator("pose.paths_update")
- layout.operator("pose.paths_clear", text="Clear all").only_selected = False
- layout.operator("pose.paths_clear", text="Clear selected").only_selected = True
-
-
class VIEW3D_MT_object_context_menu(Menu):
bl_label = "Object Context Menu"
@@ -2610,7 +2591,6 @@ class VIEW3D_MT_object_context_menu(Menu):
layout.menu("VIEW3D_MT_mirror")
layout.menu("VIEW3D_MT_snap")
layout.menu("VIEW3D_MT_object_parent")
- layout.menu("VIEW3D_MT_motion_path")
layout.operator_context = 'INVOKE_REGION_WIN'
if view and view.local_view:
@@ -3658,10 +3638,10 @@ class VIEW3D_MT_pose_context_menu(Menu):
layout.separator()
- layout.operator("pose.paths_calculate")
- layout.operator("pose.paths_update")
- layout.operator("pose.paths_clear", text="Clear all").only_selected = False
- layout.operator("pose.paths_clear", text="Clear selected").only_selected = True
+ layout.operator("pose.paths_calculate", text="Calculate Motion Paths")
+ layout.operator("pose.paths_clear", text="Clear Motion Paths")
+ layout.operator("pose.paths_update", text="Update Armature Motion Paths")
+ layout.operator("object.paths_update_visible", text="Update All Motion Paths")
layout.separator()
@@ -7657,7 +7637,6 @@ classes = (
VIEW3D_MT_object_quick_effects,
VIEW3D_MT_object_showhide,
VIEW3D_MT_object_cleanup,
- VIEW3D_MT_motion_path,
VIEW3D_MT_make_single_user,
VIEW3D_MT_make_links,
VIEW3D_MT_brush_paint_modes,
diff --git a/source/blender/blenkernel/intern/anim_visualization.c b/source/blender/blenkernel/intern/anim_visualization.c
index f4c6a29c252..53a3a7e3712 100644
--- a/source/blender/blenkernel/intern/anim_visualization.c
+++ b/source/blender/blenkernel/intern/anim_visualization.c
@@ -153,11 +153,6 @@ bMotionPath *animviz_verify_motionpaths(ReportList *reports,
if ((mpath->start_frame != mpath->end_frame) && (mpath->length > 0)) {
/* outer check ensures that we have some curve data for this path */
if (mpath->length == expected_length) {
- /* The length might be the same, but the start and end could be different */
- if (mpath->start_frame != avs->path_sf) {
- mpath->start_frame = avs->path_sf;
- mpath->end_frame = avs->path_ef;
- }
/* return/use this as it is already valid length */
return mpath;
}
diff --git a/source/blender/draw/engines/overlay/overlay_motion_path.c b/source/blender/draw/engines/overlay/overlay_motion_path.c
index aeba721e7ac..58825923f37 100644
--- a/source/blender/draw/engines/overlay/overlay_motion_path.c
+++ b/source/blender/draw/engines/overlay/overlay_motion_path.c
@@ -90,8 +90,8 @@ static void motion_path_get_frame_range_to_draw(bAnimVizSettings *avs,
end = current_frame + avs->path_ac + 1;
}
else {
- start = mpath->start_frame;
- end = mpath->end_frame;
+ start = avs->path_sf;
+ end = avs->path_ef;
}
if (start > end) {
diff --git a/source/blender/editors/animation/anim_motion_paths.c b/source/blender/editors/animation/anim_motion_paths.c
index 2c99cd1cc1f..539227933cf 100644
--- a/source/blender/editors/animation/anim_motion_paths.c
+++ b/source/blender/editors/animation/anim_motion_paths.c
@@ -340,55 +340,6 @@ static void motionpath_free_free_tree_data(ListBase *targets)
}
}
-void animviz_motionpath_compute_range(Object *ob, Scene *scene)
-{
- struct AnimKeylist *keylist = ED_keylist_create();
- bAnimVizSettings *avs;
- if (ob->mode == OB_MODE_POSE) {
- avs = &ob->pose->avs;
- bArmature *arm = ob->data;
-
- if (!ELEM(NULL, ob->adt, ob->adt->action, arm->adt)) {
- /* Loop through all the fcurves and get only the keylists for the bone location fcurves */
- LISTBASE_FOREACH (FCurve *, fcu, &ob->adt->action->curves) {
- if (strstr(fcu->rna_path, "pose.bones[") && strstr(fcu->rna_path, "location")) {
- fcurve_to_keylist(arm->adt, fcu, keylist, 0);
- }
- }
- }
- }
- else {
- avs = &ob->avs;
-
- if (!ELEM(NULL, ob->adt, ob->adt->action)) {
- /* Loop through all the fcurves and get only the keylists for the location fcurves */
- LISTBASE_FOREACH (FCurve *, fcu, &ob->adt->action->curves) {
- if (strcmp(fcu->rna_path, "location") == 0) {
- fcurve_to_keylist(ob->adt, fcu, keylist, 0);
- }
- }
- }
- }
-
- if (ED_keylist_is_empty(keylist) || (avs->path_range == MOTIONPATH_RANGE_SCENE)) {
- /* Apply scene frame range if no keys where found or if scene range is selected */
- avs->path_sf = PSFRA;
- avs->path_ef = PEFRA;
- }
- else {
- /* Compute keys range */
- Range2f frame_range;
- const bool only_selected = avs->path_range == MOTIONPATH_RANGE_KEYS_SELECTED;
- /* Get range for all keys if selected_only is false or if no keys are selected */
- if (!(only_selected && ED_keylist_selected_keys_frame_range(keylist, &frame_range))) {
- ED_keylist_all_keys_frame_range(keylist, &frame_range);
- }
- avs->path_sf = frame_range.min;
- avs->path_ef = frame_range.max;
- }
- ED_keylist_free(keylist);
-}
-
void animviz_calc_motionpaths(Depsgraph *depsgraph,
Main *bmain,
Scene *scene,
diff --git a/source/blender/editors/animation/keyframes_keylist.cc b/source/blender/editors/animation/keyframes_keylist.cc
index 3356ef4d47d..9ee047fafff 100644
--- a/source/blender/editors/animation/keyframes_keylist.cc
+++ b/source/blender/editors/animation/keyframes_keylist.cc
@@ -304,39 +304,7 @@ const struct ListBase *ED_keylist_listbase(const AnimKeylist *keylist)
return &keylist->key_columns;
}
-static void keylist_first_last(const struct AnimKeylist *keylist,
- const struct ActKeyColumn **first_column,
- const struct ActKeyColumn **last_column)
-{
- if (keylist->is_runtime_initialized) {
- *first_column = &keylist->runtime.key_columns[0];
- *last_column = &keylist->runtime.key_columns[keylist->column_len - 1];
- }
- else {
- *first_column = static_cast<const ActKeyColumn *>(keylist->key_columns.first);
- *last_column = static_cast<const ActKeyColumn *>(keylist->key_columns.last);
- }
-}
-
-bool ED_keylist_all_keys_frame_range(const struct AnimKeylist *keylist, Range2f *r_frame_range)
-{
- BLI_assert(r_frame_range);
-
- if (ED_keylist_is_empty(keylist)) {
- return false;
- }
-
- const ActKeyColumn *first_column;
- const ActKeyColumn *last_column;
- keylist_first_last(keylist, &first_column, &last_column);
- r_frame_range->min = first_column->cfra;
- r_frame_range->max = last_column->cfra;
-
- return true;
-}
-
-bool ED_keylist_selected_keys_frame_range(const struct AnimKeylist *keylist,
- Range2f *r_frame_range)
+bool ED_keylist_frame_range(const struct AnimKeylist *keylist, Range2f *r_frame_range)
{
BLI_assert(r_frame_range);
@@ -346,15 +314,13 @@ bool ED_keylist_selected_keys_frame_range(const struct AnimKeylist *keylist,
const ActKeyColumn *first_column;
const ActKeyColumn *last_column;
- keylist_first_last(keylist, &first_column, &last_column);
- while (first_column && !(first_column->sel & SELECT)) {
- first_column = first_column->next;
- }
- while (last_column && !(last_column->sel & SELECT)) {
- last_column = last_column->prev;
+ if (keylist->is_runtime_initialized) {
+ first_column = &keylist->runtime.key_columns[0];
+ last_column = &keylist->runtime.key_columns[keylist->column_len - 1];
}
- if (!first_column || !last_column || first_column == last_column) {
- return false;
+ else {
+ first_column = static_cast<const ActKeyColumn *>(keylist->key_columns.first);
+ last_column = static_cast<const ActKeyColumn *>(keylist->key_columns.last);
}
r_frame_range->min = first_column->cfra;
r_frame_range->max = last_column->cfra;
diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c
index 128126e515e..13abcefa632 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -220,8 +220,8 @@ static int pose_calculate_paths_invoke(bContext *C, wmOperator *op, const wmEven
bAnimVizSettings *avs = &ob->pose->avs;
PointerRNA avs_ptr;
- 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);
RNA_pointer_create(NULL, &RNA_AnimVizMotionPaths, avs, &avs_ptr);
RNA_enum_set(op->ptr, "bake_location", RNA_enum_get(&avs_ptr, "bake_location"));
@@ -229,7 +229,7 @@ static int pose_calculate_paths_invoke(bContext *C, wmOperator *op, const wmEven
/* 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);
}
/* For the object with pose/action: create path curves for selected bones
@@ -249,9 +249,8 @@ static int pose_calculate_paths_exec(bContext *C, wmOperator *op)
bAnimVizSettings *avs = &ob->pose->avs;
PointerRNA avs_ptr;
- avs->path_type = RNA_enum_get(op->ptr, "display_type");
- avs->path_range = RNA_enum_get(op->ptr, "range");
- animviz_motionpath_compute_range(ob, scene);
+ avs->path_sf = RNA_int_get(op->ptr, "start_frame");
+ avs->path_ef = RNA_int_get(op->ptr, "end_frame");
RNA_pointer_create(NULL, &RNA_AnimVizMotionPaths, avs, &avs_ptr);
RNA_enum_set(&avs_ptr, "bake_location", RNA_enum_get(op->ptr, "bake_location"));
@@ -259,6 +258,7 @@ static int pose_calculate_paths_exec(bContext *C, wmOperator *op)
/* set up path data for bones being calculated */
CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones_from_active_object) {
+ /* 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;
@@ -281,19 +281,6 @@ static int pose_calculate_paths_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static bool pose_calculate_paths_poll(bContext *C)
-{
- if (!ED_operator_posemode_exclusive(C)) {
- return false;
- }
- Object *ob = CTX_data_active_object(C);
- bArmature *arm = ob->data;
- if (ELEM(NULL, ob, arm, ob->pose)) {
- return false;
- }
- return true;
-}
-
void POSE_OT_paths_calculate(wmOperatorType *ot)
{
/* identifiers */
@@ -304,24 +291,30 @@ void POSE_OT_paths_calculate(wmOperatorType *ot)
/* api callbacks */
ot->invoke = pose_calculate_paths_invoke;
ot->exec = pose_calculate_paths_exec;
- ot->poll = pose_calculate_paths_poll;
+ ot->poll = ED_operator_posemode_exclusive;
/* flags */
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 bone paths on",
+ MINFRAME,
+ MAXFRAME / 2.0);
+ RNA_def_int(ot->srna,
+ "end_frame",
+ 250,
+ MINAFRAME,
+ MAXFRAME,
+ "End",
+ "Last frame to calculate bone paths on",
+ MINFRAME,
+ MAXFRAME / 2.0);
RNA_def_enum(ot->srna,
"bake_location",
@@ -343,7 +336,7 @@ static bool pose_update_paths_poll(bContext *C)
return false;
}
-static int pose_update_paths_exec(bContext *C, wmOperator *op)
+static int pose_update_paths_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
Scene *scene = CTX_data_scene(C);
@@ -351,13 +344,6 @@ static int pose_update_paths_exec(bContext *C, wmOperator *op)
if (ELEM(NULL, ob, scene)) {
return OPERATOR_CANCELLED;
}
- animviz_motionpath_compute_range(ob, scene);
-
- /* set up path data for bones being calculated */
- CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones_from_active_object) {
- animviz_verify_motionpaths(op->reports, scene, ob, pchan);
- }
- CTX_DATA_END;
/* Calculate the bones that now have motion-paths. */
/* TODO: only make for the selected bones? */
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index 4cae8bdab18..2388704dc4c 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -1097,15 +1097,6 @@ void animviz_calc_motionpaths(struct Depsgraph *depsgraph,
bool restore);
/**
- * Update motion path computation range (in `ob.avs` or `armature.avs`) from user choice in
- * `ob.avs.path_range` or `arm.avs.path_range`, depending on active user mode.
- *
- * \param ob: Object to compute range for (must be provided).
- * \param scene: Used when scene range is chosen.
- */
-void animviz_motionpath_compute_range(struct Object *ob, struct Scene *scene);
-
-/**
* Get list of motion paths to be baked for the given object.
* - assumes the given list is ready to be used.
*/
diff --git a/source/blender/editors/include/ED_keyframes_keylist.h b/source/blender/editors/include/ED_keyframes_keylist.h
index fd3d35e1df7..43bf49ed3a6 100644
--- a/source/blender/editors/include/ED_keyframes_keylist.h
+++ b/source/blender/editors/include/ED_keyframes_keylist.h
@@ -131,13 +131,7 @@ const struct ActKeyColumn *ED_keylist_find_any_between(const struct AnimKeylist
const Range2f frame_range);
bool ED_keylist_is_empty(const struct AnimKeylist *keylist);
const struct ListBase /* ActKeyColumn */ *ED_keylist_listbase(const struct AnimKeylist *keylist);
-bool ED_keylist_all_keys_frame_range(const struct AnimKeylist *keylist, Range2f *r_frame_range);
-/**
- * Return the selected key-frame's range.
- * \return False If none are selected and does not affect the frame range.
- */
-bool ED_keylist_selected_keys_frame_range(const struct AnimKeylist *keylist,
- Range2f *r_frame_range);
+bool ED_keylist_frame_range(const struct AnimKeylist *keylist, Range2f *r_frame_range);
const ActKeyColumn *ED_keylist_array(const struct AnimKeylist *keylist);
int64_t ED_keylist_array_len(const struct AnimKeylist *keylist);
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
* \{ */
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index 135c76140c1..60a49fa6945 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -76,6 +76,7 @@ void OBJECT_OT_shade_flat(struct wmOperatorType *ot);
void OBJECT_OT_paths_calculate(struct wmOperatorType *ot);
void OBJECT_OT_paths_update(struct wmOperatorType *ot);
void OBJECT_OT_paths_clear(struct wmOperatorType *ot);
+void OBJECT_OT_paths_range_update(struct wmOperatorType *ot);
void OBJECT_OT_paths_update_visible(struct wmOperatorType *ot);
void OBJECT_OT_forcefield_toggle(struct wmOperatorType *ot);
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index 45ee4daa441..35f5ede270d 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -45,6 +45,7 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_paths_calculate);
WM_operatortype_append(OBJECT_OT_paths_update);
WM_operatortype_append(OBJECT_OT_paths_clear);
+ WM_operatortype_append(OBJECT_OT_paths_range_update);
WM_operatortype_append(OBJECT_OT_paths_update_visible);
WM_operatortype_append(OBJECT_OT_forcefield_toggle);
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index d8a0fde6d07..eda9f89b51c 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -110,7 +110,7 @@ static void nla_action_draw_keyframes(
*/
Range2f frame_range;
- ED_keylist_all_keys_frame_range(keylist, &frame_range);
+ ED_keylist_frame_range(keylist, &frame_range);
immRectf(pos_id, frame_range.min, ymin + 2, frame_range.max, ymax - 2);
immUnbindProgram();
diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h
index 516d3ce94f9..8a3c1c3dbaf 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -104,14 +104,12 @@ typedef struct bAnimVizSettings {
short path_type;
/** Number of frames between points indicated on the paths. */
short path_step;
- /** #eMotionPath_Ranges. */
- short path_range;
/** #eMotionPaths_ViewFlag. */
short path_viewflag;
/** #eMotionPaths_BakeFlag. */
short path_bakeflag;
- char _pad[4];
+ char _pad[6];
/** Start and end frames of path-calculation range. */
int path_sf, path_ef;
@@ -133,14 +131,6 @@ typedef enum eMotionPaths_Types {
MOTIONPATH_TYPE_ACFRA = 1,
} eMotionPath_Types;
-/* bAnimVizSettings->path_range */
-typedef enum eMotionPath_Ranges {
- /* Default is scene */
- MOTIONPATH_RANGE_SCENE = 0,
- MOTIONPATH_RANGE_KEYS_SELECTED = 1,
- MOTIONPATH_RANGE_KEYS_ALL = 2,
-} eMotionPath_Ranges;
-
/* bAnimVizSettings->path_viewflag */
typedef enum eMotionPaths_ViewFlag {
/* show frames on path */
diff --git a/source/blender/makesrna/RNA_enum_items.h b/source/blender/makesrna/RNA_enum_items.h
index 31db8e39e6f..6e2c898d691 100644
--- a/source/blender/makesrna/RNA_enum_items.h
+++ b/source/blender/makesrna/RNA_enum_items.h
@@ -87,8 +87,6 @@ DEF_ENUM(rna_enum_keying_flag_items_api)
DEF_ENUM(rna_enum_fmodifier_type_items)
DEF_ENUM(rna_enum_motionpath_bake_location_items)
-DEF_ENUM(rna_enum_motionpath_display_type_items)
-DEF_ENUM(rna_enum_motionpath_range_items)
DEF_ENUM(rna_enum_event_value_items)
DEF_ENUM(rna_enum_event_direction_items)
diff --git a/source/blender/makesrna/intern/rna_animviz.c b/source/blender/makesrna/intern/rna_animviz.c
index 0453b327b45..cb993931296 100644
--- a/source/blender/makesrna/intern/rna_animviz.c
+++ b/source/blender/makesrna/intern/rna_animviz.c
@@ -36,27 +36,6 @@ const EnumPropertyItem rna_enum_motionpath_bake_location_items[] = {
{0, NULL, 0, NULL, NULL},
};
-const EnumPropertyItem rna_enum_motionpath_display_type_items[] = {
- {MOTIONPATH_TYPE_ACFRA,
- "CURRENT_FRAME",
- 0,
- "Around Frame",
- "Display Paths of poses within a fixed number of frames around the current frame"},
- {MOTIONPATH_TYPE_RANGE,
- "RANGE",
- 0,
- "In Range",
- "Display Paths of poses within specified range"},
- {0, NULL, 0, NULL, NULL},
-};
-
-const EnumPropertyItem rna_enum_motionpath_range_items[] = {
- {MOTIONPATH_RANGE_KEYS_ALL, "KEYS_ALL", 0, "All keys range", ""},
- {MOTIONPATH_RANGE_KEYS_SELECTED, "KEYS_SELECTED", 0, "Selected keys range", ""},
- {MOTIONPATH_RANGE_SCENE, "SCENE", 0, "Scene frame range", ""},
- {0, NULL, 0, NULL, NULL},
-};
-
#ifdef RNA_RUNTIME
static PointerRNA rna_AnimViz_motion_paths_get(PointerRNA *ptr)
@@ -194,6 +173,20 @@ static void rna_def_animviz_paths(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
+ static const EnumPropertyItem prop_type_items[] = {
+ {MOTIONPATH_TYPE_ACFRA,
+ "CURRENT_FRAME",
+ 0,
+ "Around Frame",
+ "Display Paths of poses within a fixed number of frames around the current frame"},
+ {MOTIONPATH_TYPE_RANGE,
+ "RANGE",
+ 0,
+ "In Range",
+ "Display Paths of poses within specified range"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
srna = RNA_def_struct(brna, "AnimVizMotionPaths", NULL);
RNA_def_struct_sdna(srna, "bAnimVizSettings");
RNA_def_struct_nested(brna, srna, "AnimViz");
@@ -205,16 +198,10 @@ static void rna_def_animviz_paths(BlenderRNA *brna)
/* Enums */
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "path_type");
- RNA_def_property_enum_items(prop, rna_enum_motionpath_display_type_items);
+ RNA_def_property_enum_items(prop, prop_type_items);
RNA_def_property_ui_text(prop, "Paths Type", "Type of range to show for Motion Paths");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW_ANIMVIZ, NULL);
- prop = RNA_def_property(srna, "range", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "path_range");
- RNA_def_property_enum_items(prop, rna_enum_motionpath_range_items);
- RNA_def_property_ui_text(prop, "Paths Range", "Type of range to calculate for Motion Paths");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW_ANIMVIZ, NULL);
-
prop = RNA_def_property(srna, "bake_location", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "path_bakeflag");
RNA_def_property_enum_items(prop, rna_enum_motionpath_bake_location_items);