Thursday, August 27, 2009

boRandomizer 1.0

I've come across a few situations in which I really wanted a nice randomizer, on both an object level and component level. It helps you add some imperfections to your models when needed, and it's great when you've got a ton of objects to lay out, like leaves or grass. Anyway... I made this cool GUI for randomizing just about anything. It also lets you select attributes in the channel box, and randomize their values (useful for randomizing colors and other non-transformational attributes). It works across multiple objects and you can sync nodes/channels etc. To access a bunch of other options, right click on the Translate, Rotate, Scale, or Randomize buttons and you'll see a marking menu including options for X, Y, Z, rounding values, uniform scaling, absolute/relative, world/local/object (and gimbal for rotations). So check it out, it's handy.

Friday, August 14, 2009

Marking Menu Checkboxes and #1

So it's not difficult to realize that trying to learn the finer things about mel is like trying to learn about a language that doesn't even exist. The strange part about this, however, is that every once in a while you come across something implemented by Autodesk, which is seemingly documented nowhere. The even more difficult part about some of these situations, is that due to the wonderfully symbol-filled world of programming, trying to google "#1" is identical to trying to google "1". I'm not really sure what the functionality of the pound symbol is in other programming languages, and maybe that would've helped, but... Anyway, here is a neat feature in mel, of which I couldn't find information about anywhere on the internet. What I know about it is pretty much just from trial and error.

The #1 (pound 1) option is basically the future value of a menuItem's checkbox. So let's say you are in a marking menu with a checkbox called Happy (currently unchecked). If the -command (-c) of happy was "print #1", selecting Happy would output "1" in the script editor (which is now the value of the checkbox). The next time you select Happy (currently checked) the output would be 0 (now unchecked). So the usefulness of this comes in toggling one or more options with a checkbox item.

So let's take the example of toggling the selection mask of polys.
Instead of having to do something like...

menuItem
-l "Toggle Poly Mask"
-c "selectPref -polymesh (!`selectPref -q -polymesh`)"
-checkBox (`selectType -q -polymesh`);


you could simply use

menuItem
-l "Toggle Poly Mask"
-c "selectPref -polymesh #1"
-checkBox (`selectType -q -polymesh`);


Sure not a huge change with only one option, but it definitely came in handy when I was changing about 14 options at once. Trying to use #1 in any other situation but a checkbox command will return a syntax error (you can use it in menuItem checkboxes or even regular checkboxes), so you'd have to use the not (!) technique in such situations. Anyway, putting this out there because it's always nice to have quick answers to quick questions.

Tuesday, July 7, 2009

Transform Tool Hotkeys for 2009

So I recently discovered that maya 2009 changed the functions of the w, e, and r hotkeys. They're still move, rotate, and scale of course, but a more specific function has been changed.

So for example with the move tool. When you first select something, and the move tool is on, the axes will be green red blue, and the center square will be yellow (signifying that middle mouse will move in all three axes). If you click on the green arrow it turns yellow (signifying that now middle mouse will only move in that axis.) Well the difference is that in 2008 and before, pushing 'w' again would reset the constraints (turn the center square yellow again), but now it does nothing. So if you want to go back to middle mouse working in all three axes, you have to click on the center square. I'm so used to being able to hit w and regain my middle mouse functionality that I went ahead and wrote a script to fix it. It's a part of boWorkspace.mel (which doesn't really contain anything else right now), so you can grab it if you want. Don't forget this is just for 2009 users.

For the more interested, the dumb technique that I used to fix this is just making the w, e, and r hotkeys switch to the select tool, then immediately the move, rotate, or scale tool (respectively). There is a small possibility that somewhere someday you may want to get rid of that, so there's a button in my script for setting everything back to default.

Check out the video for a representation of what I'm talkin about.

Saturday, June 20, 2009

boSmear 2.0 documentation

So I just finished the documentation for boSmear 2.0. It's available for anyone to read here:

http://www.bohdon.com/scripts/docs/boSmear_docs/

enjoy!

Friday, June 19, 2009

boSmear 2.0


So I recently returned to the magical boSmear in order to make it better. The setup I had in 1.x versions was a little complicated, involving follicles and lots of unnecessary junk. This new version is far superior in both speed and economy. The setup for this smear is instant, and with the option to turn it's weight on and off (a float from 0 to 1) you can effectively eliminate any speed detriments and animate as if it weren't there. This let's you add the smear at the beginning of your animation work period but still avoid the speed hit of a big lattice until you are ready to animate the smear itself.

There's a really sneaky technique that I used in order to make this version possible, so I thought I'd describe it briefly. The new smear 2.x setup creates in the end around 13 nodes total. Compared to the last version, which created around 600+ nodes, this is a huge difference made possible by directly connecting the vertices of the smear mesh to the deformer. The problem when trying to do this simply (create a mesh, create a lattice, connect) is that the lattice will inevitably collapse on itself, considering the fact that lattice points are not 0 0 0 by default, but the mesh verts are (and for good reason, it gives them the ability to easily be "zeroed" out). Lattice points are created with worldspace coordinates, so naturally you want to convert them to 0 0 0. Fortunately, when creating a deformer on something, it creates a shapeOrig node (like smear1latticeOrig). This node holds the worldspace data for the lattice points, and effectively turns the visible lattice points to 0 0 0. So the trick I used was to create a cluster on one of the lattice points and then delete the cluster right after it's created. This just simple "freezes" the lattice, making it ready to be plugged by the smear mesh! Long story short, creating deformer on a non-freezable object allowed me to avoid having a separate cluster, curve, etc.. for each vertex on the smear mesh. Anyway, it's a strange technique but it works pretty effectively.

I previously had smear 1.0 up for free, but I'm thinking about asking for a small fee, like $2 or something. It'll be free to Ringling students ofcourse :D. Just donate on the scripts site or drop me an email/comment if you're interested.

Oh one last thing, Keith Lango just recently finished an animation using the older version of boSmear, so go check it out! www.keithlango.com It's seriously awesome (it's the Funky! video).

To start things off...

...some, if not most, of the mel scripts that I write are made readily available (for free!) on my scripts site (bohdon.com/scripts). Other stuff may not be as readily available, but requests are welcomed! Just comment if you're interested in something and I'll see if it's something I'm willing/able to share.

Scripting!

Woohoo!! So I've started this scripting blog as a means to show updates and describe techniques on the stuff I work on. It may range from mel scripting to as3, maybe some python, basically anything that I'm currently working on. I'm also gonna bring over the script related posts from bo.log (they'll be listed as earlier than this one). Anyway, I look forward to filling this blog soon!