started to encapsulate everything in a single object

This commit is contained in:
2015-03-13 16:03:05 -07:00
parent bc178e67ee
commit b77c9bd56f
+1 -1
View File
@@ -1 +1 @@
function yToolBox(thisObj){ yToolBox_data = new Object(); yToolBox_data.icon = new File('../yScripts/yNet.png'); yToolBox_data.header = new File('../yScripts/header.png'); yToolBox_data.info = 'yorchnet.com'; yToolBox_data.name ='yToolBox'; yToolBox_data.ver ='0.4.2.1 alpha'; yToolBox_data.desc='Working tools so far...'; yToolBox_data.buttonWidth=126; yToolBox_data.buttonHeight=30; yToolBox_data.tools = []; #include "../yScripts/y_JSExtensions.jsx"; //INCLUDED TOOLS #include "../yScripts/y_setStructure.jsx"; #include "../yScripts/y_puppetRig.jsx"; #include "../yScripts/y_colorProbe.jsx"; #include "../yScripts/y_yBindBetween2.jsx"; #include "../yScripts/y_stopMotionLayer.jsx"; #include "../yScripts/y_CornerPin.jsx"; yToolBox_data.window = (thisObj instanceof Panel) ? thisObj : new Window("palette", yToolBox_data.info , undefined, {resizeable:true}); //MAIN WINDOW STRUCTURE. var res_header ="group { orientation:'column', alignment:['fill','fill'],margins:[0,0,0,0] \ header: Group { orientation:'column', alignment:['center','top'],margins:[0,0,0,0]\ title: Image {icon:'"+yToolBox_data.header.path+'/'+yToolBox_data.header.name+"',preferredSize: [175, 35]},\ ver: StaticText { text:'"+yToolBox_data.ver+"', alignment:['center','center']}\ desc: StaticText { text:'"+yToolBox_data.desc+"', alignment:['center','center']}, \ }, \ main: Group { orientation:'column',alignment:['fill','fill'], alignChildren:['center','center']," var res = ""; //To be populated with the included Tools var res_footer ="}, \ cmds: Group { alignment:['center','bottom'], \ icn_app: Image {icon:'"+ yToolBox_data.icon.path+'/'+ yToolBox_data.icon.name+"',preferredSize: [15, 18]},\ txt_info: StaticText { text:'"+yToolBox_data.info+"', alignment:['fill','center'] },\ }, \ }"; //POPULATE res with included tools. for (i=0;i<yToolBox_data.tools.length;i++){ res = res + yToolBox_data.tools [i].btnLayout; } //LAYOUT Stuff yToolBox_data.window.grp = yToolBox_data.window.add(res_header+res+res_footer); yToolBox_data.window.layout.layout(true); yToolBox_data.window.onResize = resize; yToolBox_data.window.onClose = function () {delete yToolBox_data;}; //ASSIGN buttons to the activate function of each tool; var toolBtns = yToolBox_data.window.grp.main.children; for(n=0;n<toolBtns.length;n++){ toolBtns[n].onClick=yToolBox_data.tools[n].activate; } return yToolBox_data.window}function resize(){ this.layout.resize(); customize; }function customize(){ g = yToolBox_data.window.grp.main.graphics; myFont = ScriptUI.newFont('Cooper Std Black',ScriptUI.FontStyle.REGULAR ,14 ); myBrush = g.newBrush(g.BrushType.SOLID_COLOR, [1, .45, 0, 1]); g.backgroundColor = myBrush; /*g = yToolBox_data.window.grp.header.title.graphics; g.font = myFont; g =yToolBox_data.window.grp.header.graphics; g.backgroundColor = myBrush; */ }yToolBox(this);yToolBox_data.window.grp.onDraw = resize;yToolBox_data.window.grp.onDraw = customize;
function yToolBox(thisObj){ yToolBox = new Object(); yToolBox.icon = new File('../yScripts/yNet.png'); yToolBox.header = new File('../yScripts/header.png'); yToolBox.info = 'yorchnet.com'; yToolBox.name ='yToolBox'; yToolBox.ver ='0.4.2.1 alpha'; yToolBox.desc='Working tools so far...'; yToolBox.buttonWidth=126; yToolBox.buttonHeight=30; yToolBox.tools = []; #include "../yScripts/y_JSExtensions.jsx"; //INCLUDED TOOLS #include "../yScripts/y_setStructure.jsx"; #include "../yScripts/y_puppetRig.jsx"; #include "../yScripts/y_colorProbe.jsx"; #include "../yScripts/y_yBindBetween2.jsx"; #include "../yScripts/y_stopMotionLayer.jsx"; #include "../yScripts/y_CornerPin.jsx"; yToolBox.window = (thisObj instanceof Panel) ? thisObj : new Window("palette", yToolBox.info , undefined, {resizeable:true}); //MAIN WINDOW STRUCTURE. var res_header ="group { orientation:'column', alignment:['fill','fill'],margins:[0,0,0,0] \ header: Group { orientation:'column', alignment:['center','top'],margins:[0,0,0,0]\ title: Image {icon:'"+yToolBox.header.path+'/'+yToolBox.header.name+"',preferredSize: [175, 35]},\ ver: StaticText { text:'"+yToolBox.ver+"', alignment:['center','center']}\ desc: StaticText { text:'"+yToolBox.desc+"', alignment:['center','center']}, \ }, \ main: Group { orientation:'column',alignment:['fill','fill'], alignChildren:['center','center']," var res = ""; //To be populated with the included Tools var res_footer ="}, \ cmds: Group { alignment:['center','bottom'], \ icn_app: Image {icon:'"+ yToolBox.icon.path+'/'+ yToolBox.icon.name+"',preferredSize: [15, 18]},\ txt_info: StaticText { text:'"+yToolBox.info+"', alignment:['fill','center'] },\ }, \ }"; //POPULATE res with included tools. for (i=0;i<yToolBox.tools.length;i++){ res = res + yToolBox.tools [i].btnLayout; } //LAYOUT Stuff yToolBox.window.grp = yToolBox.window.add(res_header+res+res_footer); yToolBox.window.layout.layout(true); yToolBox.window.onResize = resize; yToolBox.window.onClose = function () {delete yToolBox;}; //ASSIGN buttons to the activate function of each tool; var toolBtns = yToolBox.window.grp.main.children; for(n=0;n<toolBtns.length;n++){ toolBtns[n].onClick=yToolBox.tools[n].activate; } return yToolBox.window}function resize(){ this.layout.resize(); customize; }function customize(){ g = yToolBox.window.grp.main.graphics; myFont = ScriptUI.newFont('Cooper Std Black',ScriptUI.FontStyle.REGULAR ,14 ); myBrush = g.newBrush(g.BrushType.SOLID_COLOR, [1, .45, 0, 1]); g.backgroundColor = myBrush; /*g = yToolBox.window.grp.header.title.graphics; g.font = myFont; g =yToolBox.window.grp.header.graphics; g.backgroundColor = myBrush; */ }ytb = yToolBox(this);ytb.window.grp.onDraw = resize;ytb.window.grp.onDraw = customize;