From 4690d905d90e912154bd0a935d9b7131f60bd3cf Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Mon, 7 Dec 2020 17:14:20 +0100 Subject: [PATCH] removed converted hooks --- pype/hooks/celaction/prelaunch.py | 208 -------------------------- pype/hooks/fusion/prelaunch.py | 61 -------- pype/hooks/photoshop/prelaunch.py | 23 --- pype/hooks/premiere/prelaunch.py | 161 -------------------- pype/hooks/resolve/prelaunch.py | 69 --------- pype/hooks/tvpaint/prelaunch.py | 136 ----------------- pype/hooks/unreal/unreal_prelaunch.py | 83 ---------- 7 files changed, 741 deletions(-) delete mode 100644 pype/hooks/celaction/prelaunch.py delete mode 100644 pype/hooks/fusion/prelaunch.py delete mode 100644 pype/hooks/photoshop/prelaunch.py delete mode 100644 pype/hooks/premiere/prelaunch.py delete mode 100644 pype/hooks/resolve/prelaunch.py delete mode 100644 pype/hooks/tvpaint/prelaunch.py delete mode 100644 pype/hooks/unreal/unreal_prelaunch.py diff --git a/pype/hooks/celaction/prelaunch.py b/pype/hooks/celaction/prelaunch.py deleted file mode 100644 index c8541a9bc3..0000000000 --- a/pype/hooks/celaction/prelaunch.py +++ /dev/null @@ -1,208 +0,0 @@ -import logging -import os -import winreg -import shutil -from pype.lib import PypeHook -from pype.api import ( - Anatomy, - Logger, - get_last_version_from_path -) - -from avalon import io, api, lib - -log = logging.getLogger(__name__) - - -class CelactionPrelaunchHook(PypeHook): - """ - This hook will check if current workfile path has Unreal - project inside. IF not, it initialize it and finally it pass - path to the project by environment variable to Unreal launcher - shell script. - """ - workfile_ext = "scn" - - def __init__(self, logger=None): - if not logger: - self.log = Logger().get_logger(self.__class__.__name__) - else: - self.log = logger - - self.signature = "( {} )".format(self.__class__.__name__) - - def execute(self, *args, env: dict = None) -> bool: - if not env: - env = os.environ - - # initialize - self._S = api.Session - - # get publish version of celaction - app = "celaction_publish" - - # get context variables - project = self._S["AVALON_PROJECT"] = env["AVALON_PROJECT"] - asset = self._S["AVALON_ASSET"] = env["AVALON_ASSET"] - task = self._S["AVALON_TASK"] = env["AVALON_TASK"] - workdir = self._S["AVALON_WORKDIR"] = env["AVALON_WORKDIR"] - - # get workfile path - anatomy_filled = self.get_anatomy_filled() - workfile = anatomy_filled["work"]["file"] - version = anatomy_filled["version"] - - # create workdir if doesn't exist - os.makedirs(workdir, exist_ok=True) - self.log.info(f"Work dir is: `{workdir}`") - - # get last version of workfile - workfile_last = env.get("AVALON_LAST_WORKFILE") - self.log.debug(f"_ workfile_last: `{workfile_last}`") - - if workfile_last: - workfile = workfile_last - - workfile_path = os.path.join(workdir, workfile) - - # copy workfile from template if doesnt exist any on path - if not os.path.isfile(workfile_path): - # try to get path from environment or use default - # from `pype.celation` dir - template_path = env.get("CELACTION_TEMPLATE") or os.path.join( - env.get("PYPE_MODULE_ROOT"), - "pype/hosts/celaction/celaction_template_scene.scn" - ) - self.log.info( - f"Creating workfile from template: `{template_path}`") - shutil.copy2( - os.path.normpath(template_path), - os.path.normpath(workfile_path) - ) - - self.log.info(f"Workfile to open: `{workfile_path}`") - - # adding compulsory environment var for openting file - env["PYPE_CELACTION_PROJECT_FILE"] = workfile_path - - # setting output parameters - path = r"Software\CelAction\CelAction2D\User Settings" - winreg.CreateKey(winreg.HKEY_CURRENT_USER, path) - hKey = winreg.OpenKey( - winreg.HKEY_CURRENT_USER, - "Software\\CelAction\\CelAction2D\\User Settings", 0, - winreg.KEY_ALL_ACCESS) - - # TODO: change to root path and pyblish standalone to premiere way - pype_root_path = os.getenv("PYPE_SETUP_PATH") - path = os.path.join(pype_root_path, - "pype.bat") - - winreg.SetValueEx(hKey, "SubmitAppTitle", 0, winreg.REG_SZ, path) - - parameters = [ - "launch", - f"--app {app}", - f"--project {project}", - f"--asset {asset}", - f"--task {task}", - "--currentFile \\\"\"*SCENE*\"\\\"", - "--chunk 10", - "--frameStart *START*", - "--frameEnd *END*", - "--resolutionWidth *X*", - "--resolutionHeight *Y*", - # "--programDir \"'*PROGPATH*'\"" - ] - winreg.SetValueEx(hKey, "SubmitParametersTitle", 0, winreg.REG_SZ, - " ".join(parameters)) - - # setting resolution parameters - path = r"Software\CelAction\CelAction2D\User Settings\Dialogs" - path += r"\SubmitOutput" - winreg.CreateKey(winreg.HKEY_CURRENT_USER, path) - hKey = winreg.OpenKey(winreg.HKEY_CURRENT_USER, path, 0, - winreg.KEY_ALL_ACCESS) - winreg.SetValueEx(hKey, "SaveScene", 0, winreg.REG_DWORD, 1) - winreg.SetValueEx(hKey, "CustomX", 0, winreg.REG_DWORD, 1920) - winreg.SetValueEx(hKey, "CustomY", 0, winreg.REG_DWORD, 1080) - - # making sure message dialogs don't appear when overwriting - path = r"Software\CelAction\CelAction2D\User Settings\Messages" - path += r"\OverwriteScene" - winreg.CreateKey(winreg.HKEY_CURRENT_USER, path) - hKey = winreg.OpenKey(winreg.HKEY_CURRENT_USER, path, 0, - winreg.KEY_ALL_ACCESS) - winreg.SetValueEx(hKey, "Result", 0, winreg.REG_DWORD, 6) - winreg.SetValueEx(hKey, "Valid", 0, winreg.REG_DWORD, 1) - - path = r"Software\CelAction\CelAction2D\User Settings\Messages" - path += r"\SceneSaved" - winreg.CreateKey(winreg.HKEY_CURRENT_USER, path) - hKey = winreg.OpenKey(winreg.HKEY_CURRENT_USER, path, 0, - winreg.KEY_ALL_ACCESS) - winreg.SetValueEx(hKey, "Result", 0, winreg.REG_DWORD, 1) - winreg.SetValueEx(hKey, "Valid", 0, winreg.REG_DWORD, 1) - - return True - - def get_anatomy_filled(self): - root_path = api.registered_root() - project_name = self._S["AVALON_PROJECT"] - asset_name = self._S["AVALON_ASSET"] - - io.install() - project_entity = io.find_one({ - "type": "project", - "name": project_name - }) - assert project_entity, ( - "Project '{0}' was not found." - ).format(project_name) - log.debug("Collected Project \"{}\"".format(project_entity)) - - asset_entity = io.find_one({ - "type": "asset", - "name": asset_name, - "parent": project_entity["_id"] - }) - assert asset_entity, ( - "No asset found by the name '{0}' in project '{1}'" - ).format(asset_name, project_name) - - project_name = project_entity["name"] - - log.info( - "Anatomy object collected for project \"{}\".".format(project_name) - ) - - hierarchy_items = asset_entity["data"]["parents"] - hierarchy = "" - if hierarchy_items: - hierarchy = os.path.join(*hierarchy_items) - - template_data = { - "root": root_path, - "project": { - "name": project_name, - "code": project_entity["data"].get("code") - }, - "asset": asset_entity["name"], - "hierarchy": hierarchy.replace("\\", "/"), - "task": self._S["AVALON_TASK"], - "ext": self.workfile_ext, - "version": 1, - "username": os.getenv("PYPE_USERNAME", "").strip() - } - - avalon_app_name = os.environ.get("AVALON_APP_NAME") - if avalon_app_name: - application_def = lib.get_application(avalon_app_name) - app_dir = application_def.get("application_dir") - if app_dir: - template_data["app"] = app_dir - - anatomy = Anatomy(project_name) - anatomy_filled = anatomy.format_all(template_data).get_solved() - - return anatomy_filled diff --git a/pype/hooks/fusion/prelaunch.py b/pype/hooks/fusion/prelaunch.py deleted file mode 100644 index 69e91eda05..0000000000 --- a/pype/hooks/fusion/prelaunch.py +++ /dev/null @@ -1,61 +0,0 @@ -import os -import traceback -import importlib -from pype.lib import PypeHook -from pypeapp import Logger -from pype.hosts.fusion import utils - - -class FusionPrelaunch(PypeHook): - """ - This hook will check if current workfile path has Fusion - project inside. - """ - - def __init__(self, logger=None): - if not logger: - self.log = Logger().get_logger(self.__class__.__name__) - else: - self.log = logger - - self.signature = "( {} )".format(self.__class__.__name__) - - def execute(self, *args, env: dict = None) -> bool: - - if not env: - env = os.environ - - # making sure pyton 3.6 is installed at provided path - py36_dir = os.path.normpath(env.get("PYTHON36", "")) - assert os.path.isdir(py36_dir), ( - "Python 3.6 is not installed at the provided folder path. Either " - "make sure the `environments\resolve.json` is having correctly " - "set `PYTHON36` or make sure Python 3.6 is installed " - f"in given path. \nPYTHON36E: `{py36_dir}`" - ) - self.log.info(f"Path to Fusion Python folder: `{py36_dir}`...") - env["PYTHON36"] = py36_dir - - # setting utility scripts dir for scripts syncing - us_dir = os.path.normpath(env.get("FUSION_UTILITY_SCRIPTS_DIR", "")) - assert os.path.isdir(us_dir), ( - "Fusion utility script dir does not exists. Either make sure " - "the `environments\fusion.json` is having correctly set " - "`FUSION_UTILITY_SCRIPTS_DIR` or reinstall DaVinci Resolve. \n" - f"FUSION_UTILITY_SCRIPTS_DIR: `{us_dir}`" - ) - - try: - __import__("avalon.fusion") - __import__("pyblish") - - except ImportError as e: - print(traceback.format_exc()) - print("pyblish: Could not load integration: %s " % e) - - else: - # Resolve Setup integration - importlib.reload(utils) - utils.setup(env) - - return True diff --git a/pype/hooks/photoshop/prelaunch.py b/pype/hooks/photoshop/prelaunch.py deleted file mode 100644 index 4f00e4cd83..0000000000 --- a/pype/hooks/photoshop/prelaunch.py +++ /dev/null @@ -1,23 +0,0 @@ -import pype.lib -from pype.api import Logger - - -class PhotoshopPrelaunch(pype.lib.PypeHook): - """This hook will check for the existence of PyWin - - PyWin is a requirement for the Photoshop integration. - """ - project_code = None - - def __init__(self, logger=None): - if not logger: - self.log = Logger().get_logger(self.__class__.__name__) - else: - self.log = logger - - self.signature = "( {} )".format(self.__class__.__name__) - - def execute(self, *args, env: dict = None) -> bool: - output = pype.lib._subprocess(["pip", "install", "pywin32==227"]) - self.log.info(output) - return True diff --git a/pype/hooks/premiere/prelaunch.py b/pype/hooks/premiere/prelaunch.py deleted file mode 100644 index c0a65c0bf2..0000000000 --- a/pype/hooks/premiere/prelaunch.py +++ /dev/null @@ -1,161 +0,0 @@ -import os -import traceback -import winreg -from avalon import api, io, lib -from pype.lib import PypeHook -from pype.api import Logger, Anatomy -from pype.hosts.premiere import lib as prlib - - -class PremierePrelaunch(PypeHook): - """ - This hook will check if current workfile path has Adobe Premiere - project inside. IF not, it initialize it and finally it pass - path to the project by environment variable to Premiere launcher - shell script. - """ - project_code = None - reg_string_value = [{ - "path": r"Software\Adobe\CSXS.9", - "name": "PlayerDebugMode", - "type": winreg.REG_SZ, - "value": "1" - }] - - def __init__(self, logger=None): - if not logger: - self.log = Logger().get_logger(self.__class__.__name__) - else: - self.log = logger - - self.signature = "( {} )".format(self.__class__.__name__) - - def execute(self, *args, env: dict = None) -> bool: - - if not env: - env = os.environ - - # initialize - self._S = api.Session - - # get context variables - self._S["AVALON_PROJECT"] = env["AVALON_PROJECT"] - self._S["AVALON_ASSET"] = env["AVALON_ASSET"] - task = self._S["AVALON_TASK"] = env["AVALON_TASK"] - - # get workfile path - anatomy_filled = self.get_anatomy_filled() - - # if anatomy template should have different root for particular task - # just add for example > work[conforming]: - workfile_search_key = f"work[{task.lower()}]" - workfile_key = anatomy_filled.get( - workfile_search_key, - anatomy_filled.get("work") - ) - workdir = env["AVALON_WORKDIR"] = workfile_key["folder"] - - # create workdir if doesn't exist - os.makedirs(workdir, exist_ok=True) - self.log.info(f"Work dir is: `{workdir}`") - - # adding project code to env - env["AVALON_PROJECT_CODE"] = self.project_code - - # add keys to registry - self.modify_registry() - - # start avalon - try: - __import__("pype.hosts.premiere") - __import__("pyblish") - - except ImportError as e: - print(traceback.format_exc()) - print("pyblish: Could not load integration: %s " % e) - - else: - # Premiere Setup integration - prlib.setup(env) - - return True - - def modify_registry(self): - # adding key to registry - for key in self.reg_string_value: - winreg.CreateKey(winreg.HKEY_CURRENT_USER, key["path"]) - rg_key = winreg.OpenKey( - key=winreg.HKEY_CURRENT_USER, - sub_key=key["path"], - reserved=0, - access=winreg.KEY_ALL_ACCESS) - - winreg.SetValueEx( - rg_key, - key["name"], - 0, - key["type"], - key["value"] - ) - - def get_anatomy_filled(self): - root_path = api.registered_root() - project_name = self._S["AVALON_PROJECT"] - asset_name = self._S["AVALON_ASSET"] - - io.install() - project_entity = io.find_one({ - "type": "project", - "name": project_name - }) - assert project_entity, ( - "Project '{0}' was not found." - ).format(project_name) - self.log.debug("Collected Project \"{}\"".format(project_entity)) - - asset_entity = io.find_one({ - "type": "asset", - "name": asset_name, - "parent": project_entity["_id"] - }) - assert asset_entity, ( - "No asset found by the name '{0}' in project '{1}'" - ).format(asset_name, project_name) - - project_name = project_entity["name"] - self.project_code = project_entity["data"].get("code") - - self.log.info( - "Anatomy object collected for project \"{}\".".format(project_name) - ) - - hierarchy_items = asset_entity["data"]["parents"] - hierarchy = "" - if hierarchy_items: - hierarchy = os.path.join(*hierarchy_items) - - template_data = { - "root": root_path, - "project": { - "name": project_name, - "code": self.project_code - }, - "asset": asset_entity["name"], - "hierarchy": hierarchy.replace("\\", "/"), - "task": self._S["AVALON_TASK"], - "ext": "ppro", - "version": 1, - "username": os.getenv("PYPE_USERNAME", "").strip() - } - - avalon_app_name = os.environ.get("AVALON_APP_NAME") - if avalon_app_name: - application_def = lib.get_application(avalon_app_name) - app_dir = application_def.get("application_dir") - if app_dir: - template_data["app"] = app_dir - - anatomy = Anatomy(project_name) - anatomy_filled = anatomy.format_all(template_data).get_solved() - - return anatomy_filled diff --git a/pype/hooks/resolve/prelaunch.py b/pype/hooks/resolve/prelaunch.py deleted file mode 100644 index a122b87868..0000000000 --- a/pype/hooks/resolve/prelaunch.py +++ /dev/null @@ -1,69 +0,0 @@ -import os -import traceback -import importlib -from pype.lib import PypeHook -from pypeapp import Logger -from pype.hosts.resolve import utils - - -class ResolvePrelaunch(PypeHook): - """ - This hook will check if current workfile path has Resolve - project inside. IF not, it initialize it and finally it pass - path to the project by environment variable to Premiere launcher - shell script. - """ - - def __init__(self, logger=None): - if not logger: - self.log = Logger().get_logger(self.__class__.__name__) - else: - self.log = logger - - self.signature = "( {} )".format(self.__class__.__name__) - - def execute(self, *args, env: dict = None) -> bool: - - if not env: - env = os.environ - - # making sure pyton 3.6 is installed at provided path - py36_dir = os.path.normpath(env.get("PYTHON36_RESOLVE", "")) - assert os.path.isdir(py36_dir), ( - "Python 3.6 is not installed at the provided folder path. Either " - "make sure the `environments\resolve.json` is having correctly " - "set `PYTHON36_RESOLVE` or make sure Python 3.6 is installed " - f"in given path. \nPYTHON36_RESOLVE: `{py36_dir}`" - ) - self.log.info(f"Path to Resolve Python folder: `{py36_dir}`...") - env["PYTHON36_RESOLVE"] = py36_dir - - # setting utility scripts dir for scripts syncing - us_dir = os.path.normpath(env.get("RESOLVE_UTILITY_SCRIPTS_DIR", "")) - assert os.path.isdir(us_dir), ( - "Resolve utility script dir does not exists. Either make sure " - "the `environments\resolve.json` is having correctly set " - "`RESOLVE_UTILITY_SCRIPTS_DIR` or reinstall DaVinci Resolve. \n" - f"RESOLVE_UTILITY_SCRIPTS_DIR: `{us_dir}`" - ) - self.log.debug(f"-- us_dir: `{us_dir}`") - - # correctly format path for pre python script - pre_py_sc = os.path.normpath(env.get("PRE_PYTHON_SCRIPT", "")) - env["PRE_PYTHON_SCRIPT"] = pre_py_sc - self.log.debug(f"-- pre_py_sc: `{pre_py_sc}`...") - try: - __import__("pype.hosts.resolve") - __import__("pyblish") - - except ImportError as e: - print(traceback.format_exc()) - print("pyblish: Could not load integration: %s " % e) - - else: - # Resolve Setup integration - importlib.reload(utils) - self.log.debug(f"-- utils.__file__: `{utils.__file__}`") - utils.setup(env) - - return True diff --git a/pype/hooks/tvpaint/prelaunch.py b/pype/hooks/tvpaint/prelaunch.py deleted file mode 100644 index 0b3899f555..0000000000 --- a/pype/hooks/tvpaint/prelaunch.py +++ /dev/null @@ -1,136 +0,0 @@ -import os -import shutil -import platform -import pype.lib -from pype.api import Anatomy, Logger -import getpass -import avalon.api - - -class TvpaintPrelaunchHook(pype.lib.PypeHook): - """ - Workfile preparation hook - """ - host_name = "tvpaint" - - def __init__(self, logger=None): - if not logger: - self.log = Logger().get_logger(self.__class__.__name__) - else: - self.log = logger - - self.signature = "( {} )".format(self.__class__.__name__) - - def install_pywin(self): - if platform.system().lower() != "windows": - return - - try: - from win32com.shell import shell - except Exception: - output = pype.lib._subprocess(["pip", "install", "pywin32==227"]) - self.log.info(output) - - def execute(self, *args, env: dict = None) -> bool: - if not env: - env = os.environ - - self.install_pywin() - - # get context variables - project_name = env["AVALON_PROJECT"] - asset_name = env["AVALON_ASSET"] - task_name = env["AVALON_TASK"] - workdir = env["AVALON_WORKDIR"] - extension = avalon.api.HOST_WORKFILE_EXTENSIONS[self.host_name][0] - - # get workfile path - workfile_path = self.get_anatomy_filled( - workdir, project_name, asset_name, task_name) - - # create workdir if doesn't exist - os.makedirs(workdir, exist_ok=True) - self.log.info(f"Work dir is: `{workdir}`") - - # get last version of workfile - workfile_last = env.get("AVALON_LAST_WORKFILE") - self.log.debug(f"_ workfile_last: `{workfile_last}`") - - if workfile_last: - workfile = workfile_last - workfile_path = os.path.join(workdir, workfile) - - # copy workfile from template if doesnt exist any on path - if not os.path.isfile(workfile_path): - # try to get path from environment or use default - # from `pype.hosts.tvpaint` dir - template_path = env.get("TVPAINT_TEMPLATE") or os.path.join( - env.get("PYPE_MODULE_ROOT"), - "pype/hosts/tvpaint/template.tvpp" - ) - - # try to get template from project config folder - proj_config_path = os.path.join( - env["PYPE_PROJECT_CONFIGS"], project_name) - if os.path.exists(proj_config_path): - - template_file = None - for f in os.listdir(proj_config_path): - if extension in os.path.splitext(f): - template_file = f - - if template_file: - template_path = os.path.join( - proj_config_path, template_file) - self.log.info( - f"Creating workfile from template: `{template_path}`") - - # copy template to new destinantion - shutil.copy2( - os.path.normpath(template_path), - os.path.normpath(workfile_path) - ) - - self.log.info(f"Workfile to open: `{workfile_path}`") - - # adding compulsory environment var for openting file - env["PYPE_TVPAINT_PROJECT_FILE"] = workfile_path - - return True - - def get_anatomy_filled(self, workdir, project_name, asset_name, task_name): - dbcon = avalon.api.AvalonMongoDB() - dbcon.install() - dbcon.Session["AVALON_PROJECT"] = project_name - project_document = dbcon.find_one({"type": "project"}) - asset_document = dbcon.find_one({ - "type": "asset", - "name": asset_name - }) - dbcon.uninstall() - - asset_doc_parents = asset_document["data"].get("parents") - hierarchy = "/".join(asset_doc_parents) - - data = { - "project": { - "name": project_document["name"], - "code": project_document["data"].get("code") - }, - "task": task_name, - "asset": asset_name, - "app": self.host_name, - "hierarchy": hierarchy - } - anatomy = Anatomy(project_name) - extensions = avalon.api.HOST_WORKFILE_EXTENSIONS[self.host_name] - file_template = anatomy.templates["work"]["file"] - data.update({ - "version": 1, - "user": os.environ.get("PYPE_USERNAME") or getpass.getuser(), - "ext": extensions[0] - }) - - return avalon.api.last_workfile( - workdir, file_template, data, extensions, True - ) diff --git a/pype/hooks/unreal/unreal_prelaunch.py b/pype/hooks/unreal/unreal_prelaunch.py deleted file mode 100644 index 9f0cc45b96..0000000000 --- a/pype/hooks/unreal/unreal_prelaunch.py +++ /dev/null @@ -1,83 +0,0 @@ -import logging -import os - -from pype.lib import PypeHook -from pype.hosts.unreal import lib as unreal_lib -from pype.api import Logger - -log = logging.getLogger(__name__) - - -class UnrealPrelaunch(PypeHook): - """ - This hook will check if current workfile path has Unreal - project inside. IF not, it initialize it and finally it pass - path to the project by environment variable to Unreal launcher - shell script. - """ - - def __init__(self, logger=None): - if not logger: - self.log = Logger().get_logger(self.__class__.__name__) - else: - self.log = logger - - self.signature = "( {} )".format(self.__class__.__name__) - - def execute(self, *args, env: dict = None) -> bool: - if not env: - env = os.environ - asset = env["AVALON_ASSET"] - task = env["AVALON_TASK"] - workdir = env["AVALON_WORKDIR"] - engine_version = env["AVALON_APP_NAME"].split("_")[-1] - project_name = f"{asset}_{task}" - - # Unreal is sensitive about project names longer then 20 chars - if len(project_name) > 20: - self.log.warning((f"Project name exceed 20 characters " - f"({project_name})!")) - - # Unreal doesn't accept non alphabet characters at the start - # of the project name. This is because project name is then used - # in various places inside c++ code and there variable names cannot - # start with non-alpha. We append 'P' before project name to solve it. - # 😱 - if not project_name[:1].isalpha(): - self.log.warning(f"Project name doesn't start with alphabet " - f"character ({project_name}). Appending 'P'") - project_name = f"P{project_name}" - - project_path = os.path.join(workdir, project_name) - - self.log.info((f"{self.signature} requested UE4 version: " - f"[ {engine_version} ]")) - - detected = unreal_lib.get_engine_versions() - detected_str = ', '.join(detected.keys()) or 'none' - self.log.info((f"{self.signature} detected UE4 versions: " - f"[ {detected_str} ]")) - del(detected_str) - engine_version = ".".join(engine_version.split(".")[:2]) - if engine_version not in detected.keys(): - self.log.error((f"{self.signature} requested version not " - f"detected [ {engine_version} ]")) - return False - - os.makedirs(project_path, exist_ok=True) - - project_file = os.path.join(project_path, f"{project_name}.uproject") - engine_path = detected[engine_version] - if not os.path.isfile(project_file): - self.log.info((f"{self.signature} creating unreal " - f"project [ {project_name} ]")) - if env.get("AVALON_UNREAL_PLUGIN"): - os.environ["AVALON_UNREAL_PLUGIN"] = env.get("AVALON_UNREAL_PLUGIN") # noqa: E501 - unreal_lib.create_unreal_project(project_name, - engine_version, - project_path, - engine_path=engine_path) - - env["PYPE_UNREAL_PROJECT_FILE"] = project_file - env["AVALON_CURRENT_UNREAL_ENGINE"] = engine_path - return True