Hey I was wondering if any one could help me figure out how to run maya commands through an external editor (Aptana Studio 3). I’m not really sure where to start because I haven’t ever really done something like this before. I know it involves maya standalone but I don’t know where to go from there. I found a couple codes online but I didn’t understand what they were doing and they didn’t work when I tried running it. If anyone could shed some light and help me out I would really appreciate it. Thank you for your time.
Arite awesome, I’ll definitely check it out. The reason I wanted to figure out for aptana is so that I would get a better understanding of what was going so that i could do it for any external editor, but I’ll use this for now until I get a better understand of what is going on inside maya. Thank you guys for your help!
Send that text to a file somewhere in your scripts directories using a file object. I write to a file called ~/scripts/SENDTOMAYA.py
Open a socket stream and connect it to a port (you’ll have to have already opened this port in Maya with something like this: mc.commandPort (name=‘localhost:7546’) (I have this on a shelf button)
Send a command through the open socket that calls “import SENDTOMAYA” (or reload if it is already loaded)
The way this works is sort of like this (might not be 100% correct):
socketToMaya = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
socketToMaya.connect(('localhost', 7546)) #same port as in Maya
myCommand = 'python("if \\"' + basename + '\\" in dir(): reload(' + basename + ');\
else: import ' + basename + '\
");'
socketToMaya .send(mayaCommand)
socketToMaya .close()
socketToMaya is the open socket that is running on a port. You send myCommand through it, which is just some text, but Maya knows how to interpret it because it is listening through the port you previous opened.