Skip to content

validate_no_unknown_nodes

ValidateNoUnknownNodes

Bases: MayaInstancePlugin, OptionalPyblishPluginMixin

Checks to see if there are any unknown nodes in the instance.

This often happens if nodes from plug-ins are used but are not available on this machine.

Some studios use unknown nodes to store data on (as attributes)

because it's a lightweight node.

Source code in client/ayon_maya/plugins/publish/validate_no_unknown_nodes.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
class ValidateNoUnknownNodes(plugin.MayaInstancePlugin,
                             OptionalPyblishPluginMixin):
    """Checks to see if there are any unknown nodes in the instance.

    This often happens if nodes from plug-ins are used but are not available
    on this machine.

    Note: Some studios use unknown nodes to store data on (as attributes)
        because it's a lightweight node.

    """

    order = ValidateContentsOrder
    hosts = ['maya']
    families = ['model', 'rig']
    optional = True
    label = "Unknown Nodes"
    actions = [ayon_maya.api.action.SelectInvalidAction]

    @staticmethod
    def get_invalid(instance):
        return cmds.ls(instance, type='unknown')

    def process(self, instance):
        """Process all the nodes in the instance"""
        if not self.is_active(instance.data):
            return

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

process(instance)

Process all the nodes in the instance

Source code in client/ayon_maya/plugins/publish/validate_no_unknown_nodes.py
41
42
43
44
45
46
47
48
49
50
51
52
53
def process(self, instance):
    """Process all the nodes in the instance"""
    if not self.is_active(instance.data):
        return

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