我正在构建一个用它来控制maya的工具,我正在尝试通过node webkit连接到maya的命令端口以发送命令,但没有成功。我用mel从maya打开了端口:
commandPort -n "127.0.0.1:6000";
string $p = `commandPort -q "127.0.0.1:6000"`;
if ($p == 1) {print "CommandPort Opened \n";}
if ($p == 0) {print "CommandPort Closed \n";}
这是我的 html UI 中的代码:
<script>
var net = require('net');
var maya = new net.Socket();
maya.connect(6000, '127.0.0.1', function() {
console.log('Connected');
maya.write('polySphere -r 1 -sx 20 -sy 20 -ax 0 1 0 -cuv 2 -ch 1;');
});
</script>
节点 webkit 中的控制台显示它已连接,但在 Maya 内没有任何反应。
我刚刚开始使用整个节点 webkit 的东西,它非常酷!!!我需要你的帮助来解决这个问题。
提前感谢大家的帮助:)