Skip to content

ayon_fusion

get_fusion_version(app_name)

The function is triggered by the prelaunch hooks to get the fusion version.

app_name is obtained by prelaunch hooks from the launch_context.env.get("AYON_APP_NAME").

To get a correct Fusion version, a version number should be present in the applications/fusion/variants key of the Blackmagic Fusion Application Settings.

Source code in client/ayon_fusion/addon.py
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
def get_fusion_version(app_name):
    """
    The function is triggered by the prelaunch hooks to get the fusion version.

    `app_name` is obtained by prelaunch hooks from the
    `launch_context.env.get("AYON_APP_NAME")`.

    To get a correct Fusion version, a version number should be present
    in the `applications/fusion/variants` key
    of the Blackmagic Fusion Application Settings.
    """

    log = Logger.get_logger(__name__)

    if not app_name:
        return

    app_version_candidates = re.findall(r"\d+", app_name)
    if not app_version_candidates:
        return
    for app_version in app_version_candidates:
        if int(app_version) in FUSION_VERSIONS_DICT:
            return int(app_version)
        else:
            log.info(
                "Unsupported Fusion version: {app_version}".format(
                    app_version=app_version
                )
            )