mirror of
https://github.com/jorgevasquezp/AFX_yTools.git
synced 2026-09-16 19:22:42 +00:00
Minor changes to adjust CPoffset PuppetRig and StopmotionLayer to the new model.
This commit is contained in:
@@ -1,101 +1,89 @@
|
||||
yStopMotion_data = new Object();
|
||||
|
||||
yStopMotion_data.scriptName = 'yStopMotion';
|
||||
yStopMotion_data.scriptDesc = 'Dynamically change layer sequence opacity from a slider in pComp';
|
||||
yStopMotion_data.scriptVer = '0.1a';
|
||||
yStopMotion_data.webLink = 'yorchnet.com';
|
||||
|
||||
//if yToolBox Exists add it to its tool list.
|
||||
if (typeof(YTB)!=='undefined'){
|
||||
YTB.tools.push(yStopMotion_data);
|
||||
|
||||
//it should be called from toolbox.
|
||||
/* yStopMotion_data.buttonWidth=76;
|
||||
yStopMotion_data.buttonHeight=30;
|
||||
*/
|
||||
yStopMotion_data.btnLayout = "btn_"+yStopMotion_data.scriptName+": Button { preferredSize: ['"+ YTB.buttonWidth+"','"+ YTB.buttonHeight+"'], text:'"+yStopMotion_data.scriptName+"', helpTip:'"+yStopMotion_data.scriptDesc+"' }";
|
||||
|
||||
#include "../yScripts/y_JSExtensions.jsx";
|
||||
function YGenericTool()
|
||||
{
|
||||
this.info =
|
||||
{
|
||||
name : "yGenericTool",
|
||||
version : 0.0,
|
||||
stage : "development",
|
||||
description : "Generic script to use as a base for new tools.",
|
||||
url : "yorchnet.com"
|
||||
};
|
||||
this.appearence =
|
||||
{
|
||||
buttonHeight : 30,
|
||||
buttonWidth : 126
|
||||
};
|
||||
this.resources =
|
||||
{
|
||||
icon : new File('yNet.png'),
|
||||
};
|
||||
this.init = function init()
|
||||
{
|
||||
|
||||
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']\
|
||||
},\
|
||||
}\
|
||||
}";
|
||||
}
|
||||
|
||||
yStopMotion_data.res = "window { \
|
||||
type:'palette' , text:'"+yStopMotion_data.scriptName+' '+yStopMotion_data.scriptVer+"',\
|
||||
\
|
||||
\
|
||||
info: Group { \
|
||||
alignment:['center','bottom'], \
|
||||
icon: Image {preferredSize: [15, 18]},\
|
||||
website: StaticText { text:'"+yStopMotion_data.webLink+"', alignment:['fill','center'] },\
|
||||
}\
|
||||
\
|
||||
}";
|
||||
|
||||
//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------
|
||||
// MAIN SCRIPT GOES HERE.
|
||||
|
||||
e_0000 = "There are no comps in project."
|
||||
e_0001 = "No Comps selected."
|
||||
|
||||
function yStopMotionLayer(){
|
||||
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(e_0001,myName+' '+myVer);
|
||||
}
|
||||
}else{
|
||||
alert(e_0000,myName+' '+myVer+" : Error");
|
||||
this.createUI = function createUI()
|
||||
{
|
||||
res =
|
||||
"window {\
|
||||
resizeable : true\
|
||||
closeButton : true\
|
||||
text:'wtf'\
|
||||
}"
|
||||
|
||||
this.window = new Window( res );
|
||||
this.window.layout.layout(true);
|
||||
this.window.center();
|
||||
this.window.show();
|
||||
}
|
||||
app.endUndoGroup();
|
||||
this.yMainFunction = function yMainFunction()
|
||||
{
|
||||
this.createUI();
|
||||
}
|
||||
this.activate = function activate()
|
||||
{
|
||||
this.yTool.yMainFunction();
|
||||
}
|
||||
|
||||
this.init();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------
|
||||
|
||||
function build_yStopMotion_data_UI(){
|
||||
yStopMotion_data.window = new Window ( yStopMotion_data.res);
|
||||
yStopMotion_data.window.show();
|
||||
}
|
||||
yStopMotion_data.activate = yStopMotionLayer ;
|
||||
|
||||
//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own.
|
||||
if (typeof(YTB)=='undefined'){
|
||||
yStopMotion_data.activate();
|
||||
}else{
|
||||
}
|
||||
if (typeof(YTB)=='undefined')
|
||||
{
|
||||
yGenericTool = new YGenericTool();
|
||||
yGenericTool.activate();
|
||||
}
|
||||
else
|
||||
{
|
||||
YTB.addTool(new YGenericTool());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user