From 5de64bc16b387aa4c94e121983b7499c734f9348 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Thu, 11 Jul 2024 19:43:47 +0800 Subject: [PATCH 01/11] ported ayon_core max code to ayon_max --- client/ayon_max/api/pipeline.py | 26 ++++++++++ client/ayon_max/hooks/pre_copy_mxp.py | 20 ++++++++ client/ayon_max/mxp.py | 68 +++++++++++++++++++++++++++ server/settings/main.py | 44 +++++++++++++++++ 4 files changed, 158 insertions(+) create mode 100644 client/ayon_max/hooks/pre_copy_mxp.py create mode 100644 client/ayon_max/mxp.py diff --git a/client/ayon_max/api/pipeline.py b/client/ayon_max/api/pipeline.py index a87cd657ce..5190b0522b 100644 --- a/client/ayon_max/api/pipeline.py +++ b/client/ayon_max/api/pipeline.py @@ -7,6 +7,8 @@ import json from ayon_core.host import HostBase, IWorkfileHost, ILoadHost, IPublishHost + +from ayon_core.lib import register_event_callback import pyblish.api from ayon_core.pipeline import ( register_creator_plugin_path, @@ -48,8 +50,11 @@ def install(self): register_creator_plugin_path(CREATE_PATH) # self._register_callbacks() + _set_project() + self.menu = AYONMenu() + register_event_callback("workfile.open.before", on_before_open) self._has_been_setup = True rt.callbacks.addScript(rt.Name('systemPostNew'), on_new) @@ -205,6 +210,27 @@ def containerise(name: str, nodes: list, context, return container +def _set_project(): + workdir = os.getenv("AYON_WORKDIR") + + os.makedirs(workdir, exist_ok=True) + mxp_filepath = os.path.join(workdir, "workspace.mxp") + if os.path.exists(mxp_filepath): + rt.pathConfig.load(mxp_filepath) + directory_count = rt.pathConfig.getProjectSubDirectoryCount() + for count in range(directory_count): + proj_dir = rt.pathConfig.getProjectSubDirectory(count) + os.makedirs(proj_dir, exist_ok=True) + rt.pathConfig.doProjectSetupStepsUsingDirectory(workdir) + rt.pathConfig.setCurrentProjectFolder(workdir) + + +def on_before_open(): + """Check and set up project before opening workfile + """ + _set_project() + + def load_custom_attribute_data(): """Re-loading the AYON custom parameter built by the creator diff --git a/client/ayon_max/hooks/pre_copy_mxp.py b/client/ayon_max/hooks/pre_copy_mxp.py new file mode 100644 index 0000000000..48ee459655 --- /dev/null +++ b/client/ayon_max/hooks/pre_copy_mxp.py @@ -0,0 +1,20 @@ +from ayon_applications import PreLaunchHook, LaunchTypes +from ayon_max.mxp import create_workspace_mxp + + +class PreCopyMxp(PreLaunchHook): + """Copy workspace.mxp to workdir. + + Hook `GlobalHostDataHook` must be executed before this hook. + """ + app_groups = {"3dsmax", "adsk_3dsmax"} + launch_types = {LaunchTypes.local} + + def execute(self): + project_entity = self.data["project_entity"] + workdir = self.launch_context.env.get("AYON_WORKDIR") + if not workdir: + self.log.warning("BUG: Workdir is not filled.") + return + + create_workspace_mxp(workdir, project_entity["name"]) diff --git a/client/ayon_max/mxp.py b/client/ayon_max/mxp.py new file mode 100644 index 0000000000..d72b46a49f --- /dev/null +++ b/client/ayon_max/mxp.py @@ -0,0 +1,68 @@ +import os +from ayon_core.settings import get_project_settings +from ayon_core.lib import Logger + + +def create_workspace_mxp(workdir, project_name): + dst_filepath = os.path.join(workdir, "workspace.mxp") + if os.path.exists(dst_filepath): + return + + if not os.path.exists(workdir): + os.makedirs(workdir) + + project_settings = get_project_settings(project_name) + log = Logger.get_logger("create_workspace_mxp") + mxp_workspace = project_settings["max"].get("mxp_workspace") + # Ensure the hook would not cause possible error + # when using the old addon. + if mxp_workspace is None: + log.debug("No mxp workspace setting found in the " + "latest Max Addon. Please update to 0.1.8") + return + + max_script = default_mxp_template() + if mxp_workspace.get("enabled_project_creation"): + max_script = mxp_workspace.get("mxp_workspace_script") + # Skip if mxp script in settings is empty + if not max_script: + log.debug("File 'workspace.mxp' not created. Settings value is empty.") + return + + with open(dst_filepath, "w") as mxp_file: + mxp_file.write(max_script) + + return dst_filepath + + +def default_mxp_template(): + """Return text script for the path configuration if + users do not enable project creation in AYON project + setting + """ + mxp_template = "\n".join(( + '[Directories]', + 'Animations= ./', + 'Archives=./', + 'AutoBackup=./', + 'BitmapProxies=./', + 'Fluid Simulations=./', + 'Images=./', + 'MaxStart=./', + 'Previews=./', + 'RenderAssets=./', + 'RenderOutput= ./renders/3dsmax', + 'Scenes=./', + 'Sounds=./', + '[XReferenceDirs]', + 'Dir1=./', + '[BitmapDirs]', + 'Dir1=C:/Program Files/Autodesk/3ds Max 2023/Maps', + 'Dir2=C:/Program Files/Autodesk/3ds Max 2023/Maps/glare', + 'Dir3=C:/Program Files/Autodesk/3ds Max 2023/Maps/adskMtl', + 'Dir4=C:/Program Files/Autodesk/3ds Max 2023/Maps/Noise', + 'Dir5=C:/Program Files/Autodesk/3ds Max 2023/Maps/mental_mill', + 'Dir6=C:/Program Files/Autodesk/3ds Max 2023/Maps/fx', + 'Dir7=C:/Program Files/Autodesk/3ds Max 2023/Maps/Particle Flow Presets', + )) + return mxp_template diff --git a/server/settings/main.py b/server/settings/main.py index 7b0bfc6421..4597c6a99f 100644 --- a/server/settings/main.py +++ b/server/settings/main.py @@ -21,6 +21,14 @@ def unit_scale_enum(): ] +class MxpWorkspaceSettings(BaseSettingsModel): + enabled_project_creation: bool = SettingsField( + False, title="Enable Project Creation") + mxp_workspace_script: str = SettingsField( + title="Max mxp Workspace", widget="textarea" + ) + + class UnitScaleSettings(BaseSettingsModel): enabled: bool = SettingsField(True, title="Enabled") scene_unit_scale: str = SettingsField( @@ -46,6 +54,10 @@ class MaxSettings(BaseSettingsModel): default_factory=UnitScaleSettings, title="Set Unit Scale" ) + mxp_workspace: MxpWorkspaceSettings = SettingsField( + default_factory=MxpWorkspaceSettings, + title="Max Workspace" + ) imageio: ImageIOSettings = SettingsField( default_factory=ImageIOSettings, title="Color Management (ImageIO)" @@ -67,11 +79,43 @@ class MaxSettings(BaseSettingsModel): title="Publish Plugins") +DEFAULT_MXP_WORKSPACE_SETTINGS = "\n".join(( + '[Directories]', + 'Animations= ./sceneassets/animations', + 'Archives=./archives', + 'AutoBackup=./autoback', + 'BitmapProxies=./proxies', + 'Fluid Simulations=./SimCache', + 'Images=./sceneassets/images', + 'MaxStart=./', + 'Previews=./previews', + 'RenderAssets=./sceneassets/renderassets', + 'RenderOutput= ./renders/3dsmax', + 'Scenes=./', + 'Sounds=./sceneassets/sounds', + '[XReferenceDirs]', + 'Dir1=./', + '[BitmapDirs]', + 'Dir1=C:/Program Files/Autodesk/3ds Max 2023/Maps', + 'Dir2=C:/Program Files/Autodesk/3ds Max 2023/Maps/glare', + 'Dir3=C:/Program Files/Autodesk/3ds Max 2023/Maps/adskMtl', + 'Dir4=C:/Program Files/Autodesk/3ds Max 2023/Maps/Noise', + 'Dir5=C:/Program Files/Autodesk/3ds Max 2023/Maps/mental_mill', + 'Dir6=C:/Program Files/Autodesk/3ds Max 2023/Maps/fx', + 'Dir7=C:/Program Files/Autodesk/3ds Max 2023/Maps/Particle Flow Presets', + '', +)) + + DEFAULT_VALUES = { "unit_scale_settings": { "enabled": True, "scene_unit_scale": "Centimeters" }, + "mxp_workspace": { + "enabled_project_creation": False, + "mxp_workspace_script": DEFAULT_MXP_WORKSPACE_SETTINGS + }, "RenderSettings": DEFAULT_RENDER_SETTINGS, "CreateReview": DEFAULT_CREATE_REVIEW_SETTINGS, "PointCloud": { From 330485f26608d5da5ed347ba0ae873a367561007 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Thu, 11 Jul 2024 21:14:50 +0800 Subject: [PATCH 02/11] remove the hardcoded path --- client/ayon_max/mxp.py | 9 +-------- server/settings/main.py | 8 -------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/client/ayon_max/mxp.py b/client/ayon_max/mxp.py index d72b46a49f..34cba36feb 100644 --- a/client/ayon_max/mxp.py +++ b/client/ayon_max/mxp.py @@ -56,13 +56,6 @@ def default_mxp_template(): 'Sounds=./', '[XReferenceDirs]', 'Dir1=./', - '[BitmapDirs]', - 'Dir1=C:/Program Files/Autodesk/3ds Max 2023/Maps', - 'Dir2=C:/Program Files/Autodesk/3ds Max 2023/Maps/glare', - 'Dir3=C:/Program Files/Autodesk/3ds Max 2023/Maps/adskMtl', - 'Dir4=C:/Program Files/Autodesk/3ds Max 2023/Maps/Noise', - 'Dir5=C:/Program Files/Autodesk/3ds Max 2023/Maps/mental_mill', - 'Dir6=C:/Program Files/Autodesk/3ds Max 2023/Maps/fx', - 'Dir7=C:/Program Files/Autodesk/3ds Max 2023/Maps/Particle Flow Presets', + '' )) return mxp_template diff --git a/server/settings/main.py b/server/settings/main.py index 4597c6a99f..f351338d21 100644 --- a/server/settings/main.py +++ b/server/settings/main.py @@ -95,14 +95,6 @@ class MaxSettings(BaseSettingsModel): 'Sounds=./sceneassets/sounds', '[XReferenceDirs]', 'Dir1=./', - '[BitmapDirs]', - 'Dir1=C:/Program Files/Autodesk/3ds Max 2023/Maps', - 'Dir2=C:/Program Files/Autodesk/3ds Max 2023/Maps/glare', - 'Dir3=C:/Program Files/Autodesk/3ds Max 2023/Maps/adskMtl', - 'Dir4=C:/Program Files/Autodesk/3ds Max 2023/Maps/Noise', - 'Dir5=C:/Program Files/Autodesk/3ds Max 2023/Maps/mental_mill', - 'Dir6=C:/Program Files/Autodesk/3ds Max 2023/Maps/fx', - 'Dir7=C:/Program Files/Autodesk/3ds Max 2023/Maps/Particle Flow Presets', '', )) From a62d69cf130ad4a97a01ab61a9b7c5e56d2e53c6 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Fri, 12 Jul 2024 16:41:59 +0800 Subject: [PATCH 03/11] move the check on the mxp_workspace being enabled in project settings into the prelaunch hook --- client/ayon_max/hooks/pre_copy_mxp.py | 14 +++++++++++++- client/ayon_max/mxp.py | 19 +++---------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/client/ayon_max/hooks/pre_copy_mxp.py b/client/ayon_max/hooks/pre_copy_mxp.py index 48ee459655..357e5c3498 100644 --- a/client/ayon_max/hooks/pre_copy_mxp.py +++ b/client/ayon_max/hooks/pre_copy_mxp.py @@ -1,5 +1,6 @@ from ayon_applications import PreLaunchHook, LaunchTypes from ayon_max.mxp import create_workspace_mxp +from ayon_core.settings import get_project_settings class PreCopyMxp(PreLaunchHook): @@ -12,9 +13,20 @@ class PreCopyMxp(PreLaunchHook): def execute(self): project_entity = self.data["project_entity"] + project_settings = get_project_settings(project_entity.get("name")) + if not project_settings: + return + mxp_workspace = project_settings["max"].get("mxp_workspace") + # Ensure the hook would not cause possible error + # when using the old addon. + if mxp_workspace is None: + self.log.warning("No mxp workspace setting found in the " + "latest Max Addon.") + return + workdir = self.launch_context.env.get("AYON_WORKDIR") if not workdir: self.log.warning("BUG: Workdir is not filled.") return - create_workspace_mxp(workdir, project_entity["name"]) + create_workspace_mxp(workdir, mxp_workspace=mxp_workspace) diff --git a/client/ayon_max/mxp.py b/client/ayon_max/mxp.py index 34cba36feb..f9a79d04dc 100644 --- a/client/ayon_max/mxp.py +++ b/client/ayon_max/mxp.py @@ -1,26 +1,14 @@ import os -from ayon_core.settings import get_project_settings from ayon_core.lib import Logger -def create_workspace_mxp(workdir, project_name): +def create_workspace_mxp(workdir, mxp_workspace=None): dst_filepath = os.path.join(workdir, "workspace.mxp") if os.path.exists(dst_filepath): return - if not os.path.exists(workdir): - os.makedirs(workdir) - - project_settings = get_project_settings(project_name) log = Logger.get_logger("create_workspace_mxp") - mxp_workspace = project_settings["max"].get("mxp_workspace") - # Ensure the hook would not cause possible error - # when using the old addon. - if mxp_workspace is None: - log.debug("No mxp workspace setting found in the " - "latest Max Addon. Please update to 0.1.8") - return - + os.makedirs(workdir, exist_ok=True) max_script = default_mxp_template() if mxp_workspace.get("enabled_project_creation"): max_script = mxp_workspace.get("mxp_workspace_script") @@ -55,7 +43,6 @@ def default_mxp_template(): 'Scenes=./', 'Sounds=./', '[XReferenceDirs]', - 'Dir1=./', - '' + 'Dir1=./' )) return mxp_template From 21249518eb6a5d7e7bcb23c0a0e6801ad266deb9 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Fri, 12 Jul 2024 21:53:37 +0800 Subject: [PATCH 04/11] make sure the project creation won't break the AYON plugins installation --- client/ayon_max/api/pipeline.py | 10 +++++++++- client/ayon_max/hooks/pre_copy_mxp.py | 11 ++++++----- client/ayon_max/mxp.py | 2 +- server/settings/main.py | 3 +-- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/client/ayon_max/api/pipeline.py b/client/ayon_max/api/pipeline.py index 5190b0522b..1545e214bf 100644 --- a/client/ayon_max/api/pipeline.py +++ b/client/ayon_max/api/pipeline.py @@ -15,8 +15,10 @@ register_loader_plugin_path, AVALON_CONTAINER_ID, AYON_CONTAINER_ID, + get_current_project_name ) from ayon_max.api.menu import AYONMenu +from ayon_core.settings import get_project_settings from ayon_max.api import lib from ayon_max.api.plugin import MS_CUSTOM_ATTRIB from ayon_max import MAX_HOST_DIR @@ -211,6 +213,11 @@ def containerise(name: str, nodes: list, context, def _set_project(): + project_name = get_current_project_name() + project_settings = get_project_settings(project_name) + enable_project_creation = project_settings["max"].get("enabled_project_creation") + if not enable_project_creation: + log.debug("Project creation disabled. Skipping project creation.") workdir = os.getenv("AYON_WORKDIR") os.makedirs(workdir, exist_ok=True) @@ -220,7 +227,8 @@ def _set_project(): directory_count = rt.pathConfig.getProjectSubDirectoryCount() for count in range(directory_count): proj_dir = rt.pathConfig.getProjectSubDirectory(count) - os.makedirs(proj_dir, exist_ok=True) + if proj_dir: + os.makedirs(proj_dir, exist_ok=True) rt.pathConfig.doProjectSetupStepsUsingDirectory(workdir) rt.pathConfig.setCurrentProjectFolder(workdir) diff --git a/client/ayon_max/hooks/pre_copy_mxp.py b/client/ayon_max/hooks/pre_copy_mxp.py index 357e5c3498..ffd8692cfb 100644 --- a/client/ayon_max/hooks/pre_copy_mxp.py +++ b/client/ayon_max/hooks/pre_copy_mxp.py @@ -1,6 +1,5 @@ from ayon_applications import PreLaunchHook, LaunchTypes from ayon_max.mxp import create_workspace_mxp -from ayon_core.settings import get_project_settings class PreCopyMxp(PreLaunchHook): @@ -12,11 +11,13 @@ class PreCopyMxp(PreLaunchHook): launch_types = {LaunchTypes.local} def execute(self): - project_entity = self.data["project_entity"] - project_settings = get_project_settings(project_entity.get("name")) - if not project_settings: + max_setting = self.data["project_settings"]["max"] + enabled_project_creation = max_setting.get("enabled_project_creation") + if not enabled_project_creation: + self.log.warning("3dsmax project creation is not enabled. " + "Skipping creating workspace.mxp to workdir.") return - mxp_workspace = project_settings["max"].get("mxp_workspace") + mxp_workspace = max_setting.get("mxp_workspace") # Ensure the hook would not cause possible error # when using the old addon. if mxp_workspace is None: diff --git a/client/ayon_max/mxp.py b/client/ayon_max/mxp.py index f9a79d04dc..8ad868a1d6 100644 --- a/client/ayon_max/mxp.py +++ b/client/ayon_max/mxp.py @@ -10,7 +10,7 @@ def create_workspace_mxp(workdir, mxp_workspace=None): log = Logger.get_logger("create_workspace_mxp") os.makedirs(workdir, exist_ok=True) max_script = default_mxp_template() - if mxp_workspace.get("enabled_project_creation"): + if mxp_workspace and mxp_workspace.get("enabled_project_creation"): max_script = mxp_workspace.get("mxp_workspace_script") # Skip if mxp script in settings is empty if not max_script: diff --git a/server/settings/main.py b/server/settings/main.py index f351338d21..a0d0ea99a2 100644 --- a/server/settings/main.py +++ b/server/settings/main.py @@ -94,8 +94,7 @@ class MaxSettings(BaseSettingsModel): 'Scenes=./', 'Sounds=./sceneassets/sounds', '[XReferenceDirs]', - 'Dir1=./', - '', + 'Dir1=./' )) From 6fc1f244d7831aa7e42c6a1a3c3e767eda69b6a6 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Thu, 18 Jul 2024 23:59:58 +0800 Subject: [PATCH 05/11] make sure it doesn't show popup-dialog to convey project has been created --- client/ayon_max/api/pipeline.py | 2 +- client/ayon_max/hooks/pre_copy_mxp.py | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/client/ayon_max/api/pipeline.py b/client/ayon_max/api/pipeline.py index 1545e214bf..34b7f75f83 100644 --- a/client/ayon_max/api/pipeline.py +++ b/client/ayon_max/api/pipeline.py @@ -229,7 +229,7 @@ def _set_project(): proj_dir = rt.pathConfig.getProjectSubDirectory(count) if proj_dir: os.makedirs(proj_dir, exist_ok=True) - rt.pathConfig.doProjectSetupStepsUsingDirectory(workdir) + #rt.pathConfig.doProjectSetupStepsUsingDirectory(workdir) rt.pathConfig.setCurrentProjectFolder(workdir) diff --git a/client/ayon_max/hooks/pre_copy_mxp.py b/client/ayon_max/hooks/pre_copy_mxp.py index ffd8692cfb..4d1ed35044 100644 --- a/client/ayon_max/hooks/pre_copy_mxp.py +++ b/client/ayon_max/hooks/pre_copy_mxp.py @@ -12,11 +12,6 @@ class PreCopyMxp(PreLaunchHook): def execute(self): max_setting = self.data["project_settings"]["max"] - enabled_project_creation = max_setting.get("enabled_project_creation") - if not enabled_project_creation: - self.log.warning("3dsmax project creation is not enabled. " - "Skipping creating workspace.mxp to workdir.") - return mxp_workspace = max_setting.get("mxp_workspace") # Ensure the hook would not cause possible error # when using the old addon. @@ -24,7 +19,11 @@ def execute(self): self.log.warning("No mxp workspace setting found in the " "latest Max Addon.") return - + enabled_project_creation = max_setting["mxp_workspace"].get("enabled_project_creation") + if not enabled_project_creation: + self.log.warning("3dsmax project creation is not enabled. " + "Skipping creating workspace.mxp to workdir.") + return workdir = self.launch_context.env.get("AYON_WORKDIR") if not workdir: self.log.warning("BUG: Workdir is not filled.") From dbcfca49bf6b5a43cca5a05a49d74be522c516f7 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Fri, 19 Jul 2024 00:04:19 +0800 Subject: [PATCH 06/11] debug message --- client/ayon_max/hooks/pre_copy_mxp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/ayon_max/hooks/pre_copy_mxp.py b/client/ayon_max/hooks/pre_copy_mxp.py index 4d1ed35044..cbdbbba2fb 100644 --- a/client/ayon_max/hooks/pre_copy_mxp.py +++ b/client/ayon_max/hooks/pre_copy_mxp.py @@ -19,9 +19,9 @@ def execute(self): self.log.warning("No mxp workspace setting found in the " "latest Max Addon.") return - enabled_project_creation = max_setting["mxp_workspace"].get("enabled_project_creation") + enabled_project_creation = mxp_workspace.get("enabled_project_creation") if not enabled_project_creation: - self.log.warning("3dsmax project creation is not enabled. " + self.log.warning("3dsmax project creation is disabled. " "Skipping creating workspace.mxp to workdir.") return workdir = self.launch_context.env.get("AYON_WORKDIR") From 02cb34c1a6c2a101e7253c9d08b98164a008e20d Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Fri, 19 Jul 2024 00:05:36 +0800 Subject: [PATCH 07/11] debug message --- client/ayon_max/hooks/pre_copy_mxp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/ayon_max/hooks/pre_copy_mxp.py b/client/ayon_max/hooks/pre_copy_mxp.py index cbdbbba2fb..4173be2caf 100644 --- a/client/ayon_max/hooks/pre_copy_mxp.py +++ b/client/ayon_max/hooks/pre_copy_mxp.py @@ -21,8 +21,8 @@ def execute(self): return enabled_project_creation = mxp_workspace.get("enabled_project_creation") if not enabled_project_creation: - self.log.warning("3dsmax project creation is disabled. " - "Skipping creating workspace.mxp to workdir.") + self.log.debug("3dsmax project creation is not enabled. " + "Skipping creating workspace.mxp to workdir.") return workdir = self.launch_context.env.get("AYON_WORKDIR") if not workdir: From 7d672d66f927ed55175538797eb10a5b1db06a6c Mon Sep 17 00:00:00 2001 From: Kayla Man <64118225+moonyuet@users.noreply.github.com> Date: Fri, 19 Jul 2024 00:11:56 +0800 Subject: [PATCH 08/11] Update client/ayon_max/api/pipeline.py Co-authored-by: Roy Nieterau --- client/ayon_max/api/pipeline.py | 1 - 1 file changed, 1 deletion(-) diff --git a/client/ayon_max/api/pipeline.py b/client/ayon_max/api/pipeline.py index 34b7f75f83..332c3886a2 100644 --- a/client/ayon_max/api/pipeline.py +++ b/client/ayon_max/api/pipeline.py @@ -229,7 +229,6 @@ def _set_project(): proj_dir = rt.pathConfig.getProjectSubDirectory(count) if proj_dir: os.makedirs(proj_dir, exist_ok=True) - #rt.pathConfig.doProjectSetupStepsUsingDirectory(workdir) rt.pathConfig.setCurrentProjectFolder(workdir) From a9d20cdd5952dfab744d65ff21386ce62439530c Mon Sep 17 00:00:00 2001 From: Kayla Man <64118225+moonyuet@users.noreply.github.com> Date: Fri, 19 Jul 2024 00:18:59 +0800 Subject: [PATCH 09/11] Update client/ayon_max/api/pipeline.py Co-authored-by: Roy Nieterau --- client/ayon_max/api/pipeline.py | 1 - 1 file changed, 1 deletion(-) diff --git a/client/ayon_max/api/pipeline.py b/client/ayon_max/api/pipeline.py index 332c3886a2..0809b736cd 100644 --- a/client/ayon_max/api/pipeline.py +++ b/client/ayon_max/api/pipeline.py @@ -51,7 +51,6 @@ def install(self): register_loader_plugin_path(LOAD_PATH) register_creator_plugin_path(CREATE_PATH) - # self._register_callbacks() _set_project() self.menu = AYONMenu() From 98cf3d47ed54bbf6512c2390fcfd44d3256b6880 Mon Sep 17 00:00:00 2001 From: Kayla Man <64118225+moonyuet@users.noreply.github.com> Date: Fri, 19 Jul 2024 00:19:09 +0800 Subject: [PATCH 10/11] Update client/ayon_max/mxp.py Co-authored-by: Roy Nieterau --- client/ayon_max/mxp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_max/mxp.py b/client/ayon_max/mxp.py index 8ad868a1d6..6cfae4596e 100644 --- a/client/ayon_max/mxp.py +++ b/client/ayon_max/mxp.py @@ -8,7 +8,6 @@ def create_workspace_mxp(workdir, mxp_workspace=None): return log = Logger.get_logger("create_workspace_mxp") - os.makedirs(workdir, exist_ok=True) max_script = default_mxp_template() if mxp_workspace and mxp_workspace.get("enabled_project_creation"): max_script = mxp_workspace.get("mxp_workspace_script") @@ -17,6 +16,7 @@ def create_workspace_mxp(workdir, mxp_workspace=None): log.debug("File 'workspace.mxp' not created. Settings value is empty.") return + os.makedirs(workdir, exist_ok=True) with open(dst_filepath, "w") as mxp_file: mxp_file.write(max_script) From 95b058b40ec21e910e359319bce019e3d58c1ef4 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Fri, 19 Jul 2024 00:32:01 +0800 Subject: [PATCH 11/11] check if the project creation being enabled --- client/ayon_max/mxp.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/ayon_max/mxp.py b/client/ayon_max/mxp.py index 6cfae4596e..78630d3b9b 100644 --- a/client/ayon_max/mxp.py +++ b/client/ayon_max/mxp.py @@ -9,7 +9,11 @@ def create_workspace_mxp(workdir, mxp_workspace=None): log = Logger.get_logger("create_workspace_mxp") max_script = default_mxp_template() - if mxp_workspace and mxp_workspace.get("enabled_project_creation"): + if mxp_workspace: + if not mxp_workspace.get("enabled_project_creation"): + log.debug("3dsmax project creation is disabled.") + return + max_script = mxp_workspace.get("mxp_workspace_script") # Skip if mxp script in settings is empty if not max_script: