Skip to content

collect_usd_render

CollectUsdRender

Bases: HoudiniInstancePlugin

Collect publishing data for USD Render ROP.

If rendercommand parm is disabled (and thus no rendering triggers by the usd render rop) it is assumed to be a "Split Render" job where the farm will get an additional render job after the USD file is extracted.

Provides

instance -> ifdFile

Source code in client/ayon_houdini/plugins/publish/collect_usd_render.py
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
class CollectUsdRender(plugin.HoudiniInstancePlugin):
    """Collect publishing data for USD Render ROP.

    If `rendercommand` parm is disabled (and thus no rendering triggers by the
    usd render rop) it is assumed to be a "Split Render" job where the farm
    will get an additional render job after the USD file is extracted.

    Provides:
        instance    -> ifdFile

    """

    label = "Collect USD Render Rop"
    order = pyblish.api.CollectorOrder
    hosts = ["houdini"]
    families = ["usdrender"]

    def process(self, instance):

        rop = hou.node(instance.data.get("instance_node"))

        if instance.data["splitRender"]:
            # USD file output
            lop_output = evalParmNoFrame(
                rop, "lopoutput", pad_character="#"
            )

            # The file is usually relative to the Output Processor's 'Save to
            # Directory' which forces all USD files to end up in that directory
            # TODO: It is possible for a user to disable this
            # TODO: When enabled I think only the basename of the `lopoutput`
            #  parm is preserved, any parent folders defined are likely ignored
            folder = evalParmNoFrame(
                rop, "savetodirectory_directory", pad_character="#"
            )

            export_file = os.path.join(folder, lop_output)

            # Substitute any # characters in the name back to their $F4
            # equivalent
            def replace_to_f(match):
                number = len(match.group(0))
                if number <= 1:
                    number = ""  # make it just $F not $F1 or $F0
                return "$F{}".format(number)

            export_file = re.sub("#+", replace_to_f, export_file)
            self.log.debug(
                "Found export file: {}".format(export_file)
            )
            instance.data["ifdFile"] = export_file

            # The render job is not frame dependent but fully dependent on
            # the job having been completed, since the extracted file is a
            # single file.
            if "$F" not in export_file:
                instance.data["splitRenderFrameDependent"] = False

        # stub required data for Submit Publish Job publish plug-in
        instance.data["attachTo"] = []