diff --git a/client/ayon_substancepainter/plugins/publish/extract_maketx.py b/client/ayon_substancepainter/plugins/publish/extract_maketx.py index 027a60b..5300fd7 100644 --- a/client/ayon_substancepainter/plugins/publish/extract_maketx.py +++ b/client/ayon_substancepainter/plugins/publish/extract_maketx.py @@ -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 @@ -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"] diff --git a/server/settings/main.py b/server/settings/main.py index 9a13d2c..4a38813 100644 --- a/server/settings/main.py +++ b/server/settings/main.py @@ -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): @@ -23,6 +24,8 @@ 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 = { @@ -30,5 +33,5 @@ class SubstancePainterSettings(BaseSettingsModel): "shelves": [], "create": DEFAULT_CREATOR_SETTINGS, "load": DEFAULT_LOADER_SETTINGS, - + "publish": DEFAULT_PUBLISH_SETTINGS, } diff --git a/server/settings/publish_plugins.py b/server/settings/publish_plugins.py new file mode 100644 index 0000000..1cb5ac0 --- /dev/null +++ b/server/settings/publish_plugins.py @@ -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, + }, +}