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.
AFX_yTools/ScriptUI Panels/yToolBox.jsx

1 line
5.5 KiB

var scriptUIPanel = this;
YTB =
{
info :
{
name : "yToolBox",
ver : 0.5,
status : "alpha",
url : "yorchnet.com",
description : "My mixed bag of tools"
},
resources :
{
icon : new File('../yScripts/yNet.png'),
header : new File('../yScripts/header.png')
},
appearence :
{
buttonHeight : 30,
buttonWidth : 126
},
tools : [],
createUI : function createUI()
{
var res ="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:'" + this.resources.header.path + '/' + this.resources.header.name + "',\
preferredSize: [175, 35]},\
ver: StaticText\
{\
text:'" + this.info.ver + "',\
alignment:['center','center']\
}\
desc: StaticText\
{\
text:'" + this.info.description + "',\
alignment:['center','center']\
},\
},\
main: Group\
{\
orientation:'column',\
alignment:['fill','fill'],\
alignChildren:['center','center'],\
},\
footer: Group\
{\
alignment:['center','bottom'], \
icn_app: Image {icon:'" + this.resources.icon.path + '/' + this.resources.icon.name + "',preferredSize: [15, 18]},\
txt_info: StaticText { text:'"+ this.info.url + "', alignment:['fill','center'] },\
}, \
}";
this.window.grp = this.window.add( res );
this.window.layout.layout(true);
this.customizeUI();
//EventHandlerAssignment
this.window.onResize = this.resize;
this.window.onClose = this.close;
},
customizeUI : function customizeUI()
{
var g = this.window.graphics;
var orange = g.newBrush(g.BrushType.SOLID_COLOR, [1, .45, 0, 1]);
this.window.grp.main.graphics.backgroundColor = orange;
},
//EVENT HANDLERS
resize : function resize()
{
this.layout.resize();
},
close : function close()
{
delete this;
},
init : function init()
{
this.window = ( scriptUIPanel instanceof Panel ) ? scriptUIPanel: new Window( "palette" , this.info.name , undefined, { resizeable : true } );
this.createUI();
}
};
//delete scriptUIPanel;
/*
function yToolBox(thisObj){
YTB = new Object();
YTB.icon = new File('../yScripts/yNet.png');
YTB.header = new File('../yScripts/header.png');
YTB.info = 'yorchnet.com';
YTB.name ='yToolBox';
YTB.ver ='0.4.2.1 alpha';
YTB.desc='Working tools so far...';
YTB.buttonWidth=126;
YTB.buttonHeight=30;
YTB.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";
YTB.window = (thisObj instanceof Panel) ? thisObj : new Window("palette", YTB.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:'"+YTB.header.path+'/'+YTB.header.name+"',preferredSize: [175, 35]},\
ver: StaticText { text:'"+YTB.ver+"', alignment:['center','center']}\
desc: StaticText { text:'"+YTB.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:'"+ YTB.icon.path+'/'+ YTB.icon.name+"',preferredSize: [15, 18]},\
txt_info: StaticText { text:'"+YTB.info+"', alignment:['fill','center'] },\
}, \
}";
//POPULATE res with included tools.
for (i=0;i<YTB.tools.length;i++){
res = res + YTB.tools [i].btnLayout;
}
//LAYOUT Stuff
YTB.window.grp = YTB.window.add(res_header+res+res_footer);
YTB.window.layout.layout(true);
YTB.window.onResize = resize;
YTB.window.onClose = function () {delete YTB;};
//ASSIGN buttons to the activate function of each tool;
var toolBtns = YTB.window.grp.main.children;
for(n=0;n<toolBtns.length;n++){
toolBtns[n].onClick=YTB.tools[n].activate;
}
return YTB.window
}
function resize(){
this.layout.resize();
customize;
}
function customize(){
g = YTB.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 = YTB.window.grp.header.title.graphics;
g.font = myFont;
g =YTB.window.grp.header.graphics;
g.backgroundColor = myBrush;
}
yToolBox(this);
YTB.window.grp.onDraw = resize;
YTB.window.grp.onDraw = customize;
*/
YTB.init();