3dsMax: Settings for Ayon (#5388)

* 3dsmax settings for ayon

* lower version to '0.1.0'

* remove arguments from max application settings

* RenderSettings instead of render_settings for max

---------

Co-authored-by: Jakub Trllo <jakub.trllo@gmail.com>
This commit is contained in:
Kayla Man 2023-08-17 16:57:00 +08:00 committed by GitHub
parent bd9a794274
commit 6ae58875b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 212 additions and 3 deletions

View file

@ -127,9 +127,7 @@
"linux": []
},
"arguments": {
"windows": [
"-U MAXScript {OPENPYPE_ROOT}\\openpype\\hosts\\max\\startup\\startup.ms"
],
"windows": [],
"darwin": [],
"linux": []
},

View file

@ -0,0 +1,17 @@
from typing import Type
from ayon_server.addons import BaseServerAddon
from .version import __version__
from .settings import MaxSettings, DEFAULT_VALUES
class MaxAddon(BaseServerAddon):
name = "max"
title = "Max"
version = __version__
settings_model: Type[MaxSettings] = MaxSettings
async def get_default_settings(self):
settings_model_cls = self.get_settings_model()
return settings_model_cls(**DEFAULT_VALUES)

View file

@ -0,0 +1,10 @@
from .main import (
MaxSettings,
DEFAULT_VALUES,
)
__all__ = (
"MaxSettings",
"DEFAULT_VALUES",
)

View file

@ -0,0 +1,48 @@
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"
)

View file

@ -0,0 +1,60 @@
from pydantic import Field
from ayon_server.settings import BaseSettingsModel
from .imageio import ImageIOSettings
from .render_settings import (
RenderSettingsModel, DEFAULT_RENDER_SETTINGS
)
from .publishers import (
PublishersModel, DEFAULT_PUBLISH_SETTINGS
)
class PRTAttributesModel(BaseSettingsModel):
_layout = "compact"
name: str = Field(title="Name")
value: str = Field(title="Attribute")
class PointCloudSettings(BaseSettingsModel):
attribute: list[PRTAttributesModel] = Field(
default_factory=list, title="Channel Attribute")
class MaxSettings(BaseSettingsModel):
imageio: ImageIOSettings = Field(
default_factory=ImageIOSettings,
title="Color Management (ImageIO)"
)
RenderSettings: RenderSettingsModel = Field(
default_factory=RenderSettingsModel,
title="Render Settings"
)
PointCloud: PointCloudSettings = Field(
default_factory=PointCloudSettings,
title="Point Cloud"
)
publish: PublishersModel = Field(
default_factory=PublishersModel,
title="Publish Plugins")
DEFAULT_VALUES = {
"RenderSettings": DEFAULT_RENDER_SETTINGS,
"PointCloud": {
"attribute": [
{"name": "Age", "value": "age"},
{"name": "Radius", "value": "radius"},
{"name": "Position", "value": "position"},
{"name": "Rotation", "value": "rotation"},
{"name": "Scale", "value": "scale"},
{"name": "Velocity", "value": "velocity"},
{"name": "Color", "value": "color"},
{"name": "TextureCoordinate", "value": "texcoord"},
{"name": "MaterialID", "value": "matid"},
{"name": "custFloats", "value": "custFloats"},
{"name": "custVecs", "value": "custVecs"},
]
},
"publish": DEFAULT_PUBLISH_SETTINGS
}

View file

@ -0,0 +1,26 @@
from pydantic import Field
from ayon_server.settings import BaseSettingsModel
class BasicValidateModel(BaseSettingsModel):
enabled: bool = Field(title="Enabled")
optional: bool = Field(title="Optional")
active: bool = Field(title="Active")
class PublishersModel(BaseSettingsModel):
ValidateFrameRange: BasicValidateModel = Field(
default_factory=BasicValidateModel,
title="Validate Frame Range",
section="Validators"
)
DEFAULT_PUBLISH_SETTINGS = {
"ValidateFrameRange": {
"enabled": True,
"optional": True,
"active": True
}
}

View file

@ -0,0 +1,49 @@
from pydantic import Field
from ayon_server.settings import BaseSettingsModel
def aov_separators_enum():
return [
{"value": "dash", "label": "- (dash)"},
{"value": "underscore", "label": "_ (underscore)"},
{"value": "dot", "label": ". (dot)"}
]
def image_format_enum():
"""Return enumerator for image output formats."""
return [
{"label": "bmp", "value": "bmp"},
{"label": "exr", "value": "exr"},
{"label": "tif", "value": "tif"},
{"label": "tiff", "value": "tiff"},
{"label": "jpg", "value": "jpg"},
{"label": "png", "value": "png"},
{"label": "tga", "value": "tga"},
{"label": "dds", "value": "dds"}
]
class RenderSettingsModel(BaseSettingsModel):
default_render_image_folder: str = Field(
title="Default render image folder"
)
aov_separator: str = Field(
"underscore",
title="AOV Separator character",
enum_resolver=aov_separators_enum
)
image_format: str = Field(
enum_resolver=image_format_enum,
title="Output Image Format"
)
multipass: bool = Field(title="multipass")
DEFAULT_RENDER_SETTINGS = {
"default_render_image_folder": "renders/3dsmax",
"aov_separator": "underscore",
"image_format": "png",
"multipass": True
}

View file

@ -0,0 +1 @@
__version__ = "0.1.0"