-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.mel
More file actions
37 lines (31 loc) · 1.2 KB
/
Copy pathinstall.mel
File metadata and controls
37 lines (31 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// UTF-8
// Encoding: UTF-8
// Define global procedure for installing HUGTools
global proc installHUGTools()
{
// 检查Python版本的简单代码
string $versionCheck =
"import sys\n" +
"import maya.cmds as cmds\n" +
"if sys.version_info[0] < 3:\n" +
" cmds.error('错误: HUGTools 需要 Python 3.0 或更高版本。当前版本: ' + sys.version)\n";
python($versionCheck);
// Get the path of the installHUGTools procedure
string $scriptPath = `whatIs installHUGTools`;
string $dirPath = `substring $scriptPath 25 (size($scriptPath))`;
$dirPath = `dirname $dirPath`;
string $pythonPath = $dirPath + "/install.py";
$pythonPath = substituteAllString($pythonPath, "\\", "/");
// Python code to handle different encodings
string $pythonCode =
"import os, sys\n" +
"script_path = r'" + $pythonPath + "'\n" +
"sys.path.append(os.path.dirname(script_path))\n" +
"with open(script_path, 'rb') as f:\n" +
" content = f.read().decode('utf-8')\n" +
"exec(content)\n";
// Execute the Python code
python($pythonCode);
}
// Call the installation procedure
installHUGTools();