mirror of
https://github.com/jorgevasquezp/AFX_yTools.git
synced 2026-09-16 19:22:42 +00:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
13741e9c95 | ||
|
|
b77c9bd56f | ||
|
|
bc178e67ee | ||
|
|
1e1bb0c6aa |
@@ -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;␍␍
|
var YToolBox = function YToolBox(thisObj)␍{␍ var resources =␍ {␍ icon : new File('../yScripts/yNet.png'),␍ header : new File('../yScripts/header.png')␍ }␍ ␍ var info =␍ {␍ url : 'yorchnet.com',␍ name :'yToolBox',␍ ver :'0.4.2.1 alpha',␍ description : 'Working tools so far...'␍ }␍ ␍ var gui =␍ {␍ buttonWidth : 126,␍ buttonHeight : 30␍ }␍ ␍ var tools = [];␍ ␍ #include "../yScripts/y_JSExtensions.jsx";␍ ␍ this.addTool = function addTool(aTool)␍ {␍ alert("AddTool : Adding");␍ alert("AddTool : there are " + this.tools.length + " tools right now");␍ this.tools.push(aTool);␍ alert("AddTool : there are " + this.tools.length + " tools right now");␍ }␍ ␍ //alert(thisObj);␍ this.customize = function customize()␍ {␍ /*␍ g = this.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;␍ */␍ alert();␍ }␍␍ this.resize = function resize()␍ {␍ this.layout.resize();␍ this.customize; ␍ }␍ ␍ this.createGui = function createGui()␍ {␍ //MAIN WINDOW STRUCTURE.␍ this.gui.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:'"+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']\␍ ,"␍ this.gui.main= ""; //To be populated with the included Tools␍ this.gui.footer ="}, \␍ cmds: 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']\␍ },\␍ },\␍ }";␍ ␍ alert(this.tools);␍ this.window.grp = this.window.add( this.gui.header + this.gui.main + this.gui.footer );␍ this.window.layout.layout(true);␍ this.window.onResize = this.resize;␍␍ this.window.onClose = function () {delete yToolBox;};␍ ␍ //ASSIGN buttons to the activate function of each tool;␍ var toolBtns = this.window.grp.main.children;␍ for( var n = 0 ; n < toolBtns.length ; n++ ){␍ toolBtns[n].onClick = this.tools[n].activate;␍ }␍␍ }␍ ␍ this.init = function init()␍ {␍ this.resources = resources;␍ this.info = info;␍ this.gui = gui;␍ this.tools = tools;␍ ␍ this.window = (thisObj instanceof Panel) ? thisObj : new Window("palette", this.info , undefined, {resizeable:true});␍ this.createGui();␍ }␍ ␍ this.init();␍ return this␍}␍␍var ytb = new YToolBox(this);␍␍#include "../yScripts/y_setStructure.jsx";␍␍
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
scriptUIpanel = this;␍ytb = {␍ // INFO RESOURCES & PREFERENCES␍ info :␍ {␍ name :'yToolBox',␍ url : 'yorchnet.com',␍ ver :'0.5',␍ status : 'alpha',␍ description : 'My mixed bag of tricks'␍ },␍ resources :␍ {␍ icon : new File('../yScripts/yNet.png'),␍ header : new File('../yScripts/header.png')␍ },␍ gui :␍ {␍ buttonWidth : 126,␍ buttonHeight : 30␍ },␍ ␍ //METHODS␍ syncWindow : function syncWindow()␍ {␍ this.window = ( ( scriptUIpanel instanceof Panel ) ? scriptUIpanel : new Window ( "palette" , this.info , undefined, { resizeable:true , alignment:['fill','fill'] , orientation:'column' } ) );␍ },␍ customize : function customize()␍ {␍ //myFont = ScriptUI.newFont('Cooper Std Black',ScriptUI.FontStyle.REGULAR ,14 );␍ ␍ g = this.window.graphics;␍ naranja = g.newBrush(g.BrushType.SOLID_COLOR, [1, .45, 0, 1]);␍ black = g.newBrush(g.BrushType.SOLID_COLOR, [0, 0, 0, 1]);␍ gray1 = g.newBrush(g.BrushType.SOLID_COLOR, [.125, .125, .125, 1]);␍ gray2 = g.newBrush(g.BrushType.SOLID_COLOR, [.25, .25, .25, 1]);␍ gray3 = g.newBrush(g.BrushType.SOLID_COLOR, [.5, .5, .5, 1]);␍ gray4 = g.newBrush(g.BrushType.SOLID_COLOR, [.75, .75, .75, 1]);␍ white = g.newBrush(g.BrushType.SOLID_COLOR, [1, 1, 1, 1]);␍ ␍ g.backgroundColor = naranja;␍ ␍ this.window.grp.main.graphics.backgroundColor = gray1;␍ this.window.grp.header.graphics.backgroundColor = naranja;␍ this.window.grp.main.graphics.backgroundColor = gray2;␍ this.window.grp.footer.graphics.backgroundColor = gray3;␍ ␍ },␍ createGui : function createGui()␍ {␍ //MAIN WINDOW STRUCTURE.␍ var gui =␍ "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( gui );␍ ␍ this.window.layout.layout(true);␍ this.customize();␍ ␍ //Assignacion de Manejo de Eventos.␍ this.window.onResize = this.resize;␍ this.window.onClose = this.selfDestruct;␍ ␍ },␍ addTool : function addTool( aTool )␍ {␍ alert(" A darle ");␍ },␍ ␍ //Manejo de Eventos␍ resize : function resize()␍ {␍ this.layout.resize(); ␍ },␍ selfDestruct : function selfDestruct()␍ {␍ delete this;␍ },␍ init : function init()␍ {␍ this.syncWindow();␍ this.createGui();␍ }␍} ␍␍ytb.init();␍␍␍
|
||||||
@@ -1,52 +1 @@
|
|||||||
yGeneric_data = new Object();
|
//if (typeof(ytb)!=='undefined'){␍ ␍yGenericTool =␍{ ␍ info : ␍ {␍ name : 'YGenericTool',␍ description : 'YToolBox Generic Script is the base for adding tools.',␍ version : '0.1a',␍ status : "alpha",␍ url : 'yorchnet.com'␍ },␍ resources :␍ {␍ img : new File('../header.png')␍ },␍ gui_preferences :␍ {␍ buttonWidth : 76,␍ buttonHeight : 30␍ },␍ toolbox :␍ {␍ buttons :␍ "btn_" + this.info.name + ": Button\␍ {\␍ preferredSize: ['" + this.gui_preferences.buttonWidth + "','" + this.gui_preferences.buttonHeight + "'],\␍ text:'" + this.info.name + "',\␍ helpTip:'" + this.info.description + "'\␍ }",␍ gui :␍ "window\␍ {\␍ type:'palette',\␍ text:'" + this.info.name + ' ' + this.info.version + " " + this.info.status + "',\␍ info: Group\␍ {\␍ alignment:['center','bottom'],\␍ icon: Image\␍ {\␍ icon:'" + String( this.resources.img.path + "/" + this.resources.img.name ) + "',\␍ preferredSize: [15, 18]\␍ },\␍ website: StaticText\␍ {\␍ text:'" + this.info.url + "',\␍ alignment:['fill','center'] \␍ }\␍ }\␍ }"␍ },␍ getInfo : function getInfo( info_request )␍ {␍ var info = null ;␍ ␍ switch (info_request)␍ {␍ case "name":␍ info = this.name;␍ break;␍ case "description":␍ info = this.description;␍ break;␍ case "version":␍ info = this.version;␍ break;␍ case "status":␍ info = this.status;␍ break;␍ case "url":␍ info = this.url;␍ break;␍ }␍ return info;␍ },␍ getInfo : function getInfo( resource_request )␍ {␍ var resource = null ;␍ ␍ switch ( resource_request )␍ {␍ case "img":␍ resource = this.img;␍ break;␍ }␍ return info;␍ },␍ getToolBoxButtons : function getToolBoxButtons()␍ {␍ return this.toolbox.buttons;␍ },␍ getToolBoxGui : function getToolBoxGui()␍ {␍ return this.toolbox.gui;␍ },␍ buildUI : function buildUI()␍ { ␍ this.window = new Window ( this.toolbox.gui , {resizable:true});␍ this.window.show();␍ },␍ addToBox : function addToBox()␍ {␍ ytb.addTool(this);␍ }, ␍ init : function init()␍ {␍ if ( typeof ytb !== "undefined" )␍ {␍ this.addToBox();␍ }␍ this.buildUI();␍ }␍}␍␍yGenericTool.init()␍␍
|
||||||
|
|
||||||
yGeneric_data.scriptName = 'YTBGen';
|
|
||||||
yGeneric_data.scriptDesc = 'YToolBox Generic Script is the base for adding tools.';
|
|
||||||
yGeneric_data.scriptVer = '0.1a';
|
|
||||||
yGeneric_data.webLink = 'yorchnet.com';
|
|
||||||
yGeneric_data.img = yToolBox_data.icon;
|
|
||||||
|
|
||||||
//if yToolBox Exists add it to its tool list.
|
|
||||||
if (typeof(yToolBox_data)!=='undefined'){
|
|
||||||
|
|
||||||
//it should be called from toolbox.
|
|
||||||
yGeneric_data.buttonWidth=76;
|
|
||||||
yGeneric_data.buttonHeight=30;
|
|
||||||
|
|
||||||
yGeneric_data.btnLayout = "btn_"+yGeneric_data.scriptName+": Button { preferredSize: ['"+ yGeneric_data.buttonWidth+"','"+ yGeneric_data.buttonHeight+"'], text:'"+yGeneric_data.scriptName+"', helpTip:'"+yGeneric_data.scriptDesc+"' }";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
yGeneric_data.res = "window { \
|
|
||||||
type:'palette' , text:'"+yGeneric_data.scriptName+' '+yGeneric_data.scriptVer+"',\
|
|
||||||
\
|
|
||||||
\
|
|
||||||
info: Group { \
|
|
||||||
alignment:['center','bottom'], \
|
|
||||||
icon: Image {icon:'"+String(yGeneric_data.img.path+"/"+yGeneric_data.img.name)+"',preferredSize: [15, 18]},\
|
|
||||||
website: StaticText { text:'"+yGeneric_data.webLink+"', alignment:['fill','center'] }\
|
|
||||||
}\
|
|
||||||
\
|
|
||||||
}";
|
|
||||||
|
|
||||||
//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------
|
|
||||||
// MAIN SCRIPT GOES HERE.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------
|
|
||||||
|
|
||||||
function build_yGeneric_data_UI(){
|
|
||||||
yGeneric_data.window = new Window ( yGeneric_data.res);
|
|
||||||
yGeneric_data.window.show();
|
|
||||||
}
|
|
||||||
yGeneric_data.activate = build_yGeneric_data_UI ;
|
|
||||||
//alert();
|
|
||||||
//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own.
|
|
||||||
//if (typeof(yToolBox_data)=='undefined'){
|
|
||||||
yGeneric_data.activate();
|
|
||||||
//}else{
|
|
||||||
//}
|
|
||||||
@@ -35,8 +35,18 @@ yColorProbe_data.res = "window { \
|
|||||||
#include "usefulFunctions.jsx";
|
#include "usefulFunctions.jsx";
|
||||||
|
|
||||||
function yColorProbe(){
|
function yColorProbe(){
|
||||||
|
//It works with Sampled layers at a 100% scale only.
|
||||||
app.beginUndoGroup('Create ColorProbe');
|
app.beginUndoGroup('Create ColorProbe');
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
sel = app.project.activeItem.selectedLayers[0];
|
||||||
|
}
|
||||||
|
catch (err)
|
||||||
|
{
|
||||||
|
sel = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
myNull = app.project.activeItem.layers.addNull();
|
myNull = app.project.activeItem.layers.addNull();
|
||||||
myNull.transform.anchorPoint.setValue([50,50]);
|
myNull.transform.anchorPoint.setValue([50,50]);
|
||||||
myNull.name = yUniStr('colorProbe'); //Generates a Unique Name by adding numbers at the end of the main string.
|
myNull.name = yUniStr('colorProbe'); //Generates a Unique Name by adding numbers at the end of the main string.
|
||||||
@@ -46,13 +56,20 @@ function yColorProbe(){
|
|||||||
colorCTRL.name='outColor';
|
colorCTRL.name='outColor';
|
||||||
radiusCTRL = myNull("Effects").addProperty("Slider Control");
|
radiusCTRL = myNull("Effects").addProperty("Slider Control");
|
||||||
radiusCTRL.name ='radius';
|
radiusCTRL.name ='radius';
|
||||||
myNull("Effects")("radius")('Slider').setValue(0.5);
|
myNull("Effects")("radius")('Slider').setValue(5);
|
||||||
colExp = 'myLayer = thisLayer("Effects")("sampledLayer")("Layer");\
|
colExp = 'myLayer = thisLayer("Effects")("sampledLayer")("Layer");\
|
||||||
p = thisLayer.toWorld(thisLayer.transform.anchorPoint);\
|
p = thisLayer.toWorld(thisLayer.transform.anchorPoint);\
|
||||||
r = thisLayer("Effects")("radius")("Slider");\
|
r = thisLayer("Effects")("radius")("Slider");\
|
||||||
myLayer.sampleImage(p, radius = [r, r], postEffect=true, t=time)';
|
myLayer.sampleImage(p, radius = [r, r], postEffect=true, t=time)';
|
||||||
myNull("Effects")('outColor')('Color').expression=colExp;
|
myNull("Effects")('outColor')('Color').expression=colExp;
|
||||||
|
myNull.label=2;
|
||||||
|
myNull.source.height=30;
|
||||||
|
myNull.source.width=30;
|
||||||
|
myNull.anchorPoint=(15,15);
|
||||||
|
|
||||||
|
if(sel!==undefined){
|
||||||
|
myNull("Effects")('sampledLayer')(1).setValue(sel.index);
|
||||||
|
}
|
||||||
app.endUndoGroup();
|
app.endUndoGroup();
|
||||||
return 'ok'
|
return 'ok'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#include "../yScripts/y_JSExtensions.jsx";
|
#include "../yScripts/y_JSExtensions.jsx";
|
||||||
|
|
||||||
ySetProject_data = new Object();
|
ySetProject_data = new Object();
|
||||||
|
|
||||||
ySetProject_data.scriptName = 'YSetStructure';
|
ySetProject_data.scriptName = 'YSetStructure';
|
||||||
@@ -8,16 +7,9 @@ ySetProject_data.scriptVer = '0.1a';
|
|||||||
ySetProject_data.webLink = 'yorchnet.com';
|
ySetProject_data.webLink = 'yorchnet.com';
|
||||||
|
|
||||||
//if yToolBox Exists add it to its tool list.
|
//if yToolBox Exists add it to its tool list.
|
||||||
if (typeof(yToolBox_data)!=='undefined'){
|
if (typeof(ytb)!=='undefined'){
|
||||||
yToolBox_data.tools.push(ySetProject_data);
|
ySetProject_data.btnLayout = "btn_"+ ySetProject_data.scriptName+": Button { preferredSize: ['"+ ytb.buttonWidth+"','"+ ytb.buttonHeight+"'], text:'"+ySetProject_data.scriptName+"', helpTip:'"+ySetProject_data.scriptDesc+"' }";
|
||||||
|
ytb.addTool(ySetProject_data);
|
||||||
//it should be called from toolbox.
|
|
||||||
/*
|
|
||||||
ySetProject_data.buttonWidth=76;
|
|
||||||
ySetProject_data.buttonHeight=30;
|
|
||||||
*/
|
|
||||||
ySetProject_data.btnLayout = "btn_"+ ySetProject_data.scriptName+": Button { preferredSize: ['"+ yToolBox_data.buttonWidth+"','"+ yToolBox_data.buttonHeight+"'], text:'"+ySetProject_data.scriptName+"', helpTip:'"+ySetProject_data.scriptDesc+"' }";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ySetProject_data.res = "window { \
|
ySetProject_data.res = "window { \
|
||||||
@@ -77,7 +69,8 @@ function build_ySetProject_data_UI(){
|
|||||||
ySetProject_data.activate = ySetProject ;
|
ySetProject_data.activate = ySetProject ;
|
||||||
|
|
||||||
//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own.
|
//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own.
|
||||||
if (typeof(yToolBox_data)=='undefined'){
|
if (typeof(ytb)=='undefined')
|
||||||
ySetProject_data.activate();
|
{
|
||||||
}else{
|
ySetProject_data.activate();
|
||||||
}
|
}else{
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user