-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathSet Proxies From Folder.jsx
49 lines (45 loc) · 1.46 KB
/
Set Proxies From Folder.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
* @name Set Proxies From Folder
* @version 2.2
* @author Kyle Martinez <www.kyle-martinez.com>
*
* @description Set proxies for all compositions within the project.
*
* @license This script is provided "as is," without warranty of any kind, expressed or implied. In
* no event shall the author be held liable for any damages arising in any way from the use of this
* script.
*
* I'm just trying to help make life as an After Effects animator a little easier.
*/
(function setProxiesFromFolder() {
function setCompositionProxy(comp, allFiles) {
var name = comp.name;
if (allFiles.hasOwnProperty(name)) {
var proxy = new File(allFiles[name]);
comp.setProxy(proxy);
}
}
function getAllFiles() {
var allFiles = {};
var folder = Folder.selectDialog();
var files = folder.getFiles();
var numFiles = files.length;
for (var f = 0; f < numFiles; f++) {
var file = files[f];
var name = file.displayName.spit(".")[0];
allFiles[name] = file.fsName;
}
return allFiles;
}
app.beginUndoGroup("Set Proxies From Folder");
var allFiles = getAllFiles();
var project = app.project;
var items = project.items;
for (var i = project.numItems; i > 0; i--) {
var item = items[i];
if (item instanceof CompItem) {
setCompositionProxy(item, allFiles);
}
}
app.endUndoGroup();
})();