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
f8be5f8a83
commit
d9a150022e
4 changed files with 49 additions and 2 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 copy_workspace_mel
|
||||
from openpype.hosts.maya.lib import copy_workspace_mel,load_workspace_mel
|
||||
from . import menu, lib
|
||||
from .workio import (
|
||||
open_file,
|
||||
|
|
@ -550,7 +550,7 @@ def on_task_changed():
|
|||
def before_workfile_save(event):
|
||||
workdir_path = event["workdir_path"]
|
||||
if workdir_path:
|
||||
copy_workspace_mel(workdir_path)
|
||||
load_workspace_mel(workdir_path)
|
||||
|
||||
|
||||
class MayaDirmap(HostDirmap):
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import os
|
||||
import shutil
|
||||
|
||||
import json
|
||||
from openpype.settings import get_current_project_settings
|
||||
|
||||
def copy_workspace_mel(workdir):
|
||||
# Check that source mel exists
|
||||
|
|
@ -24,3 +26,19 @@ def copy_workspace_mel(workdir):
|
|||
src_filepath, dst_filepath
|
||||
))
|
||||
shutil.copy(src_filepath, dst_filepath)
|
||||
|
||||
|
||||
def load_workspace_mel(workdir):
|
||||
dst_filepath = os.path.join(workdir, "workspace.mel")
|
||||
if os.path.exists(dst_filepath):
|
||||
return
|
||||
|
||||
if not os.path.exists(workdir):
|
||||
os.makedirs(workdir)
|
||||
|
||||
with open(dst_filepath, "w") as mel_file:
|
||||
setting = get_current_project_settings()
|
||||
mel_script = setting["maya"]["mel-workspace"]["scripts"]
|
||||
for mel in mel_script:
|
||||
mel_file.write(mel)
|
||||
mel_file.write("\n")
|
||||
|
|
|
|||
|
|
@ -15,6 +15,20 @@
|
|||
"destination-path": []
|
||||
}
|
||||
},
|
||||
"mel-workspace":{
|
||||
"scripts":[
|
||||
"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\";"
|
||||
]
|
||||
},
|
||||
"scriptsmenu": {
|
||||
"name": "OpenPype Tools",
|
||||
"definition": [
|
||||
|
|
|
|||
|
|
@ -53,6 +53,21 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "dict",
|
||||
"collapsible": true,
|
||||
"key": "mel-workspace",
|
||||
"label": "Maya MEL Workspace",
|
||||
"is_group": true,
|
||||
"children": [
|
||||
{
|
||||
"type": "list",
|
||||
"object_type": "text",
|
||||
"key": "scripts",
|
||||
"label": "scripts"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "schema",
|
||||
"name": "schema_scriptsmenu"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue