Tuesday, June 30, 2009

Add some randomness to your life


Update 7-2-2009 - added uniform scaling options per Mr. Villabon's request.
Here is a simple MEL script I wrote called Tater. Tater is a random transform (rotate, scale, translate) Tool. Just pick the Axis u want and the type of transform and Tater does the work for you.
Update 10-8-2011 - Script is broken in Maya 2011 and 2012 do to some changes in the way MEL handles UIs. I will be updating the script soon.

Tater.mel (right click and save as)

Monday, June 29, 2009

Mel Scripts, Plugins and Bears... Oh My.

Here is a list of scripts that make my day to day grind that much more bearable. Some scripts are free from such amazing sites like Creative Crash (formerly highend3d) and Autodesk Area. Others, (mostly plugins) like that amazing NEX plugin have a price tag.

  • Bonus Tools and Layout/Level Tools
  • Stop reading and go get both of them! Bonus Tools and Level Tools are located under plugins category
  • NEX plugin
  • #1 most bad ass Maya modeling plugin!(Not free but worth every penny!)
  • Zen Tools
  • Great set of modeling tools! Needs Bonus tools to work.
  • Comet Scripts
  • Even if you don't do much rigging/setup work these are must have tools.
  • Array
  • This thing makes Mayas duplicate special option box look like a joke. A++ duplication tool.
  • djRivet
  • This creates a "rivet" on the surface of your geo allowing you to constrain stuff to a moving or deforming object.
  • yd_cracKut
  • Fast boolean tool that leaves you with all three possible boolean results.
  • mh_selectFaces
  • This script selects the face on any given axis of your model. More awesome Mike Harris scripts Here
  • oaRelaxVerts
  • This is a less destructive average vert tool. Oleg Alexander has many more amazing scripts Here
  • Crucutski
  • This is fantastic shatter script by Seth Hall. Everything this guy does is amazing
  • dp SaveScenePlus
  • gives you a incremental save button. Cant live with out it!
  • X-Tools
  • A pretty awesome way of uncluttering / organizing all of the modeling tools you know and love.
  • Tartarus
  • More modeling tools with tons of documentation.

Getting a Focus on the Command Line.

If you do a lot of command line work then this will make your day...
I was looking for a shortcut key to focus on the command line in Maya. I found some non-official documentation from and older version that said the ` key focus on command line... well that isn't true in newer versions of Maya. On top of that it doesn't have a shortcut key at all by default! Well i was digging around for a few min and I found this little gem.


setFocus $gCommandLine;


Alternatively you can use this code to toggle the command line and set focus in the event that your command line isn't already open.

if (`isUIComponentVisible("Command Line")` != 1) {
toggleUIComponentVisibility("Command Line");
}

global string $gCommandLine;
evalDeferred("setFocus "+$gCommandLine);



Set a hotkey with this command or add it to a marking menu and your set!

have fun...

Saturday, June 27, 2009

Make Maya Work...

Hello and welcome to my first real blog post.


As Maya artists we are constantly encountering new problems and limitations to our work flows. It can be frustrating to attempt a seemingly simple task only to be let down by sub par results or results that just don't work for one reason or another. It can also be tedious to do repetitive tasks manually when a script could do the work for us.

Let me introduce you to a friend of mine named MEL. MEL is short for Maya Embedded Language and it is the backbone of Maya. Everything you do in Maya calls a MEL command. All of our menus, buttons, tools, etc are powered by MEL.

I'm not going to get into the fundamentals or syntax of MEL. I'm not trying to teach you, so much as, inform you as to the importance of learning MEL (at least how to find, install and source/run a MEL script or Maya Command).

OK the B.S. introduction is over, now for the meat and potatoes...


1. Maya MEL Interface

Maya's Script Editor (Window > General Editors > Script Editor) is just what it sounds likes, a place to edit scripts. It's also the place where Maya tells us whats going on behind the scenes. Inside of the Script Editor we have two panes. The top pane is history and the bottom is the input. By default Maya shows us a simplified history of whats been happening in our scene. 99% of the time the average Maya user will be more then content with amount of information contained in the standard history pane. On the rare occasion that we need more feedback from our history pane, turn on Echo All Commands (History > Echo All Commands) in the Script Editor menu. Now be warned that echo all commands uses memory... I don't know how much or if it can be an issues but Its good form to turn it off when not using it.

The Input pane is where we can give Maya commands or inputs. At the top of the Input pane you will see two tabs, One named MEL and one named Python. Python is another language that Maya supports but is beyond the scope of this tutorial. For the purpose of this article you just need to be aware of what type of script you are running (.mel or.py) and whether you are in a MEL tab or a Python tab when inputting commands. Most of the time you will be in MEL tabs but there is always a chance that the script you're trying to run was written in Python and thus requires a python tab to execute the commands.

The most basic example of MEL in action is to type: sphere; in the input tab. Note* Every command you execute must end with a semicolon ( ; ). Maya doesn't know what to do with the command if the semicolon isn't present. Hit the Enter Key on the number pad to execute the command. Now you have a nurbs sphere! I know what you're thinking... pointless! Right?

Here's the deal, you just learned how to run commands or user made scripts in Maya. Now all you need to do is find the Maya Command or Script you want to use and run it.


2. Installing Scripts

If you're using a user created script, copy the desired files to the scripts folder (located in your C:\Users\"your name"\(My)Documents\maya\"your Maya version"\scripts folder) and launch Maya. Once in Maya, open the Script Editor and source (File>Source Script) the script that you want to run. This loads the script into Maya's memory so that it knows what we are talking about when we execute a command. Now just type the proper command to execute the script, just like we did for sphere above. Most of the time the command to execute a script is the same as the name of the script minus the .mel(magicMaker.mel would be inputted as magicMaker; ). This is not always the case. Some times the author uses different names, so read the help/readme/script comments associated with these scripts to ensure you are on the same page as the creator.

On a semi-related note, if you are using someones script, tell them you like it or what could be better... Its the least you can do. People write scripts to make computer work more efficient and bearable for themselves and their studio and they don't have to share. If you use it, show your appreciation for the hard work they did to make your life easier. I find that most people like user feed back... just be constructive if you have a problem/suggestion.

*Script Editor Notes*

  • Selecting the text (code / command) before hitting the enter key will keep the text in the input field making it easy edit the previous inputted commands/code.

  • You can make a button out of the script by selecting the text in the input field and selecting File > Save Script To Shelf...

  • Maya has a ton of help documentation use it!

  • Under Edit menu there are three options at the bottom to clear the History and or the Input panes if things get messy.

  • Explore Maya and the Script Editor... I don't have the time to cover every feature, nor do I know what they all do. Investigate!


*Article Notes*
This tutorial / article is not intended to be the be-all end-all MEL reference. This was intended as a beginners guide to understanding what MEL is and how to take advantage of it in its most simple form. If you're a computer scientist and you're upset because I'm not using programmer jargon or missing fundamental scripting concepts in the article, then you're not the person for whom it is intended.