mirror of
https://github.com/jorgevasquezp/AFX_yTools.git
synced 2026-09-16 11:13:40 +00:00
Compare commits
49
Commits
v0.4-alpha
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49975f6760 | ||
|
|
5acdd0d815 | ||
|
|
9446d53478 | ||
|
|
ce0743269d | ||
|
|
2d35ce31f5 | ||
|
|
4d91bbfe60 | ||
|
|
30a69f02a5 | ||
|
|
38f087dce4 | ||
|
|
29b22e7658 | ||
|
|
7c11b48082 | ||
|
|
24af8e259b | ||
|
|
00748360db | ||
|
|
fe6f637561 | ||
|
|
8e4b7bba2d | ||
|
|
1b34576b61 | ||
|
|
81ae9c5398 | ||
|
|
df23e7403f | ||
|
|
c74ed78512 | ||
|
|
b77f4552c2 | ||
|
|
b038e66615 | ||
|
|
631cb8f607 | ||
|
|
b1efb4928b | ||
|
|
4ca84b5fee | ||
|
|
f7b18e98d6 | ||
|
|
f1a6f31448 | ||
|
|
1e932c7a2d | ||
|
|
84e17ede95 | ||
|
|
8414847715 | ||
|
|
a879c2190d | ||
|
|
550a55e444 | ||
|
|
df5ea0ac01 | ||
|
|
f4c74abe46 | ||
|
|
e4b0a98471 | ||
|
|
58fe19cacd | ||
|
|
868c1cb141 | ||
|
|
e07df6d9d4 | ||
|
|
2d6983e014 | ||
|
|
3c12bdfb2d | ||
|
|
bb5336a612 | ||
|
|
75b0091c1d | ||
|
|
300d3c98fc | ||
|
|
cc91c4a6ce | ||
|
|
994772be8d | ||
|
|
2c49d99929 | ||
|
|
992891bf28 | ||
|
|
6d01d35cd0 | ||
|
|
1238e7949e | ||
|
|
bc178e67ee | ||
|
|
1e1bb0c6aa |
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
Base ScriptUI Panel v.0.1
|
||||
|
||||
by Jorge Vásquez Pérez
|
||||
|
||||
Changes 0.2:
|
||||
- None
|
||||
|
||||
*/
|
||||
|
||||
(function createNullsFromPaths (thisObj) {
|
||||
/* Build UI */
|
||||
function buildUI(thisObj) {
|
||||
|
||||
var windowTitle = "windowTitle";
|
||||
var firstButton = "firstButton";
|
||||
var secondButton = "secondButton";
|
||||
var thirdButton = "thirdButton";
|
||||
var win = (thisObj instanceof Panel)? thisObj : new Window('palette', windowTitle);
|
||||
win.spacing = 0;
|
||||
win.margins = 4;
|
||||
var myButtonGroup = win.add ("group");
|
||||
myButtonGroup.spacing = 4;
|
||||
myButtonGroup.margins = 0;
|
||||
myButtonGroup.orientation = "row";
|
||||
win.button1 = myButtonGroup.add ("button", undefined, firstButton);
|
||||
win.button2 = myButtonGroup.add ("button", undefined, secondButton);
|
||||
win.button3 = myButtonGroup.add ("button", undefined, thirdButton);
|
||||
myButtonGroup.alignment = "center";
|
||||
myButtonGroup.alignChildren = "center";
|
||||
|
||||
win.button1.onClick = function(){
|
||||
button1Click();
|
||||
}
|
||||
win.button2.onClick = function(){
|
||||
button2Click();
|
||||
}
|
||||
win.button3.onClick = function(){
|
||||
button3Click();
|
||||
}
|
||||
|
||||
win.layout.layout(true);
|
||||
|
||||
return win
|
||||
}
|
||||
|
||||
|
||||
// Show the Panel
|
||||
var w = buildUI(thisObj);
|
||||
if (w.toString() == "[object Panel]") {
|
||||
w;
|
||||
} else {
|
||||
w.show();
|
||||
}
|
||||
|
||||
|
||||
/* General functions */
|
||||
|
||||
/* Project Specific functions */
|
||||
function button1Click(){
|
||||
alert("Button 1 was clicked");
|
||||
}
|
||||
function button2Click(){
|
||||
alert("Button 2 was clicked");
|
||||
}
|
||||
function button3Click(){
|
||||
alert("Button 3 was clicked");
|
||||
}
|
||||
|
||||
|
||||
})(this);
|
||||
@@ -1 +1,132 @@
|
||||
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 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.
|
||||
//alert( aTool.info.name );
|
||||
|
||||
this.tools.push( aTool );
|
||||
//alert( aTool.btnLauyout );
|
||||
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);
|
||||
this.window.layout.resize();
|
||||
|
||||
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_CompHerder.jsx";
|
||||
#include "../yScripts/y_flattenSelectedFolderContents.jsx";
|
||||
#include "../yScripts/RenderToProject.jsx";
|
||||
#include "../yScripts/y_RenderMarkers.jsx";
|
||||
#include "../yScripts/y_colorProbe.jsx";
|
||||
#include "../yScripts/y_BindBetween2.jsx";
|
||||
#include "../yScripts/y_CPOffset.jsx";
|
||||
#include "../yScripts/y_puppetRig.jsx";
|
||||
#include "../yScripts/y_stopMotionLayer.jsx";
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,357 @@
|
||||
#include "../yScripts/y_JSExtensions.jsx";
|
||||
|
||||
function RenderToProject()
|
||||
{
|
||||
this.info =
|
||||
{
|
||||
name : "RenderToProject",
|
||||
btn1 : "RenderToProject",
|
||||
btn2 : "SetAllToProject",
|
||||
version : 0.1,
|
||||
stage : "development",
|
||||
description : "Set Renders to project appropriate folders according to the studio folder structure.",
|
||||
url : "yorchnet.com"
|
||||
};
|
||||
this.appearence =
|
||||
{
|
||||
buttonHeight : 30,
|
||||
buttonWidth : 126
|
||||
};
|
||||
this.resources =
|
||||
{
|
||||
icon : new File('yNet.png'),
|
||||
};
|
||||
this.methods =
|
||||
{
|
||||
getSelectedProjectItems: function(){
|
||||
var items = [];
|
||||
//var debugItems = [];
|
||||
var p = app.project;
|
||||
for ( var i = 1 ; i <= p.numItems ; i ++ ){
|
||||
var item = p.item(i);
|
||||
|
||||
if ( item.selected ){
|
||||
items.push(item);
|
||||
//debugItems.push(item.name);
|
||||
}
|
||||
}
|
||||
//alert(debugItems);
|
||||
return items;
|
||||
},
|
||||
pad : function ( n , pad ) {
|
||||
zeros = "";
|
||||
for ( i = 0 ; i < pad ; i ++ )
|
||||
{
|
||||
zeros+="0";
|
||||
}
|
||||
n = String(n);
|
||||
padded = zeros.substr( 0, pad - n.length ) + String(n) ;
|
||||
return padded
|
||||
},
|
||||
getTodayTag : function(){
|
||||
var today = new Date();
|
||||
var month_component = pad(String(today.getMonth()+1),2);
|
||||
var date_component = pad(today.getDate(),2);
|
||||
var full_year_component = String(today.getFullYear())
|
||||
var year_component = full_year_component.substr(full_year_component.length - 2,full_year_component.length );
|
||||
var tag = month_component + date_component + year_component
|
||||
return tag;
|
||||
},
|
||||
getOutputBasePath : function(){
|
||||
var file = app.project.file;
|
||||
var file_path = String(app.project.file);
|
||||
var gfx_output_base = "05_Graphics_Output";
|
||||
var endtag_output_extra = "02_EndTags";
|
||||
var scene_output_extra = "01_GFX_Scenes";
|
||||
var vfx_output_base = "03_Composite_Outputs";
|
||||
var vfx_output_base;
|
||||
var gfx_string = "09_Graphics";
|
||||
var vfx_string = "08_Composite";
|
||||
var endtag_string = "EndTags";
|
||||
|
||||
var search_gfx = file_path.search(gfx_string);
|
||||
var search_vfx = file_path.search(vfx_string);
|
||||
var search_endtag = file_path.search(endtag_string);
|
||||
var base_path;
|
||||
|
||||
if ( search_gfx != -1 ){
|
||||
var base_path = file_path.substr(0,search_gfx+gfx_string.length)+"/"+gfx_output_base;
|
||||
if ( search_endtag != -1 ){
|
||||
base_path += "/" + endtag_output_extra;
|
||||
}else{
|
||||
base_path += "/" + scene_output_extra;
|
||||
}
|
||||
}
|
||||
|
||||
if( search_vfx != -1 ){
|
||||
var base_path = file_path.substr(0,search_vfx+vfx_string.length)+"/"+vfx_output_base ;;
|
||||
}
|
||||
|
||||
//alert(base_path);
|
||||
|
||||
return base_path + "/" + this.getTodayTag();
|
||||
},
|
||||
/*
|
||||
setRenderToProjectPath : function( rqItem ){
|
||||
if ( (rqItem.status == 3015) || (rqItem.status == 3013) ){
|
||||
for ( var j = 1 ; j <= rqItem.numOutputModules ; j ++ ){
|
||||
o_module = rqItem.outputModule(j);
|
||||
|
||||
var old_name = rqItem.comp.name.replace(".","_");
|
||||
//alert(old_name);
|
||||
if ( o_module.file != null ){
|
||||
var new_path = this.getOutputBasePath();
|
||||
var new_folder = Folder( new_path );
|
||||
if ( !new_folder.exists ){
|
||||
new_folder.create();
|
||||
}
|
||||
//alert(new_path + "/" + old_name)
|
||||
var new_file = new File( new_path + "/" + old_name );
|
||||
o_module.file = new_file ;
|
||||
//alert ( new_path );
|
||||
//o_module.file= new_file;
|
||||
|
||||
}
|
||||
|
||||
var p = String( o_module.file.path ).split("/");
|
||||
|
||||
p.splice(0,3);
|
||||
|
||||
var s = "";
|
||||
|
||||
for ( var i = 0 ; i < p.length ; i ++ ){
|
||||
s += "\n"+p[i];
|
||||
}
|
||||
//alert( "Rendering to :" + "\n" + s + "\n\n" + o_module.file.name );
|
||||
}
|
||||
}
|
||||
},
|
||||
*/
|
||||
setRenderToProjectPath : function( rqItem , extra_path ){
|
||||
//alert(extra_path);
|
||||
if ( (rqItem.status == 3015) || (rqItem.status == 3013) ){
|
||||
for ( var j = 1 ; j <= rqItem.numOutputModules ; j ++ ){
|
||||
o_module = rqItem.outputModule(j);
|
||||
|
||||
var old_name = rqItem.comp.name.replace(".","_");
|
||||
//alert(old_name);
|
||||
if ( o_module.file != null ){
|
||||
if ( extra_path != undefined )
|
||||
{
|
||||
var new_path = this.getOutputBasePath()+ "/" +extra_path;
|
||||
}
|
||||
else
|
||||
{
|
||||
var new_path = this.getOutputBasePath();
|
||||
}
|
||||
|
||||
var new_folder = Folder( new_path );
|
||||
if ( !new_folder.exists ){
|
||||
new_folder.create();
|
||||
}
|
||||
//alert(new_path + "/" + old_name)
|
||||
var new_file = new File( new_path + "/" + old_name );
|
||||
o_module.file = new_file ;
|
||||
//alert ( new_path );
|
||||
//o_module.file= new_file;
|
||||
|
||||
}
|
||||
|
||||
var p = String( o_module.file.path ).split("/");
|
||||
|
||||
p.splice(0,3);
|
||||
|
||||
var s = "";
|
||||
|
||||
for ( var i = 0 ; i < p.length ; i ++ ){
|
||||
s += "\n"+p[i];
|
||||
}
|
||||
//alert( "Rendering to :" + "\n" + s + "\n\n" + o_module.file.name );
|
||||
}
|
||||
}
|
||||
},
|
||||
setRendersToProjectPath : function(){
|
||||
var q = app.project.renderQueue;
|
||||
//check the render queue item is not already rendered.
|
||||
for ( var i = 1 ; i <= q.numItems ; i ++ ){
|
||||
item = q.item(i);
|
||||
//3015 is QUEUED
|
||||
//3013 is NEEDS_OUTPUT
|
||||
|
||||
if ( (item.status == 3015) || (item.status == 3013) ){
|
||||
this.setRenderToProjectPath( item );
|
||||
}
|
||||
}
|
||||
},
|
||||
renderSelectedToProjectPath: function(){
|
||||
var q = app.project.renderQueue;
|
||||
var items = this.getSelectedProjectItems();
|
||||
|
||||
for ( var i = 0 ; i < items.length; i ++){
|
||||
if( items[i].typeName == "Composition" ){
|
||||
var item = items[i];
|
||||
rqItem = q.items.add(item);
|
||||
this.setRenderToProjectPath(rqItem);
|
||||
}
|
||||
//alert(items);
|
||||
if( items[i].typeName == "Folder" ){
|
||||
var folder = items[i];
|
||||
for ( var j = 1 ; j <= folder.numItems ; j ++ )
|
||||
{
|
||||
var item = folder.items[j];
|
||||
rqItem = q.items.add(item);
|
||||
this.setRenderToProjectPath(rqItem, item.parentFolder.name );
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
for ( var i = 0 ; i < items.length; i ++){
|
||||
if( items[i].typeName == "Composition" ){
|
||||
var item = items[i];
|
||||
rqItem = q.items.add(item);
|
||||
this.setRenderToProjectPath(rqItem);
|
||||
}
|
||||
else if ( items[i].typeName == "Folder" )
|
||||
{
|
||||
var folder = items[i];
|
||||
for ( var j = 1 ; j <= folder.numItems ; j ++ )
|
||||
{
|
||||
var item = folder.items[j];
|
||||
rqItem = q.items.add(item);
|
||||
this.setRenderToProjectPath(rqItem, item.parentFolder.name );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
q.showWindow(true);
|
||||
}
|
||||
}
|
||||
|
||||
this.init = function init()
|
||||
{
|
||||
/*
|
||||
* Sketching a possible multi button approach.
|
||||
this.btnLauyout =
|
||||
"group\
|
||||
{\
|
||||
btn1:Button{\
|
||||
preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'],\
|
||||
text:'" + this.info.btn1 + "',\
|
||||
onClick: "+ this.methods.setRendersToProjectPath;+" ,\
|
||||
helpTip:'" + this.info.description + "'\
|
||||
},\
|
||||
btn2:Button{\
|
||||
preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'],\
|
||||
text:'" + this.info.btn2 + "',\
|
||||
helpTip:'" + this.info.description + "'\
|
||||
}\
|
||||
}";
|
||||
*/
|
||||
|
||||
this.btnLauyout =
|
||||
"button{\
|
||||
preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'],\
|
||||
text:'" + this.info.btn1 + "',\
|
||||
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( )
|
||||
{
|
||||
var myUI = this;
|
||||
var res =
|
||||
" window {\
|
||||
text: 'RenderToProject',\
|
||||
alignment: ['fill','fill'], \
|
||||
alignChildren: ['center','top'], \
|
||||
orientation: 'column', \
|
||||
resizeable: 'true'\
|
||||
}";
|
||||
|
||||
myUI.window = new Window( res );
|
||||
myUI.window.layout.layout(true);
|
||||
|
||||
myUI.window.show();
|
||||
|
||||
myUI.window.layout.onResizing = myUI.window.layout.onResize = function () { myUI.layout.resize();}
|
||||
|
||||
//EVENT HANDLERS
|
||||
|
||||
/*
|
||||
myUI.window.tabs.search_tab.doItBtn.onClick = function(){
|
||||
var search_str = myUI.window.tabs.search_tab.searchGrp.searchString.text;
|
||||
var replace_str = myUI.window.tabs.search_tab.replaceGrp.replaceString.text;
|
||||
myUI.methods.replace( myUI.methods.getSelectedProjectItems() , search_str , replace_str );
|
||||
};
|
||||
|
||||
myUI.window.tabs.suprefix.suprefixGrp.pre.prefixBtn.onClick = function(){
|
||||
var pre = myUI.window.tabs.suprefix.suprefixGrp.su.prefixString.text;
|
||||
myUI.methods.prefix( myUI.methods.getSelectedProjectItems() , pre );
|
||||
};
|
||||
|
||||
myUI.window.tabs.suprefix.suprefixGrp.su.sufixBtn.onClick = function(){
|
||||
var su = myUI.window.tabs.suprefix.suprefixGrp.su.sufixString.text;
|
||||
myUI.methods.suffix( myUI.methods.getSelectedProjectItems() , su );
|
||||
};
|
||||
|
||||
myUI.window.tabs.rename_tab.renameGrp.renameBtn.onClick = function(){
|
||||
var new_name = myUI.window.tabs.rename_tab.renameGrp.renameString.text;
|
||||
myUI.methods.rename( myUI.methods.getSelectedProjectItems() , new_name );
|
||||
};
|
||||
*/
|
||||
|
||||
//END EVENT HANDLERS
|
||||
|
||||
return(this);
|
||||
}
|
||||
|
||||
this.yMainFunction = function yMainFunction()
|
||||
{
|
||||
//Have to Separate this into "Operators" so I can have mutiple buttons in a single Tool.
|
||||
w = this.methods.renderSelectedToProjectPath();
|
||||
}
|
||||
this.activate = function activate()
|
||||
{
|
||||
this.yTool.yMainFunction();
|
||||
}
|
||||
|
||||
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')
|
||||
{
|
||||
rtp = new RenderToProject();
|
||||
rtp.activate();
|
||||
}
|
||||
else
|
||||
{
|
||||
YTB.addTool(new RenderToProject());
|
||||
}
|
||||
@@ -1,20 +1,7 @@
|
||||
#include "y_JSExtensions.jsx";
|
||||
/*
|
||||
if (Array.prototype.getOne==null) Array.prototype.getOne=function(item){ //Extends the Array class with the getOne functions wich
|
||||
var val = -1;
|
||||
for(i=0;i<=this.length;i++){
|
||||
if(this[i]==item){
|
||||
var val = i;
|
||||
}
|
||||
}
|
||||
return val;
|
||||
}
|
||||
*/
|
||||
function sortNumber(a,b)
|
||||
{
|
||||
function sortNumber(a,b){
|
||||
return a - b;
|
||||
}
|
||||
|
||||
function pad(n,i){ //pad n with ceroes up to i places.
|
||||
if (String(n).length>=i){
|
||||
return String(n)
|
||||
@@ -27,8 +14,6 @@ function pad(n,i){ //pad n with ceroes up to i places.
|
||||
return padding+String(n)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function yUniStr(str){
|
||||
if (app.project.activeItem != null) {
|
||||
myLayers = app.project.activeItem.layers;
|
||||
@@ -67,7 +52,6 @@ function getBaseName(str){
|
||||
return str;
|
||||
};
|
||||
}
|
||||
|
||||
function getFirstGap(array){
|
||||
length = array.length
|
||||
array.sort(function sortNumber(a,b){return a-b})
|
||||
@@ -92,8 +76,6 @@ function yReplace(inputSTR,replaceSTR,replacementSTR){
|
||||
}
|
||||
return tmpSTR;
|
||||
}
|
||||
|
||||
|
||||
function genStamp(args){
|
||||
d = new Date();
|
||||
//alert(d.getMonth());
|
||||
@@ -103,7 +85,6 @@ function genStamp(args){
|
||||
str = String(m)+String(d)+String(y);
|
||||
return str
|
||||
}
|
||||
|
||||
function mergeMultiLine(_str){
|
||||
var re = new RegExp('[\n\r]');
|
||||
_lines = _str.split(re);
|
||||
@@ -128,3 +109,11 @@ function mergeMultiLine(_str){
|
||||
}
|
||||
return newStr;
|
||||
}
|
||||
function yFactor(n,f){
|
||||
if((typeof(n)=='number'&&typeof(f)=='number')&&(n>f)){
|
||||
value = n - (n%f);
|
||||
return(value);
|
||||
}else{
|
||||
alert('error');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
template_str="\
|
||||
01 MAIN\
|
||||
02 PComp\
|
||||
03 Source Layers\
|
||||
04 Movies\
|
||||
05 Other Projects\
|
||||
06 Audio\
|
||||
07 References\
|
||||
";
|
||||
|
||||
var FolderStructure = function(){
|
||||
var template = template_str.split('\n');
|
||||
template = template.slice(1,template.length-1);
|
||||
var tab=" ";
|
||||
for(var i = 0; i < template.length; i++){
|
||||
alert(template[i].split(tab));
|
||||
this[template[i]]='';
|
||||
}
|
||||
this.print = function(){
|
||||
for (var i in this){
|
||||
}
|
||||
};
|
||||
};
|
||||
fs = new FolderStructure()
|
||||
|
||||
fs.print();
|
||||
@@ -4,10 +4,10 @@ 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;
|
||||
yGeneric_data.img = YTB.icon;
|
||||
|
||||
//if yToolBox Exists add it to its tool list.
|
||||
if (typeof(yToolBox_data)!=='undefined'){
|
||||
if (typeof(YTB)!=='undefined'){
|
||||
|
||||
//it should be called from toolbox.
|
||||
yGeneric_data.buttonWidth=76;
|
||||
@@ -46,7 +46,7 @@ function build_yGeneric_data_UI(){
|
||||
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'){
|
||||
//if (typeof(YTB)=='undefined'){
|
||||
yGeneric_data.activate();
|
||||
//}else{
|
||||
//}
|
||||
|
||||
@@ -6,15 +6,15 @@ yMultiRenamer_data.scriptVer = '0.1a';
|
||||
yMultiRenamer_data.webLink = 'yorchnet.com';
|
||||
|
||||
//if yToolBox Exists add it to its tool list.
|
||||
if (typeof(yToolBox_data)!=='undefined'){
|
||||
yToolBox_data.tools.push(yMultiRenamer_data);
|
||||
if (typeof(YTB)!=='undefined'){
|
||||
YTB.tools.push(yMultiRenamer_data);
|
||||
|
||||
//it should be called from toolbox.
|
||||
|
||||
yMultiRenamer_data.buttonWidth=76;
|
||||
yMultiRenamer_data.buttonHeight=30;
|
||||
|
||||
yMultiRenamer_data.btnLayout = "btn_"+yMultiRenamer_data.scriptName+": Button { preferredSize: ['"+ yToolBox_data.buttonWidth+"','"+ yToolBox_data.buttonHeight+"'], text:'"+yMultiRenamer_data.scriptName+"', helpTip:'"+yMultiRenamer_data.scriptDesc+"' }";
|
||||
yMultiRenamer_data.btnLayout = "btn_"+yMultiRenamer_data.scriptName+": Button { preferredSize: ['"+ YTB.buttonWidth+"','"+ YTB.buttonHeight+"'], text:'"+yMultiRenamer_data.scriptName+"', helpTip:'"+yMultiRenamer_data.scriptDesc+"' }";
|
||||
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ function build_yMultiRenamer_data_UI(){
|
||||
yMultiRenamer_data.activate = build_yMultiRenamer_data_UI ;
|
||||
|
||||
//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'){
|
||||
yMultiRenamer_data.activate();
|
||||
}else{
|
||||
}
|
||||
|
||||
@@ -6,15 +6,15 @@ yMultiRenamer_data.scriptVer = '0.2a';
|
||||
yMultiRenamer_data.webLink = 'yorchnet.com';
|
||||
|
||||
//if yToolBox Exists add it to its tool list.
|
||||
if (typeof(yToolBox_data)!=='undefined'){
|
||||
yToolBox_data.tools.push(yMultiRenamer_data);
|
||||
if (typeof(YTB)!=='undefined'){
|
||||
YTB.tools.push(yMultiRenamer_data);
|
||||
|
||||
//it should be called from toolbox.
|
||||
|
||||
yMultiRenamer_data.buttonWidth=76;
|
||||
yMultiRenamer_data.buttonHeight=30;
|
||||
|
||||
yMultiRenamer_data.btnLayout = "btn_"+yMultiRenamer_data.scriptName+": Button { preferredSize: ['"+ yToolBox_data.buttonWidth+"','"+ yToolBox_data.buttonHeight+"'], text:'"+yMultiRenamer_data.scriptName+"', helpTip:'"+yMultiRenamer_data.scriptDesc+"' }";
|
||||
yMultiRenamer_data.btnLayout = "btn_"+yMultiRenamer_data.scriptName+": Button { preferredSize: ['"+ YTB.buttonWidth+"','"+ YTB.buttonHeight+"'], text:'"+yMultiRenamer_data.scriptName+"', helpTip:'"+yMultiRenamer_data.scriptDesc+"' }";
|
||||
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ yMultiRenamer_data.activate = build_yMultiRenamer_data_UI ;
|
||||
//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'){
|
||||
*/
|
||||
yMultiRenamer_data.activate();
|
||||
/*}else{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if (AVLayer.prototype. getPins==null) AVLayer.prototype. getPins=function(){ //Extends the AVLayer class with the getPinsfunctions which returns the Layer's property groups which are pins.
|
||||
//Useful extensions to AFX Extendscript classes.
|
||||
|
||||
if (AVLayer.prototype. getPins==null) AVLayer.prototype. getPins=function(){ //Extends the AVLayer class with the getPinsfunctions which returns the Layer's property groups which are pins.
|
||||
this.selectedPins = [];
|
||||
for(prop=0;prop<this.selectedProperties.length;prop++){
|
||||
p= this.selectedProperties[prop];
|
||||
|
||||
@@ -0,0 +1,216 @@
|
||||
#include "../yScripts/y_JSExtensions.jsx";
|
||||
function YBindBetween2()
|
||||
{
|
||||
this.info =
|
||||
{
|
||||
name : "yBindBetween2",
|
||||
version : 0.13,
|
||||
stage : "development",
|
||||
description : "Constraints a layer between two others, position and rotation-wise",
|
||||
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.version + "',\
|
||||
margins:[10,10,10,10],\
|
||||
spacing:[5,5,5,5]\
|
||||
\
|
||||
lst_layer: DropDownList\
|
||||
{\
|
||||
title:'layer to constrain',\
|
||||
preferredSize:[150,35],\
|
||||
textSelection:'Escoge',\
|
||||
helpTip:'Select the layer you wish to constrain'\
|
||||
}\
|
||||
lst_pa: DropDownList\
|
||||
{\
|
||||
title:'parent a',\
|
||||
preferredSize:[150,35],\
|
||||
textSelection:'Escoge',\
|
||||
helpTip:'Select the first parent'\
|
||||
}\
|
||||
lst_pb: DropDownList\
|
||||
{\
|
||||
title:'parent b',\
|
||||
preferredSize:[150,35],\
|
||||
textSelection:'Escoge',\
|
||||
helpTip:'Select the second parent'\
|
||||
}\
|
||||
exec_btn: Button\
|
||||
{\
|
||||
text:'do It',\
|
||||
preferredSize:[150,35],\
|
||||
helpTip:'do it'\
|
||||
}\
|
||||
info: Group\
|
||||
{\
|
||||
alignment:['center','bottom'], \
|
||||
icon: Image\
|
||||
{\
|
||||
preferredSize: [15, 18]\
|
||||
},\
|
||||
website: StaticText\
|
||||
{\
|
||||
text:'" + this.info.url + "', alignment:['fill','center']\
|
||||
},\
|
||||
}\
|
||||
}";
|
||||
}
|
||||
this.createUI = function createUI()
|
||||
{
|
||||
|
||||
this.window = new Window( this.res );
|
||||
this.refresh();
|
||||
this.window.exec_btn.onClick = this.run;
|
||||
this.window.layout.layout(true);
|
||||
this.window.center();
|
||||
this.window.show();
|
||||
}
|
||||
this.yMainFunction = function yMainFunction()
|
||||
{
|
||||
this.createUI();
|
||||
}
|
||||
this.activate = function activate()
|
||||
{
|
||||
yBindBetween2.yMainFunction();
|
||||
}
|
||||
this.run = function run()
|
||||
{
|
||||
app.beginUndoGroup('Bind Between Two');
|
||||
|
||||
selectedLayerName=String(this.window.lst_layer.selection);
|
||||
parentALayerName=String(this.window.lst_pa.selection);
|
||||
parentBLayerName=String(this.window.lst_pb.selection);
|
||||
layerN = selectedLayerName.substr(0, selectedLayerName.indexOf('.'));
|
||||
paN = parentALayerName.substr(0, parentALayerName.indexOf('.'));
|
||||
pbN = parentBLayerName.substr(0, parentBLayerName.indexOf('.'));
|
||||
layer = app.project.activeItem.layers[layerN];
|
||||
pa = app.project.activeItem.layers[paN];
|
||||
pb = app.project.activeItem.layers[pbN];
|
||||
layer("Effects").addProperty("Layer Control");
|
||||
layer("Effects")("Layer Control").name = 'ctrl01';
|
||||
layer("Effects")("ctrl01")("Layer").setValue(pa.index);
|
||||
layer("Effects").addProperty("Layer Control");
|
||||
layer("Effects")("Layer Control").name = 'ctrl02';
|
||||
layer("Effects")("ctrl02")("Layer").setValue(pb.index);
|
||||
layer("Effects").addProperty("Angle Control");
|
||||
layer("Effects")("Angle Control").name = 'offset';
|
||||
layer("Effects")("offset")("Angle").setValue(0);
|
||||
layer("Effects").addProperty("Slider Control");
|
||||
layer("Effects")("Slider Control").name = 'weight';
|
||||
layer("Effects")("weight")(1).setValue(50);
|
||||
layer("Effects").addProperty("Checkbox Control");
|
||||
layer("Effects")("Checkbox Control").name = 'stretch';
|
||||
posExp ='\
|
||||
a = effect("ctrl01")("Layer");\
|
||||
b = effect("ctrl02")("Layer");\
|
||||
aPos = a.toComp(a.anchorPoint);\
|
||||
bPos = b.toComp(b.anchorPoint);\
|
||||
w= effect("weight")(1)/100;\
|
||||
(aPos*(1-w)+bPos*(w))'
|
||||
rotExp ='\
|
||||
a =effect("ctrl01")("Layer");\
|
||||
b = effect("ctrl02")("Layer");\
|
||||
aPos = a.toComp(a.anchorPoint);\
|
||||
bPos = b.toComp(b.anchorPoint);\
|
||||
rx = lookAt(aPos,bPos)[0];\
|
||||
ry = lookAt(aPos,bPos)[1];\
|
||||
offset = effect("offset")("Angle");\
|
||||
if (aPos[1] > bPos[1]){\
|
||||
(ry) -90 + offset\
|
||||
}else{\
|
||||
90 - (ry) + offset\
|
||||
}'
|
||||
scaleExp ='\
|
||||
a = effect("ctrl01")("Layer");\
|
||||
b = effect("ctrl02")("Layer");\
|
||||
aPos = a.toComp(a.anchorPoint);\
|
||||
bPos = b.toComp(b.anchorPoint);\
|
||||
d = Math.sqrt(Math.pow((aPos[0]-bPos[0]),2)+Math.pow((aPos[1]-bPos[1]),2));\
|
||||
x = transform.scale[0];\
|
||||
y = transform.scale[1];\
|
||||
sx = ((d*100)/this.width)/100;\
|
||||
stretch = effect("stretch")("Checkbox");\
|
||||
if(stretch==true){\
|
||||
[x*sx,y]\
|
||||
}else{\
|
||||
[x,y]\
|
||||
}'
|
||||
|
||||
layer.transform.position.expression = posExp;
|
||||
layer.transform.rotation.expression= rotExp;
|
||||
layer.transform.scale.expression= scaleExp;
|
||||
|
||||
app.endUndoGroup();
|
||||
}
|
||||
|
||||
this.refresh = function refresh()
|
||||
{
|
||||
|
||||
var lists = [ this.window.lst_pa , this.window.lst_layer , this.window.lst_pb ]//they should be in this order for the assignment of the selection index works right/
|
||||
|
||||
for(i=0;i<lists.length;i++)
|
||||
{
|
||||
lists[i].removeAll();
|
||||
}
|
||||
|
||||
var sel = app.project.activeItem.selectedLayers;
|
||||
var compLayers = app.project.activeItem.layers;
|
||||
var selectableLayers = [];
|
||||
for ( var i = 1 ; i <= compLayers.length ; i++ )
|
||||
{
|
||||
selectableLayers.push(compLayers[i]);
|
||||
}
|
||||
|
||||
var lst_layer = this.window.lst_layer;
|
||||
var lst_pa = this.window.lst_pa;
|
||||
var lst_pb = this.window.lst_pb;
|
||||
|
||||
for( var i = 0 ; i < lists.length ; i++ )
|
||||
{
|
||||
for( j = 0 ; j < selectableLayers.length ; j++ )
|
||||
{
|
||||
lists[i].add('item',selectableLayers[j].index+"."+selectableLayers[j].name);
|
||||
}
|
||||
}
|
||||
|
||||
lst_layer.selection = 0;
|
||||
lst_pa.selection = 0;
|
||||
lst_pb.selection = 0;
|
||||
}
|
||||
|
||||
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')
|
||||
{
|
||||
yBindBetween2 = new YBindBetween2();
|
||||
yBindBetween2.activate();
|
||||
}
|
||||
else
|
||||
{
|
||||
yBindBetween2 = YTB.addTool(new YBindBetween2());
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
#include "../yScripts/y_JSExtensions.jsx";
|
||||
function YCPOffset()
|
||||
{
|
||||
this.info =
|
||||
{
|
||||
name : "YCornerPinOffset",
|
||||
version : 0.12,
|
||||
stage : "development",
|
||||
description : "Offsets each corner of a CornerPin Effect.",
|
||||
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']\
|
||||
},\
|
||||
}\
|
||||
}";
|
||||
}
|
||||
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();
|
||||
}
|
||||
this.yMainFunction = function yMainFunction()
|
||||
{
|
||||
//if called from the button as opposed as from the script.
|
||||
if ( String(this) == "[object Button]" )
|
||||
{
|
||||
this.yTool.processCornerPins();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.processCornerPins();
|
||||
}
|
||||
|
||||
}
|
||||
this.getSelectedCornerPins = function getSelectedCornerPins()
|
||||
{
|
||||
/* Function that returns a list of effect objects
|
||||
that match any of the names
|
||||
specified in validCornerPinNames. */
|
||||
validCornerPinNames = ["ADBE Corner Pin","CC Power Pin"];
|
||||
|
||||
selectedLayers = app.project.activeItem.selectedLayers;
|
||||
cornerPins = [];
|
||||
for (layer=0;layer<selectedLayers.length;layer++)
|
||||
{
|
||||
myLayer = selectedLayers[layer];
|
||||
myEffects = myLayer.property("ADBE Effect Parade");
|
||||
for(effect=1;effect<=myEffects.numProperties;effect++)
|
||||
{
|
||||
for(validCornerPinName=0;validCornerPinName<validCornerPinNames.length;validCornerPinName++)
|
||||
{
|
||||
if ( myEffects.property(effect).matchName == validCornerPinNames[validCornerPinName] )
|
||||
{
|
||||
cornerPins.push(myEffects.property(effect));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return cornerPins;
|
||||
}
|
||||
this.getLayer = function getLayer(effect)
|
||||
{
|
||||
/* If given a layer's effect object
|
||||
this function returns the layer object */
|
||||
layer = effect.parentProperty.parentProperty;
|
||||
return layer;
|
||||
}
|
||||
this.addEffect = function addEffect(layer,effect_string,effect_name)
|
||||
{
|
||||
new_effect = layer.property("ADBE Effect Parade").addProperty(effect_string);
|
||||
new_effect.name = effect_name;
|
||||
return new_effect;
|
||||
}
|
||||
this.addPointControls = function addPointControls(effect)
|
||||
{
|
||||
/*calling the getLayer(effect) is resetting my effect object to null, and not allowing me to do everything in a single sitting. I think it has to do with variable scopes.*/
|
||||
local = {};
|
||||
local.effect = effect;
|
||||
base_name = local.effect.name;
|
||||
names = ["Upper Left","Upper Right","Lower Left","Lower Right"];
|
||||
|
||||
for (i=1;i<=4;i++)
|
||||
{
|
||||
expression = '\
|
||||
try\
|
||||
{\
|
||||
effect("'+base_name+'")('+(i)+')+effect("'+base_name+'_'+names[i-1]+'_'+'Offset'+'")("Point")\
|
||||
}\
|
||||
catch(err)\
|
||||
{\
|
||||
[0,0]\
|
||||
}'
|
||||
local.effect.property(i).expression = expression;
|
||||
}
|
||||
layer = this.getLayer(effect);
|
||||
for(i=0;i<=3;i++)
|
||||
{
|
||||
new_effect = this.addEffect(layer,"Point Control",base_name+"_"+names[i]+"_"+"Offset");
|
||||
new_effect.property("Point").setValue([0,0]);
|
||||
}
|
||||
}
|
||||
this.processCornerPins = function processCornerPins(){
|
||||
|
||||
app.beginUndoGroup('ySetProject');
|
||||
pins = this.getSelectedCornerPins();
|
||||
|
||||
for(pin=0;pin<pins.length;pin++)
|
||||
{
|
||||
this.addPointControls(pins[pin])
|
||||
}
|
||||
app.endUndoGroup();
|
||||
}
|
||||
|
||||
this.activate = this.yMainFunction;
|
||||
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')
|
||||
{
|
||||
yCPOffset = new YCPOffset();
|
||||
yCPOffset.activate();
|
||||
}
|
||||
else
|
||||
{
|
||||
yCPOffset = YTB.addTool(new YCPOffset());
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,115 @@
|
||||
#include "../yScripts/y_JSExtensions.jsx";
|
||||
|
||||
function CompHerder()
|
||||
{
|
||||
this.info =
|
||||
{
|
||||
name : "CompHerder",
|
||||
version : 0.1,
|
||||
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']\
|
||||
},\
|
||||
}\
|
||||
}";
|
||||
}
|
||||
this.createUI = function createUI()
|
||||
{
|
||||
var res =
|
||||
"window { \
|
||||
text: 'CompHerder',\
|
||||
alignment: ['fill','fill'], \
|
||||
alignChildren: ['left','top'], \
|
||||
orientation: 'column', \
|
||||
resizeable: 'true',\
|
||||
tabs: Panel {\
|
||||
type: 'tabbedpanel',\
|
||||
alignment: ['fill','fill'], \
|
||||
alignChildren: ['left','top'], \
|
||||
orientation: 'column', \
|
||||
tab1: Panel {\
|
||||
type: 'tab',\
|
||||
text: 'search & replace'\
|
||||
},\
|
||||
tab2: Panel {\
|
||||
type: 'tab',\
|
||||
text: 'suffix/prefix'\
|
||||
},\
|
||||
tab3: Panel {\
|
||||
type: 'tab',\
|
||||
text: 'rename'\
|
||||
}\
|
||||
}\
|
||||
}";
|
||||
|
||||
this.window = new Window( res );
|
||||
this.window.layout.layout(true);
|
||||
/*
|
||||
this.window.resize();
|
||||
this.window.center();
|
||||
*/
|
||||
this.window.show();
|
||||
|
||||
this.window.layout.onResizing = this.window.layout.onResize = function () {this.layout.resize();}
|
||||
}
|
||||
this.yMainFunction = function yMainFunction()
|
||||
{
|
||||
this.createUI();
|
||||
}
|
||||
this.activate = function activate()
|
||||
{
|
||||
this.yTool.yMainFunction();
|
||||
}
|
||||
|
||||
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')
|
||||
{
|
||||
CompHerder = new CompHerder();
|
||||
CompHerder.activate();
|
||||
}
|
||||
else
|
||||
{
|
||||
YTB.addTool(new CompHerder());
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
#include "../yScripts/y_JSExtensions.jsx";
|
||||
|
||||
yOffsetCornerPin_data = new Object();
|
||||
|
||||
yOffsetCornerPin_data.scriptName = 'YCornerPinOffset';
|
||||
yOffsetCornerPin_data.scriptDesc = 'Offsets each corner of a CornerPin Effect';
|
||||
yOffsetCornerPin_data.scriptVer = '0.1a';
|
||||
yOffsetCornerPin_data.webLink = 'yorchnet.com';
|
||||
|
||||
//if yToolBox Exists add it to its tool list.
|
||||
if (typeof(yToolBox_data)!=='undefined'){
|
||||
yToolBox_data.tools.push(yOffsetCornerPin_data);
|
||||
|
||||
//it should be called from toolbox.
|
||||
/*
|
||||
yOffsetCornerPin_data.buttonWidth=76;
|
||||
yOffsetCornerPin_data.buttonHeight=30;
|
||||
*/
|
||||
yOffsetCornerPin_data.btnLayout = "btn_"+ yOffsetCornerPin_data.scriptName+": Button { preferredSize: ['"+ yToolBox_data.buttonWidth+"','"+ yToolBox_data.buttonHeight+"'], text:'"+yOffsetCornerPin_data.scriptName+"', helpTip:'"+yOffsetCornerPin_data.scriptDesc+"' }";
|
||||
|
||||
}
|
||||
|
||||
yOffsetCornerPin_data.res = "window { \
|
||||
type:'palette' , text:'"+yOffsetCornerPin_data.scriptName+' '+yOffsetCornerPin_data.scriptVer+"',\
|
||||
\
|
||||
\
|
||||
info: Group { \
|
||||
alignment:['center','bottom'], \
|
||||
icon: Image {preferredSize: [15, 18]},\
|
||||
website: StaticText { text:'"+yOffsetCornerPin_data.webLink+"', alignment:['fill','center'] },\
|
||||
}\
|
||||
\
|
||||
}";
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------
|
||||
function getSelectedCornerPins() {
|
||||
/* Function that returns a list of effect objects
|
||||
that match any of the names
|
||||
specified in validCornerPinNames. */
|
||||
validCornerPinNames = ["ADBE Corner Pin","CC Power Pin"]
|
||||
selectedLayers = app.project.activeItem.selectedLayers
|
||||
cornerPins = []
|
||||
for (layer=0;layer<selectedLayers.length;layer++){
|
||||
myLayer = selectedLayers[layer];
|
||||
myEffects = myLayer.property("ADBE Effect Parade");
|
||||
for(effect=1;effect<=myEffects.numProperties;effect++){
|
||||
for(validCornerPinName=0;validCornerPinName<validCornerPinNames.length;validCornerPinName++){
|
||||
if ( myEffects.property(effect).matchName == validCornerPinNames[validCornerPinName] && myEffects.property(effect).selected == true){
|
||||
cornerPins.push(myEffects.property(effect))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return cornerPins
|
||||
}
|
||||
function getLayer(effect){
|
||||
/* If given a layer's effect object
|
||||
this function returns the layer object */
|
||||
layer = effect.parentProperty.parentProperty
|
||||
return layer
|
||||
}
|
||||
function addEffect(layer,effect_string,effect_name){
|
||||
new_effect = layer.property("ADBE Effect Parade").addProperty(effect_string);
|
||||
new_effect.name = effect_name;
|
||||
return new_effect
|
||||
}
|
||||
function addPointControls(effect){
|
||||
/*calling the getLayer(effect) is resetting my effect object to null, and not allowing me to do everything in a single sitting. I think it has to do with variable scopes.*/
|
||||
local = {};
|
||||
local.effect = effect;
|
||||
base_name = local.effect.name;
|
||||
names = ["Upper Left","Upper Right","Lower Left","Lower Right"];
|
||||
|
||||
for (i=1;i<=4;i++){
|
||||
expression = 'try{\
|
||||
effect("'+base_name+'")('+(i)+')+effect("'+base_name+'_'+names[i-1]+'_'+'Offset'+'")("Point")\
|
||||
}catch(err){\
|
||||
[0,0]\
|
||||
}'
|
||||
local.effect.property(i).expression = expression;
|
||||
}
|
||||
layer = getLayer(effect);
|
||||
for(i=0;i<=3;i++){
|
||||
new_effect = addEffect(layer,"Point Control",base_name+"_"+names[i]+"_"+"Offset");
|
||||
new_effect.property("Point").setValue([0,0]);
|
||||
}
|
||||
}
|
||||
function processCornerPins(){
|
||||
app.beginUndoGroup('ySetProject');
|
||||
pins = getSelectedCornerPins();
|
||||
for(pin=0;pin<pins.length;pin++){
|
||||
addPointControls(pins[pin])
|
||||
}
|
||||
app.endUndoGroup();
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function build_yOffsetCornerPin_data_UI(){
|
||||
yOffsetCornerPin_data.window = new Window ( yOffsetCornerPin_data.res);
|
||||
yOffsetCornerPin_data.window.show();
|
||||
}
|
||||
yOffsetCornerPin_data.activate =processCornerPins ;
|
||||
|
||||
//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own.
|
||||
if (typeof(yToolBox_data)=='undefined'){
|
||||
yOffsetCornerPin_data.activate();
|
||||
}else{
|
||||
}
|
||||
Executable
+252
@@ -0,0 +1,252 @@
|
||||
#include "../yScripts/y_JSExtensions.jsx";
|
||||
|
||||
function GenericTool()
|
||||
{
|
||||
this.info =
|
||||
{
|
||||
name : "GenericTool",
|
||||
version : 0.1,
|
||||
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.methods =
|
||||
{
|
||||
pad : function ( n , pad ) {
|
||||
zeros = "";
|
||||
for ( i = 0 ; i < pad ; i ++ )
|
||||
{
|
||||
zeros+="0";
|
||||
}
|
||||
n = String(n);
|
||||
padded = zeros.substr( 0, pad - n.length ) + String(n) ;
|
||||
return padded
|
||||
},
|
||||
replace: function( items , string , newString ){
|
||||
for ( i = 0 ; i < items.length ; i ++ ){
|
||||
var item = items[i];
|
||||
item.name = item.name.replace( string , newString );
|
||||
}
|
||||
return true;
|
||||
},
|
||||
getSelectedProjectItems: function (){
|
||||
var items = [];
|
||||
var p = app.project;
|
||||
for ( var i = 1 ; i <= p.numItems ; i ++ ){
|
||||
var item = p.item(i);
|
||||
if ( item.selected ){
|
||||
items.push(item);
|
||||
}
|
||||
}
|
||||
//items = items.concat( app.project.activeItem.selectedItems );
|
||||
return items;
|
||||
},
|
||||
suffix: function ( items , suffix ){
|
||||
for ( i = 0 ; i < items.length ; i ++ ){
|
||||
var item = items[i];
|
||||
if ( item.name.search( suffix ) != (item.name.length - suffix.length) ){
|
||||
item.name+= "_"+suffix;
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
},
|
||||
prefix : function( items , prefix ){
|
||||
for ( i = 0 ; i < items.length ; i ++ )
|
||||
{
|
||||
var item = items[i];
|
||||
if ( item.name.search( prefix ) != 0 ){
|
||||
item.name = prefix + "_" + item.name;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
rename: function ( items , new_name ){
|
||||
for ( i = 0 ; i < items.length ; i ++ ){
|
||||
var item = items[i];
|
||||
item.name = new_name + "_" + i;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
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']\
|
||||
},\
|
||||
}\
|
||||
}";
|
||||
}
|
||||
this.createUI = function createUI( )
|
||||
{
|
||||
var myUI = this;
|
||||
var res =
|
||||
" window {\
|
||||
text: 'GenericTool',\
|
||||
alignment: ['fill','fill'], \
|
||||
alignChildren: ['center','top'], \
|
||||
orientation: 'column', \
|
||||
resizeable: 'true'\
|
||||
}"
|
||||
var res =
|
||||
"window { \
|
||||
text: 'GenericTool',\
|
||||
alignment: ['fill','fill'], \
|
||||
alignChildren: ['center','top'], \
|
||||
orientation: 'column', \
|
||||
resizeable: 'true',\
|
||||
tabs: Panel {\
|
||||
type: 'tabbedpanel',\
|
||||
alignment: ['fill','fill'], \
|
||||
alignChildren: ['center','top'], \
|
||||
search_tab: Panel {\
|
||||
type: 'tab',\
|
||||
text: 'Search & Replace',\
|
||||
orientation: 'column', \
|
||||
alignChildren: ['center','top'], \
|
||||
searchGrp: Group {\
|
||||
alignment: ['fill','fill'], \
|
||||
alignChildren: ['center','top'], \
|
||||
orientation: 'column', \
|
||||
searchString: EditText {text:'SEARCH FOR TEXT',alignment: ['fill','center']}, \
|
||||
},\
|
||||
replaceGrp: Group {\
|
||||
alignment: ['fill','fill'], \
|
||||
alignChildren: ['center','center'], \
|
||||
orientation: 'column', \
|
||||
replaceString: EditText {text:'REPLACE WITH TEXT',alignment: ['fill','center']}, \
|
||||
}\
|
||||
doItBtn: Button {text: 'Replace in selected Comps', alignment: ['center','center']} , \
|
||||
}\
|
||||
suprefix: Panel {\
|
||||
type: 'tab',\
|
||||
text: 'Suffix / Prefix',\
|
||||
orientation: 'column', \
|
||||
suprefixGrp: Group {\
|
||||
alignment: ['fill','fill'], \
|
||||
alignChildren: ['left','center'], \
|
||||
orientation: 'column', \
|
||||
pre:Group {\
|
||||
alignment: ['fill','fill'], \
|
||||
alignChildren: ['left','center'], \
|
||||
orientation: 'row', \
|
||||
prefixString: EditText {text:'PREFIX',alignment: ['fill','center']}, \
|
||||
prefixBtn: Button {text: 'Preffix'} , \
|
||||
},\
|
||||
su:Group{\
|
||||
alignment: ['fill','fill'], \
|
||||
alignChildren: ['left','center'], \
|
||||
orientation: 'row', \
|
||||
sufixString: EditText {text:'SUFIX',alignment: ['fill','center']}, \
|
||||
sufixBtn: Button {text: 'Sufix'} , \
|
||||
}\
|
||||
},\
|
||||
},\
|
||||
rename_tab: Panel {\
|
||||
type: 'tab',\
|
||||
text: 'Rename',\
|
||||
renameGrp: Group {\
|
||||
alignment: ['fill','fill'], \
|
||||
alignChildren: ['left','center'], \
|
||||
orientation: 'row', \
|
||||
renameString: EditText {text:'NEW NAME',alignment: ['fill','center']}, \
|
||||
renameBtn: Button {text: 'Rename'} ,\
|
||||
}\
|
||||
}\
|
||||
},\
|
||||
}";
|
||||
|
||||
myUI.window = new Window( res );
|
||||
myUI.window.layout.layout(true);
|
||||
|
||||
myUI.window.show();
|
||||
|
||||
myUI.window.layout.onResizing = myUI.window.layout.onResize = function () { myUI.layout.resize();}
|
||||
|
||||
//EVENT HANDLERS
|
||||
|
||||
/*
|
||||
myUI.window.tabs.search_tab.doItBtn.onClick = function(){
|
||||
var search_str = myUI.window.tabs.search_tab.searchGrp.searchString.text;
|
||||
var replace_str = myUI.window.tabs.search_tab.replaceGrp.replaceString.text;
|
||||
myUI.methods.replace( myUI.methods.getSelectedProjectItems() , search_str , replace_str );
|
||||
};
|
||||
|
||||
myUI.window.tabs.suprefix.suprefixGrp.pre.prefixBtn.onClick = function(){
|
||||
var pre = myUI.window.tabs.suprefix.suprefixGrp.su.prefixString.text;
|
||||
myUI.methods.prefix( myUI.methods.getSelectedProjectItems() , pre );
|
||||
};
|
||||
|
||||
myUI.window.tabs.suprefix.suprefixGrp.su.sufixBtn.onClick = function(){
|
||||
var su = myUI.window.tabs.suprefix.suprefixGrp.su.sufixString.text;
|
||||
myUI.methods.suffix( myUI.methods.getSelectedProjectItems() , su );
|
||||
};
|
||||
|
||||
myUI.window.tabs.rename_tab.renameGrp.renameBtn.onClick = function(){
|
||||
var new_name = myUI.window.tabs.rename_tab.renameGrp.renameString.text;
|
||||
myUI.methods.rename( myUI.methods.getSelectedProjectItems() , new_name );
|
||||
};
|
||||
*/
|
||||
|
||||
//END EVENT HANDLERS
|
||||
|
||||
return(this);
|
||||
}
|
||||
|
||||
this.yMainFunction = function yMainFunction()
|
||||
{
|
||||
w = this.createUI();
|
||||
}
|
||||
this.activate = function activate()
|
||||
{
|
||||
this.yTool.yMainFunction();
|
||||
}
|
||||
|
||||
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')
|
||||
{
|
||||
gt = new GenericTool();
|
||||
gt.activate();
|
||||
}
|
||||
else
|
||||
{
|
||||
YTB.addTool(new GenericTool());
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
if (Array.prototype.getOne==null) Array.prototype.getOne=function(item){ //Extends the Array class with the getOne functions wich
|
||||
//Useful extensions to the JavaScript class versions that come with the default ExtendScript version.
|
||||
|
||||
if (Array.prototype.getOne==null) Array.prototype.getOne=function(item){ //Extends the Array class with the getOne functions wich
|
||||
var val = -1;
|
||||
for(i=0;i<=this.length;i++){
|
||||
if(this[i]==item){
|
||||
@@ -7,11 +9,3 @@
|
||||
}
|
||||
return val;
|
||||
}
|
||||
function yFactor(n,f){
|
||||
if((typeof(n)=='number'&&typeof(f)=='number')&&(n>f)){
|
||||
value = n - (n%f);
|
||||
return(value);
|
||||
}else{
|
||||
alert('error');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,292 @@
|
||||
#include "../yScripts/y_JSExtensions.jsx";
|
||||
|
||||
function RenderMarkers()
|
||||
{
|
||||
this.info =
|
||||
{
|
||||
name : "Render Markers",
|
||||
version : 0.1,
|
||||
stage : "development",
|
||||
description : 'Render all markers in dummy layer "Renders".',
|
||||
url : "yorchnet.com"
|
||||
};
|
||||
this.appearence =
|
||||
{
|
||||
buttonHeight : 30,
|
||||
buttonWidth : 126
|
||||
};
|
||||
this.resources =
|
||||
{
|
||||
icon : new File('yNet.png'),
|
||||
};
|
||||
this.methods =
|
||||
{
|
||||
pad : function ( n , pad ) {
|
||||
zeros = "";
|
||||
for ( i = 0 ; i < pad ; i ++ )
|
||||
{
|
||||
zeros+="0";
|
||||
}
|
||||
n = String(n);
|
||||
padded = zeros.substr( 0, pad - n.length ) + String(n) ;
|
||||
return padded
|
||||
},
|
||||
replace: function( items , string , newString ){
|
||||
for ( i = 0 ; i < items.length ; i ++ ){
|
||||
var item = items[i];
|
||||
item.name = item.name.replace( string , newString );
|
||||
}
|
||||
return true;
|
||||
},
|
||||
getSelectedProjectItems: function (){
|
||||
var items = [];
|
||||
var p = app.project;
|
||||
for ( var i = 1 ; i <= p.numItems ; i ++ ){
|
||||
var item = p.item(i);
|
||||
if ( item.selected ){
|
||||
items.push(item);
|
||||
}
|
||||
}
|
||||
//items = items.concat( app.project.activeItem.selectedItems );
|
||||
return items;
|
||||
},
|
||||
suffix: function ( items , suffix ){
|
||||
for ( i = 0 ; i < items.length ; i ++ ){
|
||||
var item = items[i];
|
||||
if ( item.name.search( suffix ) != (item.name.length - suffix.length) ){
|
||||
item.name+= "_"+suffix;
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
},
|
||||
prefix : function( items , prefix ){
|
||||
for ( i = 0 ; i < items.length ; i ++ )
|
||||
{
|
||||
var item = items[i];
|
||||
if ( item.name.search( prefix ) != 0 ){
|
||||
item.name = prefix + "_" + item.name;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
rename: function ( items , new_name ){
|
||||
for ( i = 0 ; i < items.length ; i ++ ){
|
||||
var item = items[i];
|
||||
item.name = new_name + "_" + i;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
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']\
|
||||
},\
|
||||
}\
|
||||
}";
|
||||
}
|
||||
this.createUI = function createUI( )
|
||||
{
|
||||
var myUI = this;
|
||||
var res =
|
||||
" window {\
|
||||
text: 'RenderMarkers',\
|
||||
alignment: ['fill','fill'], \
|
||||
alignChildren: ['center','top'], \
|
||||
orientation: 'column', \
|
||||
resizeable: 'true'\
|
||||
}"
|
||||
var res =
|
||||
"window { \
|
||||
text: 'RenderMarkers',\
|
||||
alignment: ['fill','fill'], \
|
||||
alignChildren: ['center','top'], \
|
||||
orientation: 'column', \
|
||||
resizeable: 'true',\
|
||||
tabs: Panel {\
|
||||
type: 'tabbedpanel',\
|
||||
alignment: ['fill','fill'], \
|
||||
alignChildren: ['center','top'], \
|
||||
search_tab: Panel {\
|
||||
type: 'tab',\
|
||||
text: 'Search & Replace',\
|
||||
orientation: 'column', \
|
||||
alignChildren: ['center','top'], \
|
||||
searchGrp: Group {\
|
||||
alignment: ['fill','fill'], \
|
||||
alignChildren: ['center','top'], \
|
||||
orientation: 'column', \
|
||||
searchString: EditText {text:'SEARCH FOR TEXT',alignment: ['fill','center']}, \
|
||||
},\
|
||||
replaceGrp: Group {\
|
||||
alignment: ['fill','fill'], \
|
||||
alignChildren: ['center','center'], \
|
||||
orientation: 'column', \
|
||||
replaceString: EditText {text:'REPLACE WITH TEXT',alignment: ['fill','center']}, \
|
||||
}\
|
||||
doItBtn: Button {text: 'Replace in selected Comps', alignment: ['center','center']} , \
|
||||
}\
|
||||
suprefix: Panel {\
|
||||
type: 'tab',\
|
||||
text: 'Suffix / Prefix',\
|
||||
orientation: 'column', \
|
||||
suprefixGrp: Group {\
|
||||
alignment: ['fill','fill'], \
|
||||
alignChildren: ['left','center'], \
|
||||
orientation: 'column', \
|
||||
pre:Group {\
|
||||
alignment: ['fill','fill'], \
|
||||
alignChildren: ['left','center'], \
|
||||
orientation: 'row', \
|
||||
prefixString: EditText {text:'PREFIX',alignment: ['fill','center']}, \
|
||||
prefixBtn: Button {text: 'Preffix'} , \
|
||||
},\
|
||||
su:Group{\
|
||||
alignment: ['fill','fill'], \
|
||||
alignChildren: ['left','center'], \
|
||||
orientation: 'row', \
|
||||
sufixString: EditText {text:'SUFIX',alignment: ['fill','center']}, \
|
||||
sufixBtn: Button {text: 'Sufix'} , \
|
||||
}\
|
||||
},\
|
||||
},\
|
||||
rename_tab: Panel {\
|
||||
type: 'tab',\
|
||||
text: 'Rename',\
|
||||
renameGrp: Group {\
|
||||
alignment: ['fill','fill'], \
|
||||
alignChildren: ['left','center'], \
|
||||
orientation: 'row', \
|
||||
renameString: EditText {text:'NEW NAME',alignment: ['fill','center']}, \
|
||||
renameBtn: Button {text: 'Rename'} ,\
|
||||
}\
|
||||
}\
|
||||
},\
|
||||
}";
|
||||
|
||||
myUI.window = new Window( res );
|
||||
myUI.window.layout.layout(true);
|
||||
|
||||
myUI.window.show();
|
||||
|
||||
myUI.window.layout.onResizing = myUI.window.layout.onResize = function () { myUI.layout.resize();}
|
||||
|
||||
//EVENT HANDLERS
|
||||
|
||||
/*
|
||||
myUI.window.tabs.search_tab.doItBtn.onClick = function(){
|
||||
var search_str = myUI.window.tabs.search_tab.searchGrp.searchString.text;
|
||||
var replace_str = myUI.window.tabs.search_tab.replaceGrp.replaceString.text;
|
||||
myUI.methods.replace( myUI.methods.getSelectedProjectItems() , search_str , replace_str );
|
||||
};
|
||||
|
||||
myUI.window.tabs.suprefix.suprefixGrp.pre.prefixBtn.onClick = function(){
|
||||
var pre = myUI.window.tabs.suprefix.suprefixGrp.su.prefixString.text;
|
||||
myUI.methods.prefix( myUI.methods.getSelectedProjectItems() , pre );
|
||||
};
|
||||
|
||||
myUI.window.tabs.suprefix.suprefixGrp.su.sufixBtn.onClick = function(){
|
||||
var su = myUI.window.tabs.suprefix.suprefixGrp.su.sufixString.text;
|
||||
myUI.methods.suffix( myUI.methods.getSelectedProjectItems() , su );
|
||||
};
|
||||
|
||||
myUI.window.tabs.rename_tab.renameGrp.renameBtn.onClick = function(){
|
||||
var new_name = myUI.window.tabs.rename_tab.renameGrp.renameString.text;
|
||||
myUI.methods.rename( myUI.methods.getSelectedProjectItems() , new_name );
|
||||
};
|
||||
*/
|
||||
|
||||
//END EVENT HANDLERS
|
||||
|
||||
return(this);
|
||||
}
|
||||
this.renderMarkers = function renderMarkers(){
|
||||
p = app.project;
|
||||
rq = p.renderQueue;
|
||||
rqi = rq.items;
|
||||
comp = p.activeItem;
|
||||
|
||||
var myRenderNull = comp.layer("Render");
|
||||
if ( myRenderNull == null ){
|
||||
myRenderNull = app.project.activeItem.layers.addNull();
|
||||
myRenderNull.name = "Render";
|
||||
myRenderNull.inPoint = -1;
|
||||
myRenderNull.outPoint = -1;
|
||||
alert('Created "Render Stills" layer.\nAdd markers to this layer and run again to render stills.');
|
||||
}
|
||||
|
||||
markers= myRenderNull.property("Marker");
|
||||
|
||||
for ( var j = 1 ; j <= markers.numKeys ; j ++ ){
|
||||
i = rqi.add( comp );
|
||||
var destPath = i.outputModule(1).file.path;
|
||||
i.outputModule(1).applyTemplate("PNG+");
|
||||
var markerName = markers.keyValue(j).comment;
|
||||
i.timeSpanStart = markers.keyTime(j);
|
||||
i.timeSpanDuration = comp.frameDuration;
|
||||
|
||||
var destName = comp.name.replace(" ","_");
|
||||
|
||||
var destFrame = markers.keyTime(j) / comp.frameDuration;
|
||||
if ( markerName == "" ){
|
||||
i.outputModule(1).file = new File( destPath + "/" + destName + "_Still_f" + "[####]" )
|
||||
}else{
|
||||
i.outputModule(1).file = new File( destPath + "/" + destName + "_Still" + "_f[####]_" + markerName )
|
||||
}
|
||||
//alert( i.outputModule(1).file );
|
||||
//i.outputModule(1).includeSourceXMP = true;
|
||||
rq.render();
|
||||
}
|
||||
//alert(i.timeSpanStart);
|
||||
//alert(i.timeSpanDuration);
|
||||
|
||||
}
|
||||
this.yMainFunction = function yMainFunction()
|
||||
{
|
||||
w = RenderMarkers().renderMarkers();
|
||||
}
|
||||
this.activate = function activate()
|
||||
{
|
||||
this.yTool.yMainFunction();
|
||||
}
|
||||
|
||||
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')
|
||||
{
|
||||
gt = new RenderMarkers();
|
||||
gt.activate();
|
||||
}
|
||||
else
|
||||
{
|
||||
YTB.addTool(new RenderMarkers());
|
||||
}
|
||||
+119
-63
@@ -1,72 +1,128 @@
|
||||
yColorProbe_data = new Object();
|
||||
#include "../yScripts/y_JSExtensions.jsx";
|
||||
#include "usefulFunctions.jsx";
|
||||
|
||||
yColorProbe_data.scriptName = 'yColorProbe';
|
||||
yColorProbe_data.scriptDesc = 'Creates a Null that will Sample the selected layer within the specified radius.';
|
||||
yColorProbe_data.scriptVer = '0.2a';
|
||||
yColorProbe_data.webLink = 'yorchnet.com';
|
||||
function YColorProbe()
|
||||
{
|
||||
this.info =
|
||||
{
|
||||
name : "yColorProbe",
|
||||
version : 0.1,
|
||||
stage : "development",
|
||||
description : "Creates a Null that will Sample the selected layer within the specified radius.",
|
||||
url : "yorchnet.com"
|
||||
};
|
||||
this.appearence =
|
||||
{
|
||||
buttonHeight : 30,
|
||||
buttonWidth : 126
|
||||
};
|
||||
this.resources =
|
||||
{
|
||||
icon : new File('yNet.png'),
|
||||
};
|
||||
this.init = function init()
|
||||
{
|
||||
|
||||
//if yToolBox Exists add it to its tool list.
|
||||
if (typeof(yToolBox_data)!=='undefined'){
|
||||
yToolBox_data.tools.push(yColorProbe_data);
|
||||
this.btnLauyout =
|
||||
"button\
|
||||
{\
|
||||
preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'],\
|
||||
text:'" + this.info.name + "',\
|
||||
helpTip:'" + this.info.description + "'\
|
||||
}";
|
||||
|
||||
//it should be called from toolbox.
|
||||
/* yColorProbe_data.buttonWidth=76;
|
||||
yColorProbe_data.buttonHeight=30;
|
||||
*/
|
||||
yColorProbe_data.btnLayout = "btn_"+yColorProbe_data.scriptName+": Button { preferredSize: ['"+ yToolBox_data.buttonWidth+"','"+ yToolBox_data.buttonHeight+"'], text:'"+yColorProbe_data.scriptName+"', helpTip:'"+yColorProbe_data.scriptDesc+"' }";
|
||||
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.getInfo = function getInfo( )
|
||||
{
|
||||
alert("asdasdasd");
|
||||
}
|
||||
this.createUI = function createUI()
|
||||
{
|
||||
this.window = new Window ( this.res );
|
||||
this.window.show() ;
|
||||
}
|
||||
this.yMainFunction = function yMainFunction()
|
||||
{
|
||||
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.
|
||||
try
|
||||
{
|
||||
sel = app.project.activeItem.selectedLayers[0];
|
||||
}
|
||||
catch (err)
|
||||
{
|
||||
sel = undefined;
|
||||
}
|
||||
|
||||
if(sel!==undefined){
|
||||
myNull = app.project.activeItem.layers.addNull();
|
||||
myNull.transform.anchorPoint.setValue([50,50]);
|
||||
myNull.name = yUniStr('colorProbe'); //Generates a Unique Name by adding numbers at the end of the main string.
|
||||
layerCTRL = myNull("Effects").addProperty("Layer Control");
|
||||
layerCTRL.name='sampledLayer';
|
||||
colorCTRL = myNull("Effects").addProperty("Color Control");
|
||||
colorCTRL.name='outColor';
|
||||
radiusCTRL = myNull("Effects").addProperty("Slider Control");
|
||||
radiusCTRL.name ='radius';
|
||||
myNull("Effects")("radius")('Slider').setValue(5);
|
||||
colExp = 'myLayer = thisLayer("Effects")("sampledLayer")("Layer");\
|
||||
p = myLayer.fromWorld(thisLayer.toComp(thisLayer.transform.anchorPoint))\
|
||||
r = thisLayer("Effects")("radius")("Slider");\
|
||||
myLayer.sampleImage(p, radius = [r, r], postEffect=true, t=time)';
|
||||
myNull("Effects")('outColor')('Color').expression=colExp;
|
||||
myNull.label=2;
|
||||
myNull.source.height=30;
|
||||
myNull.source.width=30;
|
||||
myNull.anchorPoint=(15,15);
|
||||
|
||||
myNull("Effects")('sampledLayer')(1).setValue(sel.index);
|
||||
}
|
||||
else
|
||||
{
|
||||
alert("Error : No layer selected.")
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
app.endUndoGroup();
|
||||
}
|
||||
|
||||
yColorProbe_data.res = "window { \
|
||||
type:'palette' , text:'"+yColorProbe_data.scriptName+' '+yColorProbe_data.scriptVer+"',\
|
||||
\
|
||||
\
|
||||
info: Group { \
|
||||
alignment:['center','bottom'], \
|
||||
icon: Image {preferredSize: [15, 18]},\
|
||||
website: StaticText { text:'"+yColorProbe_data.webLink+"', alignment:['fill','center'] },\
|
||||
}\
|
||||
\
|
||||
}";
|
||||
this.activate = this.yMainFunction;
|
||||
|
||||
//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------
|
||||
// MAIN SCRIPT GOES HERE.
|
||||
|
||||
#include "usefulFunctions.jsx";
|
||||
|
||||
function yColorProbe(){
|
||||
app.beginUndoGroup('Create ColorProbe');
|
||||
|
||||
myNull = app.project.activeItem.layers.addNull();
|
||||
myNull.transform.anchorPoint.setValue([50,50]);
|
||||
myNull.name = yUniStr('colorProbe'); //Generates a Unique Name by adding numbers at the end of the main string.
|
||||
layerCTRL = myNull("Effects").addProperty("Layer Control");
|
||||
layerCTRL.name='sampledLayer';
|
||||
colorCTRL = myNull("Effects").addProperty("Color Control");
|
||||
colorCTRL.name='outColor';
|
||||
radiusCTRL = myNull("Effects").addProperty("Slider Control");
|
||||
radiusCTRL.name ='radius';
|
||||
myNull("Effects")("radius")('Slider').setValue(0.5);
|
||||
colExp = 'myLayer = thisLayer("Effects")("sampledLayer")("Layer");\
|
||||
p = thisLayer.toWorld(thisLayer.transform.anchorPoint);\
|
||||
r = thisLayer("Effects")("radius")("Slider");\
|
||||
myLayer.sampleImage(p, radius = [r, r], postEffect=true, t=time)';
|
||||
myNull("Effects")('outColor')('Color').expression=colExp;
|
||||
|
||||
app.endUndoGroup();
|
||||
return 'ok'
|
||||
}
|
||||
|
||||
//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------
|
||||
|
||||
function build_yColorProbe_data_UI(){
|
||||
yColorProbe_data.window = new Window ( yColorProbe_data.res);
|
||||
yColorProbe_data.window.show();
|
||||
}
|
||||
yColorProbe_data.activate =yColorProbe ;
|
||||
this.init();
|
||||
return this;
|
||||
}
|
||||
|
||||
//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own.
|
||||
if (typeof(yToolBox_data)=='undefined'){
|
||||
yColorProbe_data.activate();
|
||||
}else{
|
||||
}
|
||||
if (typeof(YTB)=='undefined')
|
||||
{
|
||||
yColorProbe = new YColorProbe();
|
||||
yColorProbe.activate();
|
||||
}
|
||||
else
|
||||
{
|
||||
yColorProbe = YTB.addTool(new YColorProbe());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
#include "../yScripts/y_JSExtensions.jsx";
|
||||
function yFlattenSelectedFolderContentsTool()
|
||||
{
|
||||
this.info =
|
||||
{
|
||||
name : "yFlatten",
|
||||
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.getSelectedProjectItems = function getSelectedProjectItems (){
|
||||
var items = [];
|
||||
var p = app.project;
|
||||
for ( var i = 1 ; i <= p.numItems ; i ++ ){
|
||||
var item = p.item(i);
|
||||
if ( item.selected ){
|
||||
items.push(item);
|
||||
}
|
||||
}
|
||||
return items;
|
||||
}
|
||||
this.getAllItems = function getAllItems( folderItem ){
|
||||
|
||||
var items = [];
|
||||
var folders = [];
|
||||
|
||||
for ( var i = 1 ; i <= folderItem.numItems ; i ++ ){
|
||||
var item = folderItem.item(i);
|
||||
|
||||
if ( (item.typeName != "Folder") ){
|
||||
//if ( (isInArray( items ,item )) == false ){
|
||||
items.push( item );
|
||||
//}
|
||||
}else{
|
||||
var new_items = yFlattenSelectedFolderContentsTool().getAllItems(item);
|
||||
for ( var j = 0 ; j < new_items.length ; j ++ ){
|
||||
new_item = new_items[j];
|
||||
//if ( (isInArray ( new_item )) == false ){
|
||||
items.push ( new_item );
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
return items
|
||||
}
|
||||
this.flatten = function flatten( items, root ){
|
||||
app.beginUndoGroup("Flatten Selected Folder Contents")
|
||||
for ( var i = 0; i < items.length ; i ++){
|
||||
item = items[i];
|
||||
item.parentFolder = root;
|
||||
}
|
||||
app.endUndoGroup()
|
||||
purgeEmptyFolders();
|
||||
return
|
||||
}
|
||||
this.purgeEmptyFolders = function purgeEmptyFolders(){
|
||||
//app.beginUndoGroup("Purge Empty Folders")
|
||||
var emptyFolders = [];
|
||||
|
||||
var p = app.project;
|
||||
for ( var i = p.numItems ; i >= 1 ; i -- ){
|
||||
item = p.item(i);
|
||||
if ( item.typeName == "Folder" ){
|
||||
if ( item.numItems <= 0 ){
|
||||
item.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//app.endUndoGroup()
|
||||
}
|
||||
this.yFlattenSelectedFolderContents = function yFlattenSelectedFolderContents()
|
||||
{
|
||||
//alert("is this working");
|
||||
//app.beginUndoGroup(yFlattenSelectedFolderContentsTool().info.description);
|
||||
yFlattenSelectedFolderContentsTool().flatten( yFlattenSelectedFolderContentsTool().getAllItems( yFlattenSelectedFolderContentsTool().getSelectedProjectItems()[0] ) , yFlattenSelectedFolderContentsTool().getSelectedProjectItems()[0] );
|
||||
//app.endUndoGroup();
|
||||
}
|
||||
|
||||
this.activate = this.yFlattenSelectedFolderContents;
|
||||
|
||||
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')
|
||||
{
|
||||
yFlattenSelectedFolderContentsTool = new yFlattenSelectedFolderContentsTool();
|
||||
yFlattenSelectedFolderContentsTool.activate();
|
||||
}
|
||||
else
|
||||
{
|
||||
yFlattenSelectedFolderContentsTool = YTB.addTool(new yFlattenSelectedFolderContentsTool());
|
||||
}
|
||||
+222
-205
@@ -1,45 +1,59 @@
|
||||
yPuppetRig_data = new Object();
|
||||
#include "../yScripts/y_JSExtensions.jsx";
|
||||
function YPuppetRigTool()
|
||||
{
|
||||
this.info =
|
||||
{
|
||||
name : "yPuppetRig",
|
||||
version : 0.0,
|
||||
stage : "development",
|
||||
description : "Tool to create nulls at puppet pin locations, and link the latter to the former.",
|
||||
url : "yorchnet.com"
|
||||
};
|
||||
this.appearence =
|
||||
{
|
||||
buttonHeight : 30,
|
||||
buttonWidth : 126
|
||||
};
|
||||
this.resources =
|
||||
{
|
||||
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.btnLauyout =
|
||||
"button\
|
||||
{\
|
||||
preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'],\
|
||||
text:'" + this.info.name + "',\
|
||||
helpTip:'" + this.info.description + "'\
|
||||
}";
|
||||
|
||||
yPuppetRig_data.scriptName = 'yPuppetRigger';
|
||||
yPuppetRig_data.scriptVer = 'v0.3.3a';
|
||||
yPuppetRig_data.scriptDesc = 'Tools for streamlining puppet-based animation rigs.';
|
||||
yPuppetRig_data.string_info = 'yorchnet.com';
|
||||
yPuppetRig_data.e_000 = 'e_000 : No layers are selected.';
|
||||
yPuppetRig_data.e_001 = 'e_001 : Layer contains no effects.';
|
||||
yPuppetRig_data.e_002 = 'e_002 : Layer contains no Puppet effects.';
|
||||
yPuppetRig_data.string_001 = 'Rig Pins';
|
||||
yPuppetRig_data.string_001x = 'Rigs Selected Pins on Layer';
|
||||
yPuppetRig_data.string_002 = 'Rig Layers';
|
||||
yPuppetRig_data.string_002x = 'Rigs Selected Layers';
|
||||
yPuppetRig_data.string_003 = 'Rig All';
|
||||
yPuppetRig_data.string_003x = 'Rig All Layers in Comp';
|
||||
|
||||
|
||||
//it should be called from toolbox.
|
||||
yPuppetRig_data.buttonWidth=76;
|
||||
yPuppetRig_data.buttonHeight=30;
|
||||
|
||||
//if yToolBox Exists add it to its tool list.
|
||||
if (typeof(yToolBox_data)!=='undefined'){
|
||||
yToolBox_data.tools.push(yPuppetRig_data);
|
||||
yPuppetRig_data.btnLayout = "btn_"+ yPuppetRig_data.scriptName+": Button { preferredSize: ['"+yToolBox_data.buttonWidth+"','"+ yToolBox_data.buttonHeight+"'], text:'"+yPuppetRig_data.scriptName+"', helpTip:'"+yPuppetRig_data.scriptDesc+"' }";
|
||||
}
|
||||
|
||||
function build_yPuppetRig_data_UI(){
|
||||
//define custom strings for error messages, names, button names and helpTips. //Defines Layout variables.
|
||||
|
||||
yPuppetRig_data.res = "window { \
|
||||
type:'palette' , text:'"+yPuppetRig_data.scriptName+" "+yPuppetRig_data.scriptVer+"',margins:[10,10,10,10],spacing:[5,5,5,5],\
|
||||
this. res =
|
||||
"window { \
|
||||
type:'palette' , text:'" + this.resources.scriptName + " " + this.resources.scriptVer + "',margins:[10,10,10,10],spacing:[5,5,5,5],\
|
||||
grp: Group { orientation:'column' , alignment:['fill','fill'] , alignChildren:['fill','fill'] , spacing:'2' , margin:'5', \
|
||||
btn_01: Button { preferredSize: ['"+yPuppetRig_data.buttonWidth+"','"+yPuppetRig_data.buttonHeight+"'], text:'"+yPuppetRig_data.string_001+"', helpTip:'"+yPuppetRig_data.string_001x+"' }, \
|
||||
btn_02: Button { preferredSize: ['"+yPuppetRig_data.buttonWidth+"','"+yPuppetRig_data.buttonHeight+"'], text:'"+yPuppetRig_data.string_002+"', helpTip:'"+yPuppetRig_data.string_002x+"' }, \
|
||||
btn_03: Button { preferredSize: ['"+yPuppetRig_data.buttonWidth+"','"+yPuppetRig_data.buttonHeight+"'], text:'"+yPuppetRig_data.string_003+"', helpTip:'"+yPuppetRig_data.string_003x+"' }, \
|
||||
btn_01: Button { preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'], text:'" + this.resources.string_001 + "', helpTip:'" + this.resources.string_001x + "' }, \
|
||||
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 + "' }, \
|
||||
chk_optn: Checkbox { text:'Enable Options', alignment:['fill','center'] , helpTip:'Enable Advanced Options' },\
|
||||
optn: Panel{ text:'Options' , visible:'false', orientation:'row' , alignment:['fill','fill'] , alignChildren:['fill','fill'] , spacing:'2' , margin:'5', \
|
||||
nullSizeGrp: Group{ \
|
||||
orientation:'column' , alignment:['fill','fill'] , alignChildren:['fill','fill'] , spacing:'2' , margin:'5', \
|
||||
sldr_tit: StaticText { text:'Set Null Size in Pixels.', alignment:['fill','center'] },\
|
||||
sldr: Slider { value:'125' , minvalue:'6' , maxvalue:'250' , text:'alaverga', helpTip:'"+yPuppetRig_data.string_001x+"' }, \
|
||||
sldr: Slider { value:'125' , minvalue:'6' , maxvalue:'250' , text:'alaverga', helpTip:'" + this.resources.string_001x + "' }, \
|
||||
sldr_Values_txt: Group{\
|
||||
orientation:'row' , alignment:['fill','fill'] , alignChildren:['center','fill'] , spacing:'2' , margin:'5', \
|
||||
mintxt: StaticText { text:'small', alignment:['left','fill'] },\
|
||||
@@ -55,191 +69,194 @@ yPuppetRig_data.res = "window { \
|
||||
},\
|
||||
info: Group { \
|
||||
alignment:['center','bottom'], \
|
||||
icn_app: Image {icon:'"+ yToolBox_data.icon.path+'/'+ yToolBox_data.icon.name+"',preferredSize: [15, 18]},\
|
||||
txt_info: StaticText { text:'"+yPuppetRig_data.string_info+"', alignment:['fill','center'] },\
|
||||
txt_info: StaticText { text:'" + this.resources.string_info + "', alignment:['fill','center'] },\
|
||||
}\
|
||||
}\
|
||||
}";
|
||||
|
||||
//if (typeof(yToolBox_data)!=='undefined'){
|
||||
yPuppetRigDialog = new Window (yPuppetRig_data.res); // Creates Window
|
||||
//}
|
||||
//yPuppetRigDialog.onDraw = customColors(yPuppetRigDialog);
|
||||
yPuppetRigDialog.grp.optn.enabled = false;
|
||||
yPuppetRigDialog.show(); //Shows Window.
|
||||
|
||||
|
||||
|
||||
//yPuppetRigDialog.grp.info.icn_app.image = yToolBox_data.icon.substring(3,yToolBox_data.icon.length);
|
||||
yPuppetRigDialog.grp.btn_01.onClick = runRigPin; //Defines Button Action
|
||||
yPuppetRigDialog.grp.btn_02.onClick = runRigLayer; //Defines Button Action
|
||||
yPuppetRigDialog.grp.btn_03.onClick = runRigAll; //Defines Button Action
|
||||
yPuppetRigDialog.grp.chk_optn.onClick = toggleOptions;
|
||||
}
|
||||
yPuppetRig_data.activate = build_yPuppetRig_data_UI ;
|
||||
|
||||
|
||||
function toggleOptions(){
|
||||
if(yPuppetRigDialog.grp.chk_optn==true){
|
||||
yPuppetRigDialog.grp.chk_optn=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
yPuppetRigDialog.grp.chk_optn=true;
|
||||
}
|
||||
yPuppetRigDialog.grp.optn.enabled = yPuppetRigDialog.grp.chk_optn;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
function getPuppetEffects(aLayer){
|
||||
puppetEffects = []
|
||||
for(i=1;i<=aLayer('Effects').numProperties;i++){
|
||||
puppetEffects.push(aLayer('Effects')(i));
|
||||
}
|
||||
return puppetEffects;
|
||||
}
|
||||
function getPosPins(aLayer){
|
||||
puppetEffects = 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
|
||||
this.createUI = function createUI()
|
||||
{
|
||||
writeLn('No FreePin3 Effect found on Layer');
|
||||
return []
|
||||
this.window = new Window( this.res );
|
||||
this.window.layout.layout(true);
|
||||
this.window.center();
|
||||
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.createUI();
|
||||
}
|
||||
function rigPins(aLayer,selectedOnly){
|
||||
pins = getPosPins(aLayer);
|
||||
selectedPins = [];
|
||||
createdNulls =[];
|
||||
for(i=0;i<pins.length;i++){
|
||||
selectedPins.push(pins[i].selected)
|
||||
}
|
||||
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])
|
||||
}
|
||||
|
||||
this.activate = function activate()
|
||||
{
|
||||
yPuppetRigTool.yMainFunction();
|
||||
}
|
||||
|
||||
//stuff to apply to main layer
|
||||
aLayer.quality = layerQuality;
|
||||
aLayer.locked = layerLock;
|
||||
/**/
|
||||
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++){
|
||||
/*TODO : Make it work with layers with multiple effects*/
|
||||
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();
|
||||
|
||||
pins = null;
|
||||
selectedPins = null;
|
||||
createdNulls = null;
|
||||
pinPosition = null;
|
||||
aLayerPosition= null;
|
||||
aLayerAnchorPoint = null;
|
||||
txtExpression = null;
|
||||
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();
|
||||
return this;
|
||||
}
|
||||
function runRigPin(){
|
||||
|
||||
/* NOT WORKING YET
|
||||
app.beginUndoGroup(string_001);
|
||||
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++){
|
||||
rigPins(workLayers[x],false);
|
||||
}
|
||||
app.endUndoGroup();
|
||||
*/
|
||||
app.beginUndoGroup(yPuppetRig_data.string_001);
|
||||
sel =app.project.activeItem.selectedLayers;
|
||||
setPropsFromUI();
|
||||
rigPins(sel[0],true);
|
||||
app.endUndoGroup();
|
||||
}
|
||||
function runRigLayer(){
|
||||
app.beginUndoGroup(yPuppetRig_data.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++){
|
||||
rigPins(workLayers[x],false);
|
||||
}
|
||||
app.endUndoGroup();
|
||||
|
||||
}
|
||||
function runRigAll(){
|
||||
app.beginUndoGroup(yPuppetRig_data.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++){
|
||||
rigPins(workLayers[x],false);
|
||||
}
|
||||
app.endUndoGroup();
|
||||
}
|
||||
function setPropsFromUI(){
|
||||
nullSize = yFactor(parseInt(yPuppetRigDialog.grp.optn.nullSizeGrp.sldr.value),5)
|
||||
if(yPuppetRigDialog.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(yPuppetRigDialog.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.
|
||||
}
|
||||
}
|
||||
|
||||
//build_yPuppetRig_UI();
|
||||
|
||||
|
||||
//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own.
|
||||
if (typeof(yToolBox_data)=='undefined'){
|
||||
yPuppetRig_data.activate();
|
||||
}else{
|
||||
}
|
||||
if (typeof(YTB)=='undefined')
|
||||
{
|
||||
yPuppetRigTool = new YPuppetRigTool();
|
||||
yPuppetRigTool.activate();
|
||||
}
|
||||
else
|
||||
{
|
||||
yPuppetRigTool = YTB.addTool(new YPuppetRigTool());
|
||||
}
|
||||
|
||||
+115
-71
@@ -1,83 +1,127 @@
|
||||
#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 + "'\
|
||||
}";
|
||||
|
||||
ySetProject_data = new Object();
|
||||
|
||||
ySetProject_data.scriptName = 'YSetStructure';
|
||||
ySetProject_data.scriptDesc = 'Set the Folder Structure for a new Project';
|
||||
ySetProject_data.scriptVer = '0.1a';
|
||||
ySetProject_data.webLink = 'yorchnet.com';
|
||||
|
||||
//if yToolBox Exists add it to its tool list.
|
||||
if (typeof(yToolBox_data)!=='undefined'){
|
||||
yToolBox_data.tools.push(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+"' }";
|
||||
|
||||
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']\
|
||||
},\
|
||||
}\
|
||||
}";
|
||||
}
|
||||
|
||||
ySetProject_data.res = "window { \
|
||||
type:'palette' , text:'"+ySetProject_data.scriptName+' '+ySetProject_data.scriptVer+"',\
|
||||
\
|
||||
\
|
||||
info: Group { \
|
||||
alignment:['center','bottom'], \
|
||||
icon: Image {preferredSize: [15, 18]},\
|
||||
website: StaticText { text:'"+ySetProject_data.webLink+"', alignment:['fill','center'] },\
|
||||
}\
|
||||
\
|
||||
}";
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------
|
||||
function ySetProject(){
|
||||
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 = [];
|
||||
var preStruct = ["01_MAIN","02_pComps","03_Images" ,"04_Movies","05_Audio" ,"06_Projects", "07_Ref", "08_Tools"];
|
||||
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);
|
||||
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();
|
||||
}
|
||||
|
||||
//to start a new organized project since the beginning
|
||||
this.activate = this.ySetProject;
|
||||
|
||||
if (projectItems.length == 0){
|
||||
newStruct = preStruct;
|
||||
}else{
|
||||
for(a=0;a<preStruct.length;a++){
|
||||
if ((projectItems.getOne(preStruct[a]))==-1){
|
||||
newStruct.push(preStruct[a]);
|
||||
};
|
||||
}
|
||||
this.init();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
for(i = 0;i<newStruct.length;i++){
|
||||
app.project.items.addFolder(newStruct[i]);
|
||||
}
|
||||
saveNow = confirm("Project Succesfully Set, Save Project?",true,"ySetProject");
|
||||
if(saveNow==true){
|
||||
app.project.save()
|
||||
}else{
|
||||
}
|
||||
app.endUndoGroup();
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function build_ySetProject_data_UI(){
|
||||
ySetProject_data.window = new Window ( ySetProject_data.res);
|
||||
ySetProject_data.window.show();
|
||||
}
|
||||
ySetProject_data.activate = ySetProject ;
|
||||
|
||||
//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own.
|
||||
if (typeof(yToolBox_data)=='undefined'){
|
||||
ySetProject_data.activate();
|
||||
}else{
|
||||
}
|
||||
if (typeof(YTB)=='undefined')
|
||||
{
|
||||
ySetProjectTool = new YSetProjectTool();
|
||||
ySetProjectTool.activate();
|
||||
}
|
||||
else
|
||||
{
|
||||
ySetProjectTool = YTB.addTool(new YSetProjectTool());
|
||||
}
|
||||
+135
-85
@@ -1,101 +1,151 @@
|
||||
yStopMotion_data = new Object();
|
||||
#include "../yScripts/y_JSExtensions.jsx";
|
||||
function YStopMotionLayer()
|
||||
{
|
||||
this.info =
|
||||
{
|
||||
name : "YStopMotionLayer",
|
||||
version : 0.11,
|
||||
stage : "development",
|
||||
description : "Tool to create a sprite-like behaviour with a composition.",
|
||||
url : "yorchnet.com"
|
||||
};
|
||||
this.appearence =
|
||||
{
|
||||
buttonHeight : 30,
|
||||
buttonWidth : 126
|
||||
};
|
||||
this.resources =
|
||||
{
|
||||
icon : new File('yNet.png'),
|
||||
e_0000 : "There are no comps in project.",
|
||||
e_0001 : "No Comps selected."
|
||||
};
|
||||
this.init = function init()
|
||||
{
|
||||
|
||||
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';
|
||||
this.btnLauyout =
|
||||
"button\
|
||||
{\
|
||||
preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'],\
|
||||
text:'" + this.info.name + "',\
|
||||
helpTip:'" + this.info.description + "'\
|
||||
}";
|
||||
|
||||
//if yToolBox Exists add it to its tool list.
|
||||
if (typeof(yToolBox_data)!=='undefined'){
|
||||
yToolBox_data.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: ['"+ yToolBox_data.buttonWidth+"','"+ yToolBox_data.buttonHeight+"'], text:'"+yStopMotion_data.scriptName+"', helpTip:'"+yStopMotion_data.scriptDesc+"' }";
|
||||
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()
|
||||
{
|
||||
res =
|
||||
"window {\
|
||||
resizeable : true\
|
||||
closeButton : true\
|
||||
text:'wtf'\
|
||||
}"
|
||||
|
||||
this.window = new Window( res );
|
||||
this.window.layout.layout(true);
|
||||
this.window.center();
|
||||
this.window.show();
|
||||
}
|
||||
|
||||
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.
|
||||
/** MEAT **/
|
||||
|
||||
e_0000 = "There are no comps in project."
|
||||
e_0001 = "No Comps selected."
|
||||
|
||||
function yStopMotionLayer(){
|
||||
myName = "yStopMotionLayer";
|
||||
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){
|
||||
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;
|
||||
myItem = sel[0].source;
|
||||
myItemType = myItem.typeName;
|
||||
|
||||
if(myItemType!="Composition"){
|
||||
alert(e_0001,myName+' '+myVer);
|
||||
}else{
|
||||
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");
|
||||
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();
|
||||
}
|
||||
app.endUndoGroup();
|
||||
|
||||
|
||||
/**/
|
||||
|
||||
|
||||
this.yMainFunction = function yMainFunction()
|
||||
{
|
||||
//this.createUI();
|
||||
this.YStopMotionLayer();
|
||||
}
|
||||
this.activate = function activate()
|
||||
{
|
||||
yStopMotionLayer.yApplyStopMotionLayer();
|
||||
//this.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(yToolBox_data)=='undefined'){
|
||||
yStopMotion_data.activate();
|
||||
}else{
|
||||
}
|
||||
if (typeof(YTB)=='undefined')
|
||||
{
|
||||
yStopMotionLayer = new YStopMotionLayer();
|
||||
yStopMotionLayer.activate();
|
||||
}
|
||||
else
|
||||
{
|
||||
yStopMotionLayer = YTB.addTool(new YStopMotionLayer());
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user