🐛 fix how AYON_UNREAL_PLUGIN overrides integration path

setting AYON_UNREAL_PLUGIN will override now inbuilt integration
This commit is contained in:
Ondřej Samohel 2024-06-06 11:08:01 +02:00
parent 8daed6fefc
commit b72f8d89f0
No known key found for this signature in database
GPG key ID: 02376E18990A97C6

View file

@ -17,7 +17,7 @@ class UnrealAddon(AYONAddon, IHostAddon):
def add_implementation_envs(self, env, app):
"""Modify environments to contain all required for implementation."""
# Set AYON_UNREAL_PLUGIN required for Unreal implementation
# Imports are in this method for Python 2 compatiblity of an addon
# Imports are in this method for Python 2 compatibility of an addon
from pathlib import Path
from .lib import get_compatible_integration
@ -39,19 +39,17 @@ class UnrealAddon(AYONAddon, IHostAddon):
raise ValueError(msg)
ue_version = app.name.replace("-", ".")
unreal_plugin_path = os.path.join(
UNREAL_ROOT_DIR, "integration", "UE_{}".format(ue_version), "Ayon"
)
UNREAL_ROOT_DIR, "integration", f"UE_{ue_version}", "Ayon")
if not Path(unreal_plugin_path).exists():
compatible_versions = get_compatible_integration(
if compatible_versions := get_compatible_integration(
ue_version, Path(UNREAL_ROOT_DIR) / "integration"
)
if compatible_versions:
):
unreal_plugin_path = compatible_versions[-1] / "Ayon"
unreal_plugin_path = unreal_plugin_path.as_posix()
if not env.get("AYON_UNREAL_PLUGIN") or \
env.get("AYON_UNREAL_PLUGIN") != unreal_plugin_path:
if not env.get("AYON_UNREAL_PLUGIN"):
env["AYON_UNREAL_PLUGIN"] = unreal_plugin_path
# Set default environments if are not set via settings