lalamax3d lalamax3d

Scripting

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

tweakBevel

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

camSwitcher

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

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
Leave a Comment more...

Toon Eyes (quick/easy setup)

by lala on Jan.11, 2009, under MXS (max script), Scripting

toonEyes

Installation: Just drag-drop or put in your “usermacros” folder

Usage: 3dsmax>>customize>>lm_Rigging(Catagory)>>ToonEyes (assign a key,quadmenu,etc)

Download: ToonEyes_v0.2

Update: minor fix (closing UI accidently without finalizing now can be fixed by selecting left and right ffds and hitting finalize button.

Notes:The Script helps you to setup toon ffd eyes symmetrically. it also add two helpers which you can constaint later (lookat) .


1 Comment :, more...

Stretchy Biped (updated)

by lala on Dec.25, 2008, under MXS (max script), Scripting

stretchybiped

Installation: Just drag-drop or put in your “usermacros” folder

Usage: 3dsmax>>customize>>lm_Rigging(Catagory)>>SquashyBiped (assign a key,quadmenu,etc)

Download: squashyBiped_v0.2 | StretchyBiped_v0.1

Update: new version add squash support (not physically real for volume calculation, but as per my liking aesthetically). also all reactor controllers now have been removed and expression controllers have been used.

Notes:The Script helps you to setup stretchy biped bones (arms,legs,spine,etc) quickly with 1 mouse click. It simply adds a parameter “stretchy” to first selected bone(modifier stack) from selection. ( you can copy paste modifier where ever you want after wards).

Example:if you want two arm bones to stretch and hand as controller parameter, just select hand and then arm bones and hit “make stretch” with optional “skip 1st”.
if you want whole spine to be stretchy, just select all spine bones and hit make stretchy.(parameter will be added to 1st selected biped bone)

9 Comments :, more...

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 wx

class 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 True

app = 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

Leave a Comment :, , more...

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).

1 Comment more...

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.

2 Comments more...