Skip to content

collect_current_file

Collect current project path.

CollectUnrealCurrentFile

Bases: ContextPlugin

Inject the current working file into context.

Source code in client/ayon_unreal/plugins/publish/collect_current_file.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
class CollectUnrealCurrentFile(pyblish.api.ContextPlugin):
    """Inject the current working file into context."""

    order = pyblish.api.CollectorOrder - 0.5
    label = "Unreal Current File"
    hosts = ['unreal']

    def process(self, context):
        """Inject the current working file."""
        current_file = unreal.Paths.get_project_file_path()
        context.data["currentFile"] = os.path.abspath(current_file)

        assert current_file != '', "Current file is empty. " \
            "Save the file before continuing."

process(context)

Inject the current working file.

Source code in client/ayon_unreal/plugins/publish/collect_current_file.py
16
17
18
19
20
21
22
def process(self, context):
    """Inject the current working file."""
    current_file = unreal.Paths.get_project_file_path()
    context.data["currentFile"] = os.path.abspath(current_file)

    assert current_file != '', "Current file is empty. " \
        "Save the file before continuing."