Complex UV Layout in Maya
Over the last couple of years UV layout in Maya has changed for the better. In this course we're going to be taking a look at some of those changes as we UV map an entire character
# 1 16-03-2008 , 10:50 PM
Registered User
Join Date: Jul 2004
Location: Vancouver
Posts: 9

python call inside mel

How can I pass a Mel string variable into a python call from within a mel script ?

so I want to do something like this ... but this doesn't work:

string $myString;
string $myList = python("myString.split(':')");


Studio where I work cannot move totally to Maya python, but I would like to take advantage of python's string, list, and re methods from within a mel script. I'm wondering if anyone out there has done something similar. I thing I need to precede with another python call to create the python string object named myString .... but still can't get anything to work ...

# 2 17-03-2008 , 10:13 PM
t1ck135's Avatar
Registered User
Join Date: May 2004
Location: UK
Posts: 1,991
Hi suzanne,

I've played about with this in the past and the following should help you on your way. The thing to remember is to make sure the python() call uses double quotes immediately inside it and then to escape any python special characters or quotes.

e.g,
Code:
python("myVar = \"hello\"");
python("print myVar")
will result in the script editor printing hello
Simon


Examples of bTraffic - a traffic animation tool for Maya
bFlocking - a tool for Maya 8.5+ to generate flocking and swarming behaviours
Jan/Feb Challenge 2007 Entry and W.I.P
May/Jun Challenge 2006 Entry and W.I.P
Mar/Apr Challenge 2006 Entry and W.I.P
Jan/Feb Challenge 2006 Entry and W.I.P
Nov/Dec Challenge 2005 Entry and W.I.P
Sep/Oct Challenge 2005 Entry and W.I.P
Jul/Aug Challenge 2005 Entry
www.flash-fx.net
Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads