Skip to content

validate_yeti_rig_settings

ValidateYetiRigSettings

Bases: MayaInstancePlugin, OptionalPyblishPluginMixin

Validate Yeti Rig Settings have collected input connections.

The input connections are collected for the nodes in the input_SET. When no input connections are found a warning is logged but it is allowed to pass validation.

Source code in client/ayon_maya/plugins/publish/validate_yeti_rig_settings.py
 9
10
11
12
13
14
15
16
17
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
60
61
class ValidateYetiRigSettings(plugin.MayaInstancePlugin,
                              OptionalPyblishPluginMixin):
    """Validate Yeti Rig Settings have collected input connections.

    The input connections are collected for the nodes in the `input_SET`.
    When no input connections are found a warning is logged but it is allowed
    to pass validation.

    """

    order = pyblish.api.ValidatorOrder
    label = "Yeti Rig Settings"
    families = ["yetiRig"]
    optional = False

    def process(self, instance):
        if not self.is_active(instance.data):
            return
        invalid = self.get_invalid(instance)
        if invalid:
            raise PublishValidationError(
                ("Detected invalid Yeti Rig data. (See log) "
                 "Tip: Save the scene"))

    @classmethod
    def get_invalid(cls, instance):

        rigsettings = instance.data.get("rigsettings", None)
        if rigsettings is None:
            cls.log.error("MAJOR ERROR: No rig settings found!")
            return True

        # Get inputs
        inputs = rigsettings.get("inputs", [])
        if not inputs:
            # Empty rig settings dictionary
            cls.log.warning("No rig inputs found. This can happen when "
                            "the rig has no inputs from outside the rig.")
            return False

        for input in inputs:
            source_id = input["sourceID"]
            if source_id is None:
                cls.log.error("Discovered source with 'None' as ID, please "
                              "check if the input shape has a cbId")
                return True

            destination_id = input["destinationID"]
            if destination_id is None:
                cls.log.error("Discovered None as destination ID value")
                return True

        return False