2 Commits
5 changed files with 79 additions and 28 deletions
+2 -3
View File
@@ -1,4 +1,3 @@
<<<<<<< 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.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; var scriptUIPanel = this;
@@ -124,5 +123,5 @@ YTB.init();
#include "../yScripts/y_BindBetween2.jsx"; #include "../yScripts/y_BindBetween2.jsx";
#include "../yScripts/y_CPOffset.jsx"; #include "../yScripts/y_CPOffset.jsx";
#include "../yScripts/y_puppetRig.jsx"; #include "../yScripts/y_puppetRig.jsx";
#include "../yScripts/y_GenericNewScript.jsx"; #include "../yScripts/y_stopMotionLayer.jsx";
>>>>>>> 841484771586f75c140288b329d54c96d3cb3925
+2 -2
View File
@@ -93,7 +93,7 @@ function YBindBetween2()
} }
this.activate = function activate() this.activate = function activate()
{ {
this.yTool.yMainFunction(); yBindBetween2.yMainFunction();
} }
this.run = function run() this.run = function run()
{ {
@@ -212,5 +212,5 @@ if (typeof(YTB)=='undefined')
} }
else else
{ {
YTB.addTool(new YBindBetween2()); yBindBetween2 = YTB.addTool(new YBindBetween2());
} }
+2 -2
View File
@@ -63,7 +63,7 @@ function YColorProbe()
} }
this.yMainFunction = function yMainFunction() this.yMainFunction = function yMainFunction()
{ {
app.beginUndoGroup(this.yTool.info.name); // yTool is a refernece to the Tool object, because THIS in this context returns the ButtonObject.... app.beginUndoGroup( yColorProbe.info.name ); // yTool is a refernece to the Tool object, because THIS in this context returns the ButtonObject....
//It works with Sampled layers at a 100% scale only. //It works with Sampled layers at a 100% scale only.
try try
@@ -124,5 +124,5 @@ if (typeof(YTB)=='undefined')
} }
else else
{ {
YTB.addTool(new YColorProbe()); yColorProbe = YTB.addTool(new YColorProbe());
} }
+2 -8
View File
@@ -4,15 +4,9 @@ function YPuppetRigTool()
this.info = this.info =
{ {
name : "yPuppetRig", name : "yPuppetRig",
<<<<<<< HEAD version : 0.34,
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 =
@@ -104,7 +98,7 @@ function YPuppetRigTool()
} }
this.activate = function activate() this.activate = function activate()
{ {
this.yTool.yMainFunction(); yPuppetRigTool.yMainFunction();
} }
/**/ /**/
+71 -13
View File
@@ -1,16 +1,12 @@
#include "../yScripts/y_JSExtensions.jsx"; #include "../yScripts/y_JSExtensions.jsx";
function YGenericTool() function YStopMotionLayer()
{ {
this.info = this.info =
{ {
<<<<<<< HEAD name : "YStopMotionLayer",
name : "yStopMotion", version : 0.11,
=======
name : "yGenericTool",
>>>>>>> 841484771586f75c140288b329d54c96d3cb3925
version : 0.1,
stage : "development", stage : "development",
description : "Dynamically change layer sequence opacity from a slider in pComp", description : "Tool to create a sprite-like behaviour with a composition.",
url : "yorchnet.com" url : "yorchnet.com"
}; };
this.appearence = this.appearence =
@@ -21,6 +17,8 @@ function YGenericTool()
this.resources = this.resources =
{ {
icon : new File('yNet.png'), icon : new File('yNet.png'),
e_0000 : "There are no comps in project.",
e_0001 : "No Comps selected."
}; };
this.init = function init() this.init = function init()
{ {
@@ -68,15 +66,75 @@ function YGenericTool()
this.window.center(); this.window.center();
this.window.show(); this.window.show();
} }
/** MEAT **/
this.yApplyStopMotionLayer = function yApplyStopMotionLayer(){
myName = "yStopMotionLayer";
myVer = "0.2a";
nComps = app.project.items.length;
app.beginUndoGroup(myName);
if(nComps>0){
sel = app.project.activeItem.selectedLayers; //array containing selection;
if(sel.length == 1&&sel[0].source!= null){
myItem = sel[0].source;
myItemType = myItem.typeName;
if(myItemType!="Composition"){
alert(e_0001,myName+' '+myVer);
}else{
sliderCtrl = sel[0]("Effects").addProperty("Slider Control");
sliderCtrl.name = "Animation State"; //should check for previously created sliders named the same and name uniquely accordingly.
txtExpression = 'myLayer = thisLayer;myComp =comp(myLayer.name);\
max = myComp.numLayers;\
myValue = effect("'+sliderCtrl.name+'")("'+sliderCtrl("Slider").name+'");\
if(myValue<=max&&myValue>1){\
parseInt(myValue)\
}else if (myValue>max){\
max\
}else if(myValue<1){1}';
//'l = thisComp.layer('+'"'+app.project.activeItem.selectedLayers[0].name+'"'+');'+'fromWorld(l.toComp(l.transform.anchorPoint))';
sliderCtrl("Slider").expression = txtExpression;
sliderCtrl("Slider").setValue(1);
txtExpression = null;
nLayers =myItem.numLayers;
txtExpression = 'extValue = comp("'+sel[0].containingComp.name+'").layer("'+myItem.name+'").effect("'+sliderCtrl.name+'")("'+sliderCtrl("Slider").name+'");if(extValue == thisLayer.index){100}else{0}';
for (z=1;z<=nLayers;z++){
myItem.layer(z).opacity.expression=txtExpression;
}
txtExpression = null;
}
}else{
alert( this.resources.e_0001,myName+' '+myVer);
}
}else{
alert(this.resources.e_0000,myName+' '+myVer+" : Error");
}
app.endUndoGroup();
}
/**/
this.yMainFunction = function yMainFunction() this.yMainFunction = function yMainFunction()
{ {
this.createUI(); //this.createUI();
this.YStopMotionLayer();
} }
this.activate = function activate() this.activate = function activate()
{ {
this.yTool.yMainFunction(); yStopMotionLayer.yApplyStopMotionLayer();
//this.yMainFunction();
} }
this.init(); this.init();
return this; return this;
} }
@@ -84,10 +142,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(); yStopMotionLayer = new YStopMotionLayer();
yGenericTool.activate(); yStopMotionLayer.activate();
} }
else else
{ {
YTB.addTool(new YGenericTool()); yStopMotionLayer = YTB.addTool(new YStopMotionLayer());
} }