mirror of
https://github.com/jorgevasquezp/AFX_yTools.git
synced 2026-08-16 15:30:59 +00:00
Cleaned up the code and made the scripts work individually and with thetoolbox
This commit is contained in:
@@ -1 +1,128 @@
|
|||||||
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;␍ this.window.onDraw = this.autoLayout;␍ },␍ 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;␍ },␍ addTool : function addTool( aTool )␍ {␍ /**** TO DO ****/␍ // Check that the tool object is unique.␍ // Call for a window resize so it refreshes propperly.␍ ␍ this.tools.push( aTool );␍␍ var btn = this.window.grp.main.add( aTool.btnLauyout );␍ ␍ btn.onClick = aTool.activate;␍ btn.yTool = aTool; // add a reference to the tool so I can access info on it later...␍ ␍ //alert(btn.onClick);␍␍ this.window.layout.layout(true);␍ ␍ },␍ //EVENT HANDLERS␍ resize : function resize()␍ {␍ this.layout.resize();␍ },␍ close : function close()␍ {␍ YTB = null;␍ delete this;␍ },␍ init : function init()␍ {␍ this.window = ( scriptUIPanel instanceof Panel ) ? scriptUIPanel: new Window( "palette" , this.info.name , undefined, { resizeable : true } );␍ this.createUI();␍ }␍ ␍};␍␍YTB.init();␍␍#include "../yScripts/y_setStructure.jsx";␍#include "../yScripts/y_colorProbe.jsx";␍#include "../yScripts/y_BindBetween2.jsx";␍#include "../yScripts/y_CPOffset.jsx";␍#include "../yScripts/y_puppetRig.jsx";␍#include "../yScripts/y_GenericNewScript.jsx";␍
|
<<<<<<< HEAD
|
||||||
|
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;␍ this.window.onDraw = this.autoLayout;␍ },␍ 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;␍ },␍ addTool : function addTool( aTool )␍ {␍ /**** TO DO ****/␍ // Check that the tool object is unique.␍ // Call for a window resize so it refreshes propperly.␍ ␍ this.tools.push( aTool );␍␍ var btn = this.window.grp.main.add( aTool.btnLauyout );␍ ␍ btn.onClick = aTool.activate;␍ btn.yTool = aTool; // add a reference to the tool so I can access info on it later...␍ ␍ //alert(btn.onClick);␍␍ this.window.layout.layout(true);␍ ␍ },␍ //EVENT HANDLERS␍ resize : function resize()␍ {␍ this.layout.resize();␍ },␍ close : function close()␍ {␍ YTB = null;␍ delete this;␍ },␍ init : function init()␍ {␍ this.window = ( scriptUIPanel instanceof Panel ) ? scriptUIPanel: new Window( "palette" , this.info.name , undefined, { resizeable : true } );␍ this.createUI();␍ }␍ ␍};␍␍YTB.init();␍␍#include "../yScripts/y_setStructure.jsx";␍#include "../yScripts/y_colorProbe.jsx";␍#include "../yScripts/y_BindBetween2.jsx";␍#include "../yScripts/y_CPOffset.jsx";␍#include "../yScripts/y_puppetRig.jsx";␍#include "../yScripts/y_GenericNewScript.jsx";
|
||||||
|
=======
|
||||||
|
var scriptUIPanel = this;
|
||||||
|
YTB =
|
||||||
|
{
|
||||||
|
info :
|
||||||
|
{
|
||||||
|
name : "yToolBox",
|
||||||
|
ver : 0.51,
|
||||||
|
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;
|
||||||
|
this.window.onDraw = this.autoLayout;
|
||||||
|
},
|
||||||
|
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;
|
||||||
|
},
|
||||||
|
addTool : function addTool( aTool )
|
||||||
|
{
|
||||||
|
/**** TO DO ****/
|
||||||
|
// Check that the tool object is unique.
|
||||||
|
// Call for a window resize so it refreshes propperly.
|
||||||
|
|
||||||
|
this.tools.push( aTool );
|
||||||
|
|
||||||
|
var btn = this.window.grp.main.add( aTool.btnLauyout );
|
||||||
|
|
||||||
|
btn.onClick = aTool.activate;
|
||||||
|
btn.yTool = aTool; // add a reference to the tool so I can access info on it later...
|
||||||
|
|
||||||
|
//alert(btn.onClick);
|
||||||
|
|
||||||
|
this.window.layout.layout(true);
|
||||||
|
|
||||||
|
return aTool;
|
||||||
|
|
||||||
|
},
|
||||||
|
//EVENT HANDLERS
|
||||||
|
resize : function resize()
|
||||||
|
{
|
||||||
|
this.layout.resize();
|
||||||
|
},
|
||||||
|
close : function close()
|
||||||
|
{
|
||||||
|
YTB = null;
|
||||||
|
delete this;
|
||||||
|
},
|
||||||
|
init : function init()
|
||||||
|
{
|
||||||
|
this.window = ( scriptUIPanel instanceof Panel ) ? scriptUIPanel: new Window( "palette" , this.info.name , undefined, { resizeable : true } );
|
||||||
|
this.createUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
YTB.init();
|
||||||
|
|
||||||
|
#include "../yScripts/y_setStructure.jsx";
|
||||||
|
#include "../yScripts/y_colorProbe.jsx";
|
||||||
|
#include "../yScripts/y_BindBetween2.jsx";
|
||||||
|
#include "../yScripts/y_CPOffset.jsx";
|
||||||
|
#include "../yScripts/y_puppetRig.jsx";
|
||||||
|
#include "../yScripts/y_GenericNewScript.jsx";
|
||||||
|
>>>>>>> 841484771586f75c140288b329d54c96d3cb3925
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ function YGenericTool()
|
|||||||
this.info =
|
this.info =
|
||||||
{
|
{
|
||||||
name : "yGenericTool",
|
name : "yGenericTool",
|
||||||
version : 0.0,
|
version : 0.1,
|
||||||
stage : "development",
|
stage : "development",
|
||||||
description : "Generic script to use as a base for new tools.",
|
description : "Generic script to use as a base for new tools.",
|
||||||
url : "yorchnet.com"
|
url : "yorchnet.com"
|
||||||
|
|||||||
+31
-23
@@ -6,7 +6,7 @@ function YColorProbe()
|
|||||||
this.info =
|
this.info =
|
||||||
{
|
{
|
||||||
name : "yColorProbe",
|
name : "yColorProbe",
|
||||||
version : 0.0,
|
version : 0.1,
|
||||||
stage : "development",
|
stage : "development",
|
||||||
description : "Creates a Null that will Sample the selected layer within the specified radius.",
|
description : "Creates a Null that will Sample the selected layer within the specified radius.",
|
||||||
url : "yorchnet.com"
|
url : "yorchnet.com"
|
||||||
@@ -75,29 +75,37 @@ function YColorProbe()
|
|||||||
sel = undefined;
|
sel = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
myNull = app.project.activeItem.layers.addNull();
|
if(sel!==undefined){
|
||||||
myNull.transform.anchorPoint.setValue([50,50]);
|
myNull = app.project.activeItem.layers.addNull();
|
||||||
myNull.name = yUniStr('colorProbe'); //Generates a Unique Name by adding numbers at the end of the main string.
|
myNull.transform.anchorPoint.setValue([50,50]);
|
||||||
layerCTRL = myNull("Effects").addProperty("Layer Control");
|
myNull.name = yUniStr('colorProbe'); //Generates a Unique Name by adding numbers at the end of the main string.
|
||||||
layerCTRL.name='sampledLayer';
|
layerCTRL = myNull("Effects").addProperty("Layer Control");
|
||||||
colorCTRL = myNull("Effects").addProperty("Color Control");
|
layerCTRL.name='sampledLayer';
|
||||||
colorCTRL.name='outColor';
|
colorCTRL = myNull("Effects").addProperty("Color Control");
|
||||||
radiusCTRL = myNull("Effects").addProperty("Slider Control");
|
colorCTRL.name='outColor';
|
||||||
radiusCTRL.name ='radius';
|
radiusCTRL = myNull("Effects").addProperty("Slider Control");
|
||||||
myNull("Effects")("radius")('Slider').setValue(5);
|
radiusCTRL.name ='radius';
|
||||||
colExp = 'myLayer = thisLayer("Effects")("sampledLayer")("Layer");\
|
myNull("Effects")("radius")('Slider').setValue(5);
|
||||||
p = thisLayer.toWorld(thisLayer.transform.anchorPoint);\
|
colExp = 'myLayer = thisLayer("Effects")("sampledLayer")("Layer");\
|
||||||
r = thisLayer("Effects")("radius")("Slider");\
|
p = thisLayer.toWorld(thisLayer.transform.anchorPoint);\
|
||||||
myLayer.sampleImage(p, radius = [r, r], postEffect=true, t=time)';
|
r = thisLayer("Effects")("radius")("Slider");\
|
||||||
myNull("Effects")('outColor')('Color').expression=colExp;
|
myLayer.sampleImage(p, radius = [r, r], postEffect=true, t=time)';
|
||||||
myNull.label=2;
|
myNull("Effects")('outColor')('Color').expression=colExp;
|
||||||
myNull.source.height=30;
|
myNull.label=2;
|
||||||
myNull.source.width=30;
|
myNull.source.height=30;
|
||||||
myNull.anchorPoint=(15,15);
|
myNull.source.width=30;
|
||||||
|
myNull.anchorPoint=(15,15);
|
||||||
if(sel!==undefined){
|
|
||||||
myNull("Effects")('sampledLayer')(1).setValue(sel.index);
|
myNull("Effects")('sampledLayer')(1).setValue(sel.index);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
alert("Error : No layer selected.")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
app.endUndoGroup();
|
app.endUndoGroup();
|
||||||
}
|
}
|
||||||
|
|||||||
+211
-33
@@ -1,12 +1,18 @@
|
|||||||
#include "../yScripts/y_JSExtensions.jsx";
|
#include "../yScripts/y_JSExtensions.jsx";
|
||||||
function YGenericTool()
|
function YPuppetRigTool()
|
||||||
{
|
{
|
||||||
this.info =
|
this.info =
|
||||||
{
|
{
|
||||||
name : "yPuppetRig",
|
name : "yPuppetRig",
|
||||||
|
<<<<<<< HEAD
|
||||||
version : 0.33,
|
version : 0.33,
|
||||||
stage : "development",
|
stage : "development",
|
||||||
description : "Tools for streamlining puppet-based animation rigs.",
|
description : "Tools for streamlining puppet-based animation rigs.",
|
||||||
|
=======
|
||||||
|
version : 0.1,
|
||||||
|
stage : "development",
|
||||||
|
description : "Tool to create nulls at puppet pin locations, and link the latter to the former.",
|
||||||
|
>>>>>>> 841484771586f75c140288b329d54c96d3cb3925
|
||||||
url : "yorchnet.com"
|
url : "yorchnet.com"
|
||||||
};
|
};
|
||||||
this.appearence =
|
this.appearence =
|
||||||
@@ -17,10 +23,22 @@ function YGenericTool()
|
|||||||
this.resources =
|
this.resources =
|
||||||
{
|
{
|
||||||
icon : new File('yNet.png'),
|
icon : new File('yNet.png'),
|
||||||
};
|
scriptName : 'yPuppetRigger',
|
||||||
|
scriptVer : 'v0.3.3a',
|
||||||
|
scriptDesc : 'Tools for streamlining puppet-based animation rigs.',
|
||||||
|
string_info : 'yorchnet.com',
|
||||||
|
e_000 : 'e_000 : No layers are selected.',
|
||||||
|
e_001 : 'e_001 : Layer contains no effects.',
|
||||||
|
e_002 : 'e_002 : Layer contains no Puppet effects.',
|
||||||
|
string_001 : 'Rig Pins',
|
||||||
|
string_001x : 'Rigs Selected Pins on Layer',
|
||||||
|
string_002 : 'Rig Layers',
|
||||||
|
string_002x : 'Rigs Selected Layers',
|
||||||
|
string_003 : 'Rig All',
|
||||||
|
string_003x : 'Rig All Layers in Comp'
|
||||||
|
};
|
||||||
this.init = function init()
|
this.init = function init()
|
||||||
{
|
{
|
||||||
|
|
||||||
this.btnLauyout =
|
this.btnLauyout =
|
||||||
"button\
|
"button\
|
||||||
{\
|
{\
|
||||||
@@ -30,39 +48,55 @@ function YGenericTool()
|
|||||||
}";
|
}";
|
||||||
|
|
||||||
this. res =
|
this. res =
|
||||||
"window\
|
"window { \
|
||||||
{\
|
type:'palette' , text:'" + this.resources.scriptName + " " + this.resources.scriptVer + "',margins:[10,10,10,10],spacing:[5,5,5,5],\
|
||||||
type:'palette',\
|
grp: Group { orientation:'column' , alignment:['fill','fill'] , alignChildren:['fill','fill'] , spacing:'2' , margin:'5', \
|
||||||
text:'" + this.info.name + ' ' + this.info.ver + ' ' + this.info.stage + "',\
|
btn_01: Button { preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'], text:'" + this.resources.string_001 + "', helpTip:'" + this.resources.string_001x + "' }, \
|
||||||
info: Group \
|
btn_02: Button { preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'], text:'" + this.resources.string_002 + "', helpTip:'" + this.resources.string_002x + "' }, \
|
||||||
{\
|
btn_03: Button { preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'], text:'" + this.resources.string_003 + "', helpTip:'" + this.resources.string_003x + "' }, \
|
||||||
alignment:['center','bottom'],\
|
chk_optn: Checkbox { text:'Enable Options', alignment:['fill','center'] , helpTip:'Enable Advanced Options' },\
|
||||||
icon: Image \
|
optn: Panel{ text:'Options' , visible:'false', orientation:'row' , alignment:['fill','fill'] , alignChildren:['fill','fill'] , spacing:'2' , margin:'5', \
|
||||||
{\
|
nullSizeGrp: Group{ \
|
||||||
icon:'" + this.resources.icon.path + '/' + this.resources.icon.name + "',\
|
orientation:'column' , alignment:['fill','fill'] , alignChildren:['fill','fill'] , spacing:'2' , margin:'5', \
|
||||||
preferredSize: [15, 18]\
|
sldr_tit: StaticText { text:'Set Null Size in Pixels.', alignment:['fill','center'] },\
|
||||||
},\
|
sldr: Slider { value:'125' , minvalue:'6' , maxvalue:'250' , text:'alaverga', helpTip:'" + this.resources.string_001x + "' }, \
|
||||||
website: StaticText\
|
sldr_Values_txt: Group{\
|
||||||
{\
|
orientation:'row' , alignment:['fill','fill'] , alignChildren:['center','fill'] , spacing:'2' , margin:'5', \
|
||||||
text:'" + this.info.url + "',\
|
mintxt: StaticText { text:'small', alignment:['left','fill'] },\
|
||||||
alignment:['fill','center']\
|
medtxt: StaticText { text:'medium', alignment:['center','fill'] },\
|
||||||
},\
|
maxtxt: StaticText { text:'big', alignment:['right','fill'] },\
|
||||||
}\
|
}\
|
||||||
}";
|
otherOptionsGrp: Group{ \
|
||||||
|
orientation:'row' , alignment:['fill','fill'] , alignChildren:['fill','fill'] , spacing:'8' , margin:'5', \
|
||||||
|
chk_box_01: Checkbox { text:'Enable Draft Mode.', alignment:['fill','center'] , helpTip:'Mostly for oldschool pixelated stuff' },\
|
||||||
|
chk_box_02: Checkbox { text:'Lock Layer', alignment:['fill','center'] , helpTip:'Lock layer after rigging.' },\
|
||||||
|
},\
|
||||||
|
}\
|
||||||
|
},\
|
||||||
|
info: Group { \
|
||||||
|
alignment:['center','bottom'], \
|
||||||
|
txt_info: StaticText { text:'" + this.resources.string_info + "', alignment:['fill','center'] },\
|
||||||
|
}\
|
||||||
|
}\
|
||||||
|
}";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
this.createUI = function createUI()
|
this.createUI = function createUI()
|
||||||
{
|
{
|
||||||
res =
|
this.window = new Window( this.res );
|
||||||
"window {\
|
|
||||||
resizeable : true\
|
|
||||||
closeButton : true\
|
|
||||||
text:'wtf'\
|
|
||||||
}"
|
|
||||||
|
|
||||||
this.window = new Window( res );
|
|
||||||
this.window.layout.layout(true);
|
this.window.layout.layout(true);
|
||||||
this.window.center();
|
this.window.center();
|
||||||
this.window.show();
|
this.window.show();
|
||||||
|
|
||||||
|
this.window.grp.optn.enabled = false;
|
||||||
|
|
||||||
|
this.window.grp.btn_01.onClick = yPuppetRigTool.runRigPin; //Defines Button Action
|
||||||
|
this.window.grp.btn_02.onClick = yPuppetRigTool.runRigLayer; //Defines Button Action
|
||||||
|
this.window.grp.btn_03.onClick = yPuppetRigTool.runRigAll; //Defines Button Action
|
||||||
|
this.window.grp.chk_optn.onClick = yPuppetRigTool.toggleOptions;
|
||||||
}
|
}
|
||||||
this.yMainFunction = function yMainFunction()
|
this.yMainFunction = function yMainFunction()
|
||||||
{
|
{
|
||||||
@@ -73,6 +107,150 @@ function YGenericTool()
|
|||||||
this.yTool.yMainFunction();
|
this.yTool.yMainFunction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**/
|
||||||
|
this.toggleOptions = function toggleOptions(){
|
||||||
|
if(this.window.grp.chk_optn==true){
|
||||||
|
this.window.grp.chk_optn=false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.window.grp.chk_optn=true;
|
||||||
|
}
|
||||||
|
this.window.grp.optn.enabled = this.window.grp.chk_optn;
|
||||||
|
}
|
||||||
|
this.customColors = function customColors(rsr){
|
||||||
|
g = rsr.graphics;
|
||||||
|
myBrush = g.newBrush(g.BrushType.SOLID_COLOR, [0.25, 0.05, 0.25, 1]);
|
||||||
|
g.backgroundColor = yToolBoxPalette.graphics.backgroundColor;
|
||||||
|
}
|
||||||
|
this.getPuppetEffects = function getPuppetEffects(aLayer){
|
||||||
|
puppetEffects = []
|
||||||
|
for(i=1;i<=aLayer('Effects').numProperties;i++){
|
||||||
|
puppetEffects.push(aLayer('Effects')(i));
|
||||||
|
}
|
||||||
|
return puppetEffects;
|
||||||
|
}
|
||||||
|
this.getPosPins = function getPosPins(aLayer){
|
||||||
|
puppetEffects = this.getPuppetEffects(aLayer);
|
||||||
|
if(puppetEffects.length>0){
|
||||||
|
posPins = [];
|
||||||
|
for(i=0;i<puppetEffects.length;i++){
|
||||||
|
posPinGroup = puppetEffects[i]('ADBE FreePin3 ARAP Group')('ADBE FreePin3 Mesh Group')('ADBE FreePin3 Mesh Atom')('ADBE FreePin3 PosPins');
|
||||||
|
for(j=1;j<=posPinGroup.numProperties;j++){
|
||||||
|
posPins.push(puppetEffects[i]('ADBE FreePin3 ARAP Group')('ADBE FreePin3 Mesh Group')('ADBE FreePin3 Mesh Atom')('ADBE FreePin3 PosPins')(j));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return posPins;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
writeLn('No FreePin3 Effect found on Layer');
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.rigPins = function rigPins(aLayer,selectedOnly){
|
||||||
|
pins = this.getPosPins(aLayer);
|
||||||
|
selectedPins = [];
|
||||||
|
createdNulls =[];
|
||||||
|
for(i=0;i<pins.length;i++){
|
||||||
|
selectedPins.push(pins[i].selected)
|
||||||
|
}
|
||||||
|
this.setPropsFromUI();
|
||||||
|
|
||||||
|
for(i=0;i<pins.length;i++){
|
||||||
|
if(selectedPins[i]||!selectedOnly){
|
||||||
|
|
||||||
|
createdNulls.push([app.project.activeItem.layers.addNull(),pins[i]]);// populate register of created Nulls, associated with the pin property groups that will be controlled by them.
|
||||||
|
createdNulls[i][0].source.height = createdNulls[i][0].source.width = nullSize;
|
||||||
|
createdNulls[i][0].name = aLayer.name+"_"+createdNulls[i][1].name; //set nulls name to it's parent layer's name + the puppuet point name.
|
||||||
|
createdNulls[i][0].label = aLayer.label; // set nulls label equalt to its parent layer.
|
||||||
|
createdNulls[i][0].transform.anchorPoint.setValue([createdNulls[i][0].source.width/2,createdNulls[i][0].source.height/2]); //center pivot of created nulls
|
||||||
|
createdNulls[i][0].moveBefore(aLayer); //stack created null on top of original layer.
|
||||||
|
pinPosition = createdNulls[i][1]('ADBE FreePin3 PosPin Position').value;
|
||||||
|
aLayerPosition = aLayer('ADBE Transform Group')('ADBE Position').value;
|
||||||
|
aLayerAnchorPoint = aLayer('ADBE Transform Group')('ADBE Anchor Point').value;
|
||||||
|
createdNulls[i][0].transform.position.setValue(pinPosition+aLayerPosition-aLayerAnchorPoint); //needs a toWorld Function
|
||||||
|
txtExpression = 'l = thisComp.layer('+'"'+createdNulls[i][0].name+'"'+');\
|
||||||
|
'+'fromWorld(l.toComp(l.transform.anchorPoint))';
|
||||||
|
createdNulls[i][1]('ADBE FreePin3 PosPin Position').expression = txtExpression;
|
||||||
|
|
||||||
|
//there has to be a way to re select the original layer one had selected.
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
createdNulls.push([null,null])
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//stuff to apply to main layer
|
||||||
|
aLayer.quality = layerQuality;
|
||||||
|
aLayer.locked = layerLock;
|
||||||
|
|
||||||
|
pins = null;
|
||||||
|
selectedPins = null;
|
||||||
|
createdNulls = null;
|
||||||
|
pinPosition = null;
|
||||||
|
aLayerPosition= null;
|
||||||
|
aLayerAnchorPoint = null;
|
||||||
|
txtExpression = null;
|
||||||
|
|
||||||
|
}
|
||||||
|
this.runRigPin = function runRigPin(){
|
||||||
|
app.beginUndoGroup( yPuppetRigTool.resources.string_001 );
|
||||||
|
sel =app.project.activeItem.selectedLayers;
|
||||||
|
yPuppetRigTool.setPropsFromUI();
|
||||||
|
yPuppetRigTool.rigPins(sel[0],true);
|
||||||
|
app.endUndoGroup();
|
||||||
|
}
|
||||||
|
this.runRigLayer = function runRigLayer(){
|
||||||
|
//alert( yPuppetRigTool.resources.string_002 );
|
||||||
|
app.beginUndoGroup( yPuppetRigTool.resources.string_002 );
|
||||||
|
allLayers = app.project.activeItem.layers;
|
||||||
|
workLayers = [];
|
||||||
|
for(i=1;i<=allLayers.length;i++){
|
||||||
|
if(allLayers[i].selected){
|
||||||
|
workLayers.push(allLayers[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(x=0;x<workLayers.length;x++){
|
||||||
|
//alert( yPuppetRigTool.info );
|
||||||
|
yPuppetRigTool.rigPins(workLayers[x],false);
|
||||||
|
}
|
||||||
|
app.endUndoGroup();
|
||||||
|
|
||||||
|
}
|
||||||
|
this.runRigAll = function runRigAll(){
|
||||||
|
app.beginUndoGroup( yPuppetRigTool.resources.string_003 );
|
||||||
|
allLayers = app.project.activeItem.layers;
|
||||||
|
workLayers = [];
|
||||||
|
for(i=1;i<=allLayers.length;i++){
|
||||||
|
workLayers.push(allLayers[i]);
|
||||||
|
}
|
||||||
|
for(x=0;x<workLayers.length;x++){
|
||||||
|
yPuppetRigTool.rigPins(workLayers[x],false);
|
||||||
|
}
|
||||||
|
app.endUndoGroup();
|
||||||
|
}
|
||||||
|
this.setPropsFromUI = function setPropsFromUI(){
|
||||||
|
nullSize = yFactor(parseInt(this.window.grp.optn.nullSizeGrp.sldr.value),5)
|
||||||
|
if(this.window.grp.optn.nullSizeGrp.otherOptionsGrp.chk_box_02.value==true){
|
||||||
|
layerLock =true // solo si vamos a hacer vainas pixeladas.
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
layerLock =false // solo si vamos a hacer vainas pixeladas.
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.window.grp.optn.nullSizeGrp.otherOptionsGrp.chk_box_01.value==true){
|
||||||
|
layerQuality =LayerQuality.DRAFT // solo si vamos a hacer vainas pixeladas.
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
layerQuality =LayerQuality.BEST // solo si vamos a hacer vainas pixeladas.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**/
|
||||||
|
|
||||||
this.init();
|
this.init();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -80,10 +258,10 @@ function YGenericTool()
|
|||||||
//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(YTB)=='undefined')
|
if (typeof(YTB)=='undefined')
|
||||||
{
|
{
|
||||||
yGenericTool = new YGenericTool();
|
yPuppetRigTool = new YPuppetRigTool();
|
||||||
yGenericTool.activate();
|
yPuppetRigTool.activate();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
YTB.addTool(new YGenericTool());
|
yPuppetRigTool = YTB.addTool(new YPuppetRigTool());
|
||||||
}
|
}
|
||||||
|
|||||||
+131
-1
@@ -1 +1,131 @@
|
|||||||
#include "../yScripts/y_JSExtensions.jsx";␍function YSetProjectTool()␍{␍ this.info =␍ {␍ name : "YSetStructure",␍ version : 0.11,␍ stage : "alpha",␍ description : "Set the Folder Structure for a new Project",␍ url : "yorchnet.com"␍ };␍ this.appearence =␍ {␍ buttonHeight : 30,␍ buttonWidth : 126␍ };␍ this.resources = ␍ {␍ icon : new File('yNet.png'),␍ };␍ this.init = function init()␍ {␍ //alert("my name is:" + this.info.name);␍ this.btnLauyout = ␍ "button\␍ {\␍ preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'],\␍ text:'" + this.info.name + "',\␍ helpTip:'" + this.info.description + "'\␍ }";␍ ␍ this. res = ␍ "window\␍ {\␍ type:'palette',\␍ text:'" + this.info.name + ' ' + this.info.ver + ' ' + this.info.stage + "',\␍ info: Group \␍ {\␍ alignment:['center','bottom'],\␍ icon: Image \␍ {\␍ icon:'" + this.resources.icon.path + '/' + this.resources.icon.name + "',\␍ preferredSize: [15, 18]\␍ },\␍ website: StaticText\␍ {\␍ text:'" + this.info.url + "',\␍ alignment:['fill','center']\␍ },\␍ }\␍ }";␍ }␍ this.createUI = function createUI()␍ {␍ this.window = new Window ( this.res );␍ this.window.show() ;␍ }␍ this.ySetProject = function ySetProject()␍ {␍ //alert("is this working");␍ app.beginUndoGroup('ySetProject');␍ var preStruct = ["01 MAIN","02 PComp","03 Source Layers" ,"04 Movies","05 Other Projects","06 Audio" , "07 Reference"];␍ var newStruct = [];␍ var projectItems = [];␍␍ for(i=1;i<=app.project.items.length;i++)␍ {␍ if(app.project.items[i].parentFolder.name=='Root')␍ {␍ projectItems.push(app.project.items[i].name);␍ }␍ }␍␍ //to start a new organized project since the beginning␍␍ if (projectItems.length == 0)␍ {␍ newStruct = preStruct;␍ }␍ else␍ {␍ for(a=0;a<preStruct.length;a++)␍ {␍ if ((projectItems.getOne(preStruct[a]))==-1)␍ {␍ newStruct.push(preStruct[a]);␍ }␍ }␍ }␍␍ for(i = 1;i<=newStruct.length;i++)␍ {␍ app.project.items.addFolder(newStruct[i-1]);␍ if ( app.project.items[i].name == "01 MAIN" )␍ {␍ //alert("yes");␍ app.project.items[i].items.addComp("JOBCODE_TYPE_[Scene_name]_vA_r000",1920,1080,1,30,23.976);␍ } ␍ ␍ }␍ ␍ saveNow = confirm("Project Succesfully Set, Save Project?",true,"ySetProject");␍ ␍ if(saveNow==true){␍ app.project.save()␍ }else{␍ ␍ }␍ app.endUndoGroup();␍ }␍ ␍ this.activate = this.ySetProject;␍ ␍ this.init();␍ return this;␍}␍␍//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own.␍if (typeof(YTB)=='undefined')␍{␍ ySetProjectTool = new YSetProjectTool();␍ ySetProjectTool.activate();␍}␍else␍{␍ ySetProjectTool = YTB.addTool(new YSetProjectTool());␍}␍
|
<<<<<<< HEAD
|
||||||
|
#include "../yScripts/y_JSExtensions.jsx";␍function YSetProjectTool()␍{␍ this.info =␍ {␍ name : "YSetStructure",␍ version : 0.11,␍ stage : "alpha",␍ description : "Set the Folder Structure for a new Project",␍ url : "yorchnet.com"␍ };␍ this.appearence =␍ {␍ buttonHeight : 30,␍ buttonWidth : 126␍ };␍ this.resources = ␍ {␍ icon : new File('yNet.png'),␍ };␍ this.init = function init()␍ {␍ //alert("my name is:" + this.info.name);␍ this.btnLauyout = ␍ "button\␍ {\␍ preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'],\␍ text:'" + this.info.name + "',\␍ helpTip:'" + this.info.description + "'\␍ }";␍ ␍ this. res = ␍ "window\␍ {\␍ type:'palette',\␍ text:'" + this.info.name + ' ' + this.info.ver + ' ' + this.info.stage + "',\␍ info: Group \␍ {\␍ alignment:['center','bottom'],\␍ icon: Image \␍ {\␍ icon:'" + this.resources.icon.path + '/' + this.resources.icon.name + "',\␍ preferredSize: [15, 18]\␍ },\␍ website: StaticText\␍ {\␍ text:'" + this.info.url + "',\␍ alignment:['fill','center']\␍ },\␍ }\␍ }";␍ }␍ this.createUI = function createUI()␍ {␍ this.window = new Window ( this.res );␍ this.window.show() ;␍ }␍ this.ySetProject = function ySetProject()␍ {␍ //alert("is this working");␍ app.beginUndoGroup('ySetProject');␍ var preStruct = ["01 MAIN","02 PComp","03 Source Layers" ,"04 Movies","05 Other Projects","06 Audio" , "07 Reference"];␍ var newStruct = [];␍ var projectItems = [];␍␍ for(i=1;i<=app.project.items.length;i++)␍ {␍ if(app.project.items[i].parentFolder.name=='Root')␍ {␍ projectItems.push(app.project.items[i].name);␍ }␍ }␍␍ //to start a new organized project since the beginning␍␍ if (projectItems.length == 0)␍ {␍ newStruct = preStruct;␍ }␍ else␍ {␍ for(a=0;a<preStruct.length;a++)␍ {␍ if ((projectItems.getOne(preStruct[a]))==-1)␍ {␍ newStruct.push(preStruct[a]);␍ }␍ }␍ }␍␍ for(i = 1;i<=newStruct.length;i++)␍ {␍ app.project.items.addFolder(newStruct[i-1]);␍ if ( app.project.items[i].name == "01 MAIN" )␍ {␍ //alert("yes");␍ app.project.items[i].items.addComp("JOBCODE_TYPE_[Scene_name]_vA_r000",1920,1080,1,30,23.976);␍ } ␍ ␍ }␍ ␍ saveNow = confirm("Project Succesfully Set, Save Project?",true,"ySetProject");␍ ␍ if(saveNow==true){␍ app.project.save()␍ }else{␍ ␍ }␍ app.endUndoGroup();␍ }␍ ␍ this.activate = this.ySetProject;␍ ␍ this.init();␍ return this;␍}␍␍//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own.␍if (typeof(YTB)=='undefined')␍{␍ ySetProjectTool = new YSetProjectTool();␍ ySetProjectTool.activate();␍}␍else␍{␍ ySetProjectTool = YTB.addTool(new YSetProjectTool());␍}
|
||||||
|
=======
|
||||||
|
#include "../yScripts/y_JSExtensions.jsx";
|
||||||
|
function YSetProjectTool()
|
||||||
|
{
|
||||||
|
this.info =
|
||||||
|
{
|
||||||
|
name : "YSetStructure",
|
||||||
|
version : 0.11,
|
||||||
|
stage : "alpha",
|
||||||
|
description : "Set the Folder Structure for a new Project",
|
||||||
|
url : "yorchnet.com"
|
||||||
|
};
|
||||||
|
this.appearence =
|
||||||
|
{
|
||||||
|
buttonHeight : 30,
|
||||||
|
buttonWidth : 126
|
||||||
|
};
|
||||||
|
this.resources =
|
||||||
|
{
|
||||||
|
icon : new File('yNet.png'),
|
||||||
|
};
|
||||||
|
this.init = function init()
|
||||||
|
{
|
||||||
|
//alert("my name is:" + this.info.name);
|
||||||
|
this.btnLauyout =
|
||||||
|
"button\
|
||||||
|
{\
|
||||||
|
preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'],\
|
||||||
|
text:'" + this.info.name + "',\
|
||||||
|
helpTip:'" + this.info.description + "'\
|
||||||
|
}";
|
||||||
|
|
||||||
|
this. res =
|
||||||
|
"window\
|
||||||
|
{\
|
||||||
|
type:'palette',\
|
||||||
|
text:'" + this.info.name + ' ' + this.info.ver + ' ' + this.info.stage + "',\
|
||||||
|
info: Group \
|
||||||
|
{\
|
||||||
|
alignment:['center','bottom'],\
|
||||||
|
icon: Image \
|
||||||
|
{\
|
||||||
|
icon:'" + this.resources.icon.path + '/' + this.resources.icon.name + "',\
|
||||||
|
preferredSize: [15, 18]\
|
||||||
|
},\
|
||||||
|
website: StaticText\
|
||||||
|
{\
|
||||||
|
text:'" + this.info.url + "',\
|
||||||
|
alignment:['fill','center']\
|
||||||
|
},\
|
||||||
|
}\
|
||||||
|
}";
|
||||||
|
}
|
||||||
|
this.createUI = function createUI()
|
||||||
|
{
|
||||||
|
this.window = new Window ( this.res );
|
||||||
|
this.window.show() ;
|
||||||
|
}
|
||||||
|
this.ySetProject = function ySetProject()
|
||||||
|
{
|
||||||
|
//alert("is this working");
|
||||||
|
app.beginUndoGroup('ySetProject');
|
||||||
|
var preStruct = ["01 MAIN","02 PComp","03 Source Layers" ,"04 Movies","05 Other Projects","06 Audio" , "07 Reference"];
|
||||||
|
var newStruct = [];
|
||||||
|
var projectItems = [];
|
||||||
|
|
||||||
|
for(i=1;i<=app.project.items.length;i++)
|
||||||
|
{
|
||||||
|
if(app.project.items[i].parentFolder.name=='Root')
|
||||||
|
{
|
||||||
|
projectItems.push(app.project.items[i].name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//to start a new organized project since the beginning
|
||||||
|
|
||||||
|
if (projectItems.length == 0)
|
||||||
|
{
|
||||||
|
newStruct = preStruct;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for(a=0;a<preStruct.length;a++)
|
||||||
|
{
|
||||||
|
if ((projectItems.getOne(preStruct[a]))==-1)
|
||||||
|
{
|
||||||
|
newStruct.push(preStruct[a]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = 1;i<=newStruct.length;i++)
|
||||||
|
{
|
||||||
|
app.project.items.addFolder(newStruct[i-1]);
|
||||||
|
if ( app.project.items[i].name == "01 MAIN" )
|
||||||
|
{
|
||||||
|
//alert("yes");
|
||||||
|
app.project.items[i].items.addComp("JOBCODE_TYPE_[Scene_name]_vA_r000",1920,1080,1,30,23.976);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
saveNow = confirm("Project Succesfully Set, Save Project?",true,"ySetProject");
|
||||||
|
|
||||||
|
if(saveNow==true){
|
||||||
|
app.project.save()
|
||||||
|
}else{
|
||||||
|
|
||||||
|
}
|
||||||
|
app.endUndoGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.activate = this.ySetProject;
|
||||||
|
|
||||||
|
this.init();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own.
|
||||||
|
if (typeof(YTB)=='undefined')
|
||||||
|
{
|
||||||
|
ySetProjectTool = new YSetProjectTool();
|
||||||
|
ySetProjectTool.activate();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
YTB.addTool(new YSetProjectTool());
|
||||||
|
}
|
||||||
|
>>>>>>> 841484771586f75c140288b329d54c96d3cb3925
|
||||||
|
|||||||
@@ -3,7 +3,11 @@ function YGenericTool()
|
|||||||
{
|
{
|
||||||
this.info =
|
this.info =
|
||||||
{
|
{
|
||||||
|
<<<<<<< HEAD
|
||||||
name : "yStopMotion",
|
name : "yStopMotion",
|
||||||
|
=======
|
||||||
|
name : "yGenericTool",
|
||||||
|
>>>>>>> 841484771586f75c140288b329d54c96d3cb3925
|
||||||
version : 0.1,
|
version : 0.1,
|
||||||
stage : "development",
|
stage : "development",
|
||||||
description : "Dynamically change layer sequence opacity from a slider in pComp",
|
description : "Dynamically change layer sequence opacity from a slider in pComp",
|
||||||
|
|||||||
Reference in New Issue
Block a user