forked from ae-scripting/scripting-snippets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
renderAll.jsx
72 lines (55 loc) · 2.43 KB
/
renderAll.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//Script for creating new version of active or selected comps
//and rendering them with preset templates
//to the "render" subfolder of a project folder
//Templates
var t1 = "h264";
var t2 = "jpg";
var t3 = "qt_animation";
var renderAll = this;
renderAll.go = function(){
//getting active element and selected elements
var activeComp = app.project.activeItem;
var selComps = app.project.selection;
//getting currect date for render folder maning
//not mandatory
var d = new Date();
var _date = d.getDate()+'_'+(d.getMonth()+1)+'_'+d.getFullYear();
//creating "render" folder
//var fldr = new Folder(app.project.file.path + '/render_' + _date + '/');
//fldr.create();
var fldr = new Folder(app.project.file.path + '/proxies/');
fldr.create();
var comps;
if(selComps.length>0){
var comps = selComps; //if some comps are selected - work on them
}
else{
//otherwise if we're in a composition - use it
if(activeComp && activeComp instanceof CompItem) var comps = [activeComp];
}
app.beginUndoGroup("Render comps");
for(var c = 0; c<comps.length; c++){
//put the comp into the render queue
//toRenderQueue(comps[c], t1, fldr);
//creating DV version
//not mandatory
var dvComp = app.project.items.addComp(comps[c].name + '_proxy', 1920, 1080, 1, comps[c].duration, 30);
//dvComp.layers.addSolid([0,0,0], "Black Solid", dvComp.width, dvComp.height, dvComp.pixelAspect, dvComp.duration);
//adding initial comp as layer
var l = dvComp.layers.add(comps[c]);
//fit scale to width
l.property("ADBE Transform Group").property("ADBE Scale").setValue(dvComp.pixelAspect*l.property("ADBE Transform Group").property("ADBE Scale").value/(comps[c].width/dvComp.width));
//put it into render queue with t2 template
toRenderQueue(dvComp, t1, fldr);
}
app.endUndoGroup();
}
renderAll.toRenderQueue = function(_comp, _template, _fldr){
//this function takes _comp composition and puts it into the render queue
//with _template template and renders it to the _fldr folder
var rQ = app.project.renderQueue;
var renderit = rQ.items.add(_comp);
renderit.outputModules[1].file = File(_fldr.fullName+"/"+_comp.name);
renderit.outputModules[1].applyTemplate(_template);
}
renderAll.go()