cgbeige
02-11-2011, 12:13 AM
I got annoyed that BBEdit doesn't have the ability to natively send MEL to Maya so I started playing around imitating how Textmate does it (with commandPort) and am very close to having something working. It's fine with single lines of code but once you get line breaks, they need to be escaped or Python chokes on the execution:
$>python /tmp/sender.py (contents:)
import socket
maya = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
maya.connect(("127.0.0.1", 5055))
Maya_text = "sphere;
string $mySelection[] = `ls -sl`;
print $mySelection[0];"
maya.send(r''+Maya_text+'')
I'm not familiar with Python, so I'm wondering if there's a way to tell it to send the text without choking on the syntax, or should I write my stdout MEL contents to a file and have Python pipe that through the socket? Textmate uses Ruby so maybe this is an easier way to do it. Dunno.
$>python /tmp/sender.py (contents:)
import socket
maya = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
maya.connect(("127.0.0.1", 5055))
Maya_text = "sphere;
string $mySelection[] = `ls -sl`;
print $mySelection[0];"
maya.send(r''+Maya_text+'')
I'm not familiar with Python, so I'm wondering if there's a way to tell it to send the text without choking on the syntax, or should I write my stdout MEL contents to a file and have Python pipe that through the socket? Textmate uses Ruby so maybe this is an easier way to do it. Dunno.
