Monday, December 6, 2010

sliderMaster - MEL Script






While working with dynamics in Maya I had to constantly keep going back and forth between several emitters, particles and fields. I soon realized I would like to have a window that offered me sliders for whatever attribute I would like to tweak.

The idea is to have a simple txt file with attributes listed in it. Using a txt file outside of Maya makes the management of the attributes much more straight forward, you can just open the file and edit it directly.

I just put a button on the shelf and run the script to have the attributes in the window so I can adjust them at will.

(Please send me a message for the code in txt version. I am more than happy to share it with you. This blog did not accept the direct posting of the code.)




This are directions on how to set up:

Hi folks, This is the way it is setup:

-Set your project folder.
-Copy the sliderMasterAttr.txt file to folder mel, inside your project folder.
-Load the script I am sending to you, sliderMaster.mel. I created a button in the shelf here to access it faster. -Open the sliderMasterAttr.txt file in a simple notepad or any text editor really.

When your working in Maya, and you want to tweak something, just go to that txt file and add the name of that object and attribute.

If you want to tweak the intensity of a spot, for instance, you could right mouse button click on the attibute you want, say intensity, and choose create expression. The Expression Editor opens up and you'll see "Selected Object and Attribute" copy that name. In this example it is spotLightShape1.intensity. Paste this in the txt file. Save the file.

If you don't want an attribute listed anymore, just delete it from your txt file.

Working here, I found out that I can leave the file open while in Maya. I just need to save it when I make changes. And by the way, please have only one attribute per line, don't skip lines. Keep only atribute names on the file. (In the file I am sending as an example you'll see three lines, delete those before you put your stuff, as they are not pertinent to your scene).

I guess that's it. I hope it helps you.



This is an example of the contents of the sliderMasterAttr.txt file:

emitterOceanParticulateMatter1.rate
emitterOceanParticulateMatter1.awayFromCenter
emitterOceanParticulateMatter1.awayFromAxis
emitterOceanParticulateMatter1.alongAxis
emitterOceanParticulateMatter1.aroundAxis
emitterOceanParticulateMatter1.randomDirection
emitterOceanParticulateMatter1.directionalSpeed
oceanParticulateMatter1turb.magnitude
oceanParticulateMatter1turb.attenuation
oceanParticulateMatter1newton.magnitude
oceanParticulateMatter1newton.attenuation
oceanParticulateMatter1newton.minDistance
oceanParticulateMatter1uniform.magnitude
oceanParticulateMatter1uniform.attenuation




1 comment: