Fix T101522: Animation: motion path range overwritten by 'Update Paths'

Expand the motion path frame range options with an extra option "Manual
Range". When chosen, Blender will not automatically update the path
range any more.

Additionally, the start/end frame fields are greyed out in the UI when
one of the automatic range options is selected (i.e. all but the new
"Manual Range" one). It is still possible to set the start/end frame
temporarily, but the original behaviour (of recomputing those on update)
remains.

Manifest Task: T101522
This commit is contained in:
Sybren A. Stüvel 2022-12-12 17:36:36 +01:00
parent 014ffc4615
commit d72c7eefd1
Notes: blender-bot 2023-02-14 11:28:39 +01:00
Referenced by issue #103239, Motion paths panel in the properties editor greyed out frame range edit boxes
Referenced by issue #101522, Motion Paths: 'Update Paths' inconveniently restores frame range
4 changed files with 14 additions and 2 deletions

View File

@ -32,8 +32,10 @@ class MotionPathButtonsPanel:
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")
start_end_group = col.column(align=True)
start_end_group.active = mps.range == 'MANUAL'
start_end_group.prop(mps, "frame_start", text="Frame Range Start")
start_end_group.prop(mps, "frame_end", text="End")
col.prop(mps, "frame_step", text="Step")
# Calculation Range

View File

@ -344,9 +344,16 @@ void animviz_motionpath_compute_range(Object *ob, Scene *scene)
{
bAnimVizSettings *avs = ob->mode == OB_MODE_POSE ? &ob->pose->avs : &ob->avs;
if (avs->path_range == MOTIONPATH_RANGE_MANUAL) {
/* Don't touch manually-determined ranges. */
return;
}
const bool has_action = ob->adt && ob->adt->action;
if (avs->path_range == MOTIONPATH_RANGE_SCENE || !has_action ||
BLI_listbase_is_empty(&ob->adt->action->curves)) {
/* Default to the scene (preview) range if there is no animation data to
* find selected keys in. */
avs->path_sf = PSFRA;
avs->path_ef = PEFRA;
return;
@ -367,6 +374,7 @@ void animviz_motionpath_compute_range(Object *ob, Scene *scene)
case MOTIONPATH_RANGE_KEYS_ALL:
ED_keylist_all_keys_frame_range(keylist, &frame_range);
break;
case MOTIONPATH_RANGE_MANUAL:
case MOTIONPATH_RANGE_SCENE:
BLI_assert_msg(false, "This should not happen, function should have exited earlier.");
};

View File

@ -139,6 +139,7 @@ typedef enum eMotionPath_Ranges {
MOTIONPATH_RANGE_SCENE = 0,
MOTIONPATH_RANGE_KEYS_SELECTED = 1,
MOTIONPATH_RANGE_KEYS_ALL = 2,
MOTIONPATH_RANGE_MANUAL = 3,
} eMotionPath_Ranges;
/* bAnimVizSettings->path_viewflag */

View File

@ -58,6 +58,7 @@ const EnumPropertyItem rna_enum_motionpath_range_items[] = {
"Selected Keys",
"From the first selected keyframe to the last"},
{MOTIONPATH_RANGE_SCENE, "SCENE", 0, "Scene Frame Range", "The entire Scene / Preview range"},
{MOTIONPATH_RANGE_MANUAL, "MANUAL", 0, "Manual Range", "Manually determined frame range"},
{0, NULL, 0, NULL, NULL},
};