mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
Merge branch 'develop' into feature/PYPE-338-publish-representations-for-sho
# Conflicts: # pype/plugins/ftrack/publish/integrate_ftrack_api.py
This commit is contained in:
commit
075e7cbada
94 changed files with 2438 additions and 2117 deletions
|
|
@ -76,7 +76,16 @@ class CollectNukeReads(pyblish.api.ContextPlugin):
|
|||
|
||||
self.log.debug("collected_frames: {}".format(label))
|
||||
|
||||
instance.data["files"] = [source_files]
|
||||
if "representations" not in instance.data:
|
||||
instance.data["representations"] = []
|
||||
|
||||
representation = {
|
||||
'name': ext,
|
||||
'ext': "." + ext,
|
||||
'files': source_files,
|
||||
"stagingDir": source_dir,
|
||||
}
|
||||
instance.data["representations"].append(representation)
|
||||
|
||||
transfer = False
|
||||
if "publish" in node.knobs():
|
||||
|
|
|
|||
|
|
@ -63,16 +63,28 @@ class CollectNukeWrites(pyblish.api.ContextPlugin):
|
|||
int(last_frame)
|
||||
)
|
||||
|
||||
if "files" not in instance.data:
|
||||
instance.data["files"] = list()
|
||||
if "representations" not in instance.data:
|
||||
instance.data["representations"] = list()
|
||||
try:
|
||||
collected_frames = os.listdir(output_dir)
|
||||
self.log.debug("collected_frames: {}".format(label))
|
||||
instance.data["files"].append(collected_frames)
|
||||
|
||||
representation = {
|
||||
'name': ext,
|
||||
'ext': ext,
|
||||
'files': collected_frames,
|
||||
"stagingDir": output_dir,
|
||||
"anatomy_template": "render"
|
||||
}
|
||||
instance.data["representations"].append(representation)
|
||||
|
||||
except Exception:
|
||||
self.log.debug("couldn't collect frames: {}".format(label))
|
||||
|
||||
|
||||
|
||||
# except Exception:
|
||||
# self.log.debug("couldn't collect frames: {}".format(label))
|
||||
|
||||
instance.data.update({
|
||||
"path": path,
|
||||
"outputDir": output_dir,
|
||||
|
|
|
|||
|
|
@ -49,18 +49,27 @@ class NukeRenderLocal(pype.api.Extractor):
|
|||
# swap path back to publish path
|
||||
path = node['file'].value()
|
||||
node['file'].setValue(path.replace(temp_dir, output_dir))
|
||||
ext = node["file_type"].value()
|
||||
|
||||
if "files" not in instance.data:
|
||||
instance.data["files"] = list()
|
||||
if "representations" not in instance.data:
|
||||
instance.data["representations"] = []
|
||||
|
||||
instance.data["files"] = [os.listdir(temp_dir)]
|
||||
collected_frames = os.listdir(temp_dir)
|
||||
repre = {
|
||||
'name': ext,
|
||||
'ext': ext,
|
||||
'files': collected_frames,
|
||||
"stagingDir": temp_dir,
|
||||
"anatomy_template": "render"
|
||||
}
|
||||
instance.data["representations"].append(repre)
|
||||
|
||||
self.log.info("Extracted instance '{0}' to: {1}".format(
|
||||
instance.name,
|
||||
output_dir
|
||||
temp_dir
|
||||
))
|
||||
|
||||
collections, remainder = clique.assemble(*instance.data['files'])
|
||||
collections, remainder = clique.assemble(collected_frames)
|
||||
self.log.info('collections: {}'.format(str(collections)))
|
||||
|
||||
if collections:
|
||||
|
|
|
|||
|
|
@ -50,10 +50,10 @@ class ExtractDataForReview(pype.api.Extractor):
|
|||
|
||||
def transcode_mov(self, instance):
|
||||
collection = instance.data["collection"]
|
||||
staging_dir = instance.data["stagingDir"].replace("\\", "/")
|
||||
stagingDir = instance.data["stagingDir"].replace("\\", "/")
|
||||
file_name = collection.format("{head}mov")
|
||||
|
||||
review_mov = os.path.join(staging_dir, file_name).replace("\\", "/")
|
||||
review_mov = os.path.join(stagingDir, file_name).replace("\\", "/")
|
||||
|
||||
self.log.info("transcoding review mov: {0}".format(review_mov))
|
||||
if instance.data.get("baked_colorspace_movie"):
|
||||
|
|
@ -75,18 +75,33 @@ class ExtractDataForReview(pype.api.Extractor):
|
|||
instance.data["baked_colorspace_movie"]))
|
||||
os.remove(instance.data["baked_colorspace_movie"])
|
||||
|
||||
instance.data["files"].append(file_name)
|
||||
if "representations" not in instance.data:
|
||||
instance.data["representations"] = []
|
||||
|
||||
representation = {
|
||||
'name': 'mov',
|
||||
'ext': 'mov',
|
||||
'files': file_name,
|
||||
"stagingDir": stagingDir,
|
||||
"anatomy_template": "render",
|
||||
"thumbnail": False,
|
||||
"preview": True,
|
||||
'startFrameReview': instance.data['startFrame'],
|
||||
'endFrameReview': instance.data['endFrame'],
|
||||
'frameRate': instance.context.data["framerate"]
|
||||
}
|
||||
instance.data["representations"].append(representation)
|
||||
|
||||
def render_review_representation(self,
|
||||
instance,
|
||||
representation="mov"):
|
||||
|
||||
assert instance.data['files'], "Instance data files should't be empty!"
|
||||
assert instance.data['representations'][0]['files'], "Instance data files should't be empty!"
|
||||
|
||||
import nuke
|
||||
temporary_nodes = []
|
||||
staging_dir = instance.data["stagingDir"].replace("\\", "/")
|
||||
self.log.debug("StagingDir `{0}`...".format(staging_dir))
|
||||
stagingDir = instance.data["stagingDir"].replace("\\", "/")
|
||||
self.log.debug("StagingDir `{0}`...".format(stagingDir))
|
||||
|
||||
collection = instance.data.get("collection", None)
|
||||
|
||||
|
|
@ -108,7 +123,7 @@ class ExtractDataForReview(pype.api.Extractor):
|
|||
node = previous_node = nuke.createNode("Read")
|
||||
|
||||
node["file"].setValue(
|
||||
os.path.join(staging_dir, fname).replace("\\", "/"))
|
||||
os.path.join(stagingDir, fname).replace("\\", "/"))
|
||||
|
||||
node["first"].setValue(first_frame)
|
||||
node["origfirst"].setValue(first_frame)
|
||||
|
|
@ -147,7 +162,7 @@ class ExtractDataForReview(pype.api.Extractor):
|
|||
|
||||
if representation in "mov":
|
||||
file = fhead + "baked.mov"
|
||||
path = os.path.join(staging_dir, file).replace("\\", "/")
|
||||
path = os.path.join(stagingDir, file).replace("\\", "/")
|
||||
self.log.debug("Path: {}".format(path))
|
||||
instance.data["baked_colorspace_movie"] = path
|
||||
write_node["file"].setValue(path)
|
||||
|
|
@ -155,22 +170,39 @@ class ExtractDataForReview(pype.api.Extractor):
|
|||
write_node["raw"].setValue(1)
|
||||
write_node.setInput(0, previous_node)
|
||||
temporary_nodes.append(write_node)
|
||||
thumbnail = False
|
||||
preview = True
|
||||
|
||||
elif representation in "jpeg":
|
||||
file = fhead + "jpeg"
|
||||
path = os.path.join(staging_dir, file).replace("\\", "/")
|
||||
path = os.path.join(stagingDir, file).replace("\\", "/")
|
||||
instance.data["thumbnail"] = path
|
||||
write_node["file"].setValue(path)
|
||||
write_node["file_type"].setValue("jpeg")
|
||||
write_node["raw"].setValue(1)
|
||||
write_node.setInput(0, previous_node)
|
||||
temporary_nodes.append(write_node)
|
||||
thumbnail = True
|
||||
preview = False
|
||||
|
||||
# retime for
|
||||
first_frame = int(last_frame) / 2
|
||||
last_frame = int(last_frame) / 2
|
||||
# add into files for integration as representation
|
||||
instance.data["files"].append(file)
|
||||
|
||||
if "representations" not in instance.data:
|
||||
instance.data["representations"] = []
|
||||
|
||||
repre = {
|
||||
'name': representation,
|
||||
'ext': representation,
|
||||
'files': file,
|
||||
"stagingDir": stagingDir,
|
||||
"anatomy_template": "render",
|
||||
"thumbnail": thumbnail,
|
||||
"preview": preview
|
||||
}
|
||||
instance.data["representations"].append(repre)
|
||||
|
||||
# Render frames
|
||||
nuke.execute(write_node.name(), int(first_frame), int(last_frame))
|
||||
|
|
|
|||
|
|
@ -19,16 +19,22 @@ class ExtractScript(pype.api.Extractor):
|
|||
current_script = instance.context.data["currentFile"]
|
||||
|
||||
# Define extract output file path
|
||||
dir_path = self.staging_dir(instance)
|
||||
stagingdir = self.staging_dir(instance)
|
||||
filename = "{0}".format(instance.data["name"])
|
||||
path = os.path.join(dir_path, filename)
|
||||
path = os.path.join(stagingdir, filename)
|
||||
|
||||
self.log.info("Performing extraction..")
|
||||
shutil.copy(current_script, path)
|
||||
|
||||
if "files" not in instance.data:
|
||||
instance.data["files"] = list()
|
||||
if "representations" not in instance.data:
|
||||
instance.data["representations"] = []
|
||||
|
||||
instance.data["files"].append(filename)
|
||||
representation = {
|
||||
'name': 'nk',
|
||||
'ext': '.nk',
|
||||
'files': filename,
|
||||
"stagingDir": stagingdir,
|
||||
}
|
||||
instance.data["representations"].append(representation)
|
||||
|
||||
self.log.info("Extracted instance '%s' to: %s" % (instance.name, path))
|
||||
|
|
|
|||
|
|
@ -30,33 +30,33 @@ class ValidatePrerenderedFrames(pyblish.api.InstancePlugin):
|
|||
hosts = ["nuke"]
|
||||
actions = [RepairCollectionAction]
|
||||
|
||||
|
||||
def process(self, instance):
|
||||
self.log.debug('instance.data["files"]: {}'.format(instance.data['files']))
|
||||
|
||||
assert instance.data.get('files'), "no frames were collected, you need to render them"
|
||||
for repre in instance.data.get('representations'):
|
||||
|
||||
collections, remainder = clique.assemble(*instance.data['files'])
|
||||
self.log.info('collections: {}'.format(str(collections)))
|
||||
assert repre.get('files'), "no frames were collected, you need to render them"
|
||||
|
||||
collection = collections[0]
|
||||
collections, remainder = clique.assemble(repre["files"])
|
||||
self.log.info('collections: {}'.format(str(collections)))
|
||||
|
||||
frame_length = instance.data["endFrame"] \
|
||||
- instance.data["startFrame"] + 1
|
||||
collection = collections[0]
|
||||
|
||||
if frame_length is not 1:
|
||||
assert len(collections) == 1, "There are multiple collections in the folder"
|
||||
assert collection.is_contiguous(), "Some frames appear to be missing"
|
||||
frame_length = instance.data["endFrame"] \
|
||||
- instance.data["startFrame"] + 1
|
||||
|
||||
assert remainder is not None, "There are some extra files in folder"
|
||||
if frame_length != 1:
|
||||
assert len(collections) == 1, "There are multiple collections in the folder"
|
||||
assert collection.is_contiguous(), "Some frames appear to be missing"
|
||||
|
||||
self.log.info('frame_length: {}'.format(frame_length))
|
||||
self.log.info('len(collection.indexes): {}'.format(
|
||||
len(collection.indexes)))
|
||||
assert remainder is not None, "There are some extra files in folder"
|
||||
|
||||
assert len(
|
||||
collection.indexes
|
||||
) is frame_length, "{} missing frames. Use "
|
||||
"repair to render all frames".format(__name__)
|
||||
self.log.info('frame_length: {}'.format(frame_length))
|
||||
self.log.info('len(collection.indexes): {}'.format(
|
||||
len(collection.indexes)))
|
||||
|
||||
instance.data['collection'] = collection
|
||||
assert len(
|
||||
collection.indexes
|
||||
) is frame_length, "{} missing frames. Use "
|
||||
"repair to render all frames".format(__name__)
|
||||
|
||||
instance.data['collection'] = collection
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue