Sunday, 15 March 2009

Tip: ad hoc scripting #2 - rapidly change variables for a group of transforms

I have already published a set of utility scripts for working on groups of transforms (link). It's easy enough to write scripts that generalise when it comes to working with variations (one simply needs to maintain a list of currently installed plugins in alphabetical order): the old method of referencing variations by number is most useful in this context. But it doesn't allow for easy manipulation of variables. Rather than write an enormous script that covers all, I've developed a (wait for it) spreadsheet that picks up all the variables via a lookup table. But it's not necessary - just a code snippet repository or, better, a clipboard utlility (e.g. ArsClip, my review) will do the trick. As an example, we'll take the lazysusan variation - all that's required is:

Transform.lazysusan_spin := 3.14159;
Transform.lazysusan_space := 0;
Transform.lazysusan_twist := 0;
Transform.lazysusan_x := 0;
Transform.lazysusan_y := 0;

These are the default values. Also, a loop wrapper:

for i := a to b do

where a and b are the first and last transforms of the group (zero-based counting, that is the first transform of the flame is in fact transform #0).

Running Apophysis with the script editor window open (Ctrl-D), just click the New tool and paste in the code, amend the values as desired and click the Run tool - one click to perform what would take perhaps 30 seconds to accomplish in the Transform Editor.

No comments: