mirror of
https://github.com/jorgevasquezp/AFX_yTools.git
synced 2026-09-16 19:22:42 +00:00
Compare commits
21
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
80d123f603 | ||
|
|
4d91bbfe60 | ||
|
|
30a69f02a5 | ||
|
|
38f087dce4 | ||
|
|
29b22e7658 | ||
|
|
7c11b48082 | ||
|
|
24af8e259b | ||
|
|
00748360db | ||
|
|
fe6f637561 | ||
|
|
8e4b7bba2d | ||
|
|
1b34576b61 | ||
|
|
81ae9c5398 | ||
|
|
df23e7403f | ||
|
|
c74ed78512 | ||
|
|
b77f4552c2 | ||
|
|
b038e66615 | ||
|
|
631cb8f607 | ||
|
|
b1efb4928b | ||
|
|
4ca84b5fee | ||
|
|
f7b18e98d6 | ||
|
|
f1a6f31448 |
@@ -1,5 +1,3 @@
|
|||||||
var scriptUIPanel = this;␍YTB =␍{ ␍ info :␍ {␍ name : "yToolBox",␍ ver : 0.5,␍ status : "alpha",␍ url : "yorchnet.com",␍ description : "My mixed bag of tools"␍ },␍ resources :␍ {␍ icon : new File('../yScripts/yNet.png'),␍ header : new File('../yScripts/header.png')␍ },␍ appearence :␍ {␍ buttonHeight : 30,␍ buttonWidth : 126 ␍ },␍ tools : [],␍ createUI : function createUI()␍ {␍ var res ="group\␍ {\␍ orientation:'column',\␍ alignment:['fill','fill'],\␍ margins:[0,0,0,0]\␍ header: Group\␍ {\␍ orientation:'column',\␍ alignment:['center','top'],\␍ margins:[0,0,0,0]\␍ title: Image\␍ {\␍ icon:'" + this.resources.header.path + '/' + this.resources.header.name + "',\␍ preferredSize: [175, 35]},\␍ ver: StaticText\␍ {\␍ text:'" + this.info.ver + "',\␍ alignment:['center','center']\␍ }\␍ desc: StaticText\␍ {\␍ text:'" + this.info.description + "',\␍ alignment:['center','center']\␍ },\␍ },\␍ main: Group\␍ {\␍ orientation:'column',\␍ alignment:['fill','fill'],\␍ alignChildren:['center','center'],\␍ },\␍ footer: Group\␍ {\␍ alignment:['center','bottom'], \␍ icn_app: Image {icon:'" + this.resources.icon.path + '/' + this.resources.icon.name + "',preferredSize: [15, 18]},\␍ txt_info: StaticText { text:'"+ this.info.url + "', alignment:['fill','center'] },\␍ }, \␍ }";␍ this.window.grp = this.window.add( res );␍ ␍ this.window.layout.layout(true);␍ this.customizeUI();␍ ␍ //EventHandlerAssignment␍ this.window.onResize = this.resize;␍ this.window.onClose = this.close;␍ this.window.onDraw = this.autoLayout;␍ },␍ customizeUI : function customizeUI()␍ {␍ var g = this.window.graphics; ␍ var orange = g.newBrush(g.BrushType.SOLID_COLOR, [1, .45, 0, 1]); ␍ this.window.grp.main.graphics.backgroundColor = orange;␍ },␍ addTool : function addTool( aTool )␍ {␍ /**** TO DO ****/␍ // Check that the tool object is unique.␍ // Call for a window resize so it refreshes propperly.␍ ␍ this.tools.push( aTool );␍␍ var btn = this.window.grp.main.add( aTool.btnLauyout );␍ ␍ btn.onClick = aTool.activate;␍ btn.yTool = aTool; // add a reference to the tool so I can access info on it later...␍ ␍ //alert(btn.onClick);␍␍ this.window.layout.layout(true);␍ ␍ },␍ //EVENT HANDLERS␍ resize : function resize()␍ {␍ this.layout.resize();␍ },␍ close : function close()␍ {␍ YTB = null;␍ delete this;␍ },␍ init : function init()␍ {␍ this.window = ( scriptUIPanel instanceof Panel ) ? scriptUIPanel: new Window( "palette" , this.info.name , undefined, { resizeable : true } );␍ this.createUI();␍ }␍ ␍};␍␍YTB.init();␍␍#include "../yScripts/y_setStructure.jsx";␍#include "../yScripts/y_colorProbe.jsx";␍#include "../yScripts/y_BindBetween2.jsx";␍#include "../yScripts/y_CPOffset.jsx";␍#include "../yScripts/y_puppetRig.jsx";␍#include "../yScripts/y_GenericNewScript.jsx";
|
|
||||||
=======
|
|
||||||
var scriptUIPanel = this;
|
var scriptUIPanel = this;
|
||||||
YTB =
|
YTB =
|
||||||
{
|
{
|
||||||
@@ -83,9 +81,10 @@ YTB =
|
|||||||
/**** TO DO ****/
|
/**** TO DO ****/
|
||||||
// Check that the tool object is unique.
|
// Check that the tool object is unique.
|
||||||
// Call for a window resize so it refreshes propperly.
|
// Call for a window resize so it refreshes propperly.
|
||||||
|
//alert( aTool.info.name );
|
||||||
|
|
||||||
this.tools.push( aTool );
|
this.tools.push( aTool );
|
||||||
|
//alert( aTool.btnLauyout );
|
||||||
var btn = this.window.grp.main.add( aTool.btnLauyout );
|
var btn = this.window.grp.main.add( aTool.btnLauyout );
|
||||||
|
|
||||||
btn.onClick = aTool.activate;
|
btn.onClick = aTool.activate;
|
||||||
@@ -94,6 +93,7 @@ YTB =
|
|||||||
//alert(btn.onClick);
|
//alert(btn.onClick);
|
||||||
|
|
||||||
this.window.layout.layout(true);
|
this.window.layout.layout(true);
|
||||||
|
this.window.layout.resize();
|
||||||
|
|
||||||
return aTool;
|
return aTool;
|
||||||
|
|
||||||
@@ -119,9 +119,14 @@ YTB =
|
|||||||
YTB.init();
|
YTB.init();
|
||||||
|
|
||||||
#include "../yScripts/y_setStructure.jsx";
|
#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_colorProbe.jsx";
|
||||||
#include "../yScripts/y_BindBetween2.jsx";
|
#include "../yScripts/y_BindBetween2.jsx";
|
||||||
#include "../yScripts/y_CPOffset.jsx";
|
#include "../yScripts/y_CPOffset.jsx";
|
||||||
#include "../yScripts/y_puppetRig.jsx";
|
#include "../yScripts/y_puppetRig.jsx";
|
||||||
#include "../yScripts/y_stopMotionLayer.jsx";
|
#include "../yScripts/y_stopMotionLayer.jsx";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,350 @@
|
|||||||
|
#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 );
|
||||||
|
//So long stupid confusing date system, hehe
|
||||||
|
//var tag = month_component + date_component + year_component;
|
||||||
|
var tag = year_component + month_component + date_component ;
|
||||||
|
return tag;
|
||||||
|
},
|
||||||
|
getOutputBasePath : function(){
|
||||||
|
var file = app.project.file;
|
||||||
|
var file_path = String(file);
|
||||||
|
|
||||||
|
//yorchnet folderstructure
|
||||||
|
pro_folder = "pro"
|
||||||
|
folder2d = "2d"
|
||||||
|
folder3d = "3d"
|
||||||
|
|
||||||
|
var search_3d = file_path.search(folder3d);
|
||||||
|
var search_2d = file_path.search(folder2d);
|
||||||
|
var base_path;
|
||||||
|
|
||||||
|
if( search_2d != -1 ){
|
||||||
|
var base_path = file_path.substr(0,file_path.search(pro_folder)+pro_folder.length) +"/"+ folder2d ;;
|
||||||
|
}
|
||||||
|
if( search_3d != -1 ){
|
||||||
|
var base_path = file_path.substr(0,file_path.search(pro_folder)+pro_folder.length) +"/"+ folder3d ;;
|
||||||
|
}
|
||||||
|
|
||||||
|
//alert(base_path);
|
||||||
|
|
||||||
|
return base_path + "/" + "renders" + "/" + this.getTodayTag();
|
||||||
|
|
||||||
|
},
|
||||||
|
/*
|
||||||
|
setRenderToProjectPath : function( rqItem ){
|
||||||
|
if ( (rqItem.status == 3015) || (rqItem.status == 3013) ){
|
||||||
|
for ( var j = 1 ; j <= rqItem.numOutputModules ; j ++ ){
|
||||||
|
o_module = rqItem.outputModule(j);
|
||||||
|
|
||||||
|
var old_name = rqItem.comp.name.replace(".","_");
|
||||||
|
//alert(old_name);
|
||||||
|
if ( o_module.file != null ){
|
||||||
|
var new_path = this.getOutputBasePath();
|
||||||
|
var new_folder = Folder( new_path );
|
||||||
|
if ( !new_folder.exists ){
|
||||||
|
new_folder.create();
|
||||||
|
}
|
||||||
|
//alert(new_path + "/" + old_name)
|
||||||
|
var new_file = new File( new_path + "/" + old_name );
|
||||||
|
o_module.file = new_file ;
|
||||||
|
//alert ( new_path );
|
||||||
|
//o_module.file= new_file;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var p = String( o_module.file.path ).split("/");
|
||||||
|
|
||||||
|
p.splice(0,3);
|
||||||
|
|
||||||
|
var s = "";
|
||||||
|
|
||||||
|
for ( var i = 0 ; i < p.length ; i ++ ){
|
||||||
|
s += "\n"+p[i];
|
||||||
|
}
|
||||||
|
//alert( "Rendering to :" + "\n" + s + "\n\n" + o_module.file.name );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
*/
|
||||||
|
setRenderToProjectPath : function( rqItem , extra_path ){
|
||||||
|
//alert(extra_path);
|
||||||
|
if ( (rqItem.status == 3015) || (rqItem.status == 3013) ){
|
||||||
|
for ( var j = 1 ; j <= rqItem.numOutputModules ; j ++ ){
|
||||||
|
o_module = rqItem.outputModule(j);
|
||||||
|
|
||||||
|
var old_name = rqItem.comp.name.replace(".","_");
|
||||||
|
//alert(old_name);
|
||||||
|
if ( o_module.file != null ){
|
||||||
|
if ( extra_path != undefined )
|
||||||
|
{
|
||||||
|
var new_path = this.getOutputBasePath()+ "/" +extra_path;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var new_path = this.getOutputBasePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
var new_folder = Folder( new_path );
|
||||||
|
if ( !new_folder.exists ){
|
||||||
|
new_folder.create();
|
||||||
|
}
|
||||||
|
//alert(new_path + "/" + old_name)
|
||||||
|
var new_file = new File( new_path + "/" + old_name );
|
||||||
|
o_module.file = new_file ;
|
||||||
|
//alert ( new_path );
|
||||||
|
//o_module.file= new_file;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var p = String( o_module.file.path ).split("/");
|
||||||
|
|
||||||
|
p.splice(0,3);
|
||||||
|
|
||||||
|
var s = "";
|
||||||
|
|
||||||
|
for ( var i = 0 ; i < p.length ; i ++ ){
|
||||||
|
s += "\n"+p[i];
|
||||||
|
}
|
||||||
|
//alert( "Rendering to :" + "\n" + s + "\n\n" + o_module.file.name );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
setRendersToProjectPath : function(){
|
||||||
|
var q = app.project.renderQueue;
|
||||||
|
//check the render queue item is not already rendered.
|
||||||
|
for ( var i = 1 ; i <= q.numItems ; i ++ ){
|
||||||
|
item = q.item(i);
|
||||||
|
//3015 is QUEUED
|
||||||
|
//3013 is NEEDS_OUTPUT
|
||||||
|
|
||||||
|
if ( (item.status == 3015) || (item.status == 3013) ){
|
||||||
|
this.setRenderToProjectPath( item );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
renderSelectedToProjectPath: function(){
|
||||||
|
var q = app.project.renderQueue;
|
||||||
|
var items = this.getSelectedProjectItems();
|
||||||
|
|
||||||
|
for ( var i = 0 ; i < items.length; i ++){
|
||||||
|
if( items[i].typeName == "Composition" ){
|
||||||
|
var item = items[i];
|
||||||
|
rqItem = q.items.add(item);
|
||||||
|
this.setRenderToProjectPath(rqItem);
|
||||||
|
}
|
||||||
|
//alert(items);
|
||||||
|
if( items[i].typeName == "Folder" ){
|
||||||
|
var folder = items[i];
|
||||||
|
for ( var j = 1 ; j <= folder.numItems ; j ++ )
|
||||||
|
{
|
||||||
|
var item = folder.items[j];
|
||||||
|
rqItem = q.items.add(item);
|
||||||
|
this.setRenderToProjectPath(rqItem, item.parentFolder.name );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
for ( var i = 0 ; i < items.length; i ++){
|
||||||
|
if( items[i].typeName == "Composition" ){
|
||||||
|
var item = items[i];
|
||||||
|
rqItem = q.items.add(item);
|
||||||
|
this.setRenderToProjectPath(rqItem);
|
||||||
|
}
|
||||||
|
else if ( items[i].typeName == "Folder" )
|
||||||
|
{
|
||||||
|
var folder = items[i];
|
||||||
|
for ( var j = 1 ; j <= folder.numItems ; j ++ )
|
||||||
|
{
|
||||||
|
var item = folder.items[j];
|
||||||
|
rqItem = q.items.add(item);
|
||||||
|
this.setRenderToProjectPath(rqItem, item.parentFolder.name );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
q.showWindow(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.init = function init()
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Sketching a possible multi button approach.
|
||||||
|
this.btnLauyout =
|
||||||
|
"group\
|
||||||
|
{\
|
||||||
|
btn1:Button{\
|
||||||
|
preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'],\
|
||||||
|
text:'" + this.info.btn1 + "',\
|
||||||
|
onClick: "+ this.methods.setRendersToProjectPath;+" ,\
|
||||||
|
helpTip:'" + this.info.description + "'\
|
||||||
|
},\
|
||||||
|
btn2:Button{\
|
||||||
|
preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'],\
|
||||||
|
text:'" + this.info.btn2 + "',\
|
||||||
|
helpTip:'" + this.info.description + "'\
|
||||||
|
}\
|
||||||
|
}";
|
||||||
|
*/
|
||||||
|
|
||||||
|
this.btnLauyout =
|
||||||
|
"button{\
|
||||||
|
preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'],\
|
||||||
|
text:'" + this.info.btn1 + "',\
|
||||||
|
helpTip:'" + this.info.description + "'\
|
||||||
|
}";
|
||||||
|
|
||||||
|
|
||||||
|
this. res =
|
||||||
|
"window\
|
||||||
|
{\
|
||||||
|
type:'palette',\
|
||||||
|
text:'" + this.info.name + ' ' + this.info.ver + ' ' + this.info.stage + "',\
|
||||||
|
info: Group \
|
||||||
|
{\
|
||||||
|
alignment:['center','bottom'],\
|
||||||
|
icon: Image \
|
||||||
|
{\
|
||||||
|
icon:'" + this.resources.icon.path + '/' + this.resources.icon.name + "',\
|
||||||
|
preferredSize: [15, 18]\
|
||||||
|
},\
|
||||||
|
website: StaticText\
|
||||||
|
{\
|
||||||
|
text:'" + this.info.url + "',\
|
||||||
|
alignment:['fill','center']\
|
||||||
|
},\
|
||||||
|
}\
|
||||||
|
}";
|
||||||
|
}
|
||||||
|
this.createUI = function createUI( )
|
||||||
|
{
|
||||||
|
var myUI = this;
|
||||||
|
var res =
|
||||||
|
" window {\
|
||||||
|
text: 'RenderToProject',\
|
||||||
|
alignment: ['fill','fill'], \
|
||||||
|
alignChildren: ['center','top'], \
|
||||||
|
orientation: 'column', \
|
||||||
|
resizeable: 'true'\
|
||||||
|
}";
|
||||||
|
|
||||||
|
myUI.window = new Window( res );
|
||||||
|
myUI.window.layout.layout(true);
|
||||||
|
|
||||||
|
myUI.window.show();
|
||||||
|
|
||||||
|
myUI.window.layout.onResizing = myUI.window.layout.onResize = function () { myUI.layout.resize();}
|
||||||
|
|
||||||
|
//EVENT HANDLERS
|
||||||
|
|
||||||
|
/*
|
||||||
|
myUI.window.tabs.search_tab.doItBtn.onClick = function(){
|
||||||
|
var search_str = myUI.window.tabs.search_tab.searchGrp.searchString.text;
|
||||||
|
var replace_str = myUI.window.tabs.search_tab.replaceGrp.replaceString.text;
|
||||||
|
myUI.methods.replace( myUI.methods.getSelectedProjectItems() , search_str , replace_str );
|
||||||
|
};
|
||||||
|
|
||||||
|
myUI.window.tabs.suprefix.suprefixGrp.pre.prefixBtn.onClick = function(){
|
||||||
|
var pre = myUI.window.tabs.suprefix.suprefixGrp.su.prefixString.text;
|
||||||
|
myUI.methods.prefix( myUI.methods.getSelectedProjectItems() , pre );
|
||||||
|
};
|
||||||
|
|
||||||
|
myUI.window.tabs.suprefix.suprefixGrp.su.sufixBtn.onClick = function(){
|
||||||
|
var su = myUI.window.tabs.suprefix.suprefixGrp.su.sufixString.text;
|
||||||
|
myUI.methods.suffix( myUI.methods.getSelectedProjectItems() , su );
|
||||||
|
};
|
||||||
|
|
||||||
|
myUI.window.tabs.rename_tab.renameGrp.renameBtn.onClick = function(){
|
||||||
|
var new_name = myUI.window.tabs.rename_tab.renameGrp.renameString.text;
|
||||||
|
myUI.methods.rename( myUI.methods.getSelectedProjectItems() , new_name );
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
//END EVENT HANDLERS
|
||||||
|
|
||||||
|
return(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.yMainFunction = function yMainFunction()
|
||||||
|
{
|
||||||
|
//Have to Separate this into "Operators" so I can have mutiple buttons in a single Tool.
|
||||||
|
w = this.methods.renderSelectedToProjectPath();
|
||||||
|
}
|
||||||
|
this.activate = function activate()
|
||||||
|
{
|
||||||
|
this.yTool.yMainFunction();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.init();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own.
|
||||||
|
if (typeof(YTB)=='undefined')
|
||||||
|
{
|
||||||
|
rtp = new RenderToProject();
|
||||||
|
rtp.activate();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
YTB.addTool(new RenderToProject());
|
||||||
|
}
|
||||||
@@ -1,20 +1,7 @@
|
|||||||
#include "y_JSExtensions.jsx";
|
#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
|
|
||||||
var val = -1;
|
|
||||||
for(i=0;i<=this.length;i++){
|
|
||||||
if(this[i]==item){
|
|
||||||
var val = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
function sortNumber(a,b)
|
|
||||||
{
|
|
||||||
return a - b;
|
return a - b;
|
||||||
}
|
}
|
||||||
|
|
||||||
function pad(n,i){ //pad n with ceroes up to i places.
|
function pad(n,i){ //pad n with ceroes up to i places.
|
||||||
if (String(n).length>=i){
|
if (String(n).length>=i){
|
||||||
return String(n)
|
return String(n)
|
||||||
@@ -27,8 +14,6 @@ function pad(n,i){ //pad n with ceroes up to i places.
|
|||||||
return padding+String(n)
|
return padding+String(n)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function yUniStr(str){
|
function yUniStr(str){
|
||||||
if (app.project.activeItem != null) {
|
if (app.project.activeItem != null) {
|
||||||
myLayers = app.project.activeItem.layers;
|
myLayers = app.project.activeItem.layers;
|
||||||
@@ -67,7 +52,6 @@ function getBaseName(str){
|
|||||||
return str;
|
return str;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFirstGap(array){
|
function getFirstGap(array){
|
||||||
length = array.length
|
length = array.length
|
||||||
array.sort(function sortNumber(a,b){return a-b})
|
array.sort(function sortNumber(a,b){return a-b})
|
||||||
@@ -92,8 +76,6 @@ function yReplace(inputSTR,replaceSTR,replacementSTR){
|
|||||||
}
|
}
|
||||||
return tmpSTR;
|
return tmpSTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function genStamp(args){
|
function genStamp(args){
|
||||||
d = new Date();
|
d = new Date();
|
||||||
//alert(d.getMonth());
|
//alert(d.getMonth());
|
||||||
@@ -103,7 +85,6 @@ function genStamp(args){
|
|||||||
str = String(m)+String(d)+String(y);
|
str = String(m)+String(d)+String(y);
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
|
||||||
function mergeMultiLine(_str){
|
function mergeMultiLine(_str){
|
||||||
var re = new RegExp('[\n\r]');
|
var re = new RegExp('[\n\r]');
|
||||||
_lines = _str.split(re);
|
_lines = _str.split(re);
|
||||||
@@ -128,3 +109,11 @@ function mergeMultiLine(_str){
|
|||||||
}
|
}
|
||||||
return newStr;
|
return newStr;
|
||||||
}
|
}
|
||||||
|
function yFactor(n,f){
|
||||||
|
if((typeof(n)=='number'&&typeof(f)=='number')&&(n>f)){
|
||||||
|
value = n - (n%f);
|
||||||
|
return(value);
|
||||||
|
}else{
|
||||||
|
alert('error');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
if (AVLayer.prototype. getPins==null) AVLayer.prototype. getPins=function(){ //Extends the AVLayer class with the getPinsfunctions which returns the Layer's property groups which are pins.
|
//Useful extensions to AFX Extendscript classes.
|
||||||
|
|
||||||
|
if (AVLayer.prototype. getPins==null) AVLayer.prototype. getPins=function(){ //Extends the AVLayer class with the getPinsfunctions which returns the Layer's property groups which are pins.
|
||||||
this.selectedPins = [];
|
this.selectedPins = [];
|
||||||
for(prop=0;prop<this.selectedProperties.length;prop++){
|
for(prop=0;prop<this.selectedProperties.length;prop++){
|
||||||
p= this.selectedProperties[prop];
|
p= this.selectedProperties[prop];
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,115 @@
|
|||||||
|
#include "../yScripts/y_JSExtensions.jsx";
|
||||||
|
|
||||||
|
function CompHerder()
|
||||||
|
{
|
||||||
|
this.info =
|
||||||
|
{
|
||||||
|
name : "CompHerder",
|
||||||
|
version : 0.1,
|
||||||
|
stage : "development",
|
||||||
|
description : "Generic script to use as a base for new tools.",
|
||||||
|
url : "yorchnet.com"
|
||||||
|
};
|
||||||
|
this.appearence =
|
||||||
|
{
|
||||||
|
buttonHeight : 30,
|
||||||
|
buttonWidth : 126
|
||||||
|
};
|
||||||
|
this.resources =
|
||||||
|
{
|
||||||
|
icon : new File('yNet.png'),
|
||||||
|
};
|
||||||
|
this.init = function init()
|
||||||
|
{
|
||||||
|
|
||||||
|
this.btnLauyout =
|
||||||
|
"button\
|
||||||
|
{\
|
||||||
|
preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'],\
|
||||||
|
text:'" + this.info.name + "',\
|
||||||
|
helpTip:'" + this.info.description + "'\
|
||||||
|
}";
|
||||||
|
|
||||||
|
this. res =
|
||||||
|
"window\
|
||||||
|
{\
|
||||||
|
type:'palette',\
|
||||||
|
text:'" + this.info.name + ' ' + this.info.ver + ' ' + this.info.stage + "',\
|
||||||
|
info: Group \
|
||||||
|
{\
|
||||||
|
alignment:['center','bottom'],\
|
||||||
|
icon: Image \
|
||||||
|
{\
|
||||||
|
icon:'" + this.resources.icon.path + '/' + this.resources.icon.name + "',\
|
||||||
|
preferredSize: [15, 18]\
|
||||||
|
},\
|
||||||
|
website: StaticText\
|
||||||
|
{\
|
||||||
|
text:'" + this.info.url + "',\
|
||||||
|
alignment:['fill','center']\
|
||||||
|
},\
|
||||||
|
}\
|
||||||
|
}";
|
||||||
|
}
|
||||||
|
this.createUI = function createUI()
|
||||||
|
{
|
||||||
|
var res =
|
||||||
|
"window { \
|
||||||
|
text: 'CompHerder',\
|
||||||
|
alignment: ['fill','fill'], \
|
||||||
|
alignChildren: ['left','top'], \
|
||||||
|
orientation: 'column', \
|
||||||
|
resizeable: 'true',\
|
||||||
|
tabs: Panel {\
|
||||||
|
type: 'tabbedpanel',\
|
||||||
|
alignment: ['fill','fill'], \
|
||||||
|
alignChildren: ['left','top'], \
|
||||||
|
orientation: 'column', \
|
||||||
|
tab1: Panel {\
|
||||||
|
type: 'tab',\
|
||||||
|
text: 'search & replace'\
|
||||||
|
},\
|
||||||
|
tab2: Panel {\
|
||||||
|
type: 'tab',\
|
||||||
|
text: 'suffix/prefix'\
|
||||||
|
},\
|
||||||
|
tab3: Panel {\
|
||||||
|
type: 'tab',\
|
||||||
|
text: 'rename'\
|
||||||
|
}\
|
||||||
|
}\
|
||||||
|
}";
|
||||||
|
|
||||||
|
this.window = new Window( res );
|
||||||
|
this.window.layout.layout(true);
|
||||||
|
/*
|
||||||
|
this.window.resize();
|
||||||
|
this.window.center();
|
||||||
|
*/
|
||||||
|
this.window.show();
|
||||||
|
|
||||||
|
this.window.layout.onResizing = this.window.layout.onResize = function () {this.layout.resize();}
|
||||||
|
}
|
||||||
|
this.yMainFunction = function yMainFunction()
|
||||||
|
{
|
||||||
|
this.createUI();
|
||||||
|
}
|
||||||
|
this.activate = function activate()
|
||||||
|
{
|
||||||
|
this.yTool.yMainFunction();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.init();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own.
|
||||||
|
if (typeof(YTB)=='undefined')
|
||||||
|
{
|
||||||
|
CompHerder = new CompHerder();
|
||||||
|
CompHerder.activate();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
YTB.addTool(new CompHerder());
|
||||||
|
}
|
||||||
+179
-16
@@ -1,9 +1,10 @@
|
|||||||
#include "../yScripts/y_JSExtensions.jsx";
|
#include "../yScripts/y_JSExtensions.jsx";
|
||||||
function YGenericTool()
|
|
||||||
|
function GenericTool()
|
||||||
{
|
{
|
||||||
this.info =
|
this.info =
|
||||||
{
|
{
|
||||||
name : "yGenericTool",
|
name : "GenericTool",
|
||||||
version : 0.1,
|
version : 0.1,
|
||||||
stage : "development",
|
stage : "development",
|
||||||
description : "Generic script to use as a base for new tools.",
|
description : "Generic script to use as a base for new tools.",
|
||||||
@@ -18,6 +19,66 @@ function YGenericTool()
|
|||||||
{
|
{
|
||||||
icon : new File('yNet.png'),
|
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.init = function init()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -50,23 +111,125 @@ function YGenericTool()
|
|||||||
}\
|
}\
|
||||||
}";
|
}";
|
||||||
}
|
}
|
||||||
this.createUI = function createUI()
|
this.createUI = function createUI( )
|
||||||
{
|
{
|
||||||
res =
|
var myUI = this;
|
||||||
"window {\
|
var res =
|
||||||
resizeable : true\
|
" window {\
|
||||||
closeButton : true\
|
text: 'GenericTool',\
|
||||||
text:'wtf'\
|
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'} ,\
|
||||||
|
}\
|
||||||
|
}\
|
||||||
|
},\
|
||||||
|
}";
|
||||||
|
|
||||||
this.window = new Window( res );
|
myUI.window = new Window( res );
|
||||||
this.window.layout.layout(true);
|
myUI.window.layout.layout(true);
|
||||||
this.window.center();
|
|
||||||
this.window.show();
|
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()
|
this.yMainFunction = function yMainFunction()
|
||||||
{
|
{
|
||||||
this.createUI();
|
w = this.createUI();
|
||||||
}
|
}
|
||||||
this.activate = function activate()
|
this.activate = function activate()
|
||||||
{
|
{
|
||||||
@@ -80,10 +243,10 @@ function YGenericTool()
|
|||||||
//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own.
|
//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own.
|
||||||
if (typeof(YTB)=='undefined')
|
if (typeof(YTB)=='undefined')
|
||||||
{
|
{
|
||||||
yGenericTool = new YGenericTool();
|
gt = new GenericTool();
|
||||||
yGenericTool.activate();
|
gt.activate();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
YTB.addTool(new YGenericTool());
|
YTB.addTool(new GenericTool());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
if (Array.prototype.getOne==null) Array.prototype.getOne=function(item){ //Extends the Array class with the getOne functions wich
|
//Useful extensions to the JavaScript class versions that come with the default ExtendScript version.
|
||||||
|
|
||||||
|
if (Array.prototype.getOne==null) Array.prototype.getOne=function(item){ //Extends the Array class with the getOne functions wich
|
||||||
var val = -1;
|
var val = -1;
|
||||||
for(i=0;i<=this.length;i++){
|
for(i=0;i<=this.length;i++){
|
||||||
if(this[i]==item){
|
if(this[i]==item){
|
||||||
@@ -7,11 +9,3 @@
|
|||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
function yFactor(n,f){
|
|
||||||
if((typeof(n)=='number'&&typeof(f)=='number')&&(n>f)){
|
|
||||||
value = n - (n%f);
|
|
||||||
return(value);
|
|
||||||
}else{
|
|
||||||
alert('error');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -0,0 +1,292 @@
|
|||||||
|
#include "../yScripts/y_JSExtensions.jsx";
|
||||||
|
|
||||||
|
function RenderMarkers()
|
||||||
|
{
|
||||||
|
this.info =
|
||||||
|
{
|
||||||
|
name : "Render Markers",
|
||||||
|
version : 0.1,
|
||||||
|
stage : "development",
|
||||||
|
description : 'Render all markers in dummy layer "Renders".',
|
||||||
|
url : "yorchnet.com"
|
||||||
|
};
|
||||||
|
this.appearence =
|
||||||
|
{
|
||||||
|
buttonHeight : 30,
|
||||||
|
buttonWidth : 126
|
||||||
|
};
|
||||||
|
this.resources =
|
||||||
|
{
|
||||||
|
icon : new File('yNet.png'),
|
||||||
|
};
|
||||||
|
this.methods =
|
||||||
|
{
|
||||||
|
pad : function ( n , pad ) {
|
||||||
|
zeros = "";
|
||||||
|
for ( i = 0 ; i < pad ; i ++ )
|
||||||
|
{
|
||||||
|
zeros+="0";
|
||||||
|
}
|
||||||
|
n = String(n);
|
||||||
|
padded = zeros.substr( 0, pad - n.length ) + String(n) ;
|
||||||
|
return padded
|
||||||
|
},
|
||||||
|
replace: function( items , string , newString ){
|
||||||
|
for ( i = 0 ; i < items.length ; i ++ ){
|
||||||
|
var item = items[i];
|
||||||
|
item.name = item.name.replace( string , newString );
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
getSelectedProjectItems: function (){
|
||||||
|
var items = [];
|
||||||
|
var p = app.project;
|
||||||
|
for ( var i = 1 ; i <= p.numItems ; i ++ ){
|
||||||
|
var item = p.item(i);
|
||||||
|
if ( item.selected ){
|
||||||
|
items.push(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//items = items.concat( app.project.activeItem.selectedItems );
|
||||||
|
return items;
|
||||||
|
},
|
||||||
|
suffix: function ( items , suffix ){
|
||||||
|
for ( i = 0 ; i < items.length ; i ++ ){
|
||||||
|
var item = items[i];
|
||||||
|
if ( item.name.search( suffix ) != (item.name.length - suffix.length) ){
|
||||||
|
item.name+= "_"+suffix;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
prefix : function( items , prefix ){
|
||||||
|
for ( i = 0 ; i < items.length ; i ++ )
|
||||||
|
{
|
||||||
|
var item = items[i];
|
||||||
|
if ( item.name.search( prefix ) != 0 ){
|
||||||
|
item.name = prefix + "_" + item.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
rename: function ( items , new_name ){
|
||||||
|
for ( i = 0 ; i < items.length ; i ++ ){
|
||||||
|
var item = items[i];
|
||||||
|
item.name = new_name + "_" + i;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
this.init = function init()
|
||||||
|
{
|
||||||
|
|
||||||
|
this.btnLauyout =
|
||||||
|
"button\
|
||||||
|
{\
|
||||||
|
preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'],\
|
||||||
|
text:'" + this.info.name + "',\
|
||||||
|
helpTip:'" + this.info.description + "'\
|
||||||
|
}";
|
||||||
|
|
||||||
|
this. res =
|
||||||
|
"window\
|
||||||
|
{\
|
||||||
|
type:'palette',\
|
||||||
|
text:'" + this.info.name + ' ' + this.info.ver + ' ' + this.info.stage + "',\
|
||||||
|
info: Group \
|
||||||
|
{\
|
||||||
|
alignment:['center','bottom'],\
|
||||||
|
icon: Image \
|
||||||
|
{\
|
||||||
|
icon:'" + this.resources.icon.path + '/' + this.resources.icon.name + "',\
|
||||||
|
preferredSize: [15, 18]\
|
||||||
|
},\
|
||||||
|
website: StaticText\
|
||||||
|
{\
|
||||||
|
text:'" + this.info.url + "',\
|
||||||
|
alignment:['fill','center']\
|
||||||
|
},\
|
||||||
|
}\
|
||||||
|
}";
|
||||||
|
}
|
||||||
|
this.createUI = function createUI( )
|
||||||
|
{
|
||||||
|
var myUI = this;
|
||||||
|
var res =
|
||||||
|
" window {\
|
||||||
|
text: 'RenderMarkers',\
|
||||||
|
alignment: ['fill','fill'], \
|
||||||
|
alignChildren: ['center','top'], \
|
||||||
|
orientation: 'column', \
|
||||||
|
resizeable: 'true'\
|
||||||
|
}"
|
||||||
|
var res =
|
||||||
|
"window { \
|
||||||
|
text: 'RenderMarkers',\
|
||||||
|
alignment: ['fill','fill'], \
|
||||||
|
alignChildren: ['center','top'], \
|
||||||
|
orientation: 'column', \
|
||||||
|
resizeable: 'true',\
|
||||||
|
tabs: Panel {\
|
||||||
|
type: 'tabbedpanel',\
|
||||||
|
alignment: ['fill','fill'], \
|
||||||
|
alignChildren: ['center','top'], \
|
||||||
|
search_tab: Panel {\
|
||||||
|
type: 'tab',\
|
||||||
|
text: 'Search & Replace',\
|
||||||
|
orientation: 'column', \
|
||||||
|
alignChildren: ['center','top'], \
|
||||||
|
searchGrp: Group {\
|
||||||
|
alignment: ['fill','fill'], \
|
||||||
|
alignChildren: ['center','top'], \
|
||||||
|
orientation: 'column', \
|
||||||
|
searchString: EditText {text:'SEARCH FOR TEXT',alignment: ['fill','center']}, \
|
||||||
|
},\
|
||||||
|
replaceGrp: Group {\
|
||||||
|
alignment: ['fill','fill'], \
|
||||||
|
alignChildren: ['center','center'], \
|
||||||
|
orientation: 'column', \
|
||||||
|
replaceString: EditText {text:'REPLACE WITH TEXT',alignment: ['fill','center']}, \
|
||||||
|
}\
|
||||||
|
doItBtn: Button {text: 'Replace in selected Comps', alignment: ['center','center']} , \
|
||||||
|
}\
|
||||||
|
suprefix: Panel {\
|
||||||
|
type: 'tab',\
|
||||||
|
text: 'Suffix / Prefix',\
|
||||||
|
orientation: 'column', \
|
||||||
|
suprefixGrp: Group {\
|
||||||
|
alignment: ['fill','fill'], \
|
||||||
|
alignChildren: ['left','center'], \
|
||||||
|
orientation: 'column', \
|
||||||
|
pre:Group {\
|
||||||
|
alignment: ['fill','fill'], \
|
||||||
|
alignChildren: ['left','center'], \
|
||||||
|
orientation: 'row', \
|
||||||
|
prefixString: EditText {text:'PREFIX',alignment: ['fill','center']}, \
|
||||||
|
prefixBtn: Button {text: 'Preffix'} , \
|
||||||
|
},\
|
||||||
|
su:Group{\
|
||||||
|
alignment: ['fill','fill'], \
|
||||||
|
alignChildren: ['left','center'], \
|
||||||
|
orientation: 'row', \
|
||||||
|
sufixString: EditText {text:'SUFIX',alignment: ['fill','center']}, \
|
||||||
|
sufixBtn: Button {text: 'Sufix'} , \
|
||||||
|
}\
|
||||||
|
},\
|
||||||
|
},\
|
||||||
|
rename_tab: Panel {\
|
||||||
|
type: 'tab',\
|
||||||
|
text: 'Rename',\
|
||||||
|
renameGrp: Group {\
|
||||||
|
alignment: ['fill','fill'], \
|
||||||
|
alignChildren: ['left','center'], \
|
||||||
|
orientation: 'row', \
|
||||||
|
renameString: EditText {text:'NEW NAME',alignment: ['fill','center']}, \
|
||||||
|
renameBtn: Button {text: 'Rename'} ,\
|
||||||
|
}\
|
||||||
|
}\
|
||||||
|
},\
|
||||||
|
}";
|
||||||
|
|
||||||
|
myUI.window = new Window( res );
|
||||||
|
myUI.window.layout.layout(true);
|
||||||
|
|
||||||
|
myUI.window.show();
|
||||||
|
|
||||||
|
myUI.window.layout.onResizing = myUI.window.layout.onResize = function () { myUI.layout.resize();}
|
||||||
|
|
||||||
|
//EVENT HANDLERS
|
||||||
|
|
||||||
|
/*
|
||||||
|
myUI.window.tabs.search_tab.doItBtn.onClick = function(){
|
||||||
|
var search_str = myUI.window.tabs.search_tab.searchGrp.searchString.text;
|
||||||
|
var replace_str = myUI.window.tabs.search_tab.replaceGrp.replaceString.text;
|
||||||
|
myUI.methods.replace( myUI.methods.getSelectedProjectItems() , search_str , replace_str );
|
||||||
|
};
|
||||||
|
|
||||||
|
myUI.window.tabs.suprefix.suprefixGrp.pre.prefixBtn.onClick = function(){
|
||||||
|
var pre = myUI.window.tabs.suprefix.suprefixGrp.su.prefixString.text;
|
||||||
|
myUI.methods.prefix( myUI.methods.getSelectedProjectItems() , pre );
|
||||||
|
};
|
||||||
|
|
||||||
|
myUI.window.tabs.suprefix.suprefixGrp.su.sufixBtn.onClick = function(){
|
||||||
|
var su = myUI.window.tabs.suprefix.suprefixGrp.su.sufixString.text;
|
||||||
|
myUI.methods.suffix( myUI.methods.getSelectedProjectItems() , su );
|
||||||
|
};
|
||||||
|
|
||||||
|
myUI.window.tabs.rename_tab.renameGrp.renameBtn.onClick = function(){
|
||||||
|
var new_name = myUI.window.tabs.rename_tab.renameGrp.renameString.text;
|
||||||
|
myUI.methods.rename( myUI.methods.getSelectedProjectItems() , new_name );
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
//END EVENT HANDLERS
|
||||||
|
|
||||||
|
return(this);
|
||||||
|
}
|
||||||
|
this.renderMarkers = function renderMarkers(){
|
||||||
|
p = app.project;
|
||||||
|
rq = p.renderQueue;
|
||||||
|
rqi = rq.items;
|
||||||
|
comp = p.activeItem;
|
||||||
|
|
||||||
|
var myRenderNull = comp.layer("Render");
|
||||||
|
if ( myRenderNull == null ){
|
||||||
|
myRenderNull = app.project.activeItem.layers.addNull();
|
||||||
|
myRenderNull.name = "Render";
|
||||||
|
myRenderNull.inPoint = -1;
|
||||||
|
myRenderNull.outPoint = -1;
|
||||||
|
alert('Created "Render Stills" layer.\nAdd markers to this layer and run again to render stills.');
|
||||||
|
}
|
||||||
|
|
||||||
|
markers= myRenderNull.property("Marker");
|
||||||
|
|
||||||
|
for ( var j = 1 ; j <= markers.numKeys ; j ++ ){
|
||||||
|
i = rqi.add( comp );
|
||||||
|
var destPath = i.outputModule(1).file.path;
|
||||||
|
i.outputModule(1).applyTemplate("PNG+");
|
||||||
|
var markerName = markers.keyValue(j).comment;
|
||||||
|
i.timeSpanStart = markers.keyTime(j);
|
||||||
|
i.timeSpanDuration = comp.frameDuration;
|
||||||
|
|
||||||
|
var destName = comp.name.replace(" ","_");
|
||||||
|
|
||||||
|
var destFrame = markers.keyTime(j) / comp.frameDuration;
|
||||||
|
if ( markerName == "" ){
|
||||||
|
i.outputModule(1).file = new File( destPath + "/" + destName + "_Still_f" + "[####]" )
|
||||||
|
}else{
|
||||||
|
i.outputModule(1).file = new File( destPath + "/" + destName + "_Still" + "_f[####]_" + markerName )
|
||||||
|
}
|
||||||
|
//alert( i.outputModule(1).file );
|
||||||
|
//i.outputModule(1).includeSourceXMP = true;
|
||||||
|
rq.render();
|
||||||
|
}
|
||||||
|
//alert(i.timeSpanStart);
|
||||||
|
//alert(i.timeSpanDuration);
|
||||||
|
|
||||||
|
}
|
||||||
|
this.yMainFunction = function yMainFunction()
|
||||||
|
{
|
||||||
|
w = RenderMarkers().renderMarkers();
|
||||||
|
}
|
||||||
|
this.activate = function activate()
|
||||||
|
{
|
||||||
|
this.yTool.yMainFunction();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.init();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own.
|
||||||
|
if (typeof(YTB)=='undefined')
|
||||||
|
{
|
||||||
|
gt = new RenderMarkers();
|
||||||
|
gt.activate();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
YTB.addTool(new RenderMarkers());
|
||||||
|
}
|
||||||
@@ -87,9 +87,9 @@ function YColorProbe()
|
|||||||
radiusCTRL.name ='radius';
|
radiusCTRL.name ='radius';
|
||||||
myNull("Effects")("radius")('Slider').setValue(5);
|
myNull("Effects")("radius")('Slider').setValue(5);
|
||||||
colExp = 'myLayer = thisLayer("Effects")("sampledLayer")("Layer");\
|
colExp = 'myLayer = thisLayer("Effects")("sampledLayer")("Layer");\
|
||||||
p = thisLayer.toWorld(thisLayer.transform.anchorPoint);\
|
p = myLayer.fromWorld(thisLayer.toComp(thisLayer.transform.anchorPoint))\
|
||||||
r = thisLayer("Effects")("radius")("Slider");\
|
r = thisLayer("Effects")("radius")("Slider");\
|
||||||
myLayer.sampleImage(p, radius = [r, r], postEffect=true, t=time)';
|
myLayer.sampleImage(p, radius = [r, r], postEffect=true, t=time)';
|
||||||
myNull("Effects")('outColor')('Color').expression=colExp;
|
myNull("Effects")('outColor')('Color').expression=colExp;
|
||||||
myNull.label=2;
|
myNull.label=2;
|
||||||
myNull.source.height=30;
|
myNull.source.height=30;
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
#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());␍}␍
|
||||||
@@ -4,9 +4,9 @@ function YPuppetRigTool()
|
|||||||
this.info =
|
this.info =
|
||||||
{
|
{
|
||||||
name : "yPuppetRig",
|
name : "yPuppetRig",
|
||||||
version : 0.34,
|
version : 0.0,
|
||||||
stage : "development",
|
stage : "development",
|
||||||
description : "Tools for streamlining puppet-based animation rigs.",
|
description : "Tool to create nulls at puppet pin locations, and link the latter to the former.",
|
||||||
url : "yorchnet.com"
|
url : "yorchnet.com"
|
||||||
};
|
};
|
||||||
this.appearence =
|
this.appearence =
|
||||||
@@ -129,6 +129,7 @@ function YPuppetRigTool()
|
|||||||
if(puppetEffects.length>0){
|
if(puppetEffects.length>0){
|
||||||
posPins = [];
|
posPins = [];
|
||||||
for(i=0;i<puppetEffects.length;i++){
|
for(i=0;i<puppetEffects.length;i++){
|
||||||
|
/*TODO : Make it work with layers with multiple effects*/
|
||||||
posPinGroup = puppetEffects[i]('ADBE FreePin3 ARAP Group')('ADBE FreePin3 Mesh Group')('ADBE FreePin3 Mesh Atom')('ADBE FreePin3 PosPins');
|
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++){
|
for(j=1;j<=posPinGroup.numProperties;j++){
|
||||||
posPins.push(puppetEffects[i]('ADBE FreePin3 ARAP Group')('ADBE FreePin3 Mesh Group')('ADBE FreePin3 Mesh Atom')('ADBE FreePin3 PosPins')(j));
|
posPins.push(puppetEffects[i]('ADBE FreePin3 ARAP Group')('ADBE FreePin3 Mesh Group')('ADBE FreePin3 Mesh Atom')('ADBE FreePin3 PosPins')(j));
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
<<<<<<< HEAD
|
|
||||||
#include "../yScripts/y_JSExtensions.jsx";␍function YSetProjectTool()␍{␍ this.info =␍ {␍ name : "YSetStructure",␍ version : 0.11,␍ stage : "alpha",␍ description : "Set the Folder Structure for a new Project",␍ url : "yorchnet.com"␍ };␍ this.appearence =␍ {␍ buttonHeight : 30,␍ buttonWidth : 126␍ };␍ this.resources = ␍ {␍ icon : new File('yNet.png'),␍ };␍ this.init = function init()␍ {␍ //alert("my name is:" + this.info.name);␍ this.btnLauyout = ␍ "button\␍ {\␍ preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'],\␍ text:'" + this.info.name + "',\␍ helpTip:'" + this.info.description + "'\␍ }";␍ ␍ this. res = ␍ "window\␍ {\␍ type:'palette',\␍ text:'" + this.info.name + ' ' + this.info.ver + ' ' + this.info.stage + "',\␍ info: Group \␍ {\␍ alignment:['center','bottom'],\␍ icon: Image \␍ {\␍ icon:'" + this.resources.icon.path + '/' + this.resources.icon.name + "',\␍ preferredSize: [15, 18]\␍ },\␍ website: StaticText\␍ {\␍ text:'" + this.info.url + "',\␍ alignment:['fill','center']\␍ },\␍ }\␍ }";␍ }␍ this.createUI = function createUI()␍ {␍ this.window = new Window ( this.res );␍ this.window.show() ;␍ }␍ this.ySetProject = function ySetProject()␍ {␍ //alert("is this working");␍ app.beginUndoGroup('ySetProject');␍ var preStruct = ["01 MAIN","02 PComp","03 Source Layers" ,"04 Movies","05 Other Projects","06 Audio" , "07 Reference"];␍ var newStruct = [];␍ var projectItems = [];␍␍ for(i=1;i<=app.project.items.length;i++)␍ {␍ if(app.project.items[i].parentFolder.name=='Root')␍ {␍ projectItems.push(app.project.items[i].name);␍ }␍ }␍␍ //to start a new organized project since the beginning␍␍ if (projectItems.length == 0)␍ {␍ newStruct = preStruct;␍ }␍ else␍ {␍ for(a=0;a<preStruct.length;a++)␍ {␍ if ((projectItems.getOne(preStruct[a]))==-1)␍ {␍ newStruct.push(preStruct[a]);␍ }␍ }␍ }␍␍ for(i = 1;i<=newStruct.length;i++)␍ {␍ app.project.items.addFolder(newStruct[i-1]);␍ if ( app.project.items[i].name == "01 MAIN" )␍ {␍ //alert("yes");␍ app.project.items[i].items.addComp("JOBCODE_TYPE_[Scene_name]_vA_r000",1920,1080,1,30,23.976);␍ } ␍ ␍ }␍ ␍ saveNow = confirm("Project Succesfully Set, Save Project?",true,"ySetProject");␍ ␍ if(saveNow==true){␍ app.project.save()␍ }else{␍ ␍ }␍ app.endUndoGroup();␍ }␍ ␍ this.activate = this.ySetProject;␍ ␍ this.init();␍ return this;␍}␍␍//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own.␍if (typeof(YTB)=='undefined')␍{␍ ySetProjectTool = new YSetProjectTool();␍ ySetProjectTool.activate();␍}␍else␍{␍ ySetProjectTool = YTB.addTool(new YSetProjectTool());␍}
|
|
||||||
=======
|
|
||||||
#include "../yScripts/y_JSExtensions.jsx";
|
#include "../yScripts/y_JSExtensions.jsx";
|
||||||
function YSetProjectTool()
|
function YSetProjectTool()
|
||||||
{
|
{
|
||||||
@@ -126,6 +123,5 @@ if (typeof(YTB)=='undefined')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
YTB.addTool(new YSetProjectTool());
|
ySetProjectTool = YTB.addTool(new YSetProjectTool());
|
||||||
}
|
}
|
||||||
>>>>>>> 841484771586f75c140288b329d54c96d3cb3925
|
|
||||||
|
|||||||
Reference in New Issue
Block a user