Property Group and Index

Moderators: Disciple, zlovatt

Post Reply
User avatar
lloydalvarez
Enhancement master
Posts: 460
Joined: June 17th, 2004, 9:27 am
Location: New York City, NY
Contact:

I have a bunch of slider expression controls on a layer. What's the code to get index of each instance in the effects chain? Currently I am only able to get the propertyIndex of the slider itself which is always 1 since it's a child of the Slider Control Expression:

Code: Select all

this.propertyIndex
Is there a way to get it's parent so that I can get a unique index for each effect instance?

Code: Select all

this.parent.propertyIndex 


doesn't work.

-Lloyd
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

Try this:

Code: Select all

this.propertyGroup(1).propertyIndex
User avatar
lloydalvarez
Enhancement master
Posts: 460
Joined: June 17th, 2004, 9:27 am
Location: New York City, NY
Contact:

Thanks Paul, that worked. So is propertyGroup(1) like saying go up one level in the hierarchy?
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

Yes.
User avatar
lloydalvarez
Enhancement master
Posts: 460
Joined: June 17th, 2004, 9:27 am
Location: New York City, NY
Contact:

By the way, this works in CS3 but doesn't work in CS4:

Code: Select all

this.propertyGroup(1).propertyIndex

In CS4 you need to write this:

Code: Select all

thisProperty.propertyGroup(1).propertyIndex
which works in CS3 so you might want to use the later

-Lloyd
Zedzero
Posts: 4
Joined: August 19th, 2004, 11:01 am
Location: London
Contact:

Hi Folks,

I'm trying to get my head around this 'propertyGroup/propertyIndex' shenanigans and struggling.

I'm trying to get a group of letters in a block of text to break up in a random fashion.

I've applied an expression to the block of text that selects the first letter and applies a random positional and rotational drift over time using interpolation. I'm using the index range selector rather than the percentage, so my start is 0 and my end is 1.

What I want to be able to do is duplicate the property group and reference the previous property groups range 'offset' and add a 1 to get the next letter along in the string.

It seems that all the 'propertyGroup(x).propertyIndex' does is tell you the index number rather than the value itself, and even then I'm struggling to actually understand how you work out how to get to the previous property groups offset value.

Any pointers would be greatly appreciated.

Otherwise I'm going to have to roll up my sleeves and get medieval on it by hand.
zedzero uk
User avatar
lloydalvarez
Enhancement master
Posts: 460
Joined: June 17th, 2004, 9:27 am
Location: New York City, NY
Contact:

The way property Group works is you tell it how far up the hierarchy you want to move so to use this on a text animator your would need to back up 3 times. Once to the offset itself, 2 to the Range Selector and 3 to the Animator Group. Then you would substitute all this (and substract 1) where you would use the index:

Code: Select all

text.animator(thisProperty.propertyGroup(3).propertyIndex-1).selector("Range Selector 1").offset
This will get you the value of the offset from the previous Animator's Range Selector 1 Offset.


-Lloyd
Zedzero
Posts: 4
Joined: August 19th, 2004, 11:01 am
Location: London
Contact:

Cheers Lloyd.

That works exactly how I wanted.

I'm still not entirely sure how!

I need to eat more fish.

Thanks again

P
zedzero uk
User avatar
lloydalvarez
Enhancement master
Posts: 460
Joined: June 17th, 2004, 9:27 am
Location: New York City, NY
Contact:

No problem, one thing to note is I generally try to stay away from index-1 type expressions since they are recursive and can slow way down if you have a lot of instances. A better way to do it is to multiply the value times the index. This method makes for much faster expression execution times.

-Lloyd
Post Reply