mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
Merge pull request #2484 from BigRoy/maya_rig_validate_cycle_errors
Validate Maya Rig produces no cycle errors
This commit is contained in:
commit
00d1896272
3 changed files with 68 additions and 0 deletions
34
openpype/hosts/maya/plugins/publish/validate_cycle_error.py
Normal file
34
openpype/hosts/maya/plugins/publish/validate_cycle_error.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
from maya import cmds
|
||||
|
||||
import pyblish.api
|
||||
|
||||
from avalon import maya
|
||||
|
||||
import openpype.api
|
||||
import openpype.hosts.maya.api.action
|
||||
|
||||
|
||||
class ValidateCycleError(pyblish.api.InstancePlugin):
|
||||
"""Validate nodes produce no cycle errors."""
|
||||
|
||||
order = openpype.api.ValidateContentsOrder + 0.05
|
||||
label = "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("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