PDA

View Full Version : is there a This_Object method or similar?



stib
11-30-2003, 03:50 PM
This is a question about expressions rather than LScript, but anyway..

In After Effects I can write an expression like:

if (This_layer.position.Y > SomeOtherlayername.Position.Y) then{something}
(don't quote me on the syntax BTW)

I can apply this expression to multiple layers and because of the This_layer property every layer object has, the result will be calculated individually for each layer using that layer's values for position.Y.

I want to do the same in a lightwave scene. I have a big array of objects and I want each one of them to dissolve in when another object falls past them. ie something like

[ThisObject.Position.Y] > [FallingObject.Position.Y]?100,0

Is there a way to access the values for each individual object seperately, so I can do this?

stib
12-02-2003, 08:43 PM
I'll take that as a 'no' then.. *sigh*

faulknermano
12-03-2003, 04:36 AM
@warnings
@script channel

create: channel
{
selfChannel = channel;
p = selfChannel.parent;
SelectItem(p.id);
}


process: ca, frame, time
{
}
options
{
...
}


you want to control dissolve through channels. therefore you will need to use a channel filter script. when you apply a CF script you want it to look at the channel it's being applied to and find the 'parent' of that channel - the layout item it belongs to. by calling the parent datamember on the the object agent that is created automatically when a CF script is applied you can get the actual Mesh object agent. in this case the OA is assigned to the variable p. it's from here that you can refer to p's position:



pos = p.getPosition(myTime);


two thing should be pointed out however: 1.) this example only applies to channels that are not nested, since it only looked at the immediate parent. you can code this so that you traverse all the way up the mesh object agent by checking the 'genus' (a datamember) of the current parent as you go up. 2.) CF does not do calculations 'real-time' so you have feed CF's process func's time parameter directly into getPosition():



process: ca, frame, time
{
pos = p.getPosition(time);
}

faulknermano
12-03-2003, 04:44 AM
btw, this is lscript, not expressions. i've tried scouring the docs for something like this way back but i dont think there's a "self" oa for reference.

UnCommonGrafx
12-03-2003, 04:36 PM
Relativity only.
Oh, maybe Amelie.

I bet lw8, too.

stib
12-03-2003, 05:36 PM
do you *bet* lw8 or *hope* lw8?

Yeah, I figured that since there was nothing about it in the docs it wasn't there. Pity. It really limits expressions. The scripting power in After effects is brilliant. I can have hundreds of layers each with the same expression, doing entirely different things. Maybe it's because AE scripting is based on Java which is more object oriented..

Thanks for the LScript help. The reason I wanted an expression was that it was a lot quicker 'n easier to write a one line expression, look at the curve, tweak etc. The overheads are a lot smaller, particularly as my LScript knowledge is pretty limited.

faulknermano
12-04-2003, 07:30 AM
Originally posted by stib

Thanks for the LScript help. The reason I wanted an expression was that it was a lot quicker 'n easier to write a one line expression, look at the curve, tweak etc. The overheads are a lot smaller, particularly as my LScript knowledge is pretty limited.

i understand. i have the opposite problem.. (in some ways). as an added note, it may interest you to know that in the current version of lscript, it is possible to create an 'expression lscript' that you can call in your expression. but of course, you still have to create the lscript first.

good luck.

stib
12-04-2003, 03:45 PM
So the Expression LScript that I call could return the value for a channel for a particular object, right..?

Hey now you're talking. I'll have to get my l337 h4XX0r hat on quick smart and start LScripting.

faulknermano
12-05-2003, 07:00 AM
Originally posted by stib
So the Expression LScript that I call could return the value for a channel for a particular object, right..?
.

yup.