|  |  |  |  |  |  |  | {
/////////////////////////////////////////////////////////////////////////
//                                                                          
// MAkinE Disney Customizer
//
// ©2017 Jorge Vasquez
// Author: Jorge Vasquez
//                                                                          
// Version History
//
////////////////////////////////////////////////////////////////////////
var tcd_scriptName = "MAkinE - Disney Customizer ";
var tcd_version = "0.1";
function tcd_buildUI(thisObj) {
    
    if (thisObj instanceof Panel) {
        var myPal = thisObj;
    } else {
        var myPal = new Window("palette",tcd_scriptName + " v" + tcd_version,undefined, {resizeable:true});
    }
    if (myPal != null) {
        
        var res = 
        "group { \
                    alignment: ['fill','fill'], \
                    alignChildren: ['left','top'], \
                    orientation: 'column', \
          match: Group { \
                    alignment: ['fill','top'], \
                    alignChildren: ['fill','top'], \
                    orientation:'column', \
                    suffix: Group { \
                        alignment: ['fill','top'], \
                        alignChildren: ['fill','top'], \
                        paletteText: StaticText {text:'Piece Palette', alignment: ['left','center']}, \
                        paletteOption: DropDownList {alignment: ['left','center']}, \
                        suffixTxt: StaticText {text:'Show Title', alignment: ['left','center']}, \
                        suffixString: EditText {text: 'Show Title', alignment: ['fill','center']}, \
                        } \
                    } \
                    doItBtn: Button {text: 'Customize', alignment: ['right','top']} , \
                }";
        
        myPal.grp = myPal.add(res);
        
        var paletteOptions = ["Palette 01","Palette 02","Palette 03","Palette 04"];
        for (var i=0; i<paletteOptions.length; i++) {
            myPal.grp.match.suffix.paletteOption.add("item",paletteOptions[i]);
        }
        
        myPal.grp.match.suffix.paletteOption.selection = 0;
        myPal.grp.match.suffix.paletteOption.minimumSize.width = myPal.grp.match.suffix.paletteOption.preferredSize.width = 75;
                                 
         myPal.grp.match.suffix.suffixString.onChange = function () {
         }
               
        
        myPal.grp.doItBtn.onClick = function () {
               var checkError = false;
               if (checkError == false) tcd_doIt ();
        } //myPal.grp.doItBtn.onClick = function () 
                
        myPal.layout.layout(true);
        myPal.layout.resize();
        myPal.onResizing = myPal.onResize = function () {this.layout.resize();}
         
        } //if (myPal != null)
    return myPal;
    }
function tcd_doIt (){
    title_layer = app.project.activeItem.layer("TITLE");
    ctrl_layer = app.project.activeItem.layer("ctrl_bubble");
    title_layer.sourceText.setValue(myPalette.grp.match.suffix.suffixString.text);
    width = title_layer.sourceRectAtTime(0, false).width;
    //alert(width)
    if ( width >= 1300 )
    {
        ctrl_layer("Effects")("long_name")("Checkbox").setValue(1);
    }
    else
    {
        ctrl_layer("Effects")("long_name")("Checkbox").setValue(0);
    }
    
    ctrl_layer("Effects")("width")("Slider").setValue(width + 75);
    
} //function tcd_doIt (palObj)
var tcd_mode = 0; // 0 - none, 1 - add suffix, 2 - search and replace
var tcd_suffix = "";
var tcd_searchTerm = "";
var tcd_replaceTerm = "";
//main
var myPalette = tcd_buildUI(this);
var tcd_folderName, tcd_addFolder, tcd_origParentFolder, tcd_parentFolder, previousComps, previousFolders;
if (parseFloat(app.version) < 8) {
    alert("This script requires Adobe After Effects CS3 or later.", tcd_scriptName);
    } else {
    if (myPalette != null && myPalette instanceof Window) {
        //myPalette.center();
        
        myPalette.show();
    }
}
} |