FORUMS: list search recent posts

Effects categories

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
S├ębastien Parrinello
Effects categories
on Dec 17, 2015 at 8:26:02 pm

Hi All !

I'm working on a basic script to create a user effects toolbar which would allow the user to quickly add the effects he uses the most on After Effects.
Of course this have been done and scripts exist such as Ft_Toolbar but this is part of a training exercise for me.

Basically I want to allow the user to choose the effect he wants by choosing the effect category first. I've thought of two solutions:

- using two dropdownlist, one to choose the effect category and the other one to choose the effect in that category (This is the way Ft_Toolbar works)

- using a treeview and display categories as nodes and effects as items of these nodes.

Thanks to the scripting guide, I managed to get the list of effects using: app.effects[i] and the effect category using: app.effects[i].category

But now I'd like to access the categories without having to specify the effect first. Is there an expression I missed or any other way to get a list of all effects categories and then access to their effects ?


Return to posts index

Xavier Gomez
Re: Effects categories
on Dec 18, 2015 at 11:25:08 am
Last Edited By Xavier Gomez on Dec 18, 2015 at 11:30:03 am

There is no ready-made method to do that, therefore you should make your own sorted list of effects.
However, it appears that the app.effects array seems to be already sorted by category, that is, all effects belonging to the same category appear in blocks.
It is not stated in the scripting guide, but since the sorting of an array of 500+ entries cannot be by chance, i would trust it, it allows to store much less things.
For instance, you could store the index start(inclusive)/end(exclusive) of each category in an object:

var rangeTable = {
"3D Channel" : {start: 0, end: 7},
"Audio" : {start: 7, end: 17},
"Blur & Sharpen" : {start: 17, end: 34},
/*etc*/
};
and fill the dropdown with those infos. Here is a function that would create that object:


var NO_CATEGORY = "(No Category)"; // or something else, up to you
function getCategoriesRangeTable(){
var table = {};
var effects = app.effects, i=0, I=effects.length, k;
while (i<I){
k = effects[i].category;
table[k||NO_CATEGORY] = {start: i, end: I}; // start: inclusive, end: exclusive
// jump to next category:
while (++i<I && effects[i].category===k);
// overwrite:
table[k||NO_CATEGORY].end = i;
};
return table;
};


Xavier

(edit: part of the code didnt display correctly...)


Return to posts index

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