mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
adding and loading maya mel workspace through openpype project setting
This commit is contained in:
parent
69d2cf20f5
commit
26fbdac8da
6 changed files with 22 additions and 42 deletions
|
|
@ -28,7 +28,7 @@ from openpype.pipeline import (
|
|||
AVALON_CONTAINER_ID,
|
||||
)
|
||||
from openpype.pipeline.load import any_outdated_containers
|
||||
from openpype.hosts.maya.lib import load_workspace_mel
|
||||
from openpype.hosts.maya.lib import create_workspace_mel
|
||||
from . import menu, lib
|
||||
from .workio import (
|
||||
open_file,
|
||||
|
|
@ -548,9 +548,10 @@ def on_task_changed():
|
|||
|
||||
|
||||
def before_workfile_save(event):
|
||||
project_name = os.getenv("AVALON_PROJECT")
|
||||
workdir_path = event["workdir_path"]
|
||||
if workdir_path:
|
||||
load_workspace_mel(workdir_path)
|
||||
create_workspace_mel(workdir_path, project_name)
|
||||
|
||||
|
||||
class MayaDirmap(HostDirmap):
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from openpype.lib import PreLaunchHook
|
||||
from openpype.hosts.maya.lib import copy_workspace_mel
|
||||
from openpype.hosts.maya.lib import create_workspace_mel
|
||||
|
||||
|
||||
class PreCopyMel(PreLaunchHook):
|
||||
|
|
@ -10,9 +10,10 @@ class PreCopyMel(PreLaunchHook):
|
|||
app_groups = ["maya"]
|
||||
|
||||
def execute(self):
|
||||
project_name = self.launch_context.env.get("AVALON_PROJECT")
|
||||
workdir = self.launch_context.env.get("AVALON_WORKDIR")
|
||||
if not workdir:
|
||||
self.log.warning("BUG: Workdir is not filled.")
|
||||
return
|
||||
|
||||
copy_workspace_mel(workdir)
|
||||
create_workspace_mel(workdir, project_name)
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
import os
|
||||
import shutil
|
||||
|
||||
from openpype.settings import get_current_project_settings
|
||||
from openpype.settings import get_project_settings
|
||||
|
||||
|
||||
def load_workspace_mel(workdir):
|
||||
def create_workspace_mel(workdir, project_name):
|
||||
dst_filepath = os.path.join(workdir, "workspace.mel")
|
||||
if os.path.exists(dst_filepath):
|
||||
return
|
||||
|
|
@ -12,9 +10,12 @@ def load_workspace_mel(workdir):
|
|||
if not os.path.exists(workdir):
|
||||
os.makedirs(workdir)
|
||||
|
||||
project_setting = get_project_settings(project_name)
|
||||
mel_script = project_setting["maya"].get("mel_workspace")
|
||||
|
||||
# Skip if mel script in settings is empty
|
||||
if not mel_script:
|
||||
return
|
||||
|
||||
with open(dst_filepath, "w") as mel_file:
|
||||
setting = get_current_project_settings()
|
||||
mel_script = setting["maya"]["mel-workspace"]["definition"]
|
||||
for mel in mel_script:
|
||||
mel_file.write(mel)
|
||||
mel_file.write("\n")
|
||||
mel_file.write(mel_script)
|
||||
|
|
|
|||
|
|
@ -19,8 +19,7 @@
|
|||
"blender/2-91",
|
||||
"harmony/20",
|
||||
"photoshop/2021",
|
||||
"aftereffects/2021",
|
||||
"unreal/4-26"
|
||||
"aftereffects/2021"
|
||||
],
|
||||
"tools_env": [],
|
||||
"active": true
|
||||
|
|
|
|||
|
|
@ -15,20 +15,7 @@
|
|||
"destination-path": []
|
||||
}
|
||||
},
|
||||
"mel-workspace":{
|
||||
"definition":[
|
||||
"workspace -fr \"shaders\" \"renderData/shaders\";",
|
||||
"workspace -fr \"images\" \"renders\";",
|
||||
"workspace -fr \"particles\" \"particles\";",
|
||||
"workspace -fr \"mayaAscii\" \"\";",
|
||||
"workspace -fr \"mayaBinary\" \"\";",
|
||||
"workspace -fr \"scene\" \"\";",
|
||||
"workspace -fr \"alembicCache\" \"cache/alembic\";",
|
||||
"workspace -fr \"renderData\" \"renderData\";",
|
||||
"workspace -fr \"sourceImages\" \"sourceimages\";",
|
||||
"workspace -fr \"fileCache\" \"cache/nCache\";"
|
||||
]
|
||||
},
|
||||
"mel_workspace": "workspace -fr \"shaders\" \"renderData/shaders\";\nworkspace -fr \"images\" \"renders\";\nworkspace -fr \"particles\" \"particles\";\nworkspace -fr \"mayaAscii\" \"\";\nworkspace -fr \"mayaBinary\" \"\";\nworkspace -fr \"scene\" \"\";\nworkspace -fr \"alembicCache\" \"cache/alembic\";\nworkspace -fr \"renderData\" \"renderData\";\nworkspace -fr \"sourceImages\" \"sourceimages\";\nworkspace -fr \"fileCache\" \"cache/nCache\";\n",
|
||||
"scriptsmenu": {
|
||||
"name": "OpenPype Tools",
|
||||
"definition": [
|
||||
|
|
|
|||
|
|
@ -54,19 +54,10 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"type": "dict",
|
||||
"collapsible": true,
|
||||
"key": "mel-workspace",
|
||||
"label": "Maya MEL Workspace",
|
||||
"is_group": true,
|
||||
"children": [
|
||||
{
|
||||
"type": "list",
|
||||
"object_type": "text",
|
||||
"key": "definition",
|
||||
"label": "definition"
|
||||
}
|
||||
]
|
||||
"type": "text",
|
||||
"multiline" : true,
|
||||
"key": "mel_workspace",
|
||||
"label": "Maya MEL Workspace"
|
||||
},
|
||||
{
|
||||
"type": "schema",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue