You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							1 line
						
					
					
						
							6.4 KiB
						
					
					
				
			
		
		
	
	
							1 line
						
					
					
						
							6.4 KiB
						
					
					
				| {
 | |
| /////////////////////////////////////////////////////////////////////////
 | |
| //                                                                          
 | |
| // MAkinE Disney Customizer
 | |
| //
 | |
| // ©2017 Jorge Vasquez
 | |
| // Author: Jorge Vasquez
 | |
| //                                                                          
 | |
| // Version History
 | |
| //
 | |
| ////////////////////////////////////////////////////////////////////////
 | |
| 
 | |
| var tcd_scriptName = "MAkinE - Disney Customizer ";
 | |
| var tcd_version = "0.1";
 | |
| //
 | |
| 
 | |
| 
 | |
| function applyPallette( palette_string ){
 | |
|     var comp = app.project.activeItem;
 | |
|     
 | |
|     var color_targets = [
 | |
|         comp.layer("TITLE")("Effects")("Fill")("Color"),
 | |
|         comp.layer("DONT_TOUCH_bubble")("Effects")("Fill")("Color"),
 | |
|         comp.layer("DONT_TOUCH_bubble_shadow")("Effects")("Fill")("Color"),
 | |
|         comp.layer("DISNEY_LOGO_Bubble")("Effects")("Logo_BG")("To"),
 | |
|         comp.layer("DISNEY_LOGO_Bubble")("Effects")("Logo_FG")("To"),
 | |
|         comp.layer("MAIN_BG")("Effects")("Fill")("Color"),
 | |
|         comp.layer("BG_Ears")("Effects")("Fill")("Color")      
 | |
|         ];
 | |
|     var opacity_targets= [
 | |
|         comp.layer("BG_Ears")("Transform")("Opacity"),
 | |
|         comp.layer("Vignette")("Transform")("Opacity")
 | |
|     ];
 | |
|     for ( var i = 0; i < color_targets.length; i++)
 | |
|         {
 | |
|             color_targets[i].setValue(hexToColor(palettes[palette_string][i]));
 | |
|         }
 | |
|     for ( var j = 0; j < opacity_targets.length; j++)
 | |
|         {
 | |
|            opacity_targets[j].setValue(palettes[palette_string][j+7]);
 | |
|         }
 | |
| }
 | |
| function hexToColor(theHex){
 | |
|   var r = theHex >> 16;
 | |
|   var g = (theHex & 0x00ff00) >> 8;
 | |
|   var b = theHex & 0xff;
 | |
|   return [r/255,g/255,b/255,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 HERE', alignment: ['fill','center']}, \
 | |
|                         } \
 | |
|                     } \
 | |
|                     doItBtn: Button {text: 'Customize', alignment: ['right','top']} , \
 | |
|                 }";
 | |
|         
 | |
|         myPal.grp = myPal.add(res);
 | |
|         
 | |
|         var paletteOptions = ["A","C","D","E","F","G","H"];
 | |
|         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.paletteOption.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 applyShowTitle( new_title ){
 | |
|     var comp =  app.project.activeItem;
 | |
|     var title_layer = comp.layer("TITLE");
 | |
|     var ctrl_layer = comp.layer("ctrl_bubble");
 | |
|     title_layer.sourceText.setValue( new_title );
 | |
|     
 | |
|     width = title_layer.sourceRectAtTime(0, false).width;
 | |
|     var new_scale;
 | |
|     var new_center;
 | |
| 
 | |
|     if ( width >= 1300 )
 | |
|     {
 | |
|         new_scale = (1500/width)*100;
 | |
|         new_center = [787,540];
 | |
|     }
 | |
|     else if ( width > 640 )
 | |
|     {
 | |
|         new_scale = 100;       
 | |
|         new_center = [960,540];
 | |
|     }
 | |
|     else
 | |
|     {
 | |
|         new_scale = 100;
 | |
|         new_center = [1040,540];
 | |
|         
 | |
|     }
 | |
|     
 | |
|     comp.layer("DONT_TOUCH_CTRL_CENTER")("Transform")("Position").setValue(new_center);
 | |
|     comp.layer("ctrl_bubble")("Transform")("Scale").setValue([new_scale,new_scale]);
 | |
|     
 | |
|     ctrl_layer("Effects")("width")("Slider").setValue(width + 75);
 | |
| }
 | |
| function tcd_doIt (){
 | |
|     
 | |
|     applyPallette(myPalette.grp.match.suffix.paletteOption.selection);
 | |
|     applyShowTitle( myPalette.grp.match.suffix.suffixString.text );
 | |
|     
 | |
|     
 | |
|     
 | |
| } //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 = "";
 | |
| */
 | |
| var palettes = {
 | |
|     A : [
 | |
|         0xFFFB00,
 | |
|         0x3BCCFD,
 | |
|         0x2A9BC1,
 | |
|         0xFAF800,
 | |
|         0xE74DB7,
 | |
|         0x6B00C0,
 | |
|         0x0D0D0F,
 | |
|         35,
 | |
|         60
 | |
|         ],
 | |
|     C : [
 | |
|         0xE74DB7,
 | |
|         0xFFFC00,
 | |
|         0xBBB900,
 | |
|         0xE74DB7,
 | |
|         0xFAF800,
 | |
|         0x00D4CF,
 | |
|         0x000000,
 | |
|         50,
 | |
|         55
 | |
|         ],
 | |
|     D : [
 | |
|         0xFFFB00,
 | |
|         0x3BCCFD,
 | |
|         0x2A9BC1,
 | |
|         0xE74DB7,
 | |
|         0xFAF800,
 | |
|         0x3A404A,
 | |
|         0x000000,
 | |
|         35,
 | |
|         45
 | |
|         ],
 | |
|     E : [
 | |
|         0x288492,
 | |
|         0xFFFC00,
 | |
|         0xBBB900,
 | |
|         0xFAF800,
 | |
|         0x7D2CE5,
 | |
|         0x3290EB,
 | |
|         0x000000,
 | |
|         35,
 | |
|         8
 | |
|         ],
 | |
|     F : [
 | |
|         0x1BF0FF,
 | |
|         0xE74DB7,
 | |
|         0xA93886,
 | |
|         0x7D2CE5,
 | |
|         0x3CCCFE,
 | |
|         0xF0ED00,
 | |
|         0xA28600,
 | |
|         85,
 | |
|         8
 | |
|         ]
 | |
| }
 | |
| 
 | |
| //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();
 | |
|     }
 | |
| }
 | |
| 
 | |
| }
 |