Skip to content

validate_product_attributes

ValidateProductAttributes

Bases: OptionalPyblishPluginMixin, InstancePlugin

Validate Product attributes.

Source code in client/ayon_flame/plugins/publish/validate_product_attributes.py
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
class ValidateProductAttributes(
    OptionalPyblishPluginMixin,
    pyblish.api.InstancePlugin
):
    """Validate Product attributes."""

    label = "Validate Product Attributes"
    order = pyblish.api.ValidatorOrder
    settings_category = "flame"

    optional = True
    active = True

    actions = [DeactivatePublishing]

    def detect_failing_instance(self, instance):
        return instance.data.get("failing")

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

        segment = instance.data["item"]
        otio_clip = instance.data["otioClip"]
        reference_name = otio_clip.media_reference.name

        msg = "Product is failing validation due following reason:"
        msg_html = self.get_description()

        shot_name = segment.shot_name.get_value()
        segment_name = segment.name.get_value()
        clip_msg = (
            f"Clip name: '{segment_name}' with shot name: '{shot_name}'\n"
            f"Problem: '{reference_name}'"
        )
        msg += f"\n{clip_msg}"

        msg_html += f"{clip_msg}"

        raise PublishValidationError(
            title="Failing Product Validation",
            message=msg,
            description=msg_html
        )

    def get_description(self):
        return inspect.cleandoc("""
            ## Product is failing validation:
            <br/>
            Make sure your clips on timeline are not converted to BatchFX<br/>
            or are not Hard Committed. This way they will lose their link <br/>
            to the original Media source file path and we are not able<br/>
            to publish them anymore.
            <br/><br/>
            Also make sure timeline clip has a standard name.
            <br/><br/>
            <b>Validation problem:</b>
            <br/>
        """)