赞
踩
目录
打开maya,右下角脚本编辑器,运行python脚本:
- import maya.cmds as cmds
-
- if not cmds.commandPort(":4434",query=True):
- cmds.commandPort(":4434")
- import socket
-
- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- s.connect(('127.0.0.1', 4434))
- s.send('print "hello world"\n'.encode("utf-8"))
- s.send('polyCube()\n'.encode("utf-8"))
- s.send('python("import maya.cmds as cmds; cmds.sphere()")'.encode("utf-8"))
该脚本:
shellCopy code
mayabatch -script path\to\script.mel
shellCopy code
Maya -batch -script /path/to/script.mel
mayabatch测试成功例子
mayabatch -script E:/Projects/EDGE-train/data/script.mel
- string $filePath = "E:/Projects/EDGE-train/data/file.txt";
- $fileId = `fopen $filePath "w"`;
-
- // 写入内容到文件
- fprint $fileId "Hello, this is a test.\n";
-
- // 关闭文件
- fclose $fileId;
-
- print ("文件已生成并写入内容。\n");
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。