{ // Create3DComp.jsx // Written by Jim George on 6/3/2008 // Contact me at backsmith@gmail.com // Created for DXARTS 545: Stereoscopic Cinema Spring 2008 // // Feel free to use, modify, and redistribute // Limitations: does not support keyframed mask shapes. Shape layers may mess things up. /** Below are instructions on how to integrate this into your work flow Footage Requirements: * You need all your footage to be named with the convention MyVideoClipLEFT.mov and MyVideoClipRIGHT.mov and for them to be in the same folder * Your files should be captured with synced time code so they're in/out points are the same and they are the same duration * Make sure the word LEFT and RIGHT doesn't show up anywhere else in the file names too ;) To Use the script: * Create a composition that is 1440x1080 with Pixel aspect of HDV 1080 (1.33) (this is a default setting in after effects for HDV 29.97 and is correct for the footage we shot with the XH G1) * Edit your movie using *only* the left camera's footage. You can do whatever you want here *except* resize the footage... so masks, effects, time stretching, opacity...is all fair game * When you are done with the cut you want, select your composition and then select File > Scripts > Run Script File... and select my attached Create3dComp.jsx * Blamo! you now have a new comp that is named YourComp_3dified and it will have widened the composition and placed the right camera's footage next to the left, flipped and ready to go. * You can export as you would normally. Note: This script creates compositions that are 2880x1080 with wide pixels, when you export out of after effects you will need to select a custom aspect ratio to get the full 3840x1080 with square pixels. */ function reverseMask(layer){ try{ var mask = layer.property("ADBE Mask Parade").property(1); }catch(e){ return; } var oldShape = mask.property("ADBE Mask Shape").value; if(!oldShape || !oldShape.vertices){ alert("could not get mask vertex array, skipping"); return; } var newShape = new Shape(); var newVertices = []; var newInTangents = []; var newOutTangents = []; for(var j = 0; j < oldShape.vertices.length; j++){ newVertices[j] = [ 1440 - oldShape.vertices[j] [0], oldShape.vertices[j] [1] ]; } for(var j = 0; j < oldShape.inTangents.length; j++){ newInTangents[j] = [ -oldShape.inTangents[j][0], oldShape.inTangents[j][1] ]; } for(var j = 0; j < oldShape.outTangents.length; j++){ newOutTangents[j] = [ -oldShape.outTangents[j][0], oldShape.outTangents[j][1] ]; } newShape.closed = oldShape.closed; newShape.vertices = newVertices; newShape.inTangents = newInTangents; newShape.outTangents = newOutTangents; mask.property("ADBE Mask Shape").setValue(newShape); } function Creat3dComp(myComp, footage){ var comp_layers = myComp.layers; for(var i = comp_layers.length; i > 0; i--) { var thisLayer = comp_layers[i]; var wasLocked = thisLayer.locked; if (wasLocked) { thisLayer.locked = false; } var newLayer = thisLayer.duplicate(); newLayer.Transform.Position.setValue([2160, 540]); newLayer.Transform.Scale.setValue([-100, 100]); for(var j = 0; j < footage.length; j++){ if(newLayer.source.file.name.replace("LEFT", "RIGHT") == footage[j].file.name){ newLayer.replaceSource(footage[j], false); reverseMask(newLayer); break; } } if (wasLocked) { thisLayer.locked = true; } } } var proj = app.project; if (proj) { var footageItems = []; for(var i = 1; i <= proj.items.length; i++){ if(proj.items[i] instanceof FootageItem){ footageItems.push(proj.items[i]); } } var undoStr = "Create 3d Comp"; var activeItem = app.project.activeItem; if (activeItem != null && (activeItem instanceof CompItem)){ app.beginUndoGroup(undoStr); var comp3d = activeItem.duplicate(); comp3d.name = activeItem.name + "_3dified"; comp3d.width = 2880; comp3d.height = 1080; Creat3dComp(comp3d, footageItems); app.endUndoGroup(); } else { alert("Please select a comp to use this script"); } } else { alert("Please open a project first to use this script."); } }