Skip to content

validate_no_animation

ValidateNoAnimation

Bases: MayaInstancePlugin, OptionalPyblishPluginMixin

Ensure no keyframes on nodes in the Instance.

Even though a Model would extract without animCurves correctly this avoids getting different output from a model when extracted from a different frame than the first frame. (Might be overly restrictive though)

Source code in client/ayon_maya/plugins/publish/validate_no_animation.py
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
class ValidateNoAnimation(plugin.MayaInstancePlugin,
                          OptionalPyblishPluginMixin):
    """Ensure no keyframes on nodes in the Instance.

    Even though a Model would extract without animCurves correctly this avoids
    getting different output from a model when extracted from a different
    frame than the first frame. (Might be overly restrictive though)

    """

    order = ValidateContentsOrder
    label = "No Animation"
    hosts = ["maya"]
    families = ["model"]
    optional = True
    actions = [ayon_maya.api.action.SelectInvalidAction]

    def process(self, instance):
        if not self.is_active(instance.data):
            return

        invalid = self.get_invalid(instance)
        if invalid:
            raise PublishValidationError(
                "Keyframes found on:\n\n{0}".format(
                    _as_report_list(sorted(invalid))
                ),
                title="Keyframes on model"
            )

    @staticmethod
    def get_invalid(instance):

        nodes = instance[:]
        if not nodes:
            return []

        curves = cmds.keyframe(nodes, query=True, name=True)
        if curves:
            return list(set(cmds.listConnections(curves)))

        return []