Skip to content

validate_frame_token

ValidateFrameToken

Bases: HoudiniInstancePlugin

Validate if the unexpanded string contains the frame ('$F') token.

This validator will only check the output parameter of the node if the Valid Frame Range is not set to 'Render Current Frame'

Rules

If you render out a frame range it is mandatory to have the frame token - '$F4' or similar - to ensure that each frame gets written. If this is not the case you will override the same file every time a frame is written out.

Examples:

Good: 'my_vbd_cache.$F4.vdb' Bad: 'my_vbd_cache.vdb'

Source code in client/ayon_houdini/plugins/publish/validate_frame_token.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
class ValidateFrameToken(plugin.HoudiniInstancePlugin):
    """Validate if the unexpanded string contains the frame ('$F') token.

    This validator will *only* check the output parameter of the node if
    the Valid Frame Range is not set to 'Render Current Frame'

    Rules:
        If you render out a frame range it is mandatory to have the
        frame token - '$F4' or similar - to ensure that each frame gets
        written. If this is not the case you will override the same file
        every time a frame is written out.

    Examples:
        Good: 'my_vbd_cache.$F4.vdb'
        Bad: 'my_vbd_cache.vdb'

    """

    order = pyblish.api.ValidatorOrder
    label = "Validate Frame Token"
    families = ["vdbcache"]

    def process(self, instance):

        invalid = self.get_invalid(instance)
        if invalid:
            raise PublishValidationError(
                f"Output settings do no match for '{invalid[0].path()}'"
            )

    @classmethod
    def get_invalid(cls, instance):

        node = hou.node(instance.data["instance_node"])
        # Check trange parm, 0 means Render Current Frame
        frame_range = node.evalParm("trange")
        if frame_range == 0:
            return

        output_parm = lib.get_output_parameter(node)
        unexpanded_str = output_parm.unexpandedString()

        if "$F" not in unexpanded_str:
            cls.log.error("No frame token found in '%s'" % node.path())
            return [node]