ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Access to all the properties of a layer SCRIPTING

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Rainier Raydán
Access to all the properties of a layer SCRIPTING
on Nov 15, 2017 at 7:48:56 pm

Hi!
I'm wondering. Is there a way to do a for loop for all the properties of a layer? I need to access to all the properties that has values so I can modify them with a function.

Thanks!


Return to posts index

Dan Ebberts
Re: Access to all the properties of a layer SCRIPTING
on Nov 15, 2017 at 9:00:55 pm

It's complicated. You'd start with the layer, and for each of the top level properties, you'd do a recursive dive through the property heirarchy, checking each property to see if has properties, checking those, etc. You might run into properties that have a value type of CUSTOM_VALUE though, which you won't be able to modify.


Dan



Return to posts index

Rainier Raydán
Re: Access to all the properties of a layer SCRIPTING
on Nov 15, 2017 at 9:03:17 pm

Yep, I see that... ussually I do a lot of for loops diving in the diferents levels of properties. Do you know how many for loops do I need to do to make it all the way down?

Thanks!


Return to posts index


Dan Ebberts
Re: Access to all the properties of a layer SCRIPTING
on Nov 15, 2017 at 9:40:34 pm

The number of nesting levels varies, especially when you're dealing with, for example, shape layers. You just need to call your property processing function recursively, until the property you're processing has no properties itself.

Dan



Return to posts index

Rainier Raydán
Re: Access to all the properties of a layer SCRIPTING
on Nov 19, 2017 at 7:48:01 pm

I've been thinking in a way to write , like you said, a property processing function but I havent find a way... can you help me with that?

Also, I'm having troubles with the hidden properties, in this case it's only TimeRemap. I get an error that said the property is hidden and I cant call addKey() function... You know a way to prevent this to happeng?

Thanks a lot


Return to posts index

Dan Ebberts
Re: Access to all the properties of a layer SCRIPTING
on Nov 19, 2017 at 10:01:58 pm

This is a simple, recursive property sniffer (be prepared though, I get 135 properties for a simple solid):


function processProperty(theProp){
if (theProp.propertyType == PropertyType.PROPERTY){
$.writeln(theProp.name);
}else{ // must be a group
for (var i = 1; i <= theProp.numProperties; i++){
processProperty(theProp.property(i));
}
}
}
var myLayer = app.project.activeItem.layer(1);
processProperty(myLayer);


You should be able to trap errors with try/catch.

Dan



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]