summaryrefslogtreecommitdiff
path: root/rpc
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-08-21 15:01:54 +0200
committerJules Laplace <julescarbon@gmail.com>2018-08-21 15:01:54 +0200
commit1599de57b53c78ac05965fe7038f3a8d67c1a3c0 (patch)
tree0e7bd8af877d627df30ff76c075859711c903a45 /rpc
parent3f35f35cc83aef3d710eaaff6395b5dc8561c2f0 (diff)
skip frames
Diffstat (limited to 'rpc')
-rw-r--r--rpc/img_ops.py44
1 files changed, 31 insertions, 13 deletions
diff --git a/rpc/img_ops.py b/rpc/img_ops.py
index bbe1856..6be1d0b 100644
--- a/rpc/img_ops.py
+++ b/rpc/img_ops.py
@@ -67,7 +67,7 @@ def process_image(opt, data_opt, im):
return img
last_im = None
-def mix_next_image(opt, data_opt, rpc_client, im, i, sequence, sequence_i):
+def mix_next_image(opt, data_opt, rpc_client, im, i=0, sequence, sequence_i=0, skip_i=0):
global last_im
if (i % 100) == 0:
@@ -77,17 +77,35 @@ def mix_next_image(opt, data_opt, rpc_client, im, i, sequence, sequence_i):
tmp_path = opt.render_dir + "frame_{:05d}_tmp.png".format(i+1)
next_path = opt.render_dir + "frame_{:05d}.png".format(i+1)
current_path = opt.render_dir + "ren_{:05d}.png".format(i+1)
- meta = { 'i': i, 'sequence_i': math.floor(sequence_i), 'sequence_len': len(sequence) }
- if data_opt.sequence and len(sequence):
- sequence_path = sequence[math.floor(sequence_i)]
- if data_opt.sequence_playing and data_opt.sequence_step != 0:
- sequence_i += data_opt.sequence_step
- if sequence_i >= len(sequence):
- print('(((( sequence looped ))))')
- sequence_i = sequence_i % len(sequence)
- if sequence_i < 0:
- print('(((( sequence looped ))))')
- sequence_i += len(sequence)
+
+ # skip a certain number of frames
+ if data_opt.sequence_skip == 0:
+ skip_i = 0
+ else:
+ skip_i += 1
+ if skip_i >= data_opt.sequence_skip:
+ skip_i = 0
+ sequence_i += data_opt.sequence_step * (data_opt.sequence_skip - 1)
+
+ # get the sequence path for the current frame
+ sequence_path = sequence[math.floor(sequence_i)]
+
+ if skip_i == 0 and data_opt.sequence_playing and data_opt.sequence_step != 0:
+ sequence_i += data_opt.sequence_step
+
+ if sequence_i >= len(sequence):
+ print('(((( sequence looped ))))')
+ sequence_i = sequence_i % len(sequence)
+ if sequence_i < 0:
+ print('(((( sequence looped ))))')
+ sequence_i += len(sequence)
+
+ meta = {
+ 'i': i,
+ 'sequence_i': math.floor(sequence_i),
+ 'skip_i': math.floor(skip_i),
+ 'sequence_len': len(sequence)
+ }
if data_opt.store_a is not True:
os.remove(last_path)
@@ -172,4 +190,4 @@ def mix_next_image(opt, data_opt, rpc_client, im, i, sequence, sequence_i):
if (i % 20) == 0:
print("created {}".format(next_path))
- return sequence_i \ No newline at end of file
+ return sequence_i, skip_i \ No newline at end of file