mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Chore: Substance Painter Addons for Ayon (#5914)
* Substance Painter Addons for Ayon * hound * make sure the class name is SubstancePainterAddon * use AYON as tab menu name when it is launched with AYON --------- Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com>
This commit is contained in:
parent
8348fe954e
commit
07d00ee787
10 changed files with 164 additions and 2 deletions
|
|
@ -170,7 +170,8 @@ class SubstanceHost(HostBase, IWorkfileHost, ILoadHost, IPublishHost):
|
|||
|
||||
parent = substance_painter.ui.get_main_window()
|
||||
|
||||
menu = QtWidgets.QMenu("OpenPype")
|
||||
tab_menu_label = os.environ.get("AVALON_LABEL") or "AYON"
|
||||
menu = QtWidgets.QMenu(tab_menu_label)
|
||||
|
||||
action = menu.addAction("Create...")
|
||||
action.triggered.connect(
|
||||
|
|
|
|||
|
|
@ -940,6 +940,23 @@ def _convert_photoshop_project_settings(ayon_settings, output):
|
|||
output["photoshop"] = ayon_photoshop
|
||||
|
||||
|
||||
def _convert_substancepainter_project_settings(ayon_settings, output):
|
||||
if "substancepainter" not in ayon_settings:
|
||||
return
|
||||
|
||||
ayon_substance_painter = ayon_settings["substancepainter"]
|
||||
_convert_host_imageio(ayon_substance_painter)
|
||||
if "shelves" in ayon_substance_painter:
|
||||
shelves_items = ayon_substance_painter["shelves"]
|
||||
new_shelves_items = {
|
||||
item["name"]: item["value"]
|
||||
for item in shelves_items
|
||||
}
|
||||
ayon_substance_painter["shelves"] = new_shelves_items
|
||||
|
||||
output["substancepainter"] = ayon_substance_painter
|
||||
|
||||
|
||||
def _convert_tvpaint_project_settings(ayon_settings, output):
|
||||
if "tvpaint" not in ayon_settings:
|
||||
return
|
||||
|
|
@ -1398,6 +1415,7 @@ def convert_project_settings(ayon_settings, default_settings):
|
|||
_convert_nuke_project_settings(ayon_settings, output)
|
||||
_convert_hiero_project_settings(ayon_settings, output)
|
||||
_convert_photoshop_project_settings(ayon_settings, output)
|
||||
_convert_substancepainter_project_settings(ayon_settings, output)
|
||||
_convert_tvpaint_project_settings(ayon_settings, output)
|
||||
_convert_traypublisher_project_settings(ayon_settings, output)
|
||||
_convert_webpublisher_project_settings(ayon_settings, output)
|
||||
|
|
|
|||
|
|
@ -1092,6 +1092,32 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"substancepainter": {
|
||||
"enabled": true,
|
||||
"label": "Substance Painter",
|
||||
"icon": "{}/app_icons/substancepainter.png",
|
||||
"host_name": "substancepainter",
|
||||
"environment": "{}",
|
||||
"variants": [
|
||||
{
|
||||
"name": "8-2-0",
|
||||
"label": "8.2",
|
||||
"executables": {
|
||||
"windows": [
|
||||
"C:\\Program Files\\Adobe\\Adobe Substance 3D Painter\\Adobe Substance 3D Painter.exe"
|
||||
],
|
||||
"darwin": [],
|
||||
"linux": []
|
||||
},
|
||||
"arguments": {
|
||||
"windows": [],
|
||||
"darwin": [],
|
||||
"linux": []
|
||||
},
|
||||
"environment": "{}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"unreal": {
|
||||
"enabled": true,
|
||||
"label": "Unreal Editor",
|
||||
|
|
|
|||
|
|
@ -164,6 +164,8 @@ class ApplicationsSettings(BaseSettingsModel):
|
|||
default_factory=AppGroupWithPython, title="Adobe After Effects")
|
||||
celaction: AppGroup = Field(
|
||||
default_factory=AppGroupWithPython, title="Celaction 2D")
|
||||
substancepainter: AppGroup = Field(
|
||||
default_factory=AppGroupWithPython, title="Substance Painter")
|
||||
unreal: AppGroup = Field(
|
||||
default_factory=AppGroupWithPython, title="Unreal Editor")
|
||||
additional_apps: list[AdditionalAppGroup] = Field(
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
__version__ = "0.1.2"
|
||||
__version__ = "0.1.3"
|
||||
|
|
|
|||
17
server_addon/substancepainter/server/__init__.py
Normal file
17
server_addon/substancepainter/server/__init__.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
from typing import Type
|
||||
|
||||
from ayon_server.addons import BaseServerAddon
|
||||
|
||||
from .version import __version__
|
||||
from .settings import SubstancePainterSettings, DEFAULT_SPAINTER_SETTINGS
|
||||
|
||||
|
||||
class SubstancePainterAddon(BaseServerAddon):
|
||||
name = "substancepainter"
|
||||
title = "Substance Painter"
|
||||
version = __version__
|
||||
settings_model: Type[SubstancePainterSettings] = SubstancePainterSettings
|
||||
|
||||
async def get_default_settings(self):
|
||||
settings_model_cls = self.get_settings_model()
|
||||
return settings_model_cls(**DEFAULT_SPAINTER_SETTINGS)
|
||||
10
server_addon/substancepainter/server/settings/__init__.py
Normal file
10
server_addon/substancepainter/server/settings/__init__.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
from .main import (
|
||||
SubstancePainterSettings,
|
||||
DEFAULT_SPAINTER_SETTINGS,
|
||||
)
|
||||
|
||||
|
||||
__all__ = (
|
||||
"SubstancePainterSettings",
|
||||
"DEFAULT_SPAINTER_SETTINGS",
|
||||
)
|
||||
61
server_addon/substancepainter/server/settings/imageio.py
Normal file
61
server_addon/substancepainter/server/settings/imageio.py
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
from pydantic import Field, validator
|
||||
from ayon_server.settings import BaseSettingsModel
|
||||
from ayon_server.settings.validators import ensure_unique_names
|
||||
|
||||
|
||||
class ImageIOConfigModel(BaseSettingsModel):
|
||||
override_global_config: bool = Field(
|
||||
False,
|
||||
title="Override global OCIO config"
|
||||
)
|
||||
filepath: list[str] = Field(
|
||||
default_factory=list,
|
||||
title="Config path"
|
||||
)
|
||||
|
||||
|
||||
class ImageIOFileRuleModel(BaseSettingsModel):
|
||||
name: str = Field("", title="Rule name")
|
||||
pattern: str = Field("", title="Regex pattern")
|
||||
colorspace: str = Field("", title="Colorspace name")
|
||||
ext: str = Field("", title="File extension")
|
||||
|
||||
|
||||
class ImageIOFileRulesModel(BaseSettingsModel):
|
||||
activate_host_rules: bool = Field(False)
|
||||
rules: list[ImageIOFileRuleModel] = Field(
|
||||
default_factory=list,
|
||||
title="Rules"
|
||||
)
|
||||
|
||||
@validator("rules")
|
||||
def validate_unique_outputs(cls, value):
|
||||
ensure_unique_names(value)
|
||||
return value
|
||||
|
||||
|
||||
class ImageIOSettings(BaseSettingsModel):
|
||||
activate_host_color_management: bool = Field(
|
||||
True, title="Enable Color Management"
|
||||
)
|
||||
ocio_config: ImageIOConfigModel = Field(
|
||||
default_factory=ImageIOConfigModel,
|
||||
title="OCIO config"
|
||||
)
|
||||
file_rules: ImageIOFileRulesModel = Field(
|
||||
default_factory=ImageIOFileRulesModel,
|
||||
title="File Rules"
|
||||
)
|
||||
|
||||
|
||||
DEFAULT_IMAGEIO_SETTINGS = {
|
||||
"activate_host_color_management": True,
|
||||
"ocio_config": {
|
||||
"override_global_config": False,
|
||||
"filepath": []
|
||||
},
|
||||
"file_rules": {
|
||||
"activate_host_rules": False,
|
||||
"rules": []
|
||||
}
|
||||
}
|
||||
26
server_addon/substancepainter/server/settings/main.py
Normal file
26
server_addon/substancepainter/server/settings/main.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
from pydantic import Field
|
||||
from ayon_server.settings import BaseSettingsModel
|
||||
from .imageio import ImageIOSettings, DEFAULT_IMAGEIO_SETTINGS
|
||||
|
||||
|
||||
class ShelvesSettingsModel(BaseSettingsModel):
|
||||
_layout = "compact"
|
||||
name: str = Field(title="Name")
|
||||
value: str = Field(title="Path")
|
||||
|
||||
|
||||
class SubstancePainterSettings(BaseSettingsModel):
|
||||
imageio: ImageIOSettings = Field(
|
||||
default_factory=ImageIOSettings,
|
||||
title="Color Management (ImageIO)"
|
||||
)
|
||||
shelves: list[ShelvesSettingsModel] = Field(
|
||||
default_factory=list,
|
||||
title="Shelves"
|
||||
)
|
||||
|
||||
|
||||
DEFAULT_SPAINTER_SETTINGS = {
|
||||
"imageio": DEFAULT_IMAGEIO_SETTINGS,
|
||||
"shelves": []
|
||||
}
|
||||
1
server_addon/substancepainter/server/version.py
Normal file
1
server_addon/substancepainter/server/version.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
__version__ = "0.1.0"
|
||||
Loading…
Add table
Add a link
Reference in a new issue