Add MayaPy application

This commit is contained in:
Toke Stuart Jepsen 2023-10-05 15:05:18 +01:00
parent 52c65c9b6c
commit f3e02c1e95
6 changed files with 110 additions and 5 deletions

View file

@ -2,7 +2,7 @@ import subprocess
from openpype.lib.applications import PreLaunchHook, LaunchTypes from openpype.lib.applications import PreLaunchHook, LaunchTypes
class LaunchFoundryAppsWindows(PreLaunchHook): class LaunchNewConsoleApps(PreLaunchHook):
"""Foundry applications have specific way how to launch them. """Foundry applications have specific way how to launch them.
Nuke is executed "like" python process so it is required to pass Nuke is executed "like" python process so it is required to pass
@ -13,13 +13,15 @@ class LaunchFoundryAppsWindows(PreLaunchHook):
# Should be as last hook because must change launch arguments to string # Should be as last hook because must change launch arguments to string
order = 1000 order = 1000
app_groups = {"nuke", "nukeassist", "nukex", "hiero", "nukestudio"} app_groups = {
"nuke", "nukeassist", "nukex", "hiero", "nukestudio", "mayapy"
}
platforms = {"windows"} platforms = {"windows"}
launch_types = {LaunchTypes.local} launch_types = {LaunchTypes.local}
def execute(self): def execute(self):
# Change `creationflags` to CREATE_NEW_CONSOLE # Change `creationflags` to CREATE_NEW_CONSOLE
# - on Windows nuke will create new window using its console # - on Windows some apps will create new window using its console
# Set `stdout` and `stderr` to None so new created console does not # Set `stdout` and `stderr` to None so new created console does not
# have redirected output to DEVNULL in build # have redirected output to DEVNULL in build
self.launch_context.kwargs.update({ self.launch_context.kwargs.update({

View file

@ -95,6 +95,8 @@ class MayaHost(HostBase, IWorkfileHost, ILoadHost, IPublishHost):
self.log.info("Installing callbacks ... ") self.log.info("Installing callbacks ... ")
register_event_callback("init", on_init) register_event_callback("init", on_init)
_set_project()
if lib.IS_HEADLESS: if lib.IS_HEADLESS:
self.log.info(( self.log.info((
"Running in headless mode, skipping Maya save/open/new" "Running in headless mode, skipping Maya save/open/new"
@ -103,7 +105,6 @@ class MayaHost(HostBase, IWorkfileHost, ILoadHost, IPublishHost):
return return
_set_project()
self._register_callbacks() self._register_callbacks()
menu.install(project_settings) menu.install(project_settings)

View file

@ -7,7 +7,7 @@ class PreCopyMel(PreLaunchHook):
Hook `GlobalHostDataHook` must be executed before this hook. Hook `GlobalHostDataHook` must be executed before this hook.
""" """
app_groups = {"maya"} app_groups = {"maya", "mayapy"}
launch_types = {LaunchTypes.local} launch_types = {LaunchTypes.local}
def execute(self): def execute(self):

View file

@ -114,6 +114,65 @@
} }
} }
}, },
"mayapy": {
"enabled": true,
"label": "MayaPy",
"icon": "{}/app_icons/maya.png",
"host_name": "maya",
"environment": {
"MAYA_DISABLE_CLIC_IPM": "Yes",
"MAYA_DISABLE_CIP": "Yes",
"MAYA_DISABLE_CER": "Yes",
"PYMEL_SKIP_MEL_INIT": "Yes",
"LC_ALL": "C"
},
"variants": {
"2024": {
"use_python_2": false,
"executables": {
"windows": [
"C:\\Program Files\\Autodesk\\Maya2024\\bin\\mayapy.exe"
],
"darwin": [],
"linux": [
"/usr/autodesk/maya2024/bin/mayapy"
]
},
"arguments": {
"windows": [
"-I"
],
"darwin": [],
"linux": [
"-I"
]
},
"environment": {}
},
"2023": {
"use_python_2": false,
"executables": {
"windows": [
"C:\\Program Files\\Autodesk\\Maya2023\\bin\\mayapy.exe"
],
"darwin": [],
"linux": [
"/usr/autodesk/maya2024/bin/mayapy"
]
},
"arguments": {
"windows": [
"-I"
],
"darwin": [],
"linux": [
"-I"
]
},
"environment": {}
}
}
},
"3dsmax": { "3dsmax": {
"enabled": true, "enabled": true,
"label": "3ds max", "label": "3ds max",

View file

@ -0,0 +1,39 @@
{
"type": "dict",
"key": "mayapy",
"label": "Autodesk MayaPy",
"collapsible": true,
"checkbox_key": "enabled",
"children": [
{
"type": "boolean",
"key": "enabled",
"label": "Enabled"
},
{
"type": "schema_template",
"name": "template_host_unchangables"
},
{
"key": "environment",
"label": "Environment",
"type": "raw-json"
},
{
"type": "dict-modifiable",
"key": "variants",
"collapsible_key": true,
"use_label_wrap": false,
"object_type": {
"type": "dict",
"collapsible": true,
"children": [
{
"type": "schema_template",
"name": "template_host_variant_items"
}
]
}
}
]
}

View file

@ -9,6 +9,10 @@
"type": "schema", "type": "schema",
"name": "schema_maya" "name": "schema_maya"
}, },
{
"type": "schema",
"name": "schema_mayapy"
},
{ {
"type": "schema", "type": "schema",
"name": "schema_3dsmax" "name": "schema_3dsmax"