Skip to content

collect_current_file

CollectHoudiniCurrentFile

Bases: HoudiniContextPlugin

Inject the current working file into context

Source code in client/ayon_houdini/plugins/publish/collect_current_file.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
class CollectHoudiniCurrentFile(plugin.HoudiniContextPlugin):
    """Inject the current working file into context"""

    order = pyblish.api.CollectorOrder - 0.1
    label = "Houdini Current File"

    def process(self, context):
        """Inject the current working file"""

        current_file = hou.hipFile.path()
        if (
                hou.hipFile.isNewFile()
                or not os.path.exists(current_file)
        ):
            # By default, Houdini will even point a new scene to a path.
            # However if the file is not saved at all and does not exist,
            # we assume the user never set it.
            self.log.warning("Houdini workfile is unsaved.")
            current_file = ""

        context.data["currentFile"] = current_file
        self.log.info('Current workfile path: {}'.format(current_file))

process(context)

Inject the current working file

Source code in client/ayon_houdini/plugins/publish/collect_current_file.py
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
def process(self, context):
    """Inject the current working file"""

    current_file = hou.hipFile.path()
    if (
            hou.hipFile.isNewFile()
            or not os.path.exists(current_file)
    ):
        # By default, Houdini will even point a new scene to a path.
        # However if the file is not saved at all and does not exist,
        # we assume the user never set it.
        self.log.warning("Houdini workfile is unsaved.")
        current_file = ""

    context.data["currentFile"] = current_file
    self.log.info('Current workfile path: {}'.format(current_file))