Skip to content

Commit

Permalink
Add settings for ExtractMakeTX and allow extractor to be optional
Browse files Browse the repository at this point in the history
  • Loading branch information
BigRoy committed Sep 18, 2024
1 parent 78585fc commit fefc6a7
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ def convert_to_tx(


class ExtractMakeTX(publish.Extractor,
publish.ColormanagedPyblishPluginMixin):
publish.ColormanagedPyblishPluginMixin,
publish.OptionalPyblishPluginMixin):
"""Extract MakeTX
This requires color management to be enabled so that the MakeTX file
Expand All @@ -109,11 +110,14 @@ class ExtractMakeTX(publish.Extractor,
label = "Extract TX"
hosts = ["substancepainter"]
families = ["image"]
settings_category = "substancepainter"

# Run directly after textures export
order = publish.Extractor.order - 0.099

def process(self, instance):
if not self.is_active(instance.data):
return

representations: "list[dict]" = instance.data["representations"]

Expand Down
5 changes: 4 additions & 1 deletion server/settings/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from .imageio import ImageIOSettings, DEFAULT_IMAGEIO_SETTINGS
from .creator_plugins import CreatorsModel, DEFAULT_CREATOR_SETTINGS
from .load_plugins import LoadersModel, DEFAULT_LOADER_SETTINGS
from .publish_plugins import PublishersModel, DEFAULT_PUBLISH_SETTINGS


class ShelvesSettingsModel(BaseSettingsModel):
Expand All @@ -23,12 +24,14 @@ class SubstancePainterSettings(BaseSettingsModel):
default_factory=DEFAULT_CREATOR_SETTINGS, title="Creators")
load: LoadersModel = SettingsField(
default_factory=DEFAULT_LOADER_SETTINGS, title="Loaders")
publish: PublishersModel = SettingsField(
default_factory=PublishersModel, title="Publishers")


DEFAULT_SPAINTER_SETTINGS = {
"imageio": DEFAULT_IMAGEIO_SETTINGS,
"shelves": [],
"create": DEFAULT_CREATOR_SETTINGS,
"load": DEFAULT_LOADER_SETTINGS,

"publish": DEFAULT_PUBLISH_SETTINGS,
}
23 changes: 23 additions & 0 deletions server/settings/publish_plugins.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from ayon_server.settings import BaseSettingsModel, SettingsField


class BasicEnabledModel(BaseSettingsModel):
enabled: bool = SettingsField(title="Enabled")
optional: bool = SettingsField(title="Optional")
active: bool = SettingsField(title="Active")


class PublishersModel(BaseSettingsModel):
ExtractMakeTX: BasicEnabledModel = SettingsField(
default_factory=BasicEnabledModel,
title="Extract Make TX",
)


DEFAULT_PUBLISH_SETTINGS = {
"ExtractMakeTX": {
"enabled": True,
"optional": True,
"active": True,
},
}

0 comments on commit fefc6a7

Please sign in to comment.