Skip to content

Commit

Permalink
Added validate_keys_none validator
Browse files Browse the repository at this point in the history
  • Loading branch information
BigRoy committed Feb 9, 2015
1 parent aa9a74d commit 0758954
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Empty file.
29 changes: 29 additions & 0 deletions examples/foobar/pyblish/plugins/validate_keys_none.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import pyblish.api
from maya import cmds


class ValidateKeysNone(pyblish.api.Validator):
""" Validates that none of the nodes in the instance have any keys """
families = ['model', 'layout']
hosts = ['maya']
category = 'cleanup'
optional = True
version = (0, 1, 0)

def process_instance(self, instance):
"""Process all the nodes in the instance """

# quick check
any_keys = cmds.keyframe(instance, q=1, selected=False)
if not any_keys:
return

# find each individual node with keys
invalid = []
for node in instance:
keys = cmds.keyframe(node, q=1, selected=False)
if keys:
invalid.append(node)

if invalid:
raise ValueError("Nodes with keys found: {0}".format(invalid))

0 comments on commit 0758954

Please sign in to comment.