View Full Version : parsing a scene to add follower via lscript???

04-18-2008, 10:21 AM
hi all,

i'm a total lscript idiot, i have been mucking around with lscript commander and hacking bits of code from the forums and have managed to make a basic tool to automate sections of my rigging pipeline.

i've heard of using "parsing" to add things like follower using lscript

and found a couple of interesting threads....

this one from jeremyhardin

and some interesting posts here by cb_3d

to be honest they are both totally over my head, can anybody give a simple example of applying follower using this? (ie forearm following a wrist)

if there is no "simple" way, maybe a few pointers so i can get a coder friend to have a look (no lightwave experience)

thanks very much in advance


04-18-2008, 11:46 AM
From LS Commander to hacking LWS is a big step. And hacking item settings/plugins is also slightly more complex than scene specific settings/plugins. As is editing it as opposed to just retrieving information from it. So if Hardins example is over your head then things aren't great.

First thing you need to do is analyze and understand the structure of the LWS, both the big picture and the bits concerning the plugin. So save a scene with Follower applied to some item. Make a search for the name of the plugin, "Follower". You'll find a line like "Plugin ItemMotionHandler 1 Follower". Inbetween that and the line "EndPlugin" is all of that plugins instance data. Decipher it. Figure out what value corresponds to what control in the interface by trial and error (ie change something, resave, analyze and repeat). Also make sure you scroll up and down to understand how different items data are separated from one another.

Now create a function that you can pass as parameters all these different values you deciphered and it will spit out a string corresponding to the plugins entry in an LWS. This should be no problem for your friend if you did a good job deciphering and documenting.

Next you are ready to parse the LWS. Save a scene copy, and open a new file. The first you read from and the other you write to. As you read a line from the first you write it to the other. As you read, start looking for the item you want to apply the plugin to - Look first for the line with "AddNull"/"AddBone"/"LoadObject"/etc and your items name and/or id (LW9.x). Then look for the line starting with "PathAlignReliableDist". Motion modifiers usually follow after it.

Now you are in the right spot, so build the string using the function you made earlier, with whatever valid parameters you like, and write that to the file. Finish up by reading and writing to the end. Load the newly written LWS.

Good luck!

04-18-2008, 01:36 PM
Its probably easier in many cases to create a simple expression and apply that to multiple channels at one time.

04-19-2008, 12:22 AM
some cool info here,

care to elaborate on a "simple" follower expression larry?


04-19-2008, 01:14 AM
The simplest way to use an expression is to link a channel to another channel.
For example linking the X channel of a null to the X channel of another null and so on.
Expressions are something seen by lscript so it might be easier to apply them rather then something like follower.

As an example, say I have a forearm bone that is the parent to the wrist bone.
I create an expression [Body.wrist.Rotation.B] * .5
and apply this to the bank channel of the forearm bone.

Now when I rotate the bank channel on the wrist the forarm rotates in its bank half as much.

04-19-2008, 01:54 AM
ok cool beans,

thanks for the breakdown evenflcw. that kinda the process i had worked put in my head.

larry's expression idea seems interesting (simpler),
i got expressions to work on a forearm twist

any pointers about getting this into a script

again, this looks interesting.....

but confusion has set in

any help would be great


04-19-2008, 02:23 AM
You might want to check this out:

specifically this one: