Merge branch 'substance_integration' into substance_painter_ocio

This commit is contained in:
Roy Nieterau 2023-01-15 01:36:32 +01:00
commit 7167ab1332
5 changed files with 11 additions and 7 deletions

View file

@ -23,7 +23,7 @@ class AddLastWorkfileToLaunchArgs(PreLaunchHook):
"blender",
"photoshop",
"tvpaint",
"substance",
"substancepainter",
"aftereffects"
]

View file

@ -189,7 +189,7 @@ def get_export_templates(config, format="png", strip_folder=True):
dict: The expected output maps.
"""
folder = config["exportPath"]
folder = config["exportPath"].replace("\\", "/")
preset = config["defaultExportPreset"]
cmd = f'alg.mapexport.getPathsExportDocumentMaps("{preset}", "{folder}", "{format}")' # noqa
result = substance_painter.js.evaluate(cmd)
@ -197,6 +197,7 @@ def get_export_templates(config, format="png", strip_folder=True):
if strip_folder:
for _stack, maps in result.items():
for map_template, map_filepath in maps.items():
map_filepath = map_filepath.replace("\\", "/")
assert map_filepath.startswith(folder)
map_filename = map_filepath[len(folder):].lstrip("/")
maps[map_template] = map_filename
@ -394,7 +395,7 @@ def get_parsed_export_maps(config):
from .colorspace import get_project_channel_data
outputs = substance_painter.export.list_project_textures(config)
templates = get_export_templates(config)
templates = get_export_templates(config, strip_folder=False)
# Get all color spaces set for the current project
project_colorspaces = set(
@ -441,7 +442,10 @@ def get_parsed_export_maps(config):
# We strip explicitly using the full parent export path instead of
# using `os.path.basename` because export template is allowed to
# have subfolders in its template which we want to match against
assert filepath.startswith(export_path)
filepath = filepath.replace("\\", "/")
assert filepath.startswith(export_path), (
f"Filepath {filepath} must start with folder {export_path}"
)
filename = filepath[len(export_path):]
for template, regex in template_regex.items():

View file

@ -60,7 +60,7 @@ class CollectTextureSet(pyblish.api.InstancePlugin):
representation = {
'name': ext.lstrip("."),
'ext': ext.lstrip("."),
'files': fnames,
'files': fnames if len(fnames) > 1 else fnames[0],
}
# Mark as UDIM explicitly if it has UDIM tiles.

View file

@ -1315,7 +1315,7 @@
}
}
},
"substance": {
"substancepainter": {
"enabled": true,
"label": "Substance Painter",
"icon": "app_icons/substancepainter.png",

View file

@ -1,6 +1,6 @@
{
"type": "dict",
"key": "substance",
"key": "substancepainter",
"label": "Substance Painter",
"collapsible": true,
"checkbox_key": "enabled",