MEL
few simple MEL Scripts(draft)
by lala on Sep.06, 2009, under MEL, Scripting
recently i enrolled myself for CG Society online workshop on MEL. it will be 8 weeks long and hopefully quite fun. i thought its good idea to start practising MEL before hand. so in this week i took simple idea and write a script each day.
BEVEL TWEAK
Installation: Just copy mel file in your scripts folder(so maya can read at startup)
Usage: in mel script editor type command : source “tweakBevel.mel”; tweakBevel();
lastly, you can pick those commands and make shelve button off-course.
Download: tweakBevel.mel
Description: select multiple bevel plus objects in viewport, run script, change settings.
camLister
Installation: Just copy mel file in your scripts folder(so maya can read at startup)
Usage: in mel script editor type command: source “camLister.mel”; camLister();”
lastly, you can pick those commands and make shelve button off-course, i recommend to use it via assigning user key. which gives me 3dsmax approach quickly looking through cameras
Download: camLister.mel
Description: if one camera node is selected, running script (command via keyboard), script simply update active model viewport to look through selected camera. where as if nothing is selected or multiple nodes are selected, simple GUI will pop up with all persp cameras listed. simply pick camera from list and active model viewport updates again to show you result from that specific camera
lmExtruder
Installation: Just copy mel file in your scripts folder(so maya can read at startup)
Usage: in mel script editor type command: source “camLister.mel”; camLister();”
lastly, you can pick those commands and make shelve button off-course, i recommend to use it via assigning user key. which gives me 3dsmax approach quickly looking through cameras
Download: camLister.mel
Description: script simply lets you do 2 things quickly
- extrude multiple cruves atonce by selected a- profile curve, b- picking all path curves, c- extrude all
- animate extruded surfaces from 0 to 1 with defined duration / offset values
maya,python,wxpython good/bad news
by lala on Oct.19, 2008, under MEL
keep in mind
- c:\python25 is different installation
- maya root python and mayapy.exe are different shells and nothing to do with orignal python
to tell your main python about maya modules do:
- pythonpath(environment variable)
- maya_location(environment variable)
to test and confirmation, open IDLE and type:
- import maya.standalone
- maya.standalone.initialize()
to tell maya python shell or mayapy.exe about your typically added site packages (wx / win32 etc)
do userSetup.py in maya scripts folder with code below
- import maya.cmds as mc
- import sys
- sys.path.append(’C:\\Python25\\lib\\site-packages\\win32′)
- sys.path.append(’C:\\Python25\\lib\\site-packages\\win32\\lib’)
- sys.path.append(’C:\\Python25\\lib\\site-packages\\Pythonwin’)
- sys.path.append(’C:\\Python25\\lib\\site-packages\\wx-2.8-msw-ansi’)
to test this, open maya script editor and in python tab script type
- import wx and hit ctrl + enter and it will hopefully work or check code below to test
————————————————————
import wxclass MyFrame(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, wx.DefaultPosition, wx.Size(250, 50))panel = wx.Panel(self, -1)
wx.Button(panel, -1, “Button1″, (0,0))
wx.Button(panel, -1, “Button2″, (80,0))
wx.Button(panel, -1, “Button3″, (160,0))class MyApp(wx.App):
def OnInit(self):
frame = MyFrame(None, -1, ‘layout.py’)
frame.Show(True)
frame.Centre()
return Trueapp = MyApp(0)
app.MainLoop()———————————————————————–
looks good
bad news,unable to fix
executing commands (python) from outsite maya(maxya / eclipse,pydev) is issue,
when i create same window (few lines above) maya hangs / refresh stops
so apparently it seems only work around is to do com port connection
don’t know much about it but hopefully it will work soon
best script editor for MEL, confusions / issues
by lala on Aug.06, 2008, under MEL
it is quite strange that maya till haven’t provided one best script editor. i missed max script environment. with with simple basic editor uptil max9. how much one ctrl+rightclick was helpful and impressive to find all controls / functions and everything and now with scitec editor its superb.
anyway, searched a lot about IDE’s and found that actually commercial products are best like MEL STUDIO PRO and MAXYA. so many other opensource IDE’s and syntax hilighting files are available on highend3d but none ever worked for me the way it should be. for simple scripter like me, having funtions list available is huge stuff and if somehow i am not able to send commands to maya from external editor then it is useless. even some free ide’s complained that they do (jedit) but it never worked for me.
lastly in terms of free IDE’s i tried a lot and get closer to eclipse and jedit. both then needs to add bla bla plugins and setup that it gives me nothing but frustration rather then automating task and get the job done.
hopefully this will be resolved in next couple of days (up to free time and xtra money).
maya globals and environment variables (things to remember)
by lala on Aug.06, 2008, under MEL
recently to improve MEL skills, i start digging little deeper. simples questions with answers are here for my personal memory
MAYA_APP_DIR (user variables) e.g : C:\Documents and Settings\haseebah\My Documents\maya\
this sets where different versions of maya created base preferences folder. e.g 8.5 and 2008
must remember that somehow it wasn’t updated unless i restart my PC.
MAYA_SCRIPT_PATH (system variables) e.g : C:\Documents and Settings\haseebah\My Documents\maya\2008\scripts\zooToolBox;C:\Documents and Settings\haseebah\My Documents\maya\2008\scripts
this helps to manage multiple folders organized. if you didn’t set this one in environment variables. also remember to put semicolon and add multiple path and was very helpful to put zooToolBox separately managed in above examples. this can also be set in maya.env file. but system / user variables take precedence if declared.
e.g. setting separate folder for python scripts is simple , add line in maya env file
PYTHONPATH = C:\Documents and Settings\haseebah\My Documents\maya\2008\scripts\Python
userSetup.mel or userSetup.py
to initialize simple script commands at startup (loading packages and assigning simple name spaces helps a lot, e.g: import maya.cmds as mc etc) also useful to setup ports for listening from jedit and eclipse.


