KAZIK/tools/generators/make_studio_v5.jsx

57 lines
4.4 KiB
JavaScript

/* Finishing timelines. Cameras and props are editable in the matching .blend. */
(function(){
app.beginSuppressDialogs();
var root=File($.fileName).parent.parent.parent.fsName.replace(/\\/g,"/");
var version=parseInt($.global.eblanStudioVersion || 8,10);
var work=root+"/build/cinematic-v"+version;
function log(s){var f=new File(work+"/ae-studio-v"+version+".log");f.open("a");f.writeln(s);f.close();}
try{
var edits={
5:{title:"After hours",seconds:24,fadeIn:.45,fadeOut:.8,power:7.3,impact:14.08,logo:21,preview:6,
shots:[['01 / Floor litter',0,5],['02 / Whole workshop',5,11],
['03 / Workbench - falling can',11,17],['04 / CRT - EBLAN GAMES',17,24]]},
6:{title:"Room 17",seconds:12,fadeIn:.16,fadeOut:.46,power:149/24,impact:4.78,logo:186/24,preview:2.59,
shots:[['01 / Corridor and doorway',0,68/24],['02 / Falling can',68/24,116/24],
['03 / Workbench',116/24,172/24],['04 / Studio logo',172/24,12]]},
7:{title:"Room 17 at night",seconds:12,fadeIn:.12,fadeOut:.44,power:163/24,impact:161/24,logo:222/24,preview:2.59,
shots:[['01 / Door swings in',0,49/24],['02 / Demo cassette',49/24,121/24],
['03 / Over the lip',121/24,159/24],['04 / Rim and switch',159/24,172/24],
['05 / Starter relay',172/24,222/24],['06 / Eblan Games',222/24,12]]},
8:{title:"Splice",seconds:16,fadeIn:.12,fadeOut:.42,power:263/24,impact:161/24,logo:332/24,preview:80/24,
shots:[['01 / Door 17',0,49/24],['02 / Spliced tape',49/24,103/24],
['02B / Take-up spindle',103/24,121/24],
['03 / Can rolls off the desk',121/24,159/24],['04 / Rim on switch',159/24,172/24],
['05 / Relay release',172/24,254/24],['06 / Cold phosphor',254/24,332/24],
['07 / Studio signature',332/24,16]]}
};
var edit=edits[version];
if(!edit)throw new Error("Unsupported studio version: "+version);
var seconds=edit.seconds;
var shots=edit.shots;
app.newProject();app.project.bitsPerChannel=16;
var options=new ImportOptions(new File(work+"/frames/frame_0001.png"));options.sequence=true;options.forceAlphabetical=true;
var footage=app.project.importFile(options);footage.mainSource.conformFrameRate=24;
if(footage.duration<seconds-.01)throw new Error("Incomplete Blender render: "+footage.duration);
footage.name="Blender / "+seconds*24+" Full HD frames";
var master=app.project.items.addComp("MASTER / EBLAN GAMES - "+edit.title,1920,1080,1,seconds,24);
for(var i=0;i<shots.length;i++){
var layer=master.layers.add(footage);layer.name=shots[i][0];layer.inPoint=shots[i][1];layer.outPoint=shots[i][2];
master.markerProperty.setValueAtTime(shots[i][1],new MarkerValue(shots[i][0]));
}
var fade=master.layers.addSolid([0,0,0],"Black / opening and ending fades",1920,1080,1,seconds);
var opacity=fade.property("ADBE Transform Group").property("ADBE Opacity");
opacity.setValueAtTime(0,100);opacity.setValueAtTime(edit.fadeIn,0);
opacity.setValueAtTime(seconds-edit.fadeOut,0);opacity.setValueAtTime(seconds,100);
var sound=app.project.importFile(new ImportOptions(new File(root+"/assets/audio/startup/studio-workshop-v"+version+".wav")));
var audio=master.layers.add(sound);audio.name=version>=6 ? "Stereo / drums, flyby, can and CRT" : "Stereo / fan, room, CRT, falling can, PC chime";audio.outPoint=seconds;
master.markerProperty.setValueAtTime(edit.power,new MarkerValue("CRT relay / power on"));
master.markerProperty.setValueAtTime(edit.impact,new MarkerValue("Can / impact"));
master.markerProperty.setValueAtTime(edit.logo,new MarkerValue("Studio logo"));
master.time=edit.preview;
master.openInViewer();
app.project.save(new File(root+"/assets/cinematics/source/EblanGames-workshop-v"+version+(version===8 ? "-16s" : "")+".aep"));
log("SUCCESS / 1920x1080 / 24fps / "+seconds*24+" frames / "+seconds+" seconds / "+shots.length+" shots / stereo");
app.project.close(CloseOptions.DO_NOT_SAVE_CHANGES);
}catch(e){log("ERROR: "+e.toString()+" at line "+e.line);}
app.endSuppressDialogs(false);app.quit();
})();