Skip to content

Commit

Permalink
make sure the context setting and project workfile dir being set corr…
Browse files Browse the repository at this point in the history
…ectly during the installation
  • Loading branch information
moonyuet committed Nov 19, 2024
1 parent 7d92d59 commit 72abb97
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions client/ayon_max/api/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ def install(self):
register_creator_plugin_path(CREATE_PATH)

_set_project()
lib.set_context_setting()

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)

rt.callbacks.addScript(rt.Name('filePostOpen'),
Expand Down Expand Up @@ -214,13 +214,14 @@ def containerise(name: str, nodes: list, context,
def _set_project():
project_name = get_current_project_name()
project_settings = get_project_settings(project_name)
workdir = os.getenv("AYON_WORKDIR")
os.makedirs(workdir, exist_ok=True)
rt.pathConfig.setCurrentProjectFolder(workdir)
enable_project_creation = project_settings["max"].get("enabled_project_creation")
if not enable_project_creation:
log.debug("Project creation disabled. Skipping project creation.")
return
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)
Expand All @@ -229,7 +230,6 @@ def _set_project():
proj_dir = rt.pathConfig.getProjectSubDirectory(count)
if proj_dir:
os.makedirs(proj_dir, exist_ok=True)
rt.pathConfig.setCurrentProjectFolder(workdir)


def on_before_open():
Expand Down

0 comments on commit 72abb97

Please sign in to comment.