mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
OP-2813 - fix for rendering single file from AE in DL
Solves issue with rendering .mov or .avi file. Added test cae for collect_frames
This commit is contained in:
parent
7c6594ab12
commit
f724e0ca22
3 changed files with 75 additions and 4 deletions
|
|
@ -13,18 +13,30 @@ def collect_frames(files):
|
|||
Uses clique as most precise solution
|
||||
|
||||
Args:
|
||||
files(list): list of source paths
|
||||
files(list) or (set with single value): list of source paths
|
||||
Returns:
|
||||
(dict): {'/asset/subset_v001.0001.png': '0001', ....}
|
||||
"""
|
||||
collections, remainder = clique.assemble(files, minimum_items=1)
|
||||
|
||||
real_file_name = None
|
||||
if len(files) == 1:
|
||||
real_file_name = list(files)[0]
|
||||
|
||||
sources_and_frames = {}
|
||||
if collections:
|
||||
for collection in collections:
|
||||
src_head = collection.head
|
||||
src_tail = collection.tail
|
||||
|
||||
if src_head.endswith("_v"):
|
||||
# print("Collection gathered incorrectly, not a sequence "
|
||||
# "just a version found in {}".format(files))
|
||||
if len(collections) > 1:
|
||||
continue
|
||||
else:
|
||||
return {real_file_name: None}
|
||||
|
||||
for index in collection.indexes:
|
||||
src_frame = collection.format("{padding}") % index
|
||||
src_file_name = "{}{}{}".format(src_head, src_frame,
|
||||
|
|
@ -71,14 +83,15 @@ def path_from_representation(representation, anatomy):
|
|||
|
||||
def copy_file(src_path, dst_path):
|
||||
"""Hardlink file if possible(to save space), copy if not"""
|
||||
from openpype.lib import create_hard_link # safer importing
|
||||
from avalon.vendor import filelink # safer importing
|
||||
|
||||
if os.path.exists(dst_path):
|
||||
return
|
||||
try:
|
||||
create_hard_link(
|
||||
filelink.create(
|
||||
src_path,
|
||||
dst_path
|
||||
dst_path,
|
||||
filelink.HARDLINK
|
||||
)
|
||||
except OSError:
|
||||
shutil.copyfile(src_path, dst_path)
|
||||
|
|
|
|||
|
|
@ -599,6 +599,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
|
|||
"files": os.path.basename(remainder),
|
||||
"stagingDir": os.path.dirname(remainder),
|
||||
}
|
||||
representations.append(rep)
|
||||
if "render" in instance.get("families"):
|
||||
rep.update({
|
||||
"fps": instance.get("fps"),
|
||||
|
|
|
|||
57
tests/unit/openpype/lib/test_delivery.py
Normal file
57
tests/unit/openpype/lib/test_delivery.py
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""Test suite for delivery functions."""
|
||||
from openpype.lib.delivery import collect_frames
|
||||
|
||||
|
||||
def test_collect_frames_multi_sequence():
|
||||
files = ["Asset_renderCompositingMain_v001.0000.png",
|
||||
"Asset_renderCompositingMain_v001.0001.png",
|
||||
"Asset_renderCompositingMain_v001.0002.png"]
|
||||
ret = collect_frames(files)
|
||||
|
||||
expected = {
|
||||
"Asset_renderCompositingMain_v001.0000.png": "0000",
|
||||
"Asset_renderCompositingMain_v001.0001.png": "0001",
|
||||
"Asset_renderCompositingMain_v001.0002.png": "0002"
|
||||
}
|
||||
|
||||
print(ret)
|
||||
assert ret == expected, "Not matching"
|
||||
|
||||
|
||||
def test_collect_frames_single_sequence():
|
||||
files = ["Asset_renderCompositingMain_v001.0000.png"]
|
||||
ret = collect_frames(files)
|
||||
|
||||
expected = {
|
||||
"Asset_renderCompositingMain_v001.0000.png": "0000"
|
||||
}
|
||||
|
||||
print(ret)
|
||||
assert ret == expected, "Not matching"
|
||||
|
||||
|
||||
def test_collect_frames_single_sequence_as_dict():
|
||||
files = {"Asset_renderCompositingMain_v001.0000.png"}
|
||||
ret = collect_frames(files)
|
||||
|
||||
expected = {
|
||||
"Asset_renderCompositingMain_v001.0000.png": "0000"
|
||||
}
|
||||
|
||||
print(ret)
|
||||
assert ret == expected, "Not matching"
|
||||
|
||||
|
||||
def test_collect_frames_single_file():
|
||||
files = {"Asset_renderCompositingMain_v001.png"}
|
||||
ret = collect_frames(files)
|
||||
|
||||
expected = {
|
||||
"Asset_renderCompositingMain_v001.png": None
|
||||
}
|
||||
|
||||
print(ret)
|
||||
assert ret == expected, "Not matching"
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue