diff options
author | Campbell Barton <campbell@blender.org> | 2022-02-15 09:06:43 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-02-15 09:21:21 +0300 |
commit | fcac0b6fea79608850a3cf69e81f60c580c585df (patch) | |
tree | 9ec91116d6199486901900ad123f58279ab2151f /release/scripts | |
parent | fa7bd4c06954a9d5e9345000ca1d3f929ce67de1 (diff) |
Fix playing image-sequences with frames containing 9 or more numbers
The path calculation method for animation players: frame-cycler, rv &
mplayer would fail when the number of digits exceeded the range of a
32bit int causing RenderData.frame_path() to raise a ValueError.
Use a simpler method of extracting the range that uses the sign to
detect the beginning of the number.
Diffstat (limited to 'release/scripts')
-rw-r--r-- | release/scripts/startup/bl_operators/screen_play_rendered_anim.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/release/scripts/startup/bl_operators/screen_play_rendered_anim.py b/release/scripts/startup/bl_operators/screen_play_rendered_anim.py index 7ad3cacb395..78efe9c4af0 100644 --- a/release/scripts/startup/bl_operators/screen_play_rendered_anim.py +++ b/release/scripts/startup/bl_operators/screen_play_rendered_anim.py @@ -50,16 +50,19 @@ class PlayRenderedAnim(Operator): # NOTE: make an api call for this would be nice, however this isn't needed in many places. file_a = rd.frame_path(frame=0, **kwargs) + file_b = rd.frame_path(frame=-1, **kwargs) + assert len(file_b) == len(file_a) + 1 - frame_tmp = 9 - file_b = rd.frame_path(frame=frame_tmp, **kwargs) + for number_beg in range(len(file_a)): + if file_a[number_beg] != file_b[number_beg]: + break - while len(file_a) == len(file_b): - frame_tmp = (frame_tmp * 10) + 9 - file_b = rd.frame_path(frame=frame_tmp, **kwargs) - file_b = rd.frame_path(frame=int(frame_tmp / 10), **kwargs) + for number_end in range(-1, -(len(file_a) + 1), -1): + if file_a[number_end] != file_b[number_end]: + break - return ("".join((c if file_b[i] == c else ch) for i, c in enumerate(file_a))) + number_end += len(file_a) + 1 + return file_a[:number_beg] + (ch * (number_end - number_beg)) + file_a[number_end:] def execute(self, context): import os |