diff --git a/pype/plugins/global/publish/cleanup.py b/pype/plugins/global/publish/cleanup.py index 68ec9a48ad..3bb9ddc144 100644 --- a/pype/plugins/global/publish/cleanup.py +++ b/pype/plugins/global/publish/cleanup.py @@ -16,21 +16,21 @@ class CleanUp(pyblish.api.InstancePlugin): exclude_families = ["clip"] def process(self, instance): - if [ef for ef in self.exclude_families - if instance.data["family"] in ef]: - return - import tempfile - - staging_dir = instance.data.get("stagingDir", None) - if not staging_dir or not os.path.exists(staging_dir): - self.log.info("No staging directory found: %s" % staging_dir) - return - - temp_root = tempfile.gettempdir() - if not os.path.normpath(staging_dir).startswith(temp_root): - self.log.info("Skipping cleanup. Staging directory is not in the " - "temp folder: %s" % staging_dir) - return - - self.log.info("Removing temporary folder ...") - shutil.rmtree(staging_dir) + # if [ef for ef in self.exclude_families + # if instance.data["family"] in ef]: + # return + # import tempfile + # + # staging_dir = instance.data.get("stagingDir", None) + # if not staging_dir or not os.path.exists(staging_dir): + # self.log.info("No staging directory found: %s" % staging_dir) + # return + # + # temp_root = tempfile.gettempdir() + # if not os.path.normpath(staging_dir).startswith(temp_root): + # self.log.info("Skipping cleanup. Staging directory is not in the " + # "temp folder: %s" % staging_dir) + # return + # + # self.log.info("Removing temporary folder ...") + # shutil.rmtree(staging_dir) diff --git a/pype/plugins/global/publish/integrate.py b/pype/plugins/global/publish/integrate.py index d1a572fbfd..208bc027d5 100644 --- a/pype/plugins/global/publish/integrate.py +++ b/pype/plugins/global/publish/integrate.py @@ -28,9 +28,7 @@ class IntegrateAsset(pyblish.api.InstancePlugin): families = ["look", "assembly", "yetiRig", - "yeticache", - "nukescript", - "write"] + "yeticache"] exclude_families = ["clip"] def process(self, instance): diff --git a/pype/plugins/global/publish/integrate_new.py b/pype/plugins/global/publish/integrate_new.py index 5f6fa7b674..0ffe84987b 100644 --- a/pype/plugins/global/publish/integrate_new.py +++ b/pype/plugins/global/publish/integrate_new.py @@ -56,7 +56,10 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): "vrayproxy", "render", "imagesequence", - "review" + "review", + "nukescript", + "render", + "write" ] exclude_families = ["clip"] @@ -228,7 +231,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): if isinstance(files, list): src_collections, remainder = clique.assemble(files) self.log.debug( - "dst_collections: {}".format(str(src_collections))) + "src_collections: {}".format(str(src_collections))) src_collection = src_collections[0] # Assert that each member has identical suffix src_head = src_collection.format("{head}") @@ -242,6 +245,8 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): anatomy_filled = anatomy.format(template_data) test_dest_files.append( anatomy_filled[template_name]["path"]) + self.log.debug( + "test_dest_files: {}".format(str(test_dest_files))) dst_collections, remainder = clique.assemble(test_dest_files) dst_collection = dst_collections[0] diff --git a/pype/plugins/global/publish/integrate_rendered_frames.py b/pype/plugins/global/publish/integrate_rendered_frames.py index e814e31640..ff8d6adc71 100644 --- a/pype/plugins/global/publish/integrate_rendered_frames.py +++ b/pype/plugins/global/publish/integrate_rendered_frames.py @@ -24,7 +24,7 @@ class IntegrateFrames(pyblish.api.InstancePlugin): label = "Integrate Frames" order = pyblish.api.IntegratorOrder - families = ["imagesequence", "render", "write", "source"] + families = ["imagesequence", "source"] family_targets = [".frames", ".local", ".review", "imagesequence", "render", "source"] exclude_families = ["clip"] diff --git a/pype/plugins/nuke/publish/collect_writes.py b/pype/plugins/nuke/publish/collect_writes.py index fb66a29bc8..68bc2fd5d4 100644 --- a/pype/plugins/nuke/publish/collect_writes.py +++ b/pype/plugins/nuke/publish/collect_writes.py @@ -64,19 +64,27 @@ class CollectNukeWrites(pyblish.api.ContextPlugin): ) if "representations" not in instance.data: - instance.data["representations"] = [] + instance.data["representations"] = list() + try: + collected_frames = os.listdir(output_dir) - representation = { - 'name': ext, - 'ext': "." + ext, - 'files': collected_frames, - "stagingDir": output_dir, - } - instance.data["representations"].append(representation) + 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, diff --git a/pype/plugins/nuke/publish/extract_render_local.py b/pype/plugins/nuke/publish/extract_render_local.py index 5ac1c77059..18a1aa1f54 100644 --- a/pype/plugins/nuke/publish/extract_render_local.py +++ b/pype/plugins/nuke/publish/extract_render_local.py @@ -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: diff --git a/pype/plugins/nuke/publish/extract_review.py b/pype/plugins/nuke/publish/extract_review.py index ed38893927..2eabbd4e87 100644 --- a/pype/plugins/nuke/publish/extract_review.py +++ b/pype/plugins/nuke/publish/extract_review.py @@ -26,7 +26,7 @@ class ExtractDataForReview(pype.api.Extractor): # Deselect all nodes to prevent external connections [i["selected"].setValue(False) for i in nuke.allNodes()] self.log.debug("creating staging dir:") - self.stagingDir(instance) + self.staging_dir(instance) self.log.debug("instance: {}".format(instance)) self.log.debug("instance.data[families]: {}".format( @@ -75,13 +75,28 @@ 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 = [] @@ -155,6 +170,8 @@ 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" @@ -165,6 +182,8 @@ class ExtractDataForReview(pype.api.Extractor): 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 @@ -174,13 +193,16 @@ class ExtractDataForReview(pype.api.Extractor): if "representations" not in instance.data: instance.data["representations"] = [] - representation = { - 'name': 'nk', - 'ext': '.nk', + repre = { + 'name': representation, + 'ext': representation, 'files': file, - "stagingDir": stagingdir, + "stagingDir": stagingDir, + "anatomy_template": "render", + "thumbnail": thumbnail, + "preview": preview } - instance.data["representations"].append(representation) + instance.data["representations"].append(repre) # Render frames nuke.execute(write_node.name(), int(first_frame), int(last_frame)) diff --git a/pype/plugins/nuke/publish/validate_collection.py b/pype/plugins/nuke/publish/validate_collection.py index c402927373..1d0e1b260e 100644 --- a/pype/plugins/nuke/publish/validate_collection.py +++ b/pype/plugins/nuke/publish/validate_collection.py @@ -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