mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
Validate Rig produces no cycle errors
This commit is contained in:
parent
81eef3533e
commit
d53a40c4e5
1 changed files with 36 additions and 0 deletions
|
|
@ -0,0 +1,36 @@
|
|||
from maya import cmds
|
||||
|
||||
import pyblish.api
|
||||
|
||||
from avalon import maya
|
||||
|
||||
import openpype.api
|
||||
import openpype.hosts.maya.api.action
|
||||
from openpype.hosts.maya.api.lib import undo_chunk
|
||||
|
||||
|
||||
class ValidateRigCycleError(pyblish.api.InstancePlugin):
|
||||
"""Validate rig nodes produce have no cycle errors."""
|
||||
|
||||
order = openpype.api.ValidateContentsOrder + 0.05
|
||||
label = "Rig Cycle Errors"
|
||||
hosts = ["maya"]
|
||||
families = ["rig"]
|
||||
actions = [openpype.hosts.maya.api.action.SelectInvalidAction]
|
||||
optional = True
|
||||
|
||||
def process(self, instance):
|
||||
invalid = self.get_invalid(instance)
|
||||
if invalid:
|
||||
raise RuntimeError("Rig nodes produce a cycle error: %s" % invalid)
|
||||
|
||||
@classmethod
|
||||
def get_invalid(cls, instance):
|
||||
|
||||
with maya.maintained_selection():
|
||||
cmds.select(instance[:], noExpand=True)
|
||||
plugs = cmds.cycleCheck(all=False, # check selection only
|
||||
list=True)
|
||||
invalid = cmds.ls(plugs, objectsOnly=True, long=True)
|
||||
return invalid
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue