// rd_Approximate.jsx // Copyright (c) 2007-2013 redefinery (Jeffrey R. Almasol). All rights reserved. // check it: www.redefinery.com // // Name: rd_Approximate // Version: 1.0 // // Description: // This script creates, sets, or unsets proxies for the selected // footage and composition items. // // If using a still or movie proxy, proxies will be rendered using // existing render settings and output module template, // preferably Best Settings / Photoshop for stills, // and Draft Settings / Lossless with Alpha for movies. // // Note: If you want to use a still-frame or sequence proxy, make sure to set // the output module template to a still-image format. Conversely, // if you want to use a movie proxy, set the template to a movie file // format. // // If using a file, you will be asked to select the file when you // click the Set Proxy button. If using stills or movies, you are // asked to select an output folder. Also, if using movies, you // can select to keep the proxy the same name as the source, // but the source file's format must be the same as the selected // output module template's file format. // // Note: This version of the script requires After Effects CS5 // or later. It can be used as a dockable panel by placing the // script in a ScriptUI Panels subfolder of the Scripts folder, // and then choosing this script from the Window menu. // // Legal stuff: // 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. // // In other words, I'm just trying to share knowledge with and help out my // fellow AE script heads, so don't blame me if my code doesn't rate. :-) // rd_Approximate() // // Description: // This function contains the main logic for this script. // // Parameters: // thisObj - "this" object. // // Returns: // Nothing. // (function rd_Approximate(thisObj) { // Globals var rd_ApproximateData = new Object(); // Store globals in an object rd_ApproximateData.scriptName = "rd: Approximate"; rd_ApproximateData.scriptTitle = rd_ApproximateData.scriptName + " v1.0"; rd_ApproximateData.strType = {en: "Proxy Type:"}; rd_ApproximateData.strTypeOpts = {en: '["Still", "Movie", "File", "Placeholder", "Sequence"]'}; rd_ApproximateData.strRSTemplate = {en: "Render Settings Template:"}; rd_ApproximateData.strOMTemplate = {en: "Output Module Template:"}; rd_ApproximateData.strRefresh = {en: "Refresh"}; rd_ApproximateData.strOutFolder = {en: "Output Folder:"}; rd_ApproximateData.strOutFolderBrowse = {en: "Browse..."}; rd_ApproximateData.strOutName = {en: "Output Name Template:"} rd_ApproximateData.strUseSourceNameForProxy = {en: "Use source name for proxy"}; rd_ApproximateData.strSetProxy = {en: "Set Proxy"}; rd_ApproximateData.strSetProxyMore = {en: "Set Proxy..."}; rd_ApproximateData.strUnsetProxy = {en: "Unset Proxy"}; rd_ApproximateData.strFileTitle = {en: "Select the file to use as a proxy"}; rd_ApproximateData.strSelectProxyFolder = {en: "Select the folder for storing rendered proxies."}; rd_ApproximateData.strHelp = {en: "?"}; rd_ApproximateData.strNoItemToProxy = {en: "Please select at least one footage or composition item, then try again."}; rd_ApproximateData.strNoProxiedItemToUnset = {en: "Please select at least one proxied item, then try again."}; rd_ApproximateData.strErrGetTpls = {en: "Couldn't retrieve the list of render settings and output module templates."}; rd_ApproximateData.strErrRenameProxy = {en: "Could not rename proxy file to '%1'."}; rd_ApproximateData.strMinAE100 = {en: "This script requires Adobe After Effects CS5 or later."}; rd_ApproximateData.strHelpText = { en: "Copyright (c) 2007-2013 redefinery (Jeffrey R. Almasol).\n" + "All rights reserved.\n" + "\n" + "This script creates, sets, or unsets proxies for the selected footage and composition items.\n" + "\n" + "If using a still or movie proxy, proxies will be rendered using existing render settings and output module template, preferably Best Settings / Photoshop for stills, and Draft Settings / Lossless with Alpha for movies.\n" + "\n" + "Note: If you want to use a still-frame or sequence proxy, make sure to set the output module template to a still-image format. Conversely, if you want to use a movie proxy, set the template to a movie file format.\n" + "\n" + "If using a file, you will be asked to select the file when you click the Set Proxy button. If using stills or movies, you are asked to select an output folder. Also, if using movies, you can select to keep the proxy the same name as the source, but the source file's format must be the same as the selected output module template's file format.\n" + "\n" + "Note: This version of the script requires After Effects CS5 or later. It can be used as a dockable panel by placing the script in a ScriptUI Panels subfolder of the Scripts folder, and then choosing this script from the Window menu." }; // rd_Approximate_localize() // // Description: // This function localizes the given string variable based on the current locale. // // Parameters: // strVar - The string variable's name. // // Returns: // String. // function rd_Approximate_localize(strVar) { return strVar["en"]; } // rd_Approximate_buildUI() // // Description: // This function builds the user interface. // // Parameters: // thisObj - Panel object (if script is launched from Window menu); null otherwise. // // Returns: // Window or Panel object representing the built user interface. // function rd_Approximate_buildUI(thisObj) { var pal = (thisObj instanceof Panel) ? thisObj : new Window("palette", rd_ApproximateData.scriptName, undefined, {resizeable:true}); if (pal !== null) { var res = "group { \ orientation:'column', alignment:['fill','top'], \ header: Group { \ alignment:['fill','top'], \ title: StaticText { text:'" + rd_ApproximateData.scriptName + "', alignment:['fill','center'] }, \ help: Button { text:'" + rd_Approximate_localize(rd_ApproximateData.strHelp) +"', maximumSize:[30,20], alignment:['right','center'] }, \ }, \ r1: Group { \ alignment:['fill','top'], \ proxyType: StaticText { text:'" + rd_Approximate_localize(rd_ApproximateData.strType) + "' }, \ proxyTypeList: DropDownList { properties:{items:" + rd_Approximate_localize(rd_ApproximateData.strTypeOpts) + "}, alignment:['fill','top'], preferredSize:[-1,20] }, \ }, \ r4: Group { \ alignment:['fill','top'], \ r4left: Group { \ orientation:'column', alignment:['fill','center'], \ r4top: Group { \ alignment:['fill','top'], \ rsTpl: StaticText { text:'" + rd_Approximate_localize(rd_ApproximateData.strRSTemplate) + "' }, \ rsTplList: DropDownList { alignment:['fill','top'], alignment:['fill','top'], preferredSize:[-1,20] }, \ }, \ r4btm: Group { \ alignment:['fill','top'], \ omTpl: StaticText { text:'" + rd_Approximate_localize(rd_ApproximateData.strOMTemplate) + "' }, \ omTplList: DropDownList { alignment:['fill','top'], alignment:['fill','top'], preferredSize:[-1,20] }, \ }, \ }, \ refresh: Button { text:'" + rd_Approximate_localize(rd_ApproximateData.strRefresh) + "', alignment:['right','center'], preferredSize:[-1,20] }, \ }, \ r5: Group { \ alignment:['fill','top'], \ outFolder: StaticText { text:'" + rd_Approximate_localize(rd_ApproximateData.strOutFolder) + "' }, \ outFolderName: EditText { text:'', characters:20, alignment:['fill','top'], preferredSize:[-1,20] }, \ outFolderBrowse: Button { text:'" + rd_Approximate_localize(rd_ApproximateData.strOutFolderBrowse) + "', alignment:['right','top'], preferredSize:[-1,20] }, \ }, \ r6: Group { \ alignment:['fill','top'], \ outName: StaticText { text:'" + rd_Approximate_localize(rd_ApproximateData.strOutName) + "' }, \ outNameTpl: EditText { text:'[compName]_[layerName].[fileExtension]', characters:20, alignment:['fill','top'], preferredSize:[-1,20] }, \ }, \ r7: Group { \ alignment:['fill','top'], \ filler: StaticText { text:'' }, \ proxyNameSameAsSource: Checkbox { text:'" + rd_Approximate_localize( rd_ApproximateData.strUseSourceNameForProxy ) + "' }, \ }, \ cmds: Group { \ alignment:['right','top'], \ unsetProxyBtn: Button { text:'" + rd_Approximate_localize(rd_ApproximateData.strUnsetProxy) + "', preferredSize:[-1,20] }, \ setProxyBtn: Button { text:'" + rd_Approximate_localize(rd_ApproximateData.strSetProxy) + "', preferredSize:[-1,20] }, \ }, \ }"; pal.grp = pal.add(res); pal.grp.r1.proxyType.preferredSize.width = pal.grp.r4.r4left.r4btm.omTpl.preferredSize.width = pal.grp.r5.outFolder.preferredSize.width = pal.grp.r6.outName.preferredSize.width = pal.grp.r7.filler.preferredSize.width = pal.grp.r4.r4left.r4top.rsTpl.preferredSize.width; pal.grp.r4.r4left.r4btm.margins.top -= 5; pal.grp.cmds.margins.top += 5; pal.layout.layout(true); pal.grp.minimumSize = pal.grp.size; pal.layout.resize(); pal.onResizing = pal.onResize = function () {this.layout.resize();} pal.grp.r1.proxyTypeList.selection = 0; pal.grp.r1.proxyTypeList.onChange = function () { var proxyType = this.selection.index; if ((proxyType === 0) || (proxyType === 4)) // Still or Sequence { // Try to auto-match a Best Settings RS / Photoshop OM template var listItems = this.parent.parent.r4.r4left.r4top.rsTplList; for (var i=0; i