更新 install.mel
This commit is contained in:
31
install.mel
31
install.mel
@@ -24,6 +24,31 @@ global proc string[] getMCPPaths() {
|
|||||||
return $paths;
|
return $paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Force create MCP menu
|
||||||
|
global proc forceMCPMenu() {
|
||||||
|
// Delete existing menu if it exists
|
||||||
|
if (`menu -exists "MCPMenu"`) {
|
||||||
|
deleteUI -menu "MCPMenu";
|
||||||
|
print("Removed existing MCP menu\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create new menu
|
||||||
|
string $mainWindow = "MayaWindow";
|
||||||
|
string $mcpMenu = `menu -label "MCP" -parent $mainWindow "MCPMenu"`;
|
||||||
|
|
||||||
|
// Add menu items
|
||||||
|
menuItem -label "Start Server" -command "python(\"import maya_mcp_plugin; maya_mcp_plugin.start_server_cmd()\")";
|
||||||
|
menuItem -label "Stop Server" -command "python(\"import maya_mcp_plugin; maya_mcp_plugin.stop_server_cmd()\")";
|
||||||
|
menuItem -label "Restart Server" -command "python(\"import maya_mcp_plugin; maya_mcp_plugin.restart_server_cmd()\")";
|
||||||
|
menuItem -divider true;
|
||||||
|
menuItem -label "Configure Port" -command "python(\"import maya_mcp_plugin; maya_mcp_plugin.configure_port_cmd()\")";
|
||||||
|
menuItem -divider true;
|
||||||
|
menuItem -label "About" -command "python(\"import maya_mcp_plugin; maya_mcp_plugin.about_cmd()\")";
|
||||||
|
|
||||||
|
print("MCP menu created successfully\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Install MCP plugin
|
// Install MCP plugin
|
||||||
global proc installMCPPlugin() {
|
global proc installMCPPlugin() {
|
||||||
string $paths[] = `getMCPPaths`;
|
string $paths[] = `getMCPPaths`;
|
||||||
@@ -98,6 +123,10 @@ global proc installMCPPlugin() {
|
|||||||
evalEcho("loadPlugin \"" + $pluginPath + "\"");
|
evalEcho("loadPlugin \"" + $pluginPath + "\"");
|
||||||
print("Plugin loaded successfully\n");
|
print("Plugin loaded successfully\n");
|
||||||
|
|
||||||
|
// Force create MCP menu
|
||||||
|
print("Creating MCP menu...\n");
|
||||||
|
evalDeferred("forceMCPMenu()");
|
||||||
|
|
||||||
// Set plugin to auto load
|
// Set plugin to auto load
|
||||||
print("Setting plugin to auto load...\n");
|
print("Setting plugin to auto load...\n");
|
||||||
evalEcho("pluginInfo -edit -autoload true \"" + $pluginPath + "\"");
|
evalEcho("pluginInfo -edit -autoload true \"" + $pluginPath + "\"");
|
||||||
@@ -204,7 +233,7 @@ global proc uninstallMCPPlugin() {
|
|||||||
|
|
||||||
// Show success dialog
|
// Show success dialog
|
||||||
confirmDialog -title "MCP Uninstallation Successful"
|
confirmDialog -title "MCP Uninstallation Successful"
|
||||||
-message ("Maya MCP has been successfully uninstalled!\n\nThe plugin has been unloaded and auto load disabled.")
|
-message ("Maya MCP has been successfully uninstalled!\n\nThe plugin has been unloaded and disabled from auto loading.")
|
||||||
-button "OK"
|
-button "OK"
|
||||||
-defaultButton "OK";
|
-defaultButton "OK";
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user