Created
March 6, 2016 13:37
-
-
Save madoodia/3cd1ce59db6b57c73709 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# madoodia@gmail.com | |
# -------------------- | |
import pyblish.api | |
from maya import cmds | |
# class ValidateKeyframesOnMesh(pyblish.api.InstancePlugin): | |
class ValidateKeyframesOnMesh(pyblish.api.Validator): | |
"""Validate keyframe on meshes | |
If you have any keyframe on any mesh this will detect it. | |
You have to remove mesh's keyframe to continue. | |
""" | |
order = pyblish.api.ValidatorOrder | |
families = ['anr.model'] | |
hosts = ['maya'] | |
category = 'geometry' | |
label = 'Keyframe On Mesh' | |
version = (0, 0, 1) | |
def process(self, instance): | |
invalid = [] | |
sys.log.info('Finding keyframes...') | |
for node in cmds.ls(instance): | |
# key = cmds.keyframe(node, q=1) | |
key = cmds.findKeyframe(node, curve=True) | |
if key in not None: | |
invalid.append(node) | |
continue | |
if invalid: | |
raise RuntimeError( | |
"Meshes found in instance[{0}] have keyframe: {1}".format(instance, invalid)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment