47 Commits
Author SHA1 Message Date
jorge 49975f6760 Slightly changed the folders on the original structure, Mostly replacing spaces with underscores. 2023-07-24 08:58:26 -07:00
jorge 5acdd0d815 Delete README.md 2022-10-05 21:45:40 -07:00
jorge 9446d53478 Create README.md 2022-10-05 21:44:56 -07:00
jorge ce0743269d Added a BaseScriptsUIPanel script for adding more tools easily. 2021-07-16 23:08:13 -07:00
jorge 2d35ce31f5 fixed undo mistmach issue 2021-07-15 23:01:28 -07:00
Jorge Vásquez Pérez 4d91bbfe60 Cleared some spacing issues. 2019-02-05 18:00:26 -08:00
Jorge Vásquez Pérez 30a69f02a5 Added a to-do. 2019-02-05 17:59:43 -08:00
Jorge Vásquez Pérez 38f087dce4 Added a tool to render a still frame for each of the markers contained in a dummy layer called 'Render'. 2019-02-05 17:31:01 -08:00
Jorge Vásquez Pérez 29b22e7658 Added a tool to flatten a folder's contents in the AFX project. 2019-02-05 15:32:49 -08:00
Jorge Vásquez Pérez 7c11b48082 Fixed the RenderToProject script so it created the right foilders 2017-11-16 16:30:48 -08:00
Jorge Vásquez Pérez 24af8e259b Changed the way in which the RenderToProjects scripts adds the items to the queue, if a CompItem is selected, it'll add it to the project's appropriate folder, if a folder is selected, it'll create a subfolder for all the items in the selected folder 2017-07-11 12:39:35 -07:00
Jorge Vásquez Pérez 00748360db Fixed a bug that rendered end_tags to the wrong folder. 2017-07-10 17:23:46 -07:00
Jorge Vásquez Pérez fe6f637561 Changed the script for it to allow to probe scaled layers without breaking. 2017-05-03 12:17:06 -07:00
Jorge Vásquez Pérez 8e4b7bba2d Changed the behavior of the button from SETTING the items already present in the queue to the correct folder; to actually ADDING the selected project items to the corresponding folders 2017-04-18 13:20:50 -07:00
Jorge Vásquez Pérez 1b34576b61 Fixed a mislabeling of a UI input field that rendered the Prefixing function unusable. 2017-04-13 18:17:42 -07:00
Jorge Vásquez Pérez 81ae9c5398 Fixed an error on a string declaration that broke the yToolMenu when addig said tool. 2017-04-13 18:03:59 -07:00
Jorge Vásquez Pérez df23e7403f Changed the description for RenderToProject and y_CompHerder scripts. 2017-04-13 17:01:25 -07:00
Jorge Vásquez Pérez c74ed78512 Added CompHearder and RenderToProject to the yScriptsToolbox 2017-04-13 15:38:42 -07:00
Jorge Vásquez Pérez b77f4552c2 Added a new tool to reroute items in the render quque to the approopriate folder, according to the studio folder structure 2017-04-13 15:34:10 -07:00
Jorge Vásquez Pérez b038e66615 Reorganized some functions on corresponding scripts to make it clearer of what was supposed to go in each one 2017-04-13 15:30:13 -07:00
Jorge Vássquez Pérez 631cb8f607 Brought back the main UI Panel to functioning condition. 2016-12-02 17:29:48 -08:00
Jorge Vássquez Pérez b1efb4928b Hopefully this will finally fix the merging issues I had. 2016-12-02 17:20:13 -08:00
Jorge Vássquez Pérez 4ca84b5fee Fixing even more merge issues. 2016-12-02 16:55:46 -08:00
Jorge Vássquez Pérez f7b18e98d6 Fixed more issues with the git merge. 2016-12-02 16:50:58 -08:00
Jorge Vássquez Pérez f1a6f31448 Brought y_stopMotionLayer up to date. 2016-12-02 16:48:01 -08:00
Jorge Vássquez Pérez 1e932c7a2d Cleaned up the code and made the scripts work individually and with thetoolbox 2016-12-02 15:30:12 -08:00
Jorge Vássquez Pérez 84e17ede95 Adapted all scripts to work on their own and with the toolbox. 2016-12-02 15:25:00 -08:00
Jorge Vássquez Pérez 8414847715 Fixed the PuppetRig Script to conform to the new code for the Toolbox, changed all linebreaks to unix, updated all script version numbers 2016-12-02 11:58:07 -08:00
jorge a879c2190d removed a debuging alert() 2015-07-16 13:08:56 -07:00
jorge 550a55e444 Added a new comp on every new project, with our internal new project template name. 2015-07-16 12:58:14 -07:00
jorge df5ea0ac01 Minor changes to adjust CPoffset PuppetRig and StopmotionLayer to the new model. 2015-06-04 15:06:39 -07:00
jorge f4c74abe46 Converted the CornerPinOffset tool to the new model 2015-04-10 17:24:12 -07:00
jorge e4b0a98471 Added BindBetween2, to the tool bar, and cleaned it's name up. 2015-04-10 12:16:28 -07:00
jorge 58fe19cacd Transfered BindBetween2 to the new model 2015-04-10 12:07:32 -07:00
jorge 868c1cb141 Cambiando bind between 2, incomplete 2015-04-09 14:40:04 -07:00
jorge e07df6d9d4 Switched line endings to Unix-like on all scripts 2015-03-19 12:27:58 -07:00
jorge 2d6983e014 Now the button calls to a reference of the tool from this.yTool, to be able to access its methods 2015-03-19 10:51:04 -07:00
jorge 3c12bdfb2d Added a reference to the tool to the buttons added to the toolbox, so I can call them later 2015-03-19 10:49:57 -07:00
jorge bb5336a612 I'm really not sure what I changed.. :S I have to learn to use git better... 2015-03-18 18:39:09 -07:00
jorge 75b0091c1d started cleaning up code, to adapt to new generic script mode 2015-03-18 18:33:20 -07:00
jorge 300d3c98fc Cleaned up a Generic script to base new tools on 2015-03-18 18:32:44 -07:00
jorge cc91c4a6ce When closing the window now it makes the YTB variable a null, to clean up a bit. 2015-03-18 17:49:20 -07:00
jorge 994772be8d Re-enabled the createUI function for tools to be able to create their own independent windows 2015-03-18 17:48:04 -07:00
jorge 2c49d99929 Removed some debgging alert() calls 2015-03-18 17:18:54 -07:00
jorge 992891bf28 Got the toolbox code cleaned up, and the YSetStrcuture tool, already works with this new model. 2015-03-18 16:45:14 -07:00
jorge 6d01d35cd0 Reorganized the ToolBox and encapsulated it into a Signle namespace YTB, the tool bundling doesn't work yet 2015-03-18 12:58:55 -07:00
jorge 1238e7949e added a tabbed_structure test 2015-03-13 15:50:17 -07:00
28 changed files with 3223 additions and 1361 deletions
+71
View File
@@ -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);
+132 -1
View File
@@ -1 +1,132 @@
var YToolBox = function YToolBox(thisObj){ var resources = { icon : new File('../yScripts/yNet.png'), header : new File('../yScripts/header.png') } var info = { url : 'yorchnet.com', name :'yToolBox', ver :'0.4.2.1 alpha', description : 'Working tools so far...' } var gui = { buttonWidth : 126, buttonHeight : 30 } var tools = []; #include "../yScripts/y_JSExtensions.jsx"; this.addTool = function addTool(aTool) { alert("AddTool : Adding"); alert("AddTool : there are " + this.tools.length + " tools right now"); this.tools.push(aTool); alert("AddTool : there are " + this.tools.length + " tools right now"); } //alert(thisObj);␍ this.customize = function customize()␍ {␍ /* g = this.window.grp.main.graphics; myFont = ScriptUI.newFont('Cooper Std Black',ScriptUI.FontStyle.REGULAR ,14 ); myBrush = g.newBrush(g.BrushType.SOLID_COLOR, [1, .45, 0, 1]); g.backgroundColor = myBrush; */␍ alert();␍ }␍␍ this.resize = function resize()␍ {␍ this.layout.resize();␍ this.customize; ␍ }␍ ␍ this.createGui = function createGui()␍ {␍ //MAIN WINDOW STRUCTURE. this.gui.header = "group\␍ {\␍ orientation:'column',\␍ alignment:['fill','fill'],\␍ margins:[0,0,0,0]\␍ \␍ header: Group\␍ {\␍ orientation:'column', \␍ alignment:['center','top'],\␍ margins:[0,0,0,0]\␍ \␍ title: Image\␍ {\␍ icon:'"+this.resources.header.path+'/'+this.resources.header.name+"',\␍ preferredSize: [175, 35]},\␍ ver: StaticText { text:'"+this.info.ver+"',\␍ alignment:['center','center']}\␍ desc: StaticText\␍ {\␍ text:'"+this.info.description+"',\␍ alignment:['center','center']\␍ },\␍ },\␍ main: Group {\␍ orientation:'column',\␍ alignment:['fill','fill'],\␍ alignChildren:['center','center']\␍ ," this.gui.main= ""; //To be populated with the included Tools this.gui.footer ="}, \ cmds: Group\ {\ alignment:['center','bottom'],\ icn_app: Image\ {\ icon:'"+ this.resources.icon.path+'/'+ this.resources.icon.name+"',\ preferredSize: [15, 18]\ },\ txt_info: StaticText\ {\ text:'"+ this.info.url+"',\ alignment:['fill','center']\ },\ },\ }"; alert(this.tools); this.window.grp = this.window.add( this.gui.header + this.gui.main + this.gui.footer ); this.window.layout.layout(true); this.window.onResize = this.resize; this.window.onClose = function () {delete yToolBox;}; //ASSIGN buttons to the activate function of each tool; var toolBtns = this.window.grp.main.children; for( var n = 0 ; n < toolBtns.length ; n++ ){ toolBtns[n].onClick = this.tools[n].activate; } } this.init = function init() { this.resources = resources; this.info = info; this.gui = gui; this.tools = tools; this.window = (thisObj instanceof Panel) ? thisObj : new Window("palette", this.info , undefined, {resizeable:true}); this.createGui(); } this.init(); return this}var ytb = new YToolBox(this);#include "../yScripts/y_setStructure.jsx"; 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";
-1
View File
@@ -1 +0,0 @@
scriptUIpanel = this;ytb = { // INFO RESOURCES & PREFERENCES info : { name :'yToolBox', url : 'yorchnet.com', ver :'0.5', status : 'alpha', description : 'My mixed bag of tricks' }, resources : { icon : new File('../yScripts/yNet.png'), header : new File('../yScripts/header.png') }, gui : { buttonWidth : 126, buttonHeight : 30 }, //METHODS syncWindow : function syncWindow() { this.window = ( ( scriptUIpanel instanceof Panel ) ? scriptUIpanel : new Window ( "palette" , this.info , undefined, { resizeable:true , alignment:['fill','fill'] , orientation:'column' } ) ); }, customize : function customize() { //myFont = ScriptUI.newFont('Cooper Std Black',ScriptUI.FontStyle.REGULAR ,14 ); g = this.window.graphics; naranja = g.newBrush(g.BrushType.SOLID_COLOR, [1, .45, 0, 1]); black = g.newBrush(g.BrushType.SOLID_COLOR, [0, 0, 0, 1]); gray1 = g.newBrush(g.BrushType.SOLID_COLOR, [.125, .125, .125, 1]); gray2 = g.newBrush(g.BrushType.SOLID_COLOR, [.25, .25, .25, 1]); gray3 = g.newBrush(g.BrushType.SOLID_COLOR, [.5, .5, .5, 1]); gray4 = g.newBrush(g.BrushType.SOLID_COLOR, [.75, .75, .75, 1]); white = g.newBrush(g.BrushType.SOLID_COLOR, [1, 1, 1, 1]); g.backgroundColor = naranja; this.window.grp.main.graphics.backgroundColor = gray1; this.window.grp.header.graphics.backgroundColor = naranja; this.window.grp.main.graphics.backgroundColor = gray2; this.window.grp.footer.graphics.backgroundColor = gray3; }, createGui : function createGui() { //MAIN WINDOW STRUCTURE. var gui = "group\ {\ orientation:'column',\ alignment:['fill','fill'],\ margins:[0,0,0,0]\ \ header: Group\ {\ orientation:'column', \ alignment:['center','top'],\ margins:[0,0,0,0]\ \ title: Image\ {\ icon:'"+this.resources.header.path+'/'+this.resources.header.name+"',\ preferredSize: [175, 35]},\ ver: StaticText { text:'"+this.info.ver+"',\ alignment:['center','center']}\ desc: StaticText\ {\ text:'"+this.info.description+"',\ alignment:['center','center']\ },\ },\ main: Group {\ orientation:'column',\ alignment:['fill','fill'],\ alignChildren:['center','center']\ ,\ }, \ footer: Group\ {\ alignment:['center','bottom'],\ icn_app: Image\ {\ icon:'"+ this.resources.icon.path+'/'+ this.resources.icon.name+"',\ preferredSize: [15, 18]\ },\ txt_info: StaticText\ {\ text:'"+ this.info.url+"',\ alignment:['fill','center']\ },\ },\ }"; this.window.grp = this.window.add( gui ); this.window.layout.layout(true); this.customize(); //Assignacion de Manejo de Eventos. this.window.onResize = this.resize; this.window.onClose = this.selfDestruct; }, addTool : function addTool( aTool ) { alert(" A darle "); }, //Manejo de Eventos resize : function resize() { this.layout.resize(); }, selfDestruct : function selfDestruct() { delete this; }, init : function init() { this.syncWindow(); this.createGui(); }} ytb.init();
+357
View File
@@ -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());
}
+119 -130
View File
@@ -1,130 +1,119 @@
#include "y_JSExtensions.jsx"; #include "y_JSExtensions.jsx";
/* function sortNumber(a,b){
if (Array.prototype.getOne==null) Array.prototype.getOne=function(item){ //Extends the Array class with the getOne functions wich return a - b;
var val = -1; }
for(i=0;i<=this.length;i++){ function pad(n,i){ //pad n with ceroes up to i places.
if(this[i]==item){ if (String(n).length>=i){
var val = i; return String(n)
} }else{
} dif = i- (String(n)).length;
return val; padding = "";
} for (p=0;p<dif;p++){
*/ padding = padding+"0"
function sortNumber(a,b) }
{ return padding+String(n)
return a - b; }
} }
function yUniStr(str){
function pad(n,i){ //pad n with ceroes up to i places. if (app.project.activeItem != null) {
if (String(n).length>=i){ myLayers = app.project.activeItem.layers;
return String(n) //myLayerNames = [];
}else{ nameMatches = [];
dif = i- (String(n)).length; for (i=1;i<=myLayers.length;i++){
padding = ""; if(getBaseName(myLayers[i].name) == getBaseName(str)){
for (p=0;p<dif;p++){ nameMatches.push(getN(myLayers[i].name))
padding = padding+"0" }
}
return padding+String(n) }
}
} newN = getFirstGap(nameMatches);
if(nameMatches.length == 0 | (newN==0)){
return str
function yUniStr(str){ }else{
if (app.project.activeItem != null) { return str+' '+newN
myLayers = app.project.activeItem.layers; }
//myLayerNames = []; }else{
nameMatches = []; alert('E01 : No Comp is ACTIVE')
for (i=1;i<=myLayers.length;i++){ }
if(getBaseName(myLayers[i].name) == getBaseName(str)){ }
nameMatches.push(getN(myLayers[i].name)) function getN(str){
} lastChunk = str.substr(str.lastIndexOf(' '),str.length);
if(lastChunk == parseInt(lastChunk)){
} return parseInt(lastChunk);
}else{
newN = getFirstGap(nameMatches); return 0;
if(nameMatches.length == 0 | (newN==0)){ };
return str }
}else{ function getBaseName(str){
return str+' '+newN lastChunk = str.substr(str.lastIndexOf(' '),str.length);
} if(lastChunk == parseInt(lastChunk)){
}else{ return str.substr(0,str.lastIndexOf(' '));
alert('E01 : No Comp is ACTIVE') }else{
} return str;
} };
function getN(str){ }
lastChunk = str.substr(str.lastIndexOf(' '),str.length); function getFirstGap(array){
if(lastChunk == parseInt(lastChunk)){ length = array.length
return parseInt(lastChunk); array.sort(function sortNumber(a,b){return a-b})
}else{ max = array[array.length-1]
return 0; for (n=0;n<=max;n++){
}; entry = array.getOne(n);
} if (entry == -1){
function getBaseName(str){ return n
lastChunk = str.substr(str.lastIndexOf(' '),str.length); }
if(lastChunk == parseInt(lastChunk)){ }
return str.substr(0,str.lastIndexOf(' ')); return max+1
}else{ return array[0];
return str; }
}; function yReplace(inputSTR,replaceSTR,replacementSTR){
} tmpArray = inputSTR.split(replaceSTR);
tmpSTR = '';
function getFirstGap(array){ for(i=0;i<tmpArray.length;i++){
length = array.length tmpSTR = tmpSTR+tmpArray[i]
array.sort(function sortNumber(a,b){return a-b}) if(i<tmpArray.length-1){
max = array[array.length-1] tmpSTR = tmpSTR+replacementSTR;
for (n=0;n<=max;n++){ }
entry = array.getOne(n); }
if (entry == -1){ return tmpSTR;
return n }
} function genStamp(args){
} d = new Date();
return max+1 //alert(d.getMonth());
return array[0]; y = String(d.getFullYear()).substring(2,4);
} m = pad(d.getMonth()+1,2);
function yReplace(inputSTR,replaceSTR,replacementSTR){ d = pad(d.getUTCDate(),2);
tmpArray = inputSTR.split(replaceSTR); str = String(m)+String(d)+String(y);
tmpSTR = ''; return str
for(i=0;i<tmpArray.length;i++){ }
tmpSTR = tmpSTR+tmpArray[i] function mergeMultiLine(_str){
if(i<tmpArray.length-1){ var re = new RegExp('[\n\r]');
tmpSTR = tmpSTR+replacementSTR; _lines = _str.split(re);
} newStr = '';
}
return tmpSTR; if(_lines.length>1){
} for(L=0;L<_lines.length;L++){
alert(_lines[L]);
if(L==_lines.length-1||_lines[L]==''){
function genStamp(args){ dash = '';
d = new Date(); }else{
//alert(d.getMonth()); dash = '.';
y = String(d.getFullYear()).substring(2,4); }
m = pad(d.getMonth()+1,2); if(_lines[L]!=''){
d = pad(d.getUTCDate(),2); newStr = newStr+_lines[L]+dash;
str = String(m)+String(d)+String(y); }else{
return str newStr = newStr;
} }
}
function mergeMultiLine(_str){ }else{
var re = new RegExp('[\n\r]'); newStr = _str;
_lines = _str.split(re); }
newStr = ''; return newStr;
}
if(_lines.length>1){ function yFactor(n,f){
for(L=0;L<_lines.length;L++){ if((typeof(n)=='number'&&typeof(f)=='number')&&(n>f)){
alert(_lines[L]); value = n - (n%f);
if(L==_lines.length-1||_lines[L]==''){ return(value);
dash = ''; }else{
}else{ alert('error');
dash = '.'; }
} }
if(_lines[L]!=''){
newStr = newStr+_lines[L]+dash;
}else{
newStr = newStr;
}
}
}else{
newStr = _str;
}
return newStr;
}
+85 -85
View File
@@ -1,85 +1,85 @@
#include '/c/Program Files/01_Design/Adobe After Effects CS5.5/Support Files/Scripts/yScripts/y_JSExtensions.jsx' #include '/c/Program Files/01_Design/Adobe After Effects CS5.5/Support Files/Scripts/yScripts/y_JSExtensions.jsx'
function getComps(folderItem){ function getComps(folderItem){
_comps = []; _comps = [];
for(i=1;i<=folderItem.numItems;i++){ for(i=1;i<=folderItem.numItems;i++){
item = folderItem.item(i); item = folderItem.item(i);
if(item.typeName=='Composition'){ if(item.typeName=='Composition'){
_comps.push(item); _comps.push(item);
} }
} }
return _comps return _comps
} }
function getFolders(folderItem){ function getFolders(folderItem){
_folders = []; _folders = [];
for(i=1;i<=folderItem.numItems;i++){ for(i=1;i<=folderItem.numItems;i++){
item = folderItem.item(i); item = folderItem.item(i);
if(item.typeName=='Folder'){ if(item.typeName=='Folder'){
_folders.push(item); _folders.push(item);
} }
} }
return _folders return _folders
} }
function getItems(folderItem){ function getItems(folderItem){
_folders = getFolders(folderItem); _folders = getFolders(folderItem);
_comps = getComps(folderItem); _comps = getComps(folderItem);
while(_folders.length!=0){ while(_folders.length!=0){
newFolderItem = _folders.shift(); newFolderItem = _folders.shift();
_comps = _comps.concat(getComps(newFolderItem)); _comps = _comps.concat(getComps(newFolderItem));
_folders = _folders.concat(getFolders(newFolderItem)); _folders = _folders.concat(getFolders(newFolderItem));
} }
return _comps return _comps
} }
function getLayers(compItem){ function getLayers(compItem){
layers = []; layers = [];
for(i=1;i<=compItem.numLayers;i++){ for(i=1;i<=compItem.numLayers;i++){
item = compItem.layer(i); item = compItem.layer(i);
if(item.matchName == 'ADBE AV Layer'){ if(item.matchName == 'ADBE AV Layer'){
if(item.source.typeName == 'Composition'){ if(item.source.typeName == 'Composition'){
layers.push(item) layers.push(item)
} }
} }
} }
return layers return layers
} }
//_replaceMe = getLayers(app.project.item(6)) //_replaceMe = getLayers(app.project.item(6))
//b = app.project.ac //b = app.project.ac
function doIt(){ function doIt(){
app.beginUndoGroup('a') app.beginUndoGroup('a')
for(i=0;i<_replaceMe.length;i++){ for(i=0;i<_replaceMe.length;i++){
replaceable = _replaceMe[i]; replaceable = _replaceMe[i];
hit = null; hit = null;
for(k=0;k<_replaceWith.length;k++){ for(k=0;k<_replaceWith.length;k++){
replacement = _replaceWith[k]; replacement = _replaceWith[k];
//alert(String(replaceable.source.name)+','+String(replacement.name)) //alert(String(replaceable.source.name)+','+String(replacement.name))
if(replaceable.source.name==replacement.name){ if(replaceable.source.name==replacement.name){
hit = replacement; hit = replacement;
} }
} }
if(hit!=null){ if(hit!=null){
_replaceMe[i].replaceSource(hit,false) _replaceMe[i].replaceSource(hit,false)
}else{ }else{
_replaceMe[i].property("Marker").addKey(0) _replaceMe[i].property("Marker").addKey(0)
} }
} }
app.endUndoGroup() app.endUndoGroup()
} }
function getComp(){ function getComp(){
comp = app.project.activeItem comp = app.project.activeItem
return comp return comp
} }
/* /*
//STEP 1 //STEP 1
_replaceMe = getLayers(getComp()) _replaceMe = getLayers(getComp())
//STEP 2 //STEP 2
_replaceWith = getItems(app.project.activeItem) _replaceWith = getItems(app.project.activeItem)
doIt() doIt()
*/ */
+26
View File
@@ -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();
+52 -1
View File
@@ -1 +1,52 @@
//if (typeof(ytb)!=='undefined'){ yGenericTool ={ info : { name : 'YGenericTool', description : 'YToolBox Generic Script is the base for adding tools.', version : '0.1a', status : "alpha", url : 'yorchnet.com' }, resources : { img : new File('../header.png') }, gui_preferences : { buttonWidth : 76, buttonHeight : 30 }, toolbox : { buttons : "btn_" + this.info.name + ": Button\ {\ preferredSize: ['" + this.gui_preferences.buttonWidth + "','" + this.gui_preferences.buttonHeight + "'],\ text:'" + this.info.name + "',\ helpTip:'" + this.info.description + "'\ }", gui : "window\ {\ type:'palette',\ text:'" + this.info.name + ' ' + this.info.version + " " + this.info.status + "',\ info: Group\ {\ alignment:['center','bottom'],\ icon: Image\ {\ icon:'" + String( this.resources.img.path + "/" + this.resources.img.name ) + "',\ preferredSize: [15, 18]\ },\ website: StaticText\ {\ text:'" + this.info.url + "',\ alignment:['fill','center'] \ }\ }\ }" }, getInfo : function getInfo( info_request ) { var info = null ; switch (info_request) { case "name": info = this.name; break; case "description": info = this.description; break; case "version": info = this.version; break; case "status": info = this.status; break; case "url": info = this.url; break; } return info; }, getInfo : function getInfo( resource_request ) { var resource = null ; switch ( resource_request ) { case "img": resource = this.img; break; } return info; }, getToolBoxButtons : function getToolBoxButtons() { return this.toolbox.buttons; }, getToolBoxGui : function getToolBoxGui() { return this.toolbox.gui; }, buildUI : function buildUI() { this.window = new Window ( this.toolbox.gui , {resizable:true}); this.window.show(); }, addToBox : function addToBox() { ytb.addTool(this); }, init : function init() { if ( typeof ytb !== "undefined" ) { this.addToBox(); } this.buildUI(); }}yGenericTool.init() yGeneric_data = new Object();
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 = YTB.icon;
//if yToolBox Exists add it to its tool list.
if (typeof(YTB)!=='undefined'){
//it should be called from toolbox.
yGeneric_data.buttonWidth=76;
yGeneric_data.buttonHeight=30;
yGeneric_data.btnLayout = "btn_"+yGeneric_data.scriptName+": Button { preferredSize: ['"+ yGeneric_data.buttonWidth+"','"+ yGeneric_data.buttonHeight+"'], text:'"+yGeneric_data.scriptName+"', helpTip:'"+yGeneric_data.scriptDesc+"' }";
}
yGeneric_data.res = "window { \
type:'palette' , text:'"+yGeneric_data.scriptName+' '+yGeneric_data.scriptVer+"',\
\
\
info: Group { \
alignment:['center','bottom'], \
icon: Image {icon:'"+String(yGeneric_data.img.path+"/"+yGeneric_data.img.name)+"',preferredSize: [15, 18]},\
website: StaticText { text:'"+yGeneric_data.webLink+"', alignment:['fill','center'] }\
}\
\
}";
//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------
// MAIN SCRIPT GOES HERE.
//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------
function build_yGeneric_data_UI(){
yGeneric_data.window = new Window ( yGeneric_data.res);
yGeneric_data.window.show();
}
yGeneric_data.activate = build_yGeneric_data_UI ;
//alert();
//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own.
//if (typeof(YTB)=='undefined'){
yGeneric_data.activate();
//}else{
//}
+176 -176
View File
@@ -1,176 +1,176 @@
yMultiRenamer_data = new Object(); yMultiRenamer_data = new Object();
yMultiRenamer_data.scriptName = 'yMultiRenamer'; yMultiRenamer_data.scriptName = 'yMultiRenamer';
yMultiRenamer_data.scriptDesc = 'Tool to make it easy to rename multiple project items and/or comp layers'; yMultiRenamer_data.scriptDesc = 'Tool to make it easy to rename multiple project items and/or comp layers';
yMultiRenamer_data.scriptVer = '0.1a'; yMultiRenamer_data.scriptVer = '0.1a';
yMultiRenamer_data.webLink = 'yorchnet.com'; yMultiRenamer_data.webLink = 'yorchnet.com';
//if yToolBox Exists add it to its tool list. //if yToolBox Exists add it to its tool list.
if (typeof(yToolBox_data)!=='undefined'){ if (typeof(YTB)!=='undefined'){
yToolBox_data.tools.push(yMultiRenamer_data); YTB.tools.push(yMultiRenamer_data);
//it should be called from toolbox. //it should be called from toolbox.
yMultiRenamer_data.buttonWidth=76; yMultiRenamer_data.buttonWidth=76;
yMultiRenamer_data.buttonHeight=30; 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+"' }";
} }
yMultiRenamer_data.res = "window { \ yMultiRenamer_data.res = "window { \
type:'palette' , text:'"+yMultiRenamer_data.scriptName+' '+yMultiRenamer_data.scriptVer+"', margins:[10,10,10,10],spacing:[5,5,5,5],\ type:'palette' , text:'"+yMultiRenamer_data.scriptName+' '+yMultiRenamer_data.scriptVer+"', margins:[10,10,10,10],spacing:[5,5,5,5],\
\ \
root_str_chk: Checkbox { text:'New root name:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',value:true },\ root_str_chk: Checkbox { text:'New root name:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',value:true },\
root_str: EditText { text:'', alignment:['fill','center'],helpTip:'Includes Items and folders within folders and subfolders.' },\ root_str: EditText { text:'', alignment:['fill','center'],helpTip:'Includes Items and folders within folders and subfolders.' },\
search_str_chk: Checkbox { text:'Search for:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ search_str_chk: Checkbox { text:'Search for:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\
search_str: EditText { text:'', alignment:['fill','center'],helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\ search_str: EditText { text:'', alignment:['fill','center'],helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\
search_rplc_tit: StaticText { text:'Replace with:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ search_rplc_tit: StaticText { text:'Replace with:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\
search_rplc: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false},\ search_rplc: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false},\
pre_chk: Checkbox { text:'AddAsPrefix', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ pre_chk: Checkbox { text:'AddAsPrefix', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\
pre: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\ pre: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\
pre_chk: Checkbox { text:'AddAsSuffix', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ pre_chk: Checkbox { text:'AddAsSuffix', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\
su: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\ su: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\
recursive_optn: Checkbox { text:'Recursive', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ recursive_optn: Checkbox { text:'Recursive', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\
selectedCompsOnly_optn: Checkbox { text:'Selected Comps Only', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ selectedCompsOnly_optn: Checkbox { text:'Selected Comps Only', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\
globalItems_optn: Checkbox { text:'All Items', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ globalItems_optn: Checkbox { text:'All Items', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\
globalLayers_optn: Checkbox { text:'All Layers', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ globalLayers_optn: Checkbox { text:'All Layers', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\
global_optn: Checkbox { text:'Global', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ global_optn: Checkbox { text:'Global', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\
exec_btn: Button {text:'do It',preferredSize:[150,35],helpTip:'do it'}\ exec_btn: Button {text:'do It',preferredSize:[150,35],helpTip:'do it'}\
info: Group { \ info: Group { \
alignment:['center','bottom'], \ alignment:['center','bottom'], \
icon: Image {preferredSize: [15, 18]},\ icon: Image {preferredSize: [15, 18]},\
website: StaticText { text:'"+yMultiRenamer_data.webLink+"', alignment:['fill','center'] },\ website: StaticText { text:'"+yMultiRenamer_data.webLink+"', alignment:['fill','center'] },\
}\ }\
\ \
}"; }";
//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//-------- //--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------
// MAIN SCRIPT GOES HERE. // MAIN SCRIPT GOES HERE.
function yMultiRenamer(){ function yMultiRenamer(){
recursive_sw = yMultiRenamer_data.window.recursive_optn.value; recursive_sw = yMultiRenamer_data.window.recursive_optn.value;
selectedCompsOnly_sw = yMultiRenamer_data.window.selectedCompsOnly_optn.value; selectedCompsOnly_sw = yMultiRenamer_data.window.selectedCompsOnly_optn.value;
globalItems_sw = yMultiRenamer_data.window.globalItems_optn.value; globalItems_sw = yMultiRenamer_data.window.globalItems_optn.value;
globalLayers_sw = yMultiRenamer_data.window.globalLayers_optn.value; globalLayers_sw = yMultiRenamer_data.window.globalLayers_optn.value;
global_sw = yMultiRenamer_data.window.global_optn.value; global_sw = yMultiRenamer_data.window.global_optn.value;
//Gathers all SELECTED items into projectItems, //Gathers all SELECTED items into projectItems,
var rawItems = app.project.items; var rawItems = app.project.items;
var projectItems = []; var projectItems = [];
for(i=1;i<=rawItems.length;i++){ for(i=1;i<=rawItems.length;i++){
currentItem = rawItems[i]; currentItem = rawItems[i];
if( (currentItem.selected||(currentItem.parentFolder.selected&recursive_sw))||(globalItems_sw||global_sw) ){ if( (currentItem.selected||(currentItem.parentFolder.selected&recursive_sw))||(globalItems_sw||global_sw) ){
projectItems.push(currentItem); projectItems.push(currentItem);
} }
} }
//Gathers all SELECTED layers into projectLayers, //Gathers all SELECTED layers into projectLayers,
var projectComps = []; var projectComps = [];
for(i=1;i<rawItems.length;i++){ for(i=1;i<rawItems.length;i++){
currentItem = rawItems[i]; currentItem = rawItems[i];
if(currentItem.typeName=='Composition'){ if(currentItem.typeName=='Composition'){
projectComps.push(currentItem) projectComps.push(currentItem)
} }
} }
var rawLayers = []; var rawLayers = [];
for(i=0;i<projectComps.length;i++){ for(i=0;i<projectComps.length;i++){
for(j=1;j<=projectComps[i].layers.length;j++){ for(j=1;j<=projectComps[i].layers.length;j++){
rawLayers.push(projectComps[i].layers[j]) rawLayers.push(projectComps[i].layers[j])
} }
} }
var projectLayers = []; var projectLayers = [];
for(i=0;i<rawLayers.length;i++){ for(i=0;i<rawLayers.length;i++){
currentItem = rawLayers[i]; currentItem = rawLayers[i];
if((currentItem.selected&(currentItem.containingComp.selected||!selectedCompsOnly_sw))||(globalLayers_sw||global_sw) ){ if((currentItem.selected&(currentItem.containingComp.selected||!selectedCompsOnly_sw))||(globalLayers_sw||global_sw) ){
projectLayers.push(currentItem); projectLayers.push(currentItem);
} }
} }
/* /*
var allComps =[]; var allComps =[];
for(i=1;i<=app.project.items.length;i++){ for(i=1;i<=app.project.items.length;i++){
if(app.project.items[i].typeName=='Composition'){ if(app.project.items[i].typeName=='Composition'){
allComps.push(app.project.items[i].selectedLayers); allComps.push(app.project.items[i].selectedLayers);
} }
} }
//alert(allComps); //alert(allComps);
for(i=1;i<=app.project.items.length;i++){ for(i=1;i<=app.project.items.length;i++){
anItem = app.project.items[i] anItem = app.project.items[i]
if(anItem.selected == true){ if(anItem.selected == true){
projectItems.push(anItem); projectItems.push(anItem);
subItems = anItem.items; subItems = anItem.items;
if(anItem.typeName=='Folder'){ if(anItem.typeName=='Folder'){
if((subItems.length>0)&(yMultiRenamer_data.window.subFolders_optn.value==true)){ if((subItems.length>0)&(yMultiRenamer_data.window.subFolders_optn.value==true)){
for(a=1;a<=subItems.length;a++){ for(a=1;a<=subItems.length;a++){
projectItems.push(subItems[a]) projectItems.push(subItems[a])
} }
} }
} }
} }
} }
if(yMultiRenamer_data.window.allComps_optn.value==false ){ if(yMultiRenamer_data.window.allComps_optn.value==false ){
if((app.project.activeItem!=null )&(app.project.activeItem.typeName=='Composition')){ if((app.project.activeItem!=null )&(app.project.activeItem.typeName=='Composition')){
layers = app.project.activeItem.selectedLayers; layers = app.project.activeItem.selectedLayers;
for (i=0;i<layers.length;i++){ for (i=0;i<layers.length;i++){
projectItems.push(layers[i]); projectItems.push(layers[i]);
} }
} }
} }
if(yMultiRenamer_data.window.allComps_optn.value==true ){ if(yMultiRenamer_data.window.allComps_optn.value==true ){
for(i=0;i<allComps.length;i++){ for(i=0;i<allComps.length;i++){
layers = allComps[i].selectedLayers; layers = allComps[i].selectedLayers;
alert(allComps[i]); alert(allComps[i]);
for (L=0;L<layers.length;L++){ for (L=0;L<layers.length;L++){
projectItems.push(layers[i]); projectItems.push(layers[i]);
} }
} }
} }
alert(projectItems) alert(projectItems)
*/ */
allRenamable = projectItems.concat(projectLayers); allRenamable = projectItems.concat(projectLayers);
//alert(allRenamable); //alert(allRenamable);
app.beginUndoGroup('Multi Renamer'); app.beginUndoGroup('Multi Renamer');
for(i=0;i<allRenamable.length;i++){ for(i=0;i<allRenamable.length;i++){
writeLn('progress '+(parseInt(((i+1)/allRenamable.length)*100))+'%'); writeLn('progress '+(parseInt(((i+1)/allRenamable.length)*100))+'%');
n = ''; n = '';
if(i>0){ if(i>0){
n = ' '+String(i); n = ' '+String(i);
} }
if(!allRenamable[i].locked){ if(!allRenamable[i].locked){
allRenamable[i].name = yMultiRenamer_data.window.root_str.text+n; allRenamable[i].name = yMultiRenamer_data.window.root_str.text+n;
//allRenamable[i].name = String(Math.random()); //EVIL LAUGHS //allRenamable[i].name = String(Math.random()); //EVIL LAUGHS
} }
} }
app.endUndoGroup(); app.endUndoGroup();
} }
//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//-------- //--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------
function build_yMultiRenamer_data_UI(){ function build_yMultiRenamer_data_UI(){
yMultiRenamer_data.window = new Window ( yMultiRenamer_data.res); yMultiRenamer_data.window = new Window ( yMultiRenamer_data.res);
yMultiRenamer_data.window.exec_btn.onClick = yMultiRenamer; yMultiRenamer_data.window.exec_btn.onClick = yMultiRenamer;
yMultiRenamer_data.window.show(); yMultiRenamer_data.window.show();
} }
yMultiRenamer_data.activate = 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. //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(); yMultiRenamer_data.activate();
}else{ }else{
} }
// a= yMultiRenamer() // a= yMultiRenamer()
+151 -151
View File
@@ -1,151 +1,151 @@
yMultiRenamer_data = new Object(); yMultiRenamer_data = new Object();
yMultiRenamer_data.scriptName = 'yMultiRenamer'; yMultiRenamer_data.scriptName = 'yMultiRenamer';
yMultiRenamer_data.scriptDesc = 'Tool to make it easy to rename multiple project items and/or comp layers'; yMultiRenamer_data.scriptDesc = 'Tool to make it easy to rename multiple project items and/or comp layers';
yMultiRenamer_data.scriptVer = '0.2a'; yMultiRenamer_data.scriptVer = '0.2a';
yMultiRenamer_data.webLink = 'yorchnet.com'; yMultiRenamer_data.webLink = 'yorchnet.com';
//if yToolBox Exists add it to its tool list. //if yToolBox Exists add it to its tool list.
if (typeof(yToolBox_data)!=='undefined'){ if (typeof(YTB)!=='undefined'){
yToolBox_data.tools.push(yMultiRenamer_data); YTB.tools.push(yMultiRenamer_data);
//it should be called from toolbox. //it should be called from toolbox.
yMultiRenamer_data.buttonWidth=76; yMultiRenamer_data.buttonWidth=76;
yMultiRenamer_data.buttonHeight=30; 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+"' }";
} }
yMultiRenamer_data.res = "window { \ yMultiRenamer_data.res = "window { \
type:'palette' , text:'"+yMultiRenamer_data.scriptName+' '+yMultiRenamer_data.scriptVer+"', margins:[10,10,10,10],spacing:[5,5,5,5],\ type:'palette' , text:'"+yMultiRenamer_data.scriptName+' '+yMultiRenamer_data.scriptVer+"', margins:[10,10,10,10],spacing:[5,5,5,5],\
\ \
}"; }";
/* /*
items_tab:Tab{text:'asdasd',helpTip:'asdasdasd'},\ items_tab:Tab{text:'asdasd',helpTip:'asdasdasd'},\
root_str_chk: Checkbox { text:'New root name:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',value:true },\ root_str_chk: Checkbox { text:'New root name:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',value:true },\
root_str: EditText { text:'', alignment:['fill','center'],helpTip:'Includes Items and folders within folders and subfolders.' },\ root_str: EditText { text:'', alignment:['fill','center'],helpTip:'Includes Items and folders within folders and subfolders.' },\
search_str_chk: Checkbox { text:'Search for:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ search_str_chk: Checkbox { text:'Search for:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\
search_str: EditText { text:'', alignment:['fill','center'],helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\ search_str: EditText { text:'', alignment:['fill','center'],helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\
search_rplc_tit: StaticText { text:'Replace with:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ search_rplc_tit: StaticText { text:'Replace with:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\
search_rplc: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false},\ search_rplc: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false},\
pre_chk: Checkbox { text:'AddAsPrefix', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ pre_chk: Checkbox { text:'AddAsPrefix', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\
pre: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\ pre: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\
pre_chk: Checkbox { text:'AddAsSuffix', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ pre_chk: Checkbox { text:'AddAsSuffix', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\
su: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\ su: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\
recursive_optn: Checkbox { text:'Recursive', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ recursive_optn: Checkbox { text:'Recursive', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\
selectedCompsOnly_optn: Checkbox { text:'Selected Comps Only', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ selectedCompsOnly_optn: Checkbox { text:'Selected Comps Only', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\
globalItems_optn: Checkbox { text:'All Items', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ globalItems_optn: Checkbox { text:'All Items', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\
globalLayers_optn: Checkbox { text:'All Layers', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ globalLayers_optn: Checkbox { text:'All Layers', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\
global_optn: Checkbox { text:'Global', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ global_optn: Checkbox { text:'Global', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\
exec_btn: Button {text:'do It',preferredSize:[150,35],helpTip:'do it'}\ exec_btn: Button {text:'do It',preferredSize:[150,35],helpTip:'do it'}\
info: Group { \ info: Group { \
alignment:['center','bottom'], \ alignment:['center','bottom'], \
icon: Image {preferredSize: [15, 18]},\ icon: Image {preferredSize: [15, 18]},\
website: StaticText { text:'"+yMultiRenamer_data.webLink+"', alignment:['fill','center'] },\ website: StaticText { text:'"+yMultiRenamer_data.webLink+"', alignment:['fill','center'] },\
}\ }\
\ \
}"; }";
*/ */
//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//-------- //--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------
// MAIN SCRIPT GOES HERE. // MAIN SCRIPT GOES HERE.
/* /*
function yMultiRenamer(){ function yMultiRenamer(){
recursive_sw = yMultiRenamer_data.window.recursive_optn.value; recursive_sw = yMultiRenamer_data.window.recursive_optn.value;
selectedCompsOnly_sw = yMultiRenamer_data.window.selectedCompsOnly_optn.value; selectedCompsOnly_sw = yMultiRenamer_data.window.selectedCompsOnly_optn.value;
globalItems_sw = yMultiRenamer_data.window.globalItems_optn.value; globalItems_sw = yMultiRenamer_data.window.globalItems_optn.value;
globalLayers_sw = yMultiRenamer_data.window.globalLayers_optn.value; globalLayers_sw = yMultiRenamer_data.window.globalLayers_optn.value;
global_sw = yMultiRenamer_data.window.global_optn.value; global_sw = yMultiRenamer_data.window.global_optn.value;
//Gathers all SELECTED items into projectItems, //Gathers all SELECTED items into projectItems,
var rawItems = app.project.items; var rawItems = app.project.items;
var projectItems = []; var projectItems = [];
for(i=1;i<=rawItems.length;i++){ for(i=1;i<=rawItems.length;i++){
currentItem = rawItems[i]; currentItem = rawItems[i];
if( (currentItem.selected||(currentItem.parentFolder.selected&recursive_sw))||(globalItems_sw||global_sw) ){ if( (currentItem.selected||(currentItem.parentFolder.selected&recursive_sw))||(globalItems_sw||global_sw) ){
projectItems.push(currentItem); projectItems.push(currentItem);
} }
} }
//Gathers all SELECTED layers into projectLayers, //Gathers all SELECTED layers into projectLayers,
var projectComps = []; var projectComps = [];
for(i=1;i<rawItems.length;i++){ for(i=1;i<rawItems.length;i++){
currentItem = rawItems[i]; currentItem = rawItems[i];
if(currentItem.typeName=='Composition'){ if(currentItem.typeName=='Composition'){
projectComps.push(currentItem) projectComps.push(currentItem)
} }
} }
var rawLayers = []; var rawLayers = [];
for(i=0;i<projectComps.length;i++){ for(i=0;i<projectComps.length;i++){
for(j=1;j<=projectComps[i].layers.length;j++){ for(j=1;j<=projectComps[i].layers.length;j++){
rawLayers.push(projectComps[i].layers[j]) rawLayers.push(projectComps[i].layers[j])
} }
} }
var projectLayers = []; var projectLayers = [];
for(i=0;i<rawLayers.length;i++){ for(i=0;i<rawLayers.length;i++){
currentItem = rawLayers[i]; currentItem = rawLayers[i];
if((currentItem.selected&(currentItem.containingComp.selected||!selectedCompsOnly_sw))||(globalLayers_sw||global_sw) ){ if((currentItem.selected&(currentItem.containingComp.selected||!selectedCompsOnly_sw))||(globalLayers_sw||global_sw) ){
projectLayers.push(currentItem); projectLayers.push(currentItem);
} }
} }
allRenamable = projectItems.concat(projectLayers); allRenamable = projectItems.concat(projectLayers);
//alert(allRenamable); //alert(allRenamable);
app.beginUndoGroup('Multi Renamer'); app.beginUndoGroup('Multi Renamer');
for(i=0;i<allRenamable.length;i++){ for(i=0;i<allRenamable.length;i++){
writeLn('progress '+(parseInt(((i+1)/allRenamable.length)*100))+'%'); writeLn('progress '+(parseInt(((i+1)/allRenamable.length)*100))+'%');
n = ''; n = '';
if(i>0){ if(i>0){
n = ' '+String(i); n = ' '+String(i);
} }
if(!allRenamable[i].locked){ if(!allRenamable[i].locked){
allRenamable[i].name = yMultiRenamer_data.window.root_str.text+n; allRenamable[i].name = yMultiRenamer_data.window.root_str.text+n;
//allRenamable[i].name = String(Math.random()); //EVIL LAUGHS //allRenamable[i].name = String(Math.random()); //EVIL LAUGHS
} }
} }
app.endUndoGroup(); app.endUndoGroup();
} }
*/ */
//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//-------- //--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------
function build_yMultiRenamer_data_UI(){ function build_yMultiRenamer_data_UI(){
yMultiRenamer_data.window = new Window ( yMultiRenamer_data.res); yMultiRenamer_data.window = new Window ( yMultiRenamer_data.res);
yMultiRenamer_data.window.tbdpnl = yMultiRenamer_data.window.add("tabbedpanel"); yMultiRenamer_data.window.tbdpnl = yMultiRenamer_data.window.add("tabbedpanel");
yMultiRenamer_data.window.tbdpnl.itemsTab = yMultiRenamer_data.window.tbdpnl.add("tab",undefined,"Layers"); yMultiRenamer_data.window.tbdpnl.itemsTab = yMultiRenamer_data.window.tbdpnl.add("tab",undefined,"Layers");
yMultiRenamer_data.window.tbdpnl.layersTab = yMultiRenamer_data.window.tbdpnl.add("tab",undefined,"Items"); yMultiRenamer_data.window.tbdpnl.layersTab = yMultiRenamer_data.window.tbdpnl.add("tab",undefined,"Items");
yMultiRenamer_data.window.tbdpnl.bothTab = yMultiRenamer_data.window.tbdpnl.add("tab",undefined,"Both"); yMultiRenamer_data.window.tbdpnl.bothTab = yMultiRenamer_data.window.tbdpnl.add("tab",undefined,"Both");
yMultiRenamer_data.window.tbdpnl.txt = yMultiRenamer_data.window.add("statictext",undefined,"adsad"); yMultiRenamer_data.window.tbdpnl.txt = yMultiRenamer_data.window.add("statictext",undefined,"adsad");
yMultiRenamer_data.window.tbdpnl.onChange = update; yMultiRenamer_data.window.tbdpnl.onChange = update;
//yMultiRenamer_data.window.exec_btn.onClick = yMultiRenamer; //yMultiRenamer_data.window.exec_btn.onClick = yMultiRenamer;
yMultiRenamer_data.window.show(); yMultiRenamer_data.window.show();
} }
function update(){ function update(){
yMultiRenamer_data.window.tbdpnl.txt.text = yMultiRenamer_data.window.tbdpnl.selection.text; yMultiRenamer_data.window.tbdpnl.txt.text = yMultiRenamer_data.window.tbdpnl.selection.text;
} }
yMultiRenamer_data.activate = 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. //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(); yMultiRenamer_data.activate();
/*}else{ /*}else{
} }
*/ */
// a= yMultiRenamer() // a= yMultiRenamer()
+40 -40
View File
@@ -1,40 +1,40 @@
//app.project.renderQueue.render() //app.project.renderQueue.render()
sl = app.project.activeItem.selectedLayers; sl = app.project.activeItem.selectedLayers;
//a = app.project.renderQueue.items[1] //a = app.project.renderQueue.items[1]
function Marker(time,comment,layer){ function Marker(time,comment,layer){
this.time = time; this.time = time;
this.comment = comment; this.comment = comment;
this.layer = layer; this.layer = layer;
return this return this
} }
markers = []; markers = [];
//alert(new marker(50,'asdads').time); //alert(new marker(50,'asdads').time);
for(i=0;i<sl.length;i++){ for(i=0;i<sl.length;i++){
for(j=1;j<=sl[i].property("Marker").numKeys;j++){ for(j=1;j<=sl[i].property("Marker").numKeys;j++){
var time = sl[i].property("Marker").keyTime(j); var time = sl[i].property("Marker").keyTime(j);
var comment = sl[i].property("Marker").keyValue(j).comment; var comment = sl[i].property("Marker").keyValue(j).comment;
var layer = sl[i]; var layer = sl[i];
markers.push(new Marker(time,comment,layer)); markers.push(new Marker(time,comment,layer));
} }
} }
function addMarkers(){ function addMarkers(){
for(i=0;i<markers.length;i++){ for(i=0;i<markers.length;i++){
var item = app.project.renderQueue.items.add(markers[i].layer.containingComp); var item = app.project.renderQueue.items.add(markers[i].layer.containingComp);
item.timeSpanStart = markers[i].time; item.timeSpanStart = markers[i].time;
item.timeSpanDuration = markers[i].layer.containingComp.frameDuration; item.timeSpanDuration = markers[i].layer.containingComp.frameDuration;
alert(item.timeSpanStart) alert(item.timeSpanStart)
} }
return 'Markers Succesfully added to render Queue.' return 'Markers Succesfully added to render Queue.'
} }
addMarkers() addMarkers()
//nKeys = app.project.activeItem.lselectedLayers.property(1).numKeys; //nKeys = app.project.activeItem.lselectedLayers.property(1).numKeys;
//var myMarker = new MarkerValue("Fade Up"); //var myMarker = new MarkerValue("Fade Up");
//app.project.activeItem.property("Marker").setValueAtTime(2, myMarker); //app.project.activeItem.property("Marker").setValueAtTime(2, myMarker);
+65 -65
View File
@@ -1,65 +1,65 @@
#include "usefulFunctions.jsx"; #include "usefulFunctions.jsx";
function yExportPng(comp,time,name,path){ function yExportPng(comp,time,name,path){
var oldResolutionFactor = comp.resolutionFactor; var oldResolutionFactor = comp.resolutionFactor;
comp.resolutionFactor=[1,1]; comp.resolutionFactor=[1,1];
if(typeof(name)=='undefined'){ if(typeof(name)=='undefined'){
var name = app.project.activeItem.name; var name = app.project.activeItem.name;
} }
if(typeof(comp)=='undefined'){ if(typeof(comp)=='undefined'){
var comp = app.project.activeItem; var comp = app.project.activeItem;
} }
if(typeof(path)=='undefined'){ if(typeof(path)=='undefined'){
var path = app.project.file.path; var path = app.project.file.path;
} }
//alert(path+'/'+name+'.png') //alert(path+'/'+name+'.png')
var file = new File(path+'/'+name+'.png'); var file = new File(path+'/'+name+'.png');
comp.saveFrameToPng(time,file); comp.saveFrameToPng(time,file);
file.close(); file.close();
comp.resolutionFactor=oldResolutionFactor; comp.resolutionFactor=oldResolutionFactor;
return 'Exported.' return 'Exported.'
} }
function marker(time,text){ function marker(time,text){
this.time = time; this.time = time;
this.text = text; this.text = text;
return this return this
} }
function exportMartkers(){ function exportMartkers(){
activeItem = app.project.activeItem; activeItem = app.project.activeItem;
myString = 'export_frames'; myString = 'export_frames';
if(activeItem.layer(myString)!=null){ if(activeItem.layer(myString)!=null){
myLayer =activeItem.layer(myString); myLayer =activeItem.layer(myString);
frames = []; frames = [];
for(i=1;i<=myLayer.property("Marker").numKeys;i++){ for(i=1;i<=myLayer.property("Marker").numKeys;i++){
var time = myLayer.property("Marker").keyTime(i); var time = myLayer.property("Marker").keyTime(i);
var text = mergeMultiLine(myLayer.property("Marker").keyValue(i).comment); var text = mergeMultiLine(myLayer.property("Marker").keyValue(i).comment);
frames.push(new marker(time,text)); frames.push(new marker(time,text));
} }
if(frames.length==0){ if(frames.length==0){
alert('The '+myString+' layer contains no markers.','yRenderMarkers'); alert('The '+myString+' layer contains no markers.','yRenderMarkers');
} }
for(i=0;i<frames.length;i++){ for(i=0;i<frames.length;i++){
var n = activeItem.name+'_'+frames[i].text; var n = activeItem.name+'_'+frames[i].text;
yExportPng(activeItem,frames[i].time,n,'/c') yExportPng(activeItem,frames[i].time,n,'/c')
} }
//alert(frames); //alert(frames);
}else{ }else{
createNull = confirm('No '+myString+' layer found, do you want to create one?',true,'yRenderMarkers'); createNull = confirm('No '+myString+' layer found, do you want to create one?',true,'yRenderMarkers');
if(createNull==true){ if(createNull==true){
myNull = app.project.activeItem.layers.addNull(); myNull = app.project.activeItem.layers.addNull();
myNull.name = myString; myNull.name = myString;
}else{ }else{
alert('A '+myString+' layer is required for the script to work.','yRenderMarkers'); alert('A '+myString+' layer is required for the script to work.','yRenderMarkers');
} }
} }
} }
exportMartkers(); exportMartkers();
+50 -50
View File
@@ -1,50 +1,50 @@
#include "usefulFunctions.jsx" #include "usefulFunctions.jsx"
alert(pad(5,10)) alert(pad(5,10))
/* /*
app.project.renderQueue.items.add(app.project.item(1)) app.project.renderQueue.items.add(app.project.item(1))
a = app.project.renderQueue.items[1]; a = app.project.renderQueue.items[1];
a = app.project.activeItem; a = app.project.activeItem;
alert(a) alert(a)
*/ */
function rndrPatch(){ function rndrPatch(){
if(String(app.project.activeItem)=='[object CompItem]'){ if(String(app.project.activeItem)=='[object CompItem]'){
var myComp = app.project.activeItem; var myComp = app.project.activeItem;
var item =app.project.renderQueue.items.add(myComp); var item =app.project.renderQueue.items.add(myComp);
item.timeSpanStart = app.project.activeItem.workAreaStart; item.timeSpanStart = app.project.activeItem.workAreaStart;
item.timeSpanDuration = app.project.activeItem.workAreaDuration; item.timeSpanDuration = app.project.activeItem.workAreaDuration;
return 'Done' return 'Done'
}else{ }else{
return 'Error' return 'Error'
} }
} }
function rndrAddStamp(RQItem){ function rndrAddStamp(RQItem){
return RQItem return RQItem
} }
function rndrRelocate(){ function rndrRelocate(){
justEnabled = true; justEnabled = true;
var numItems = app.project.renderQueue.items.length; var numItems = app.project.renderQueue.items.length;
var myFolder = Folder.selectDialog(); var myFolder = Folder.selectDialog();
for(i=1;i<=numItems;i++){ for(i=1;i<=numItems;i++){
myItem =app.project.renderQueue.item(i); myItem =app.project.renderQueue.item(i);
if(!justEnabled||myItem.render){ if(!justEnabled||myItem.render){
var f =new File(myFolder.absoluteURI+'/'+myItem.outputModule(1).file.name); var f =new File(myFolder.absoluteURI+'/'+myItem.outputModule(1).file.name);
myItem.outputModule(1).file = f; myItem.outputModule(1).file = f;
} }
} }
return 'Done.' return 'Done.'
} }
//rndrRelocate() //rndrRelocate()
/* /*
myFolder = Folder.selectDialog(); myFolder = Folder.selectDialog();
a = new File(myFolder.absoluteURI+'/'+'asdasd_[######].png'); a = new File(myFolder.absoluteURI+'/'+'asdasd_[######].png');
app.project.renderQueue.item(1).outputModule(1).file = a; app.project.renderQueue.item(1).outputModule(1).file = a;
//a = rndrAddStamp(app.project.renderQueue.item(1).outputModule(1).file.name); //a = rndrAddStamp(app.project.renderQueue.item(1).outputModule(1).file.name);
*/ */
rndrPatch() rndrPatch()
+26 -24
View File
@@ -1,24 +1,26 @@
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.
this.selectedPins = [];
for(prop=0;prop<this.selectedProperties.length;prop++){ 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.
p= this.selectedProperties[prop]; this.selectedPins = [];
if(p.matchName=="ADBE FreePin3 PosPin Atom"){ for(prop=0;prop<this.selectedProperties.length;prop++){
this.selectedPins.push(p); p= this.selectedProperties[prop];
} if(p.matchName=="ADBE FreePin3 PosPin Atom"){
} this.selectedPins.push(p);
return this.selectedPins; }
} }
return this.selectedPins;
function yMkUnique(aString){ }
myLayers = app.project.activeItem.layers;
uniqueness = 1; function yMkUnique(aString){
for(i=1;i<=myLayers.length;i++){ myLayers = app.project.activeItem.layers;
if(aString == myLayers[i].name){ uniqueness = 1;
uniqueness++; for(i=1;i<=myLayers.length;i++){
} if(aString == myLayers[i].name){
} uniqueness++;
return(aString+'_'+uniqueness); }
} }
s = 'asdas_1'; return(aString+'_'+uniqueness);
alert(s.length); }
alert(yMkUnique('apple')) s = 'asdas_1';
alert(s.length);
alert(yMkUnique('apple'))
+216
View File
@@ -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());
}
+173
View File
@@ -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
+115
View File
@@ -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());
}
-108
View File
@@ -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{
}
+252
View File
@@ -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());
}
+11 -17
View File
@@ -1,17 +1,11 @@
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.
var val = -1;
for(i=0;i<=this.length;i++){ if (Array.prototype.getOne==null) Array.prototype.getOne=function(item){ //Extends the Array class with the getOne functions wich
if(this[i]==item){ var val = -1;
var val = i; for(i=0;i<=this.length;i++){
} if(this[i]==item){
} var val = i;
return val; }
} }
function yFactor(n,f){ return val;
if((typeof(n)=='number'&&typeof(f)=='number')&&(n>f)){ }
value = n - (n%f);
return(value);
}else{
alert('error');
}
}
+292
View File
@@ -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());
}
+128 -89
View File
@@ -1,89 +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.'; function YColorProbe()
yColorProbe_data.scriptVer = '0.2a'; {
yColorProbe_data.webLink = 'yorchnet.com'; this.info =
{
//if yToolBox Exists add it to its tool list. name : "yColorProbe",
if (typeof(yToolBox_data)!=='undefined'){ version : 0.1,
yToolBox_data.tools.push(yColorProbe_data); stage : "development",
description : "Creates a Null that will Sample the selected layer within the specified radius.",
//it should be called from toolbox. url : "yorchnet.com"
/* yColorProbe_data.buttonWidth=76; };
yColorProbe_data.buttonHeight=30; this.appearence =
*/ {
yColorProbe_data.btnLayout = "btn_"+yColorProbe_data.scriptName+": Button { preferredSize: ['"+ yToolBox_data.buttonWidth+"','"+ yToolBox_data.buttonHeight+"'], text:'"+yColorProbe_data.scriptName+"', helpTip:'"+yColorProbe_data.scriptDesc+"' }"; buttonHeight : 30,
buttonWidth : 126
} };
this.resources =
yColorProbe_data.res = "window { \ {
type:'palette' , text:'"+yColorProbe_data.scriptName+' '+yColorProbe_data.scriptVer+"',\ icon : new File('yNet.png'),
\ };
\ this.init = function init()
info: Group { \ {
alignment:['center','bottom'], \
icon: Image {preferredSize: [15, 18]},\ this.btnLauyout =
website: StaticText { text:'"+yColorProbe_data.webLink+"', alignment:['fill','center'] },\ "button\
}\ {\
\ preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'],\
}"; text:'" + this.info.name + "',\
helpTip:'" + this.info.description + "'\
//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//-------- }";
// MAIN SCRIPT GOES HERE.
this. res =
#include "usefulFunctions.jsx"; "window\
{\
function yColorProbe(){ type:'palette',\
//It works with Sampled layers at a 100% scale only. text:'" + this.info.name + ' ' + this.info.ver + ' ' + this.info.stage + "',\
app.beginUndoGroup('Create ColorProbe'); info: Group \
{\
try alignment:['center','bottom'],\
{ icon: Image \
sel = app.project.activeItem.selectedLayers[0]; {\
} icon:'" + this.resources.icon.path + '/' + this.resources.icon.name + "',\
catch (err) preferredSize: [15, 18]\
{ },\
sel = undefined; website: StaticText\
} {\
text:'" + this.info.url + "',\
myNull = app.project.activeItem.layers.addNull(); alignment:['fill','center']\
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"); this.getInfo = function getInfo( )
colorCTRL.name='outColor'; {
radiusCTRL = myNull("Effects").addProperty("Slider Control"); alert("asdasdasd");
radiusCTRL.name ='radius'; }
myNull("Effects")("radius")('Slider').setValue(5); this.createUI = function createUI()
colExp = 'myLayer = thisLayer("Effects")("sampledLayer")("Layer");\ {
p = thisLayer.toWorld(thisLayer.transform.anchorPoint);\ this.window = new Window ( this.res );
r = thisLayer("Effects")("radius")("Slider");\ this.window.show() ;
myLayer.sampleImage(p, radius = [r, r], postEffect=true, t=time)'; }
myNull("Effects")('outColor')('Color').expression=colExp; this.yMainFunction = function yMainFunction()
myNull.label=2; {
myNull.source.height=30; app.beginUndoGroup( yColorProbe.info.name ); // yTool is a refernece to the Tool object, because THIS in this context returns the ButtonObject....
myNull.source.width=30;
myNull.anchorPoint=(15,15); //It works with Sampled layers at a 100% scale only.
try
if(sel!==undefined){ {
myNull("Effects")('sampledLayer')(1).setValue(sel.index); sel = app.project.activeItem.selectedLayers[0];
} }
app.endUndoGroup(); catch (err)
return 'ok' {
} sel = undefined;
}
//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------
if(sel!==undefined){
function build_yColorProbe_data_UI(){ myNull = app.project.activeItem.layers.addNull();
yColorProbe_data.window = new Window ( yColorProbe_data.res); myNull.transform.anchorPoint.setValue([50,50]);
yColorProbe_data.window.show(); myNull.name = yUniStr('colorProbe'); //Generates a Unique Name by adding numbers at the end of the main string.
} layerCTRL = myNull("Effects").addProperty("Layer Control");
yColorProbe_data.activate =yColorProbe ; layerCTRL.name='sampledLayer';
colorCTRL = myNull("Effects").addProperty("Color Control");
//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own. colorCTRL.name='outColor';
if (typeof(yToolBox_data)=='undefined'){ radiusCTRL = myNull("Effects").addProperty("Slider Control");
yColorProbe_data.activate(); radiusCTRL.name ='radius';
}else{ 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();
}
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')
{
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());
}
+262 -245
View File
@@ -1,245 +1,262 @@
yPuppetRig_data = new Object(); #include "../yScripts/y_JSExtensions.jsx";
function YPuppetRigTool()
yPuppetRig_data.scriptName = 'yPuppetRigger'; {
yPuppetRig_data.scriptVer = 'v0.3.3a'; this.info =
yPuppetRig_data.scriptDesc = 'Tools for streamlining puppet-based animation rigs.'; {
yPuppetRig_data.string_info = 'yorchnet.com'; name : "yPuppetRig",
yPuppetRig_data.e_000 = 'e_000 : No layers are selected.'; version : 0.0,
yPuppetRig_data.e_001 = 'e_001 : Layer contains no effects.'; stage : "development",
yPuppetRig_data.e_002 = 'e_002 : Layer contains no Puppet effects.'; description : "Tool to create nulls at puppet pin locations, and link the latter to the former.",
yPuppetRig_data.string_001 = 'Rig Pins'; url : "yorchnet.com"
yPuppetRig_data.string_001x = 'Rigs Selected Pins on Layer'; };
yPuppetRig_data.string_002 = 'Rig Layers'; this.appearence =
yPuppetRig_data.string_002x = 'Rigs Selected Layers'; {
yPuppetRig_data.string_003 = 'Rig All'; buttonHeight : 30,
yPuppetRig_data.string_003x = 'Rig All Layers in Comp'; buttonWidth : 126
};
this.resources =
//it should be called from toolbox. {
yPuppetRig_data.buttonWidth=76; icon : new File('yNet.png'),
yPuppetRig_data.buttonHeight=30; scriptName : 'yPuppetRigger',
scriptVer : 'v0.3.3a',
//if yToolBox Exists add it to its tool list. scriptDesc : 'Tools for streamlining puppet-based animation rigs.',
if (typeof(yToolBox_data)!=='undefined'){ string_info : 'yorchnet.com',
yToolBox_data.tools.push(yPuppetRig_data); e_000 : 'e_000 : No layers are selected.',
yPuppetRig_data.btnLayout = "btn_"+ yPuppetRig_data.scriptName+": Button { preferredSize: ['"+yToolBox_data.buttonWidth+"','"+ yToolBox_data.buttonHeight+"'], text:'"+yPuppetRig_data.scriptName+"', helpTip:'"+yPuppetRig_data.scriptDesc+"' }"; e_001 : 'e_001 : Layer contains no effects.',
} e_002 : 'e_002 : Layer contains no Puppet effects.',
string_001 : 'Rig Pins',
function build_yPuppetRig_data_UI(){ string_001x : 'Rigs Selected Pins on Layer',
//define custom strings for error messages, names, button names and helpTips. //Defines Layout variables. string_002 : 'Rig Layers',
string_002x : 'Rigs Selected Layers',
yPuppetRig_data.res = "window { \ string_003 : 'Rig All',
type:'palette' , text:'"+yPuppetRig_data.scriptName+" "+yPuppetRig_data.scriptVer+"',margins:[10,10,10,10],spacing:[5,5,5,5],\ string_003x : 'Rig All Layers in Comp'
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+"' }, \ this.init = function init()
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+"' }, \ this.btnLauyout =
chk_optn: Checkbox { text:'Enable Options', alignment:['fill','center'] , helpTip:'Enable Advanced Options' },\ "button\
optn: Panel{ text:'Options' , visible:'false', orientation:'row' , alignment:['fill','fill'] , alignChildren:['fill','fill'] , spacing:'2' , margin:'5', \ {\
nullSizeGrp: Group{ \ preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'],\
orientation:'column' , alignment:['fill','fill'] , alignChildren:['fill','fill'] , spacing:'2' , margin:'5', \ text:'" + this.info.name + "',\
sldr_tit: StaticText { text:'Set Null Size in Pixels.', alignment:['fill','center'] },\ helpTip:'" + this.info.description + "'\
sldr: Slider { value:'125' , minvalue:'6' , maxvalue:'250' , text:'alaverga', helpTip:'"+yPuppetRig_data.string_001x+"' }, \ }";
sldr_Values_txt: Group{\
orientation:'row' , alignment:['fill','fill'] , alignChildren:['center','fill'] , spacing:'2' , margin:'5', \ this. res =
mintxt: StaticText { text:'small', alignment:['left','fill'] },\ "window { \
medtxt: StaticText { text:'medium', alignment:['center','fill'] },\ type:'palette' , text:'" + this.resources.scriptName + " " + this.resources.scriptVer + "',margins:[10,10,10,10],spacing:[5,5,5,5],\
maxtxt: StaticText { text:'big', alignment:['right','fill'] },\ grp: Group { orientation:'column' , alignment:['fill','fill'] , alignChildren:['fill','fill'] , spacing:'2' , margin:'5', \
}\ btn_01: Button { preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'], text:'" + this.resources.string_001 + "', helpTip:'" + this.resources.string_001x + "' }, \
otherOptionsGrp: Group{ \ btn_02: Button { preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'], text:'" + this.resources.string_002 + "', helpTip:'" + this.resources.string_002x + "' }, \
orientation:'row' , alignment:['fill','fill'] , alignChildren:['fill','fill'] , spacing:'8' , margin:'5', \ btn_03: Button { preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'], text:'" + this.resources.string_003 + "', helpTip:'" + this.resources.string_003x + "' }, \
chk_box_01: Checkbox { text:'Enable Draft Mode.', alignment:['fill','center'] , helpTip:'Mostly for oldschool pixelated stuff' },\ chk_optn: Checkbox { text:'Enable Options', alignment:['fill','center'] , helpTip:'Enable Advanced Options' },\
chk_box_02: Checkbox { text:'Lock Layer', alignment:['fill','center'] , helpTip:'Lock layer after rigging.' },\ 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'] },\
info: Group { \ sldr: Slider { value:'125' , minvalue:'6' , maxvalue:'250' , text:'alaverga', helpTip:'" + this.resources.string_001x + "' }, \
alignment:['center','bottom'], \ sldr_Values_txt: Group{\
icn_app: Image {icon:'"+ yToolBox_data.icon.path+'/'+ yToolBox_data.icon.name+"',preferredSize: [15, 18]},\ orientation:'row' , alignment:['fill','fill'] , alignChildren:['center','fill'] , spacing:'2' , margin:'5', \
txt_info: StaticText { text:'"+yPuppetRig_data.string_info+"', alignment:['fill','center'] },\ mintxt: StaticText { text:'small', alignment:['left','fill'] },\
}\ medtxt: StaticText { text:'medium', alignment:['center','fill'] },\
}\ maxtxt: StaticText { text:'big', alignment:['right','fill'] },\
}"; }\
otherOptionsGrp: Group{ \
//if (typeof(yToolBox_data)!=='undefined'){ orientation:'row' , alignment:['fill','fill'] , alignChildren:['fill','fill'] , spacing:'8' , margin:'5', \
yPuppetRigDialog = new Window (yPuppetRig_data.res); // Creates Window chk_box_01: Checkbox { text:'Enable Draft Mode.', alignment:['fill','center'] , helpTip:'Mostly for oldschool pixelated stuff' },\
//} chk_box_02: Checkbox { text:'Lock Layer', alignment:['fill','center'] , helpTip:'Lock layer after rigging.' },\
//yPuppetRigDialog.onDraw = customColors(yPuppetRigDialog); },\
yPuppetRigDialog.grp.optn.enabled = false; }\
yPuppetRigDialog.show(); //Shows Window. },\
info: Group { \
alignment:['center','bottom'], \
txt_info: StaticText { text:'" + this.resources.string_info + "', alignment:['fill','center'] },\
//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 ;
}
this.createUI = function createUI()
function toggleOptions(){ {
if(yPuppetRigDialog.grp.chk_optn==true){ this.window = new Window( this.res );
yPuppetRigDialog.grp.chk_optn=false; this.window.layout.layout(true);
} this.window.center();
else this.window.show();
{
yPuppetRigDialog.grp.chk_optn=true; this.window.grp.optn.enabled = false;
}
yPuppetRigDialog.grp.optn.enabled = yPuppetRigDialog.grp.chk_optn; this.window.grp.btn_01.onClick = yPuppetRigTool.runRigPin; //Defines Button Action
} this.window.grp.btn_02.onClick = yPuppetRigTool.runRigLayer; //Defines Button Action
function customColors(rsr){ this.window.grp.btn_03.onClick = yPuppetRigTool.runRigAll; //Defines Button Action
g = rsr.graphics; this.window.grp.chk_optn.onClick = yPuppetRigTool.toggleOptions;
myBrush = g.newBrush(g.BrushType.SOLID_COLOR, [0.25, 0.05, 0.25, 1]); }
g.backgroundColor = yToolBoxPalette.graphics.backgroundColor; this.yMainFunction = function yMainFunction()
} {
this.createUI();
function getPuppetEffects(aLayer){ }
puppetEffects = [] this.activate = function activate()
for(i=1;i<=aLayer('Effects').numProperties;i++){ {
puppetEffects.push(aLayer('Effects')(i)); yPuppetRigTool.yMainFunction();
} }
return puppetEffects;
} /**/
function getPosPins(aLayer){ this.toggleOptions = function toggleOptions(){
puppetEffects = getPuppetEffects(aLayer); if(this.window.grp.chk_optn==true){
if(puppetEffects.length>0){ this.window.grp.chk_optn=false;
posPins = []; }
for(i=0;i<puppetEffects.length;i++){ else
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++){ this.window.grp.chk_optn=true;
posPins.push(puppetEffects[i]('ADBE FreePin3 ARAP Group')('ADBE FreePin3 Mesh Group')('ADBE FreePin3 Mesh Atom')('ADBE FreePin3 PosPins')(j)); }
} this.window.grp.optn.enabled = this.window.grp.chk_optn;
} }
return posPins; this.customColors = function customColors(rsr){
} g = rsr.graphics;
else myBrush = g.newBrush(g.BrushType.SOLID_COLOR, [0.25, 0.05, 0.25, 1]);
{ g.backgroundColor = yToolBoxPalette.graphics.backgroundColor;
writeLn('No FreePin3 Effect found on Layer'); }
return [] this.getPuppetEffects = function getPuppetEffects(aLayer){
} puppetEffects = []
} for(i=1;i<=aLayer('Effects').numProperties;i++){
function rigPins(aLayer,selectedOnly){ puppetEffects.push(aLayer('Effects')(i));
pins = getPosPins(aLayer); }
selectedPins = []; return puppetEffects;
createdNulls =[]; }
for(i=0;i<pins.length;i++){ this.getPosPins = function getPosPins(aLayer){
selectedPins.push(pins[i].selected) puppetEffects = this.getPuppetEffects(aLayer);
} if(puppetEffects.length>0){
setPropsFromUI(); posPins = [];
for(i=0;i<puppetEffects.length;i++){
for(i=0;i<pins.length;i++){ /*TODO : Make it work with layers with multiple effects*/
if(selectedPins[i]||!selectedOnly){ 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++){
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. posPins.push(puppetEffects[i]('ADBE FreePin3 ARAP Group')('ADBE FreePin3 Mesh Group')('ADBE FreePin3 Mesh Atom')('ADBE FreePin3 PosPins')(j));
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. return posPins;
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. else
pinPosition = createdNulls[i][1]('ADBE FreePin3 PosPin Position').value; {
aLayerPosition = aLayer('ADBE Transform Group')('ADBE Position').value; writeLn('No FreePin3 Effect found on Layer');
aLayerAnchorPoint = aLayer('ADBE Transform Group')('ADBE Anchor Point').value; return []
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))'; this.rigPins = function rigPins(aLayer,selectedOnly){
createdNulls[i][1]('ADBE FreePin3 PosPin Position').expression = txtExpression; pins = this.getPosPins(aLayer);
selectedPins = [];
//there has to be a way to re select the original layer one had selected. createdNulls =[];
} for(i=0;i<pins.length;i++){
else{ selectedPins.push(pins[i].selected)
createdNulls.push([null,null]) }
} this.setPropsFromUI();
} for(i=0;i<pins.length;i++){
if(selectedPins[i]||!selectedOnly){
//stuff to apply to main layer
aLayer.quality = layerQuality; 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.
aLayer.locked = layerLock; 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.
pins = null; createdNulls[i][0].label = aLayer.label; // set nulls label equalt to its parent layer.
selectedPins = null; createdNulls[i][0].transform.anchorPoint.setValue([createdNulls[i][0].source.width/2,createdNulls[i][0].source.height/2]); //center pivot of created nulls
createdNulls = null; createdNulls[i][0].moveBefore(aLayer); //stack created null on top of original layer.
pinPosition = null; pinPosition = createdNulls[i][1]('ADBE FreePin3 PosPin Position').value;
aLayerPosition= null; aLayerPosition = aLayer('ADBE Transform Group')('ADBE Position').value;
aLayerAnchorPoint = null; aLayerAnchorPoint = aLayer('ADBE Transform Group')('ADBE Anchor Point').value;
txtExpression = null; 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))';
function runRigPin(){ createdNulls[i][1]('ADBE FreePin3 PosPin Position').expression = txtExpression;
/* NOT WORKING YET //there has to be a way to re select the original layer one had selected.
app.beginUndoGroup(string_001); }
allLayers = app.project.activeItem.layers; else{
workLayers = []; createdNulls.push([null,null])
for(i=1;i<=allLayers.length;i++){ }
if(allLayers[i].selected){
workLayers.push(allLayers[i]); }
}
} //stuff to apply to main layer
for(x=0;x<workLayers.length;x++){ aLayer.quality = layerQuality;
rigPins(workLayers[x],false); aLayer.locked = layerLock;
}
app.endUndoGroup(); pins = null;
*/ selectedPins = null;
app.beginUndoGroup(yPuppetRig_data.string_001); createdNulls = null;
sel =app.project.activeItem.selectedLayers; pinPosition = null;
setPropsFromUI(); aLayerPosition= null;
rigPins(sel[0],true); aLayerAnchorPoint = null;
app.endUndoGroup(); txtExpression = null;
}
function runRigLayer(){ }
app.beginUndoGroup(yPuppetRig_data.string_002); this.runRigPin = function runRigPin(){
allLayers = app.project.activeItem.layers; app.beginUndoGroup( yPuppetRigTool.resources.string_001 );
workLayers = []; sel =app.project.activeItem.selectedLayers;
for(i=1;i<=allLayers.length;i++){ yPuppetRigTool.setPropsFromUI();
if(allLayers[i].selected){ yPuppetRigTool.rigPins(sel[0],true);
workLayers.push(allLayers[i]); app.endUndoGroup();
} }
} this.runRigLayer = function runRigLayer(){
for(x=0;x<workLayers.length;x++){ //alert( yPuppetRigTool.resources.string_002 );
rigPins(workLayers[x],false); app.beginUndoGroup( yPuppetRigTool.resources.string_002 );
} allLayers = app.project.activeItem.layers;
app.endUndoGroup(); workLayers = [];
for(i=1;i<=allLayers.length;i++){
} if(allLayers[i].selected){
function runRigAll(){ workLayers.push(allLayers[i]);
app.beginUndoGroup(yPuppetRig_data.string_003); }
allLayers = app.project.activeItem.layers; }
workLayers = []; for(x=0;x<workLayers.length;x++){
for(i=1;i<=allLayers.length;i++){ //alert( yPuppetRigTool.info );
workLayers.push(allLayers[i]); yPuppetRigTool.rigPins(workLayers[x],false);
} }
for(x=0;x<workLayers.length;x++){ app.endUndoGroup();
rigPins(workLayers[x],false);
} }
app.endUndoGroup(); this.runRigAll = function runRigAll(){
} app.beginUndoGroup( yPuppetRigTool.resources.string_003 );
function setPropsFromUI(){ allLayers = app.project.activeItem.layers;
nullSize = yFactor(parseInt(yPuppetRigDialog.grp.optn.nullSizeGrp.sldr.value),5) workLayers = [];
if(yPuppetRigDialog.grp.optn.nullSizeGrp.otherOptionsGrp.chk_box_02.value==true){ for(i=1;i<=allLayers.length;i++){
layerLock =true // solo si vamos a hacer vainas pixeladas. workLayers.push(allLayers[i]);
} }
else for(x=0;x<workLayers.length;x++){
{ yPuppetRigTool.rigPins(workLayers[x],false);
layerLock =false // solo si vamos a hacer vainas pixeladas. }
} app.endUndoGroup();
}
if(yPuppetRigDialog.grp.optn.nullSizeGrp.otherOptionsGrp.chk_box_01.value==true){ this.setPropsFromUI = function setPropsFromUI(){
layerQuality =LayerQuality.DRAFT // solo si vamos a hacer vainas pixeladas. nullSize = yFactor(parseInt(this.window.grp.optn.nullSizeGrp.sldr.value),5)
} if(this.window.grp.optn.nullSizeGrp.otherOptionsGrp.chk_box_02.value==true){
else layerLock =true // solo si vamos a hacer vainas pixeladas.
{ }
layerQuality =LayerQuality.BEST // solo si vamos a hacer vainas pixeladas. else
} {
} layerLock =false // solo si vamos a hacer vainas pixeladas.
}
//build_yPuppetRig_UI();
if(this.window.grp.optn.nullSizeGrp.otherOptionsGrp.chk_box_01.value==true){
layerQuality =LayerQuality.DRAFT // solo si vamos a hacer vainas pixeladas.
//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own. }
if (typeof(yToolBox_data)=='undefined'){ else
yPuppetRig_data.activate(); {
}else{ layerQuality =LayerQuality.BEST // solo si vamos a hacer vainas pixeladas.
} }
}
/**/
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')
{
yPuppetRigTool = new YPuppetRigTool();
yPuppetRigTool.activate();
}
else
{
yPuppetRigTool = YTB.addTool(new YPuppetRigTool());
}
+127 -76
View File
@@ -1,76 +1,127 @@
#include "../yScripts/y_JSExtensions.jsx"; #include "../yScripts/y_JSExtensions.jsx";
ySetProject_data = new Object(); function YSetProjectTool()
{
ySetProject_data.scriptName = 'YSetStructure'; this.info =
ySetProject_data.scriptDesc = 'Set the Folder Structure for a new Project'; {
ySetProject_data.scriptVer = '0.1a'; name : "YSetStructure",
ySetProject_data.webLink = 'yorchnet.com'; version : 0.11,
stage : "alpha",
//if yToolBox Exists add it to its tool list. description : "Set the Folder Structure for a new Project",
if (typeof(ytb)!=='undefined'){ url : "yorchnet.com"
ySetProject_data.btnLayout = "btn_"+ ySetProject_data.scriptName+": Button { preferredSize: ['"+ ytb.buttonWidth+"','"+ ytb.buttonHeight+"'], text:'"+ySetProject_data.scriptName+"', helpTip:'"+ySetProject_data.scriptDesc+"' }"; };
ytb.addTool(ySetProject_data); this.appearence =
} {
buttonHeight : 30,
ySetProject_data.res = "window { \ buttonWidth : 126
type:'palette' , text:'"+ySetProject_data.scriptName+' '+ySetProject_data.scriptVer+"',\ };
\ this.resources =
\ {
info: Group { \ icon : new File('yNet.png'),
alignment:['center','bottom'], \ };
icon: Image {preferredSize: [15, 18]},\ this.init = function init()
website: StaticText { text:'"+ySetProject_data.webLink+"', alignment:['fill','center'] },\ {
}\ //alert("my name is:" + this.info.name);
\ this.btnLauyout =
}"; "button\
{\
//------------------------------------------------------------------------------------------------------------------------ preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'],\
function ySetProject(){ text:'" + this.info.name + "',\
app.beginUndoGroup('ySetProject'); helpTip:'" + this.info.description + "'\
var preStruct = ["01 MAIN","02 PComp","03 Source Layers" ,"04 Movies","05 Other Projects","06 Audio" , "07 Reference"]; }";
var newStruct = [];
var projectItems = []; this. res =
"window\
for(i=1;i<=app.project.items.length;i++){ {\
if(app.project.items[i].parentFolder.name=='Root'){ type:'palette',\
projectItems.push(app.project.items[i].name); text:'" + this.info.name + ' ' + this.info.ver + ' ' + this.info.stage + "',\
} info: Group \
} {\
alignment:['center','bottom'],\
//to start a new organized project since the beginning icon: Image \
{\
if (projectItems.length == 0){ icon:'" + this.resources.icon.path + '/' + this.resources.icon.name + "',\
newStruct = preStruct; preferredSize: [15, 18]\
}else{ },\
for(a=0;a<preStruct.length;a++){ website: StaticText\
if ((projectItems.getOne(preStruct[a]))==-1){ {\
newStruct.push(preStruct[a]); text:'" + this.info.url + "',\
}; alignment:['fill','center']\
} },\
} }\
}";
}
for(i = 0;i<newStruct.length;i++){ this.createUI = function createUI()
app.project.items.addFolder(newStruct[i]); {
} this.window = new Window ( this.res );
saveNow = confirm("Project Succesfully Set, Save Project?",true,"ySetProject"); this.window.show() ;
if(saveNow==true){ }
app.project.save() this.ySetProject = function ySetProject()
}else{ {
} //alert("is this working");
app.endUndoGroup(); app.beginUndoGroup('ySetProject');
} var preStruct = ["01_MAIN","02_pComps","03_Images" ,"04_Movies","05_Audio" ,"06_Projects", "07_Ref", "08_Tools"];
//------------------------------------------------------------------------------------------------------------------------ var newStruct = [];
var projectItems = [];
function build_ySetProject_data_UI(){
ySetProject_data.window = new Window ( ySetProject_data.res); for(i=1;i<=app.project.items.length;i++)
ySetProject_data.window.show(); {
} if(app.project.items[i].parentFolder.name=='Root')
ySetProject_data.activate = ySetProject ; {
projectItems.push(app.project.items[i].name);
//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own. }
if (typeof(ytb)=='undefined') }
{
ySetProject_data.activate(); //to start a new organized project since the beginning
}else{
} if (projectItems.length == 0)
{
newStruct = preStruct;
}
else
{
for(a=0;a<preStruct.length;a++)
{
if ((projectItems.getOne(preStruct[a]))==-1)
{
newStruct.push(preStruct[a]);
}
}
}
for(i = 1;i<=newStruct.length;i++)
{
app.project.items.addFolder(newStruct[i-1]);
if ( app.project.items[i].name == "01 MAIN" )
{
//alert("yes");
app.project.items[i].items.addComp("JOBCODE_TYPE_[Scene_name]_vA_r000",1920,1080,1,30,23.976);
}
}
saveNow = confirm("Project Succesfully Set, Save Project?",true,"ySetProject");
if(saveNow==true){
app.project.save()
}else{
}
app.endUndoGroup();
}
this.activate = this.ySetProject;
this.init();
return this;
}
//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own.
if (typeof(YTB)=='undefined')
{
ySetProjectTool = new YSetProjectTool();
ySetProjectTool.activate();
}
else
{
ySetProjectTool = YTB.addTool(new YSetProjectTool());
}
+151 -101
View File
@@ -1,101 +1,151 @@
yStopMotion_data = new Object(); #include "../yScripts/y_JSExtensions.jsx";
function YStopMotionLayer()
yStopMotion_data.scriptName = 'yStopMotion'; {
yStopMotion_data.scriptDesc = 'Dynamically change layer sequence opacity from a slider in pComp'; this.info =
yStopMotion_data.scriptVer = '0.1a'; {
yStopMotion_data.webLink = 'yorchnet.com'; name : "YStopMotionLayer",
version : 0.11,
//if yToolBox Exists add it to its tool list. stage : "development",
if (typeof(yToolBox_data)!=='undefined'){ description : "Tool to create a sprite-like behaviour with a composition.",
yToolBox_data.tools.push(yStopMotion_data); url : "yorchnet.com"
};
//it should be called from toolbox. this.appearence =
/* yStopMotion_data.buttonWidth=76; {
yStopMotion_data.buttonHeight=30; buttonHeight : 30,
*/ buttonWidth : 126
yStopMotion_data.btnLayout = "btn_"+yStopMotion_data.scriptName+": Button { preferredSize: ['"+ yToolBox_data.buttonWidth+"','"+ yToolBox_data.buttonHeight+"'], text:'"+yStopMotion_data.scriptName+"', helpTip:'"+yStopMotion_data.scriptDesc+"' }"; };
this.resources =
} {
icon : new File('yNet.png'),
yStopMotion_data.res = "window { \ e_0000 : "There are no comps in project.",
type:'palette' , text:'"+yStopMotion_data.scriptName+' '+yStopMotion_data.scriptVer+"',\ e_0001 : "No Comps selected."
\ };
\ this.init = function init()
info: Group { \ {
alignment:['center','bottom'], \
icon: Image {preferredSize: [15, 18]},\ this.btnLauyout =
website: StaticText { text:'"+yStopMotion_data.webLink+"', alignment:['fill','center'] },\ "button\
}\ {\
\ preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'],\
}"; text:'" + this.info.name + "',\
helpTip:'" + this.info.description + "'\
//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//-------- }";
// MAIN SCRIPT GOES HERE.
this. res =
e_0000 = "There are no comps in project." "window\
e_0001 = "No Comps selected." {\
type:'palette',\
function yStopMotionLayer(){ text:'" + this.info.name + ' ' + this.info.ver + ' ' + this.info.stage + "',\
myName = "yStopMotionLayer"; info: Group \
myVer = "0.2a"; {\
nComps = app.project.items.length; alignment:['center','bottom'],\
app.beginUndoGroup(myName); icon: Image \
if(nComps>0){ {\
sel = app.project.activeItem.selectedLayers; //array containing selection; icon:'" + this.resources.icon.path + '/' + this.resources.icon.name + "',\
if(sel.length == 1&&sel[0].source!= null){ preferredSize: [15, 18]\
},\
myItem = sel[0].source; website: StaticText\
myItemType = myItem.typeName; {\
text:'" + this.info.url + "',\
if(myItemType!="Composition"){ alignment:['fill','center']\
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. this.createUI = function createUI()
txtExpression = 'myLayer = thisLayer;myComp =comp(myLayer.name);\ {
max = myComp.numLayers;\ res =
myValue = effect("'+sliderCtrl.name+'")("'+sliderCtrl("Slider").name+'");\ "window {\
if(myValue<=max&&myValue>1){\ resizeable : true\
parseInt(myValue)\ closeButton : true\
}else if (myValue>max){\ text:'wtf'\
max\ }"
}else if(myValue<1){1}';
//'l = thisComp.layer('+'"'+app.project.activeItem.selectedLayers[0].name+'"'+');'+'fromWorld(l.toComp(l.transform.anchorPoint))'; this.window = new Window( res );
sliderCtrl("Slider").expression = txtExpression; this.window.layout.layout(true);
sliderCtrl("Slider").setValue(1); this.window.center();
txtExpression = null; this.window.show();
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; /** MEAT **/
}
txtExpression = null;
} this.yApplyStopMotionLayer = function yApplyStopMotionLayer(){
}else{
alert(e_0001,myName+' '+myVer); myName = "yStopMotionLayer";
} myVer = "0.2a";
}else{ nComps = app.project.items.length;
alert(e_0000,myName+' '+myVer+" : Error"); app.beginUndoGroup(myName);
} if(nComps>0){
app.endUndoGroup(); sel = app.project.activeItem.selectedLayers; //array containing selection;
} if(sel.length == 1&&sel[0].source!= null){
myItem = sel[0].source;
myItemType = myItem.typeName;
if(myItemType!="Composition"){
alert(e_0001,myName+' '+myVer);
//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//-------- }else{
function build_yStopMotion_data_UI(){ sliderCtrl = sel[0]("Effects").addProperty("Slider Control");
yStopMotion_data.window = new Window ( yStopMotion_data.res); sliderCtrl.name = "Animation State"; //should check for previously created sliders named the same and name uniquely accordingly.
yStopMotion_data.window.show(); txtExpression = 'myLayer = thisLayer;myComp =comp(myLayer.name);\
} max = myComp.numLayers;\
yStopMotion_data.activate = yStopMotionLayer ; myValue = effect("'+sliderCtrl.name+'")("'+sliderCtrl("Slider").name+'");\
if(myValue<=max&&myValue>1){\
//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own. parseInt(myValue)\
if (typeof(yToolBox_data)=='undefined'){ }else if (myValue>max){\
yStopMotion_data.activate(); max\
}else{ }else if(myValue<1){1}';
} //'l = thisComp.layer('+'"'+app.project.activeItem.selectedLayers[0].name+'"'+');'+'fromWorld(l.toComp(l.transform.anchorPoint))';
sliderCtrl("Slider").expression = txtExpression;
sliderCtrl("Slider").setValue(1);
txtExpression = null;
nLayers =myItem.numLayers;
txtExpression = 'extValue = comp("'+sel[0].containingComp.name+'").layer("'+myItem.name+'").effect("'+sliderCtrl.name+'")("'+sliderCtrl("Slider").name+'");if(extValue == thisLayer.index){100}else{0}';
for (z=1;z<=nLayers;z++){
myItem.layer(z).opacity.expression=txtExpression;
}
txtExpression = null;
}
}else{
alert( this.resources.e_0001,myName+' '+myVer);
}
}else{
alert(this.resources.e_0000,myName+' '+myVer+" : Error");
}
app.endUndoGroup();
}
/**/
this.yMainFunction = function yMainFunction()
{
//this.createUI();
this.YStopMotionLayer();
}
this.activate = function activate()
{
yStopMotionLayer.yApplyStopMotionLayer();
//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')
{
yStopMotionLayer = new YStopMotionLayer();
yStopMotionLayer.activate();
}
else
{
yStopMotionLayer = YTB.addTool(new YStopMotionLayer());
}
File diff suppressed because one or more lines are too long