make sure original basename is used during publishing as the tyc export needs very strict naming

This commit is contained in:
Kayla Man 2023-10-16 16:06:58 +08:00
parent 02e1bfd22b
commit 7431f6e9ef
7 changed files with 41 additions and 10 deletions

View file

@ -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"]

View file

@ -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,

View file

@ -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

View file

@ -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"
}

View file

@ -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": [

View file

@ -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": [

View file

@ -1 +1 @@
__version__ = "0.1.2"
__version__ = "0.1.3"