Thursday, November 17, 2011

Frames Per Beat Calculator

Shahbaaz Shah is awesome.  How awesome?  Well, for one thing, he's working in-house as a contract animator at Reel FX.  For another thing, he just passed along the link to this nifty little tool by Rich Reel that gives you a frame count (and a bunch of other spiffy figures) as you tap out a beat on the keyboard.  If you've got to animate anything that involves rhythm, this could come in pretty handy.

Kudos to Rich for making it, and thanks to Shahbaaz for passing it along!

Monday, November 14, 2011

I Tawt I Taw a Puddy Tat!

Entertainment Weekly has posted a sneak peek at I Tawt I Taw a Puddy Tat, a new CG animated short film featuring Sylvester and Tweety.  The short is one of three new theatrical Looney Tunes shorts that Reel FX has produced for Warner Bros, and one of two that feature revived audio of classic cartoon voice talent, Mel Blanc.  June Foray, another legend in the world of cartoon character voices, was brought in to voice Granny.


I Tawt I Taw a Puddy Tat will play in front of Happy Feet Two this coming weekend, while the other two shorts -- one featuring Daffy and Elmer (again with Mel's stellar vocals), the other bringing back Wile E Coyote and Roadrunner for more mayhem -- will appear in front of other WB features in 2012.

Friday, November 11, 2011

Auto-placing Toolbars

I fiddled around with Maya 2012's toolbar options a bit more today, and learned a few interesting things. The most interesting of all was the discovery of a way to auto-load a custom toolbar when Maya opens, and have it appear in the same position that it was in when you last closed the program. (This is all in Python, by the way; I'm not sure if it would work the exact same way in MEL.)

Saving Toolbar Positions
The first thing I had to figure out was how Maya saved toolbar placement. When I wrote the other day about fixing a co-worker's missing tool settings panel, I mentioned the discovery of Maya's startupMainWindowState settings file. I also found some flags on the windowPrefs command for saving and restoring these settings. Today I learned that when using those flags, the full absolute path to the file should not be passed. Maya only wants the name of the file; it already knows where it lives. So to save, it's as simple as this:


import maya.cmds as mc
mc.windowPref(saveMainWindowState="startupMainWindowState")

Maya also saves the toolbar settings automatically when it closes, and we'll take advantage of this as we move forward.

Restoring the Toolbar
Immediately after you have built your interface and wrapped it up in a toolbar, restoring Maya's window state settings will move the toolbar back into its original position (assuming it had an original position when the settings were last saved).  Here's a quick example:



import maya.cmds as mc
window = mc.window("myWindow")
column = mc.columnLayout(p=window)
button = mc.button(p=column, l="Click me!",
                   c="print('clicked!')")
toolbar = mc.toolbar("myToolbar", content=window, label="Clicker",
                     area="top")
mc.windowPref(restoreMainWindowState="startupMainWindowState")



Naming the toolbar is important, as this is what will allow you to re-position that toolbar automatically between sessions.  If it doesn't have a consistent name, it won't work.

Obviously the last line won't do much the first time that you run it, because there is no saved position for this toolbar.  However, move the toolbar to some other position, then close Maya, which will save the toolbar's position.  Open Maya, run the same code, and the toolbar should re-spawn in the same place where you moved it.

The next step is to make Maya auto-load your toolbar each time that it starts.

Auto-Loading the Toolbar
Maya looks for  -- and executes the contents of -- two files each time that it starts: userSetup.mel and userSetup.py.  If used, these files should be placed in Maya's "scripts" folder.  In this case, we're going to use the Python startup file to kick off our toolbar.

First, we'll need to wrap our code inside a function, and save it in a file.  Copy the following into a new file in your favorite text editor:



import maya.cmds as mc

def main():
    window = mc.window("myWindow")
    column = mc.columnLayout(p=window)
    button = mc.button(p=column, l="Click me!",
                       c="print('clicked!')")
    toolbar = mc.toolbar("myToolbar", content=window,
                         label="Clicker", area="top")
    mc.windowPref(restoreMainWindowState="startupMainWindowState")


Save this file as "myToolbar.py" into Maya's prefs/scripts folder, which is one of the places in the sys.path setting of Maya's embedded Python.

Now start a new text file, and add this to it:

import maya.cmds as mc
import myToolbar
mc.evalDeferred(myToolbar.main)

Save this file as "userSetup.py" into Maya's scripts folder.

The reason we're using "evalDeferred" is because Maya needs to wait to execute the UI code until it has a UI to work with.  If you don't defer the execution, Maya will crash before it even opens.

Close Maya and re-open it.  Your custom toolbar should automatically appear where you last placed it.


Thursday, November 10, 2011

Notes on bird flight

A few days back, one of the guys at work posted a link to a really great page on Brendan Body's web site that has a LOT of awesome observations about bird flight and how to animate it. Brendan was a lead animator on Legend of the Guardians: The Owls of Ga'Hoole, and "had a large role in developing the style of the bird flight for the film." You can see his application of these flight principles in his showreel from the film (inserted below). According to Brendan:
I'm responsible for all animation apart from a couple of shots where someone else animated the background characters - where Nyra says "Owlet, that one says you're his brother" and also where Ezylryb says "Soren, you did what was right". All cycles used in the flying shots are my own.
Awesome work, Brendan!

Tuesday, November 08, 2011

New iPhone App: Coach's Eye

Earlier today I received an email about an interesting new iPhone app that was just released by the folks at TechSmith. It's called Coach's Eye, and while it's being primarily marketed as a tool for coaches (of various types), I think it has some definite potential in the realm of animation.

In a nutshell, Coach's Eye is a simple video review tool. You can load a video clip (from one of several possible sources), scrub through it, add annotations (or "telestrations" as the TechSmith folks call them), and even record vocal comments. Once you're done, save the whole thing and share it using the app's sharing tools.

So how could Coach's Eye be useful for animators? Here are just a few thoughts...
  • Record a video critique of a piece of animation sent to you by a friend/colleague/student
  • Create a series of action analysis clips where you break down animated or live-action footage
  • Record reference footage for a shot you're animating, and make notes on specific things that you want to make sure to incorporate into your work
Right now they're offering Coach's Eye at a special introductory price of 99 cents. This deal won't be around forever, so swing on over to the App Store if you want to learn more.

And no, I'm not getting a kickback for plugging it. I just think it's cool, and wanted to pass the word.


Fixing Toolbar Issues in Maya 2012

One of the guys at work came to me with an odd problem: he couldn't get the Tool Settings dialog to appear. Clicking the middle button in the upper-right corner of Maya's main window normally makes this dockable dialog pop into view just to the left of the main viewport. In this case, it just made the viewport edge shift ever-so-slightly from left to right. It didn't create the usual drag bar, so we couldn't force the width using the mouse. Restarting Maya did no good. After digging into the UI elements, I found that the width of the dialog's main formLayout was at 0. However, forcing it to a different value did absolutely nothing.

I was pretty sure that Autodesk had to have created a way of keeping track of all those nifty dockables in Maya 2012, and it took a while to figure out where they put it. While the file where this data is stored is not exactly formatted for human eyeballs, I was able to read a bunch of things like "dockState," "dockControl," "dockWidget," and "toolBar", though, so I was pretty confident that I had the right thing. We closed Maya, renamed the file, opened Maya, and presto! The Tool Settings panel was working again!

If you run into this problem, the file in question is named "startupMainWindowState", and is the lone file stored in Maya's prefs/mainWindowStates folder. As I said above, it's not anything can can be edited manually (at least not easily). However, Autodesk did create a simple way to save and load the settings contained in this file. In the windowPref command, there are a couple flags that do the job: saveMainWindowState and restoreMainWindowState. If you make your own dockable windows or toolbars, those commands should let you save and restore their state so that you don't have to manually re-position them every time you make them. I haven't tested them yet, but I plan on doing so tomorrow, and will update this post with my findings.