Skip to content

validate_segments

ValidateSegments

Bases: OptionalPyblishPluginMixin, ContextPlugin

Validate segments attributes.

Source code in client/ayon_flame/plugins/publish/validate_segments.py
 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
 99
100
101
102
103
104
105
class ValidateSegments(
    OptionalPyblishPluginMixin,
    pyblish.api.ContextPlugin
):
    """Validate segments attributes."""

    label = "Validate Segments"
    order = pyblish.api.ValidatorOrder
    settings_category = "flame"

    optional = True
    active = False

    actions = [ShowSegmentsRed, HideSegments]

    def process(self, context):
        failed_segments = context.data["failedSegments"]

        if not failed_segments:
            return

        msg = "Timeline Clips failing validation:"
        msg_html = self.get_description()
        for segment in failed_segments:
            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}'")
            msg += f"\n{clip_msg}"

            msg_html += f"<br/> - {clip_msg}"

        raise PublishValidationError(
            title="Missing correct segments attributes",
            message=msg,
            description=msg_html
        )

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