diff --git a/jsx/MKN_DC_Customizer.jsx b/jsx/MKN_DC_Customizer.jsx index 9143717..029bc1f 100644 --- a/jsx/MKN_DC_Customizer.jsx +++ b/jsx/MKN_DC_Customizer.jsx @@ -1 +1 @@ -{ ///////////////////////////////////////////////////////////////////////// // // 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 = { col_title: comp.layer("TITLE")("Effects")("Fill")("Color"), col_bubble: comp.layer("DONT_TOUCH_bubble")("Effects")("Fill")("Color"), col_bubble_shadow: comp.layer("DONT_TOUCH_bubble_shadow")("Effects")("Fill")("Color"), col_logo_bg : comp.layer("DISNEY_LOGO_Bubble_BG")("Effects")("Fill")("Color"), col_logo_fg: comp.layer("DISNEY_LOGO_Bubble_FG")("Effects")("Fill")("Color"), col_logo_neutral: comp.layer("DISNEY_LOGO_Bubble_GRAY")("Effects")("Fill")("Color"), col_logo_accent: comp.layer("DISNEY_LOGO_Bubble_ACCENT")("Effects")("Fill")("Color"), }; for ( var i in color_targets ) { color_targets[i].setValue(hexToColor(palettes[palette_string][i])); } } 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', \ title: Group { \ alignment: ['fill','top'], \ alignChildren: ['fill','top'], \ paletteText: StaticText {text:'Piece Palette', alignment: ['left','center']}, \ paletteOption: DropDownList {alignment: ['left','center']}, \ titleTxt: StaticText {text:'Show Title', alignment: ['left','center']}, \ titleString: EditText {text: 'SHOW TITLE HERE', alignment: ['fill','center']}, \ } \ } \ doItBtn: Button {text: 'Customize', alignment: ['right','top']} , \ }"; myPal.grp = myPal.add(res); for ( i in paletteOptionNames ) { myPal.grp.match.title.paletteOption.add("item",i); } myPal.grp.match.title.paletteOption.selection = 0; myPal.grp.match.title.paletteOption.minimumSize.width = myPal.grp.match.title.paletteOption.preferredSize.width = 75; myPal.grp.match.title.titleString.onChange = function () { //alert("changing text"); var title = myPalette.grp.match.title.titleString.text; applyShowTitle( title ); } myPal.grp.match.title.paletteOption.onChange = function () { //alert("changing palette"); var id = paletteOptionNames[myPalette.grp.match.title.paletteOption.selection]; setBG( id ); applyPallette( id ); } 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 setBG ( id ){ new_source = app.project.activeItem.layer("DC_GEN_BG_"+String(id)).source; a = app.project.activeItem.layer("BG"); a.replaceSource(new_source,false) } function tcd_doIt (){ /*var id = paletteOptionNames[myPalette.grp.match.title.paletteOption.selection]; var title = myPalette.grp.match.title.titleString.text; setBG( id ); applyPallette( id ); applyShowTitle( title ); */ } //function tcd_doIt (palObj) var paletteOptions = ["C","D","E","F","G","H"]; var paletteOptionNames = { Gray : "D", Gold : "F", Magenta : "G", Blue_1 : "C", Blue_2 : "E", Blue_3 : "H" }; var palettes = { A : { col_title: 0xFFFB00, col_bubble: 0x3BCCFD, col_bubble_shadow: 0x2A9BC1, col_logo_bg : 0xFAF800, col_logo_fg: 0xE74DB7, col_logo_neutral: 0x2C313B, col_logo_accent: 0x19EDFF }, C : { col_title: 0xE74DB7, col_bubble: 0xFFFC00, col_bubble_shadow: 0xBBB900, col_logo_bg : 0xE74DB7, col_logo_fg: 0xFAF800, col_logo_neutral: 0x2C313B, col_logo_accent: 0x7c36e1 }, D : { col_title: 0x2a3a51, col_bubble: 0x3ed9bc, col_bubble_shadow: 0x238573, col_logo_bg : 0xE74DB7, col_logo_fg: 0xFAF800, col_logo_neutral: 0x2C313B, col_logo_accent: 0x3ed9bc }, E : { col_title: 0x288492, col_bubble: 0xFFFC00, col_bubble_shadow: 0xBBB900, col_logo_bg : 0xe149ae, col_logo_fg: 0xFFFC00, col_logo_neutral: 0x2C313B, col_logo_accent: 0x19EDFF }, F : { col_title: 0x1BF0FF, col_bubble: 0xE74DB7, col_bubble_shadow: 0xA93886, col_logo_bg : 0x1BF0FF, col_logo_fg: 0xE74DB7, col_logo_neutral: 0x2C313B, col_logo_accent: 0x7c36e1 }, G : { col_title: 0xfffa38, col_bubble: 0x7c36e1, col_bubble_shadow: 0x5525ab, col_logo_bg : 0x44f2fc, col_logo_fg: 0x7c36e1, col_logo_neutral: 0x2C313B, col_logo_accent: 0x2C313B }, H: { col_title: 0x7c36e1, col_bubble: 0xfffa38, col_bubble_shadow: 0xc3bf28, col_logo_bg : 0x7c36e1, col_logo_fg: 0xfffa38, col_logo_neutral: 0x2C313B, col_logo_accent: 0xE74DB7 } } //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(); } } } \ No newline at end of file +{ ///////////////////////////////////////////////////////////////////////// // // 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 = { col_title: comp.layer("TITLE")("Effects")("Fill")("Color"), col_bubble: comp.layer("DONT_TOUCH_bubble")("Effects")("Fill")("Color"), col_bubble_shadow: comp.layer("DONT_TOUCH_bubble_shadow")("Effects")("Fill")("Color"), col_logo_bg : comp.layer("DISNEY_LOGO_Bubble_BG")("Effects")("Fill")("Color"), col_logo_fg: comp.layer("DISNEY_LOGO_Bubble_FG")("Effects")("Fill")("Color"), col_logo_neutral: comp.layer("DISNEY_LOGO_Bubble_GRAY")("Effects")("Fill")("Color"), col_logo_accent: comp.layer("DISNEY_LOGO_Bubble_ACCENT")("Effects")("Fill")("Color"), }; for ( var i in color_targets ) { color_targets[i].setValue(hexToColor(palettes[palette_string][i])); } } 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', \ title: Group { \ alignment: ['fill','top'], \ alignChildren: ['fill','top'], \ paletteText: StaticText {text:'Piece Palette', alignment: ['left','center']}, \ paletteOption: DropDownList {alignment: ['left','center']}, \ titleTxt: StaticText {text:'Show Title', alignment: ['left','center']}, \ titleString: EditText {text: 'SHOW TITLE HERE', alignment: ['fill','center']}, \ } \ } \ \ }"; //doItBtn: Button {text: 'Customize', alignment: ['right','top']} , \ myPal.grp = myPal.add(res); for ( i in paletteOptionNames ) { myPal.grp.match.title.paletteOption.add("item",i); } myPal.grp.match.title.paletteOption.selection = 0; myPal.grp.match.title.paletteOption.minimumSize.width = myPal.grp.match.title.paletteOption.preferredSize.width = 75; myPal.grp.match.title.titleString.onChange = function () { //alert("changing text"); var title = myPalette.grp.match.title.titleString.text; applyShowTitle( title ); } myPal.grp.match.title.paletteOption.onChange = function () { //alert("changing palette"); var id = paletteOptionNames[myPalette.grp.match.title.paletteOption.selection]; setBG( id ); applyPallette( id ); } /* 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 setBG ( id ){ new_source = app.project.activeItem.layer("DC_GEN_BG_"+String(id)).source; a = app.project.activeItem.layer("BG"); a.replaceSource(new_source,false) } function tcd_doIt (){ } //function tcd_doIt (palObj) var paletteOptions = ["C","D","E","F","G","H"]; var paletteOptionNames = { Gray : "D", Gold : "F", Magenta : "G", Blue_1 : "C", Blue_2 : "E", Blue_3 : "H" }; var palettes = { A : { col_title: 0xFFFB00, col_bubble: 0x3BCCFD, col_bubble_shadow: 0x2A9BC1, col_logo_bg : 0xFAF800, col_logo_fg: 0xE74DB7, col_logo_neutral: 0x2C313B, col_logo_accent: 0x19EDFF }, C : { col_title: 0xE74DB7, col_bubble: 0xFFFC00, col_bubble_shadow: 0xBBB900, col_logo_bg : 0xE74DB7, col_logo_fg: 0xFAF800, col_logo_neutral: 0x2C313B, col_logo_accent: 0x7c36e1 }, D : { col_title: 0x2a3a51, col_bubble: 0x3ed9bc, col_bubble_shadow: 0x238573, col_logo_bg : 0xE74DB7, col_logo_fg: 0xFAF800, col_logo_neutral: 0x2C313B, col_logo_accent: 0x3ed9bc }, E : { col_title: 0x288492, col_bubble: 0xFFFC00, col_bubble_shadow: 0xBBB900, col_logo_bg : 0xe149ae, col_logo_fg: 0xFFFC00, col_logo_neutral: 0x2C313B, col_logo_accent: 0x19EDFF }, F : { col_title: 0x1BF0FF, col_bubble: 0xE74DB7, col_bubble_shadow: 0xA93886, col_logo_bg : 0x1BF0FF, col_logo_fg: 0xE74DB7, col_logo_neutral: 0x2C313B, col_logo_accent: 0x7c36e1 }, G : { col_title: 0xfffa38, col_bubble: 0x7c36e1, col_bubble_shadow: 0x5525ab, col_logo_bg : 0x44f2fc, col_logo_fg: 0x7c36e1, col_logo_neutral: 0x2C313B, col_logo_accent: 0x2C313B }, H: { col_title: 0x7c36e1, col_bubble: 0xfffa38, col_bubble_shadow: 0xc3bf28, col_logo_bg : 0x7c36e1, col_logo_fg: 0xfffa38, col_logo_neutral: 0x2C313B, col_logo_accent: 0xE74DB7 } } //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(); } } } \ No newline at end of file