mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Merge pull request #4150 from 2-REC-forks/bugfix/sa-validate-texture-workfiles
Bugfix: Standalone Publish - ValidateTextureBatchWorkfiles settings
This commit is contained in:
commit
092ae0fa49
1 changed files with 22 additions and 5 deletions
|
|
@ -1,5 +1,7 @@
|
|||
import os
|
||||
import pyblish.api
|
||||
|
||||
from openpype.settings import get_project_settings
|
||||
from openpype.pipeline.publish import (
|
||||
ValidateContentsOrder,
|
||||
PublishXmlValidationError,
|
||||
|
|
@ -18,23 +20,38 @@ class ValidateTextureBatchWorkfiles(pyblish.api.InstancePlugin):
|
|||
families = ["texture_batch_workfile"]
|
||||
optional = True
|
||||
|
||||
# from presets
|
||||
main_workfile_extensions = ['mra']
|
||||
|
||||
def process(self, instance):
|
||||
if instance.data["family"] == "workfile":
|
||||
ext = instance.data["representations"][0]["ext"]
|
||||
if ext not in self.main_workfile_extensions:
|
||||
main_workfile_extensions = self.get_main_workfile_extensions()
|
||||
if ext not in main_workfile_extensions:
|
||||
self.log.warning("Only secondary workfile present!")
|
||||
return
|
||||
|
||||
if not instance.data.get("resources"):
|
||||
msg = "No secondary workfile present for workfile '{}'". \
|
||||
format(instance.data["name"])
|
||||
ext = self.main_workfile_extensions[0]
|
||||
ext = main_workfile_extensions[0]
|
||||
formatting_data = {"file_name": instance.data["name"],
|
||||
"extension": ext}
|
||||
|
||||
raise PublishXmlValidationError(self, msg,
|
||||
formatting_data=formatting_data
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def get_main_workfile_extensions():
|
||||
project_settings = get_project_settings(os.environ["AVALON_PROJECT"])
|
||||
|
||||
try:
|
||||
extensions = (project_settings["standalonepublisher"]
|
||||
["publish"]
|
||||
["CollectTextures"]
|
||||
["main_workfile_extensions"])
|
||||
except KeyError:
|
||||
raise Exception("Setting 'Main workfile extensions' not found."
|
||||
" The setting must be set for the"
|
||||
" 'Collect Texture' publish plugin of the"
|
||||
" 'Standalone Publish' tool.")
|
||||
|
||||
return extensions
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue