mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
nuke: making validator code nicer
This commit is contained in:
parent
907500c9e9
commit
06f338a95b
1 changed files with 8 additions and 16 deletions
|
|
@ -1,10 +1,10 @@
|
|||
from pprint import pformat
|
||||
import pyblish.api
|
||||
|
||||
from openpype.client import get_project, get_asset_by_id, get_asset_by_name
|
||||
import openpype.api
|
||||
from openpype.client import get_asset_by_name
|
||||
from openpype.pipeline import legacy_io
|
||||
from openpype.pipeline import PublishXmlValidationError
|
||||
from openpype.api import get_errored_instances_from_context
|
||||
from openpype.hosts.nuke.api.lib import (
|
||||
get_avalon_knob_data,
|
||||
WorkfileSettings
|
||||
|
|
@ -12,19 +12,6 @@ from openpype.hosts.nuke.api.lib import (
|
|||
import nuke
|
||||
|
||||
|
||||
@pyblish.api.log
|
||||
class RepairScriptAttributes(pyblish.api.Action):
|
||||
label = "Repair"
|
||||
on = "failed"
|
||||
icon = "wrench"
|
||||
|
||||
def process(self, context, plugin):
|
||||
instances = get_errored_instances_from_context(context)
|
||||
|
||||
self.log.debug(instances)
|
||||
WorkfileSettings().set_context_settings()
|
||||
|
||||
|
||||
@pyblish.api.log
|
||||
class ValidateScriptAttributes(pyblish.api.InstancePlugin):
|
||||
""" Validates file output. """
|
||||
|
|
@ -34,7 +21,7 @@ class ValidateScriptAttributes(pyblish.api.InstancePlugin):
|
|||
label = "Validatte script attributes"
|
||||
hosts = ["nuke"]
|
||||
optional = True
|
||||
actions = [RepairScriptAttributes]
|
||||
actions = [openpype.api.RepairAction]
|
||||
|
||||
def process(self, instance):
|
||||
root = nuke.root()
|
||||
|
|
@ -139,3 +126,8 @@ class ValidateScriptAttributes(pyblish.api.InstancePlugin):
|
|||
"failed_attributes": attrs_wrong_html
|
||||
}
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def repair(cls, instance):
|
||||
cls.log.debug("__ repairing instance: {}".format(instance))
|
||||
WorkfileSettings().set_context_settings()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue