From 45d3cc63ce1afbf868f906fbe2c1b599351ce070 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Mon, 4 Jan 2021 19:18:53 +0100 Subject: [PATCH 1/7] renamed `repr` variable to `repre` as `repr` is buildin function --- .../standalonepublisher/publish/collect_context.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pype/plugins/standalonepublisher/publish/collect_context.py b/pype/plugins/standalonepublisher/publish/collect_context.py index 9dbeec93fb..3ef197fa1a 100644 --- a/pype/plugins/standalonepublisher/publish/collect_context.py +++ b/pype/plugins/standalonepublisher/publish/collect_context.py @@ -66,23 +66,23 @@ class CollectContextDataSAPublish(pyblish.api.ContextPlugin): in_data_list = list() representations = in_data.pop("representations") - for repr in representations: + for repre in representations: in_data_copy = copy.deepcopy(in_data) - ext = repr["ext"][1:] + ext = repre["ext"][1:] subset = in_data_copy["subset"] # filter out non editorial files if ext not in self.batch_extensions: - in_data_copy["representations"] = [repr] + in_data_copy["representations"] = [repre] in_data_copy["subset"] = f"{ext}{subset}" in_data_list.append(in_data_copy) - files = repr.get("files") + files = repre.get("files") # delete unneeded keys delete_repr_keys = ["frameStart", "frameEnd"] for k in delete_repr_keys: - if repr.get(k): - repr.pop(k) + if repre.get(k): + repre.pop(k) # convert files to list if it isnt if not isinstance(files, (tuple, list)): From a7dd5dc3dcf495720266b4e839574dc25a1dab8d Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Mon, 4 Jan 2021 19:23:07 +0100 Subject: [PATCH 2/7] remove dot from extension and add warning in integrate new to be ackwnoledged about extension with dot --- pype/plugins/global/publish/integrate_new.py | 11 +++++++++++ pype/plugins/global/publish/integrate_thumbnail.py | 2 +- .../standalonepublisher/publish/collect_context.py | 6 +++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/pype/plugins/global/publish/integrate_new.py b/pype/plugins/global/publish/integrate_new.py index 133b4fc6ef..d52fede0bd 100644 --- a/pype/plugins/global/publish/integrate_new.py +++ b/pype/plugins/global/publish/integrate_new.py @@ -329,6 +329,17 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): if repre.get("outputName"): template_data["output"] = repre['outputName'] + ext = repre["ext"] + if ext.startswith("."): + self.log.warning(( + "Implementaion warning: <\"{}\">" + " Representation's extension stored under \"ext\" key " + " started with dot (\"{}\")." + ).format(repre["name"], ext)) + ext = ext[1:] + repre["ext"] = ext + template_data["ext"] = ext + template = os.path.normpath( anatomy.templates[template_name]["path"]) diff --git a/pype/plugins/global/publish/integrate_thumbnail.py b/pype/plugins/global/publish/integrate_thumbnail.py index 97122d2c39..23d2da5f4b 100644 --- a/pype/plugins/global/publish/integrate_thumbnail.py +++ b/pype/plugins/global/publish/integrate_thumbnail.py @@ -95,7 +95,7 @@ class IntegrateThumbnails(pyblish.api.InstancePlugin): template_data.update({ "_id": str(thumbnail_id), "thumbnail_root": os.environ.get("AVALON_THUMBNAIL_ROOT"), - "ext": file_extension, + "ext": file_extension[1:], "thumbnail_type": "thumbnail" }) diff --git a/pype/plugins/standalonepublisher/publish/collect_context.py b/pype/plugins/standalonepublisher/publish/collect_context.py index 3ef197fa1a..cd7246c0a2 100644 --- a/pype/plugins/standalonepublisher/publish/collect_context.py +++ b/pype/plugins/standalonepublisher/publish/collect_context.py @@ -145,12 +145,16 @@ class CollectContextDataSAPublish(pyblish.api.ContextPlugin): component["stagingDir"] = component["stagingDir"] if isinstance(component["files"], list): - collections, remainder = clique.assemble(component["files"]) + collections, _remainder = clique.assemble(component["files"]) self.log.debug("collecting sequence: {}".format(collections)) instance.data["frameStart"] = int(component["frameStart"]) instance.data["frameEnd"] = int(component["frameEnd"]) instance.data["fps"] = int(component["fps"]) + ext = component["ext"] + if ext.startswith("."): + component["ext"] = ext[1:] + if component["preview"]: instance.data["families"].append("review") instance.data["repreProfiles"] = ["h264"] From beee823f344ff58684dfc19c71fea3f493283068 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Mon, 4 Jan 2021 19:23:20 +0100 Subject: [PATCH 3/7] replaced representation in template with ext --- pype/settings/defaults/project_anatomy/templates.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pype/settings/defaults/project_anatomy/templates.json b/pype/settings/defaults/project_anatomy/templates.json index 32f962556f..dcb0991a06 100644 --- a/pype/settings/defaults/project_anatomy/templates.json +++ b/pype/settings/defaults/project_anatomy/templates.json @@ -10,18 +10,18 @@ }, "render": { "folder": "{root}/{project[name]}/{hierarchy}/{asset}/publish/render/{subset}/{@version}", - "file": "{project[code]}_{asset}_{subset}_{@version}<_{output}><.{@frame}>.{representation}", + "file": "{project[code]}_{asset}_{subset}_{@version}<_{output}><.{@frame}>.{ext}", "path": "{@folder}/{@file}" }, "publish": { "folder": "{root}/{project[name]}/{hierarchy}/{asset}/publish/{family}/{subset}/{@version}", - "file": "{project[code]}_{asset}_{subset}_{@version}<_{output}><.{@frame}>.{representation}", + "file": "{project[code]}_{asset}_{subset}_{@version}<_{output}><.{@frame}>.{ext}", "path": "{@folder}/{@file}", - "thumbnail": "{thumbnail_root}/{project[name]}/{_id}_{thumbnail_type}{ext}" + "thumbnail": "{thumbnail_root}/{project[name]}/{_id}_{thumbnail_type}.{ext}" }, "master": { "folder": "{root}/{project[name]}/{hierarchy}/{asset}/publish/{family}/{subset}/master", - "file": "{project[code]}_{asset}_{subset}_master<_{output}><.{frame}>.{representation}", + "file": "{project[code]}_{asset}_{subset}_master<_{output}><.{frame}>.{ext}", "path": "{@folder}/{@file}" }, "delivery": {}, From 7e8ba29cbe04934427b4da622cbfcbbc4d54254c Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Mon, 4 Jan 2021 19:23:52 +0100 Subject: [PATCH 4/7] added representation key to template data --- pype/plugins/global/publish/integrate_new.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pype/plugins/global/publish/integrate_new.py b/pype/plugins/global/publish/integrate_new.py index d52fede0bd..8f3d13c44f 100644 --- a/pype/plugins/global/publish/integrate_new.py +++ b/pype/plugins/global/publish/integrate_new.py @@ -329,6 +329,8 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): if repre.get("outputName"): template_data["output"] = repre['outputName'] + template_data["representation"] = repre["name"] + ext = repre["ext"] if ext.startswith("."): self.log.warning(( From 40a972802e3b4a6feccb556b5ac72f0fdc5814ce Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Tue, 5 Jan 2021 10:14:22 +0100 Subject: [PATCH 5/7] removed dot from extensions --- pype/plugins/houdini/publish/extract_alembic.py | 2 +- pype/plugins/houdini/publish/extract_vdb_cache.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pype/plugins/houdini/publish/extract_alembic.py b/pype/plugins/houdini/publish/extract_alembic.py index 4910c45aca..a71b85c529 100644 --- a/pype/plugins/houdini/publish/extract_alembic.py +++ b/pype/plugins/houdini/publish/extract_alembic.py @@ -42,7 +42,7 @@ class ExtractAlembic(pype.api.Extractor): representation = { 'name': 'abc', - 'ext': '.abc', + 'ext': 'abc', 'files': file_name, "stagingDir": staging_dir, } diff --git a/pype/plugins/houdini/publish/extract_vdb_cache.py b/pype/plugins/houdini/publish/extract_vdb_cache.py index 29686ef2fd..c56a4dd73a 100644 --- a/pype/plugins/houdini/publish/extract_vdb_cache.py +++ b/pype/plugins/houdini/publish/extract_vdb_cache.py @@ -42,7 +42,7 @@ class ExtractVDBCache(pype.api.Extractor): representation = { 'name': 'mov', - 'ext': '.mov', + 'ext': 'mov', 'files': output, "stagingDir": staging_dir, } From 1231e4a3d602416642eb2328da5276f1a5f35df8 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Tue, 5 Jan 2021 10:43:26 +0100 Subject: [PATCH 6/7] removed double dot repacement --- pype/plugins/global/publish/integrate_new.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pype/plugins/global/publish/integrate_new.py b/pype/plugins/global/publish/integrate_new.py index 8f3d13c44f..f3e0bf6fed 100644 --- a/pype/plugins/global/publish/integrate_new.py +++ b/pype/plugins/global/publish/integrate_new.py @@ -368,7 +368,6 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): test_dest_files = list() for i in [1, 2]: - template_data["representation"] = repre['ext'] template_data["frame"] = src_padding_exp % i anatomy_filled = anatomy.format(template_data) template_filled = anatomy_filled[template_name]["path"] @@ -389,6 +388,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): index_frame_start = None + # TODO use frame padding from right template group if repre.get("frameStart") is not None: frame_start_padding = int( anatomy.templates["render"].get( @@ -424,7 +424,8 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): dst = "{0}{1}{2}".format( dst_head, dst_padding, - dst_tail).replace("..", ".") + dst_tail + ) self.log.debug("destination: `{}`".format(dst)) src = os.path.join(stagingdir, src_file_name) @@ -444,7 +445,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): dst_head, dst_start_frame, dst_tail - ).replace("..", ".") + ) repre['published_path'] = dst else: @@ -468,7 +469,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): anatomy_filled = anatomy.format(template_data) template_filled = anatomy_filled[template_name]["path"] repre_context = template_filled.used_values - dst = os.path.normpath(template_filled).replace("..", ".") + dst = os.path.normpath(template_filled) instance.data["transfers"].append([src, dst]) From 42faada1658e496b77ee05c679dd84124ca4808c Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Tue, 5 Jan 2021 10:44:50 +0100 Subject: [PATCH 7/7] removed filling of "representation" key with representation "ext" key --- pype/plugins/global/publish/integrate_new.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/pype/plugins/global/publish/integrate_new.py b/pype/plugins/global/publish/integrate_new.py index f3e0bf6fed..2e5a9e5b94 100644 --- a/pype/plugins/global/publish/integrate_new.py +++ b/pype/plugins/global/publish/integrate_new.py @@ -463,8 +463,6 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): "Given file name is a full path" ) - template_data["representation"] = repre['ext'] - src = os.path.join(stagingdir, fname) anatomy_filled = anatomy.format(template_data) template_filled = anatomy_filled[template_name]["path"]