Skip to content

actions

A module containing generic loader actions that will display in the Loader.

SetFrameRangeLoader

Bases: HoudiniLoader

Set frame range excluding pre- and post-handles

Source code in client/ayon_houdini/plugins/load/actions.py
 8
 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
class SetFrameRangeLoader(plugin.HoudiniLoader):
    """Set frame range excluding pre- and post-handles"""

    product_types = {
        "animation",
        "camera",
        "pointcache",
        "vdbcache",
        "usd",
    }
    representations = {"abc", "vdb", "usd"}

    label = "Set frame range"
    order = 11
    icon = "clock-o"
    color = "white"

    def load(self, context, name, namespace, data):

        import hou

        version_attributes = context["version"]["attrib"]

        start = version_attributes.get("frameStart")
        end = version_attributes.get("frameEnd")

        if start is None or end is None:
            print(
                "Skipping setting frame range because start or "
                "end frame data is missing.."
            )
            return

        hou.playbar.setFrameRange(start, end)
        hou.playbar.setPlaybackRange(start, end)

SetFrameRangeWithHandlesLoader

Bases: HoudiniLoader

Set frame range including pre- and post-handles

Source code in client/ayon_houdini/plugins/load/actions.py
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
class SetFrameRangeWithHandlesLoader(plugin.HoudiniLoader):
    """Set frame range including pre- and post-handles"""

    product_types = {
        "animation",
        "camera",
        "pointcache",
        "vdbcache",
        "usd",
    }
    representations = {"abc", "vdb", "usd"}

    label = "Set frame range (with handles)"
    order = 12
    icon = "clock-o"
    color = "white"

    def load(self, context, name, namespace, data):

        import hou

        version_attributes = context["version"]["attrib"]

        start = version_attributes.get("frameStart")
        end = version_attributes.get("frameEnd")

        if start is None or end is None:
            print(
                "Skipping setting frame range because start or "
                "end frame data is missing.."
            )
            return

        # Include handles
        start -= version_attributes.get("handleStart", 0)
        end += version_attributes.get("handleEnd", 0)

        hou.playbar.setFrameRange(start, end)
        hou.playbar.setPlaybackRange(start, end)