initial support for configurable dirmap

This commit is contained in:
Ondrej Samohel 2021-07-27 10:30:26 +02:00 committed by Ondřej Samohel
parent 0f3f72b83f
commit c31cdf94d1
No known key found for this signature in database
GPG key ID: 02376E18990A97C6
4 changed files with 65 additions and 2 deletions

View file

@ -26,6 +26,24 @@ INVENTORY_PATH = os.path.join(PLUGINS_DIR, "inventory")
def install():
from openpype.settings import get_project_settings
project_settings = get_project_settings(os.getenv("AVALON_PROJECT"))
mapping = project_settings["maya"]["maya-dirmap"]["paths"] or {}
if mapping.get("source-path") and project_settings["maya"]["maya-dirmap"]["enabled"] is True:
log.info("Processing directory mapping ...")
cmds.dirmap(en=True)
for k, sp in enumerate(mapping["source-path"]):
try:
print("{} -> {}".format(sp, mapping["destination-path"][k]))
cmds.dirmap(m=[sp, mapping["destination-path"][k]])
cmds.dirmap(m=[mapping["destination-path"][k], sp])
except IndexError:
# missing corresponding destination path
log.error(("invalid dirmap mapping, missing corresponding"
" destination directory."))
break
pyblish.register_plugin_path(PUBLISH_PATH)
avalon.register_plugin_path(avalon.Loader, LOAD_PATH)
avalon.register_plugin_path(avalon.Creator, CREATE_PATH)

View file

@ -7,6 +7,19 @@
"workfile": "ma",
"yetiRig": "ma"
},
"maya-dirmap": {
"enabled": true,
"paths": {
"source-path": [
"foo1",
"foo2"
],
"destination-path": [
"bar1",
"bar2"
]
}
},
"create": {
"CreateLook": {
"enabled": true,

View file

@ -1,6 +1,5 @@
{
"project_setup": {
"dev_mode": true,
"install_unreal_python_engine": false
"dev_mode": true
}
}

View file

@ -14,6 +14,39 @@
"type": "text"
}
},
{
"type": "dict",
"collapsible": true,
"checkbox_key": "enabled",
"key": "maya-dirmap",
"label": "Maya Directory Mapping",
"is_group": true,
"children": [
{
"type": "boolean",
"key": "enabled",
"label": "Enabled"
},
{
"type": "dict",
"key": "paths",
"children": [
{
"type": "list",
"object_type": "text",
"key": "source-path",
"label": "Source Path"
},
{
"type": "list",
"object_type": "text",
"key": "destination-path",
"label": "Destination Path"
}
]
}
]
},
{
"type": "schema",
"name": "schema_maya_create"