Tuesday, September 29, 2009

s'more scripts

A couple new scripts and some slight revisions of previously posted ones. First the old . . .
zbw_attributes.mel (rt_click "save as" to download)
Previously, I had a color slider just to change the color (via color override) of multiple controls at once. I've added some new stuff (or rather I made a different script and added the color stuff to that). Basically, this script will lock or hide (or unlock/unhide) all or any of the standard tranforms from the channel box. So for an FK controls that just use rotation, you could select all of them and lock and/or hide all of the tranlates, scale and visibility. The color stuff is also here, but in canvas format instead of slider format. The slider was just a bit too random for my taste.

Same playblast script that was up before, just changed the background toggle to a canvas format for ease and added green so you can quickly key a test playblast into your comp or storyreel.

I'm working on a job that requires me to have LOTS of objects in the scene and mess with them a bit to add a bit of randomness, so I wrote two quick scripts. This one will take a selection of objects and randomly remove a certain percentage. So if you wanted to change the shader on some objects or offset the animation on some objects, you'd select them all, then run the script and remove whatever percentage of them and go for it as a subgroup of the whole. This runs a random check on each object vs. the percent you enter.

This script takes a selection and performs a random transform on each object based on the info you enter. You can do translation, rotation or scale (or all of them) either in world space or based on the current position. It cycles through the objects and calculates random values for each attribute for each object, so for lots of objects it may take some time. The example below was 2500 objects and 6 attributes and it took a couple of minutes. But I've had lots of situations where this would be useful, so I thought I'd script-ize it up.

As always, the code is a bit crude at times (no dummy checks on object types, etc). Maybe I'll clean it up later, maybe not ;)

The basis for the randomizing scripts was something like this:

As I said, there are about 2500 objects in the scene (placed by hand). I used the selection script to select a few squares here and there to change shaders to dirty up the mosaic. I wanted the pieces to blow away (based on objects in the 2d comp) but didn't want to deal with dynamics. So The random transform script was used to add a key frame to each object. Basically this whole animation is two keyframes on each object. One in place and one with the random transform script. I then selected a few and offset those two keys a frame or two a couple of different times. Took about 5 minutes total (2 of which were waiting for the random calculations). Not perfect, but quick and dirty (like I like it).

No comments:

Post a Comment