define 'UNREAL_ADDON_ROOT' and use it

This commit is contained in:
Jakub Trllo 2024-06-06 17:50:01 +02:00
parent 196d307a57
commit 8ca69f512b
3 changed files with 9 additions and 9 deletions

View file

@ -1,9 +1,10 @@
from .version import __version__
from .addon import UnrealAddon
from .addon import UNREAL_ADDON_ROOT, UnrealAddon
__all__ = (
"__version__",
"UNREAL_ADDON_ROOT",
"UnrealAddon",
)

View file

@ -4,7 +4,7 @@ from ayon_core.addon import AYONAddon, IHostAddon
from .version import __version__
UNREAL_ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
UNREAL_ADDON_ROOT = os.path.dirname(os.path.abspath(__file__))
class UnrealAddon(AYONAddon, IHostAddon):
@ -14,7 +14,7 @@ class UnrealAddon(AYONAddon, IHostAddon):
def get_global_environments(self):
return {
"AYON_UNREAL_ROOT": UNREAL_ROOT_DIR,
"AYON_UNREAL_ROOT": UNREAL_ADDON_ROOT,
}
def add_implementation_envs(self, env, app):
@ -43,11 +43,11 @@ class UnrealAddon(AYONAddon, IHostAddon):
ue_version = app.name.replace("-", ".")
unreal_plugin_path = os.path.join(
UNREAL_ROOT_DIR, "integration", "UE_{}".format(ue_version), "Ayon"
UNREAL_ADDON_ROOT, "integration", "UE_{}".format(ue_version), "Ayon"
)
if not Path(unreal_plugin_path).exists():
compatible_versions = get_compatible_integration(
ue_version, Path(UNREAL_ROOT_DIR) / "integration"
ue_version, Path(UNREAL_ADDON_ROOT) / "integration"
)
if compatible_versions:
unreal_plugin_path = compatible_versions[-1] / "Ayon"
@ -70,7 +70,7 @@ class UnrealAddon(AYONAddon, IHostAddon):
if app.host_name != self.host_name:
return []
return [
os.path.join(UNREAL_ROOT_DIR, "hooks")
os.path.join(UNREAL_ADDON_ROOT, "hooks")
]
def get_workfile_extensions(self):

View file

@ -21,8 +21,8 @@ from ayon_core.pipeline import (
get_current_project_name,
)
from ayon_core.tools.utils import host_tools
import ayon_core.hosts.unreal
from ayon_core.host import HostBase, ILoadHost, IPublishHost
from ayon_unreal import UNREAL_ADDON_ROOT
import unreal # noqa
@ -36,8 +36,7 @@ UNREAL_VERSION = semver.VersionInfo(
*os.getenv("AYON_UNREAL_VERSION").split(".")
)
HOST_DIR = os.path.dirname(os.path.abspath(ayon_core.hosts.unreal.__file__))
PLUGINS_DIR = os.path.join(HOST_DIR, "plugins")
PLUGINS_DIR = os.path.join(UNREAL_ADDON_ROOT, "plugins")
PUBLISH_PATH = os.path.join(PLUGINS_DIR, "publish")
LOAD_PATH = os.path.join(PLUGINS_DIR, "load")
CREATE_PATH = os.path.join(PLUGINS_DIR, "create")