Jakub's comment

This commit is contained in:
Kayla Man 2023-07-05 21:06:31 +08:00
parent dab513f01c
commit be10dc7349
2 changed files with 30 additions and 6 deletions

View file

@ -120,7 +120,9 @@ def deliver_single_file(
anatomy_data,
format_dict,
report_items,
log
log,
has_renumbered_frame=False,
new_frame_start=0
):
"""Copy single file to calculated path based on template

View file

@ -237,13 +237,35 @@ class DeliveryOptionsDialog(QtWidgets.QDialog):
src_paths.append(src_path)
sources_and_frames = collect_frames(src_paths)
frames = set(sources_and_frames.values())
frames.discard(None)
first_frame = None
if frames:
first_frame = next(iter(frames))
for src_path, frame in sources_and_frames.items():
args[0] = src_path
if frame:
anatomy_data["frame"] = frame
new_report_items, uploaded = deliver_sequence(*args)
else:
new_report_items, uploaded = deliver_single_file(*args)
# Renumber frames
if renumber_frame and frame is not None:
# Calculate offset between first frame and current frame
# - '0' for first frame
offset = frame_offset - int(first_frame)
# Add offset to new frame start
frame = int(frame)
dst_frame = frame + offset
if dst_frame < 0:
msg = "Renumber frame has a smaller number than original frame" # noqa
report_items[msg].append(src_path)
self.log.warning("{} <{}>".format(
msg, dst_frame))
continue
frame = dst_frame
if frame is not None:
if frame:
anatomy_data["frame"] = frame
new_report_items, uploaded = deliver_single_file(*args)
report_items.update(new_report_items)
self._update_progress(uploaded)
else: # fallback for Pype2 and representations without files