Fix T70891: Motion Path - Changing endframe clamps startframe to 1

There were two strange things going on:

- Start frame was clamped to 1, even when frame 0 is always a valid number.
  This also ignored the 'Allow Negative Frames' user preference.
- Start frame was only clamped when setting the end frame, so first setting
  the end frame and then the start frame would result in a different result
  than doing it in the opposite order.

This commit fixes both issues by:

- Clamping the lower bound of the start frame only if negative frames are
  not allowed, and
- apply that clamp both when setting the start and the end frame.
This commit is contained in:
Sybren A. Stüvel
2020-01-21 11:52:37 +01:00
parent 5a29356b4d
commit 40d71fc642

View File

@@ -63,6 +63,8 @@ static void rna_AnimViz_path_start_frame_set(PointerRNA *ptr, int value)
/* XXX: watchit! Path Start > MAXFRAME/2 could be a problem... */
data->path_sf = value;
FRAMENUMBER_MIN_CLAMP(data->path_sf);
CLAMP(data->path_ef, data->path_sf + 1, MAXFRAME / 2);
}
@@ -71,7 +73,11 @@ static void rna_AnimViz_path_end_frame_set(PointerRNA *ptr, int value)
bAnimVizSettings *data = (bAnimVizSettings *)ptr->data;
data->path_ef = value;
CLAMP(data->path_sf, 1, data->path_ef - 1);
CLAMP_MAX(data->path_sf, data->path_ef - 1);
if (U.flag & USER_NONEGFRAMES) {
CLAMP_MIN(data->path_sf, 0);
CLAMP_MIN(data->path_ef, 1);
}
}
#else