From 7431f6e9ef68b95ad0dc6c7ac0e9b1c1656672ce Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Mon, 16 Oct 2023 16:06:58 +0800 Subject: [PATCH] make sure original basename is used during publishing as the tyc export needs very strict naming --- openpype/hosts/max/plugins/load/load_tycache.py | 2 +- .../plugins/publish/collect_tycache_attributes.py | 4 +++- .../hosts/max/plugins/publish/extract_tycache.py | 15 ++++++++------- .../defaults/project_anatomy/templates.json | 6 ++++++ .../defaults/project_settings/global.json | 11 +++++++++++ server_addon/core/server/settings/tools.py | 11 +++++++++++ server_addon/core/server/version.py | 2 +- 7 files changed, 41 insertions(+), 10 deletions(-) diff --git a/openpype/hosts/max/plugins/load/load_tycache.py b/openpype/hosts/max/plugins/load/load_tycache.py index 7eac0de3e5..ff3a26fbd6 100644 --- a/openpype/hosts/max/plugins/load/load_tycache.py +++ b/openpype/hosts/max/plugins/load/load_tycache.py @@ -13,7 +13,7 @@ from openpype.hosts.max.api.pipeline import ( from openpype.pipeline import get_representation_path, load -class PointCloudLoader(load.LoaderPlugin): +class TyCacheLoader(load.LoaderPlugin): """Point Cloud Loader.""" families = ["tycache"] diff --git a/openpype/hosts/max/plugins/publish/collect_tycache_attributes.py b/openpype/hosts/max/plugins/publish/collect_tycache_attributes.py index d735b2f2c0..56cf6614e2 100644 --- a/openpype/hosts/max/plugins/publish/collect_tycache_attributes.py +++ b/openpype/hosts/max/plugins/publish/collect_tycache_attributes.py @@ -42,6 +42,7 @@ class CollectTyCacheData(pyblish.api.InstancePlugin, "tycacheChanMaterials", "tycacheChanCustomFloat" "tycacheChanCustomVector", "tycacheChanCustomTM", "tycacheChanPhysX", "tycacheMeshBackup", + "tycacheCreateObject", "tycacheCreateObjectIfNotCreated", "tycacheAdditionalCloth", "tycacheAdditionalSkin", @@ -59,7 +60,8 @@ class CollectTyCacheData(pyblish.api.InstancePlugin, "tycacheChanRot", "tycacheChanScale", "tycacheChanVel", "tycacheChanShape", "tycacheChanMatID", "tycacheChanMapping", - "tycacheChanMaterials"] + "tycacheChanMaterials", "tycacheCreateObject", + "tycacheCreateObjectIfNotCreated"] return [ EnumDef("all_tyc_attrs", tyc_attr_enum, diff --git a/openpype/hosts/max/plugins/publish/extract_tycache.py b/openpype/hosts/max/plugins/publish/extract_tycache.py index 0327564b3a..a787080776 100644 --- a/openpype/hosts/max/plugins/publish/extract_tycache.py +++ b/openpype/hosts/max/plugins/publish/extract_tycache.py @@ -37,7 +37,7 @@ class ExtractTyCache(publish.Extractor): stagingdir = self.staging_dir(instance) filename = "{name}.tyc".format(**instance.data) path = os.path.join(stagingdir, filename) - filenames = self.get_file(instance, start, end) + filenames = self.get_files(instance, start, end) additional_attributes = instance.data.get("tyc_attrs", {}) with maintained_selection(): @@ -55,14 +55,14 @@ class ExtractTyCache(publish.Extractor): tycache_spline_enabled=has_tyc_spline) for job in job_args: rt.Execute(job) - + representations = instance.data.setdefault("representations", []) representation = { 'name': 'tyc', 'ext': 'tyc', 'files': filenames if len(filenames) > 1 else filenames[0], - "stagingDir": stagingdir + "stagingDir": stagingdir, } - instance.data["representations"].append(representation) + representations.append(representation) self.log.info(f"Extracted instance '{instance.name}' to: {filenames}") # Get the tyMesh filename for extraction @@ -71,13 +71,14 @@ class ExtractTyCache(publish.Extractor): 'name': 'tyMesh', 'ext': 'tyc', 'files': mesh_filename, - "stagingDir": stagingdir + "stagingDir": stagingdir, + "outputName": '__tyMesh' } - instance.data["representations"].append(mesh_repres) + representations.append(mesh_repres) self.log.info( f"Extracted instance '{instance.name}' to: {mesh_filename}") - def get_file(self, instance, start_frame, end_frame): + def get_files(self, instance, start_frame, end_frame): """Get file names for tyFlow in tyCache format. Set the filenames accordingly to the tyCache file diff --git a/openpype/settings/defaults/project_anatomy/templates.json b/openpype/settings/defaults/project_anatomy/templates.json index e5e535bf19..aa3f8d4843 100644 --- a/openpype/settings/defaults/project_anatomy/templates.json +++ b/openpype/settings/defaults/project_anatomy/templates.json @@ -53,6 +53,11 @@ "file": "{originalBasename}<.{@frame}><_{udim}>.{ext}", "path": "{@folder}/{@file}" }, + "tycache": { + "folder": "{root[work]}/{project[name]}/{hierarchy}/{asset}/publish/{family}/{subset}/{@version}", + "file": "{originalBasename}<_{@version}><_{@frame}>.{ext}", + "path": "{@folder}/{@file}" + }, "source": { "folder": "{root[work]}/{originalDirname}", "file": "{originalBasename}.{ext}", @@ -66,6 +71,7 @@ "simpleUnrealTextureHero": "Simple Unreal Texture - Hero", "simpleUnrealTexture": "Simple Unreal Texture", "online": "online", + "tycache": "tycache", "source": "source", "transient": "transient" } diff --git a/openpype/settings/defaults/project_settings/global.json b/openpype/settings/defaults/project_settings/global.json index 06a595d1c5..9ccf5cae05 100644 --- a/openpype/settings/defaults/project_settings/global.json +++ b/openpype/settings/defaults/project_settings/global.json @@ -546,6 +546,17 @@ "task_types": [], "task_names": [], "template_name": "online" + }, + { + "families": [ + "tycache" + ], + "hosts": [ + "max" + ], + "task_types": [], + "task_names": [], + "template_name": "tycache" } ], "hero_template_name_profiles": [ diff --git a/server_addon/core/server/settings/tools.py b/server_addon/core/server/settings/tools.py index 7befc795e4..d7c7b367b7 100644 --- a/server_addon/core/server/settings/tools.py +++ b/server_addon/core/server/settings/tools.py @@ -487,6 +487,17 @@ DEFAULT_TOOLS_VALUES = { "task_types": [], "task_names": [], "template_name": "publish_online" + }, + { + "families": [ + "tycache" + ], + "hosts": [ + "max" + ], + "task_types": [], + "task_names": [], + "template_name": "publish_tycache" } ], "hero_template_name_profiles": [ diff --git a/server_addon/core/server/version.py b/server_addon/core/server/version.py index b3f4756216..ae7362549b 100644 --- a/server_addon/core/server/version.py +++ b/server_addon/core/server/version.py @@ -1 +1 @@ -__version__ = "0.1.2" +__version__ = "0.1.3"