diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-01-21 13:52:37 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-01-21 13:53:12 +0300 |
commit | 40d71fc6428c462ca4d5eb35206baf334072497c (patch) | |
tree | a88366887b45f7e35b9d018336747b7c3560ea87 /source/blender/makesrna/intern/rna_animviz.c | |
parent | 5a29356b4d6b512bcb7faee85b0fe360437ac227 (diff) |
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.
Diffstat (limited to 'source/blender/makesrna/intern/rna_animviz.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_animviz.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_animviz.c b/source/blender/makesrna/intern/rna_animviz.c index f539da488ce..61a1f1ffcd5 100644 --- a/source/blender/makesrna/intern/rna_animviz.c +++ b/source/blender/makesrna/intern/rna_animviz.c @@ -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 |