Random walk keyframed blocks in MEL

February 4th, 2009

I’m starting a project, and I thought I’d do it in the window of my little shop, here on this sidestreet of the Internet. That way everyone wandering by can peek in, gaze upon the array of parts strewn all over my workbench, and wonder what I’m up to.

MEL code follows:

proc doit(string $u) {
  vector $s = sphrand(1);
  xform -r -t ($s.x) ($s.y) ($s.z) $u;
}

select `polyCube -h 1 -n "pCube1"`;

for ($i=0; $i<500; ++$i) {
  $sel = `ls -sl`;
  select -cl;
  select `instance $sel`;
  $new = `ls -sl`;
  setKeyframe -attribute "visibility" -v 0 -t 0 $new; 
  setKeyframe -attribute "visibility" -v 1 -t $i $new;
  doit($new[0]);
}
« previously: La Mare aux TĂȘtards | Home | next: Random walk pyramids »

2 Responses to “Random walk keyframed blocks in MEL”

  1. Robert Chiniquy Says:

    What language is this? What tool do you use to put it together?

  2. zoomy Says:

    Ah ha! The bait is taken!

    MEL is the Maya Embedded Language, a scripting language embedded in the 3D app Maya. It’s clunky, and strongly typed, but I think it’ll go where I want. Blender would be the natural choice but I live in Mayaworld.

    I liked your color space visualizer. It looked like a bouncy castle.

Leave a Reply