Skip to content

Commit 4e0ffd5

Browse files
committed
DOM: Add folder argument to getCompositions
It can be useful to be able to only get comps in single folder
1 parent 1681020 commit 4e0ffd5

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

lib/dom.js

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,24 +78,16 @@ aeq.extend({
7878
},
7979

8080
/**
81-
* Gets all the CompItems in the project
81+
* Gets all the CompItems in the project. Or all CompItems in the given folder.
8282
* @method
8383
* @memberof aeq
84+
* @param {FolderItem} [folder=app.project] The folder to get comps from.
85+
* @param {boolean} [deep=true] Go through subfolders looking for comps.
8486
* @return {aeq.arrayEx} Array of CompItems
8587
*/
86-
getCompositions: function () {
87-
var arr = [];
88-
var len = app.project.items.length;
89-
90-
for (var i=1; i <= len; i++)
91-
{
92-
var item = app.project.item(i);
93-
94-
if (aeq.isComp(item))
95-
arr.push(item);
96-
}
97-
98-
return aeq.arrayEx(arr);
88+
getCompositions: function(folder, deep) {
89+
var items = aeq.getItems(folder, deep)
90+
return items.filter( aeq.isComp )
9991
},
10092

10193
/**

0 commit comments

Comments
 (0)