Skip to content

validate_render_existing_frames

ValidateRenderLocalHasExistingFrames

Bases: BlenderInstancePlugin

Validate all files for the representations exist on disk.

Source code in client/ayon_blender/plugins/publish/validate_render_existing_frames.py
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
class ValidateRenderLocalHasExistingFrames(plugin.BlenderInstancePlugin):
    """Validate all files for the representations exist on disk."""

    order = ValidateContentsOrder
    families = ["render.local_no_render"]
    label = "Validate Existing Frames"

    def process(self, instance):
        missing_paths = []
        for repre in instance.data.get("representations", []):
            files = repre.get("files")
            if isinstance(files, str):
                files = [files]

            staging_dir = repre["stagingDir"]
            for fname in files:
                path = os.path.join(staging_dir, fname)
                if not os.path.exists(path):
                    missing_paths.append(path)

        if missing_paths:
            collections, remainder = clique.assemble(missing_paths)
            for path in itertools.chain(collections, remainder):
                self.log.warning(f"Missing files: {path}")

            raise PublishValidationError(
                title="Missing existing frames",
                message=(
                    "Render has missing files. Please make sure to render the "
                    "missing frames or pick another render target."
                )
            )