PDA

View Full Version : Expressions 101



Surrealist.
06-10-2005, 06:08 PM
I am trying to learn expressions. But since I want to use them in in IK the doc states that you need to use Lscript expressions.

The Expression builder gives the following as examples of L script syntax:

Camera.pos(Time).X

Yet the Epression Builder's Lscript Functions all return syntax like the folowing:

abs([ItemOne.Position.X])

basically Bracket-type of syntax within ()

I vaguely remember reading something about this. Is this so that the Bracket type of syntax can be used as an L script entry?

I would really like to get a handle on this stuff, so any help would be appreciated.

Also the following is a bracket expression for making something turn in the opposite direction (from a LW8 tutorial):

-[Crunk:Crunk_rightthigh.Rotation.P]

Clear enough to understand. Now how would I make this an Lscript expression?

And I have not quite got my wits around wether or not you would even want such an expression in IK but bascially I want to know how to convert if I need to and so far none of the Lscript examples even work, they all return erors when trying to compile. So I am a little stumped.

A good dose of Expressions 101 would be in order if you have anyplace to point me that would be great.

EDIT: I am now getting a grip on the idea that the place to use Lscrip expressions is in the Modifier tab in the Graph Editor, Motion Options and Object Deformations tabs so I'll be experimenting with the syntaxes I have there as well to see how they work. Still would like a 101.

Thanks.

MonroePoteet
06-11-2005, 12:23 AM
I'm no expert, but I've found that problems I've had are because expressions are case sensitive (and different between the two!!), the channel names are different, and you MUST hit the return key after entering an expression in the "Motion Expressions" panel.

Regarding case sensitivity, in the example you gave, the problem is that Camera.pos(Time).x must have a lower-case x, not an upper-case X. The bracket syntax of the Crunk expression you gave should work fine, assuming you have a mesh object named "Crunk" with a layer named "Crunk_rightthigh". The equivalent LScript form should be:

Crunk:Crunk_rightthigh.rot(Time).p

The equivalent bracket notation for the Camera expression above is:

[Camera.Position.X]

Note the case in each example.

Regarding channel names, the bracket notation uses the full name with an initial capital letter, while Lscript notation uses the shorter version, all lower case:

Bracket "Position" = LScript "pos"
Bracket "Rotation" = LScript "rot"
Bracket "Scale" = LScript "scale"

As well, the LScript form requires an explicit time parameter (e.g. pos(Time)), while the bracket notation includes the current time implicitly.

One serious stumbling block in the "Motion Expression" panel is that you MUST press return after entering the expression. Simply going and pressing the Validate button without hitting return to "commit" the new expression doesn't change the existing expression, but revalidates the old expression. This is especially frustrating when you've got an invalid expression that keeps getting an error over and over when you keep trying to fix it, but forget to press return each time!

I think unless you want to specify a Time other than the current time (like look-ahead or something), the bracket notation is easier to use. I prefer it because then I can use the Expression Builder pulldown and the right-click "Append to Expression" in the channel bin to get a correct channel name.

Hope this helps, and good luck! As I said, I'm no expert.

mTp

Surrealist.
06-13-2005, 12:00 AM
Thanks for thew reply. Absolutely any information at this point will come in handy. I will remember the return key tip.

Thanks for all of the other info, I'll try and put it to some good use. :)