Changed individual tools filenames, for better organization

This commit is contained in:
2014-12-03 17:26:05 -08:00
parent 0bfe359e55
commit 344402e916
18 changed files with 1 additions and 469 deletions
+85
View File
@@ -0,0 +1,85 @@
#include '/c/Program Files/01_Design/Adobe After Effects CS5.5/Support Files/Scripts/yScripts/y_JSExtensions.jsx'
function getComps(folderItem){
_comps = [];
for(i=1;i<=folderItem.numItems;i++){
item = folderItem.item(i);
if(item.typeName=='Composition'){
_comps.push(item);
}
}
return _comps
}
function getFolders(folderItem){
_folders = [];
for(i=1;i<=folderItem.numItems;i++){
item = folderItem.item(i);
if(item.typeName=='Folder'){
_folders.push(item);
}
}
return _folders
}
function getItems(folderItem){
_folders = getFolders(folderItem);
_comps = getComps(folderItem);
while(_folders.length!=0){
newFolderItem = _folders.shift();
_comps = _comps.concat(getComps(newFolderItem));
_folders = _folders.concat(getFolders(newFolderItem));
}
return _comps
}
function getLayers(compItem){
layers = [];
for(i=1;i<=compItem.numLayers;i++){
item = compItem.layer(i);
if(item.matchName == 'ADBE AV Layer'){
if(item.source.typeName == 'Composition'){
layers.push(item)
}
}
}
return layers
}
//_replaceMe = getLayers(app.project.item(6))
//b = app.project.ac
function doIt(){
app.beginUndoGroup('a')
for(i=0;i<_replaceMe.length;i++){
replaceable = _replaceMe[i];
hit = null;
for(k=0;k<_replaceWith.length;k++){
replacement = _replaceWith[k];
//alert(String(replaceable.source.name)+','+String(replacement.name))
if(replaceable.source.name==replacement.name){
hit = replacement;
}
}
if(hit!=null){
_replaceMe[i].replaceSource(hit,false)
}else{
_replaceMe[i].property("Marker").addKey(0)
}
}
app.endUndoGroup()
}
function getComp(){
comp = app.project.activeItem
return comp
}
/*
//STEP 1
_replaceMe = getLayers(getComp())
//STEP 2
_replaceWith = getItems(app.project.activeItem)
doIt()
*/
+52
View File
@@ -0,0 +1,52 @@
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 = yToolBox_data.icon;
//if yToolBox Exists add it to its tool list.
if (typeof(yToolBox_data)!=='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(yToolBox_data)=='undefined'){
yGeneric_data.activate();
//}else{
//}
+176
View File
@@ -0,0 +1,176 @@
yMultiRenamer_data = new Object();
yMultiRenamer_data.scriptName = 'yMultiRenamer';
yMultiRenamer_data.scriptDesc = 'Tool to make it easy to rename multiple project items and/or comp layers';
yMultiRenamer_data.scriptVer = '0.1a';
yMultiRenamer_data.webLink = 'yorchnet.com';
//if yToolBox Exists add it to its tool list.
if (typeof(yToolBox_data)!=='undefined'){
yToolBox_data.tools.push(yMultiRenamer_data);
//it should be called from toolbox.
yMultiRenamer_data.buttonWidth=76;
yMultiRenamer_data.buttonHeight=30;
yMultiRenamer_data.btnLayout = "btn_"+yMultiRenamer_data.scriptName+": Button { preferredSize: ['"+ yToolBox_data.buttonWidth+"','"+ yToolBox_data.buttonHeight+"'], text:'"+yMultiRenamer_data.scriptName+"', helpTip:'"+yMultiRenamer_data.scriptDesc+"' }";
}
yMultiRenamer_data.res = "window { \
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: 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: 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: 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: 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.' },\
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.' },\
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' },\
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' },\
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:'"+yMultiRenamer_data.webLink+"', alignment:['fill','center'] },\
}\
\
}";
//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------
// MAIN SCRIPT GOES HERE.
function yMultiRenamer(){
recursive_sw = yMultiRenamer_data.window.recursive_optn.value;
selectedCompsOnly_sw = yMultiRenamer_data.window.selectedCompsOnly_optn.value;
globalItems_sw = yMultiRenamer_data.window.globalItems_optn.value;
globalLayers_sw = yMultiRenamer_data.window.globalLayers_optn.value;
global_sw = yMultiRenamer_data.window.global_optn.value;
//Gathers all SELECTED items into projectItems,
var rawItems = app.project.items;
var projectItems = [];
for(i=1;i<=rawItems.length;i++){
currentItem = rawItems[i];
if( (currentItem.selected||(currentItem.parentFolder.selected&recursive_sw))||(globalItems_sw||global_sw) ){
projectItems.push(currentItem);
}
}
//Gathers all SELECTED layers into projectLayers,
var projectComps = [];
for(i=1;i<rawItems.length;i++){
currentItem = rawItems[i];
if(currentItem.typeName=='Composition'){
projectComps.push(currentItem)
}
}
var rawLayers = [];
for(i=0;i<projectComps.length;i++){
for(j=1;j<=projectComps[i].layers.length;j++){
rawLayers.push(projectComps[i].layers[j])
}
}
var projectLayers = [];
for(i=0;i<rawLayers.length;i++){
currentItem = rawLayers[i];
if((currentItem.selected&(currentItem.containingComp.selected||!selectedCompsOnly_sw))||(globalLayers_sw||global_sw) ){
projectLayers.push(currentItem);
}
}
/*
var allComps =[];
for(i=1;i<=app.project.items.length;i++){
if(app.project.items[i].typeName=='Composition'){
allComps.push(app.project.items[i].selectedLayers);
}
}
//alert(allComps);
for(i=1;i<=app.project.items.length;i++){
anItem = app.project.items[i]
if(anItem.selected == true){
projectItems.push(anItem);
subItems = anItem.items;
if(anItem.typeName=='Folder'){
if((subItems.length>0)&(yMultiRenamer_data.window.subFolders_optn.value==true)){
for(a=1;a<=subItems.length;a++){
projectItems.push(subItems[a])
}
}
}
}
}
if(yMultiRenamer_data.window.allComps_optn.value==false ){
if((app.project.activeItem!=null )&(app.project.activeItem.typeName=='Composition')){
layers = app.project.activeItem.selectedLayers;
for (i=0;i<layers.length;i++){
projectItems.push(layers[i]);
}
}
}
if(yMultiRenamer_data.window.allComps_optn.value==true ){
for(i=0;i<allComps.length;i++){
layers = allComps[i].selectedLayers;
alert(allComps[i]);
for (L=0;L<layers.length;L++){
projectItems.push(layers[i]);
}
}
}
alert(projectItems)
*/
allRenamable = projectItems.concat(projectLayers);
//alert(allRenamable);
app.beginUndoGroup('Multi Renamer');
for(i=0;i<allRenamable.length;i++){
writeLn('progress '+(parseInt(((i+1)/allRenamable.length)*100))+'%');
n = '';
if(i>0){
n = ' '+String(i);
}
if(!allRenamable[i].locked){
allRenamable[i].name = yMultiRenamer_data.window.root_str.text+n;
//allRenamable[i].name = String(Math.random()); //EVIL LAUGHS
}
}
app.endUndoGroup();
}
//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------
function build_yMultiRenamer_data_UI(){
yMultiRenamer_data.window = new Window ( yMultiRenamer_data.res);
yMultiRenamer_data.window.exec_btn.onClick = yMultiRenamer;
yMultiRenamer_data.window.show();
}
yMultiRenamer_data.activate = build_yMultiRenamer_data_UI ;
//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own.
if (typeof(yToolBox_data)=='undefined'){
yMultiRenamer_data.activate();
}else{
}
// a= yMultiRenamer()
+151
View File
@@ -0,0 +1,151 @@
yMultiRenamer_data = new Object();
yMultiRenamer_data.scriptName = 'yMultiRenamer';
yMultiRenamer_data.scriptDesc = 'Tool to make it easy to rename multiple project items and/or comp layers';
yMultiRenamer_data.scriptVer = '0.2a';
yMultiRenamer_data.webLink = 'yorchnet.com';
//if yToolBox Exists add it to its tool list.
if (typeof(yToolBox_data)!=='undefined'){
yToolBox_data.tools.push(yMultiRenamer_data);
//it should be called from toolbox.
yMultiRenamer_data.buttonWidth=76;
yMultiRenamer_data.buttonHeight=30;
yMultiRenamer_data.btnLayout = "btn_"+yMultiRenamer_data.scriptName+": Button { preferredSize: ['"+ yToolBox_data.buttonWidth+"','"+ yToolBox_data.buttonHeight+"'], text:'"+yMultiRenamer_data.scriptName+"', helpTip:'"+yMultiRenamer_data.scriptDesc+"' }";
}
yMultiRenamer_data.res = "window { \
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'},\
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.' },\
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_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},\
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_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 },\
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' },\
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' },\
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'}\
info: Group { \
alignment:['center','bottom'], \
icon: Image {preferredSize: [15, 18]},\
website: StaticText { text:'"+yMultiRenamer_data.webLink+"', alignment:['fill','center'] },\
}\
\
}";
*/
//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------
// MAIN SCRIPT GOES HERE.
/*
function yMultiRenamer(){
recursive_sw = yMultiRenamer_data.window.recursive_optn.value;
selectedCompsOnly_sw = yMultiRenamer_data.window.selectedCompsOnly_optn.value;
globalItems_sw = yMultiRenamer_data.window.globalItems_optn.value;
globalLayers_sw = yMultiRenamer_data.window.globalLayers_optn.value;
global_sw = yMultiRenamer_data.window.global_optn.value;
//Gathers all SELECTED items into projectItems,
var rawItems = app.project.items;
var projectItems = [];
for(i=1;i<=rawItems.length;i++){
currentItem = rawItems[i];
if( (currentItem.selected||(currentItem.parentFolder.selected&recursive_sw))||(globalItems_sw||global_sw) ){
projectItems.push(currentItem);
}
}
//Gathers all SELECTED layers into projectLayers,
var projectComps = [];
for(i=1;i<rawItems.length;i++){
currentItem = rawItems[i];
if(currentItem.typeName=='Composition'){
projectComps.push(currentItem)
}
}
var rawLayers = [];
for(i=0;i<projectComps.length;i++){
for(j=1;j<=projectComps[i].layers.length;j++){
rawLayers.push(projectComps[i].layers[j])
}
}
var projectLayers = [];
for(i=0;i<rawLayers.length;i++){
currentItem = rawLayers[i];
if((currentItem.selected&(currentItem.containingComp.selected||!selectedCompsOnly_sw))||(globalLayers_sw||global_sw) ){
projectLayers.push(currentItem);
}
}
allRenamable = projectItems.concat(projectLayers);
//alert(allRenamable);
app.beginUndoGroup('Multi Renamer');
for(i=0;i<allRenamable.length;i++){
writeLn('progress '+(parseInt(((i+1)/allRenamable.length)*100))+'%');
n = '';
if(i>0){
n = ' '+String(i);
}
if(!allRenamable[i].locked){
allRenamable[i].name = yMultiRenamer_data.window.root_str.text+n;
//allRenamable[i].name = String(Math.random()); //EVIL LAUGHS
}
}
app.endUndoGroup();
}
*/
//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------
function build_yMultiRenamer_data_UI(){
yMultiRenamer_data.window = new Window ( yMultiRenamer_data.res);
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.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.txt = yMultiRenamer_data.window.add("statictext",undefined,"adsad");
yMultiRenamer_data.window.tbdpnl.onChange = update;
//yMultiRenamer_data.window.exec_btn.onClick = yMultiRenamer;
yMultiRenamer_data.window.show();
}
function update(){
yMultiRenamer_data.window.tbdpnl.txt.text = yMultiRenamer_data.window.tbdpnl.selection.text;
}
yMultiRenamer_data.activate = build_yMultiRenamer_data_UI ;
//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own.
/*
if (typeof(yToolBox_data)=='undefined'){
*/
yMultiRenamer_data.activate();
/*}else{
}
*/
// a= yMultiRenamer()
+40
View File
@@ -0,0 +1,40 @@
//app.project.renderQueue.render()
sl = app.project.activeItem.selectedLayers;
//a = app.project.renderQueue.items[1]
function Marker(time,comment,layer){
this.time = time;
this.comment = comment;
this.layer = layer;
return this
}
markers = [];
//alert(new marker(50,'asdads').time);
for(i=0;i<sl.length;i++){
for(j=1;j<=sl[i].property("Marker").numKeys;j++){
var time = sl[i].property("Marker").keyTime(j);
var comment = sl[i].property("Marker").keyValue(j).comment;
var layer = sl[i];
markers.push(new Marker(time,comment,layer));
}
}
function addMarkers(){
for(i=0;i<markers.length;i++){
var item = app.project.renderQueue.items.add(markers[i].layer.containingComp);
item.timeSpanStart = markers[i].time;
item.timeSpanDuration = markers[i].layer.containingComp.frameDuration;
alert(item.timeSpanStart)
}
return 'Markers Succesfully added to render Queue.'
}
addMarkers()
//nKeys = app.project.activeItem.lselectedLayers.property(1).numKeys;
//var myMarker = new MarkerValue("Fade Up");
//app.project.activeItem.property("Marker").setValueAtTime(2, myMarker);
+65
View File
@@ -0,0 +1,65 @@
#include "usefulFunctions.jsx";
function yExportPng(comp,time,name,path){
var oldResolutionFactor = comp.resolutionFactor;
comp.resolutionFactor=[1,1];
if(typeof(name)=='undefined'){
var name = app.project.activeItem.name;
}
if(typeof(comp)=='undefined'){
var comp = app.project.activeItem;
}
if(typeof(path)=='undefined'){
var path = app.project.file.path;
}
//alert(path+'/'+name+'.png')
var file = new File(path+'/'+name+'.png');
comp.saveFrameToPng(time,file);
file.close();
comp.resolutionFactor=oldResolutionFactor;
return 'Exported.'
}
function marker(time,text){
this.time = time;
this.text = text;
return this
}
function exportMartkers(){
activeItem = app.project.activeItem;
myString = 'export_frames';
if(activeItem.layer(myString)!=null){
myLayer =activeItem.layer(myString);
frames = [];
for(i=1;i<=myLayer.property("Marker").numKeys;i++){
var time = myLayer.property("Marker").keyTime(i);
var text = mergeMultiLine(myLayer.property("Marker").keyValue(i).comment);
frames.push(new marker(time,text));
}
if(frames.length==0){
alert('The '+myString+' layer contains no markers.','yRenderMarkers');
}
for(i=0;i<frames.length;i++){
var n = activeItem.name+'_'+frames[i].text;
yExportPng(activeItem,frames[i].time,n,'/c')
}
//alert(frames);
}else{
createNull = confirm('No '+myString+' layer found, do you want to create one?',true,'yRenderMarkers');
if(createNull==true){
myNull = app.project.activeItem.layers.addNull();
myNull.name = myString;
}else{
alert('A '+myString+' layer is required for the script to work.','yRenderMarkers');
}
}
}
exportMartkers();
+50
View File
@@ -0,0 +1,50 @@
#include "usefulFunctions.jsx"
alert(pad(5,10))
/*
app.project.renderQueue.items.add(app.project.item(1))
a = app.project.renderQueue.items[1];
a = app.project.activeItem;
alert(a)
*/
function rndrPatch(){
if(String(app.project.activeItem)=='[object CompItem]'){
var myComp = app.project.activeItem;
var item =app.project.renderQueue.items.add(myComp);
item.timeSpanStart = app.project.activeItem.workAreaStart;
item.timeSpanDuration = app.project.activeItem.workAreaDuration;
return 'Done'
}else{
return 'Error'
}
}
function rndrAddStamp(RQItem){
return RQItem
}
function rndrRelocate(){
justEnabled = true;
var numItems = app.project.renderQueue.items.length;
var myFolder = Folder.selectDialog();
for(i=1;i<=numItems;i++){
myItem =app.project.renderQueue.item(i);
if(!justEnabled||myItem.render){
var f =new File(myFolder.absoluteURI+'/'+myItem.outputModule(1).file.name);
myItem.outputModule(1).file = f;
}
}
return 'Done.'
}
//rndrRelocate()
/*
myFolder = Folder.selectDialog();
a = new File(myFolder.absoluteURI+'/'+'asdasd_[######].png');
app.project.renderQueue.item(1).outputModule(1).file = a;
//a = rndrAddStamp(app.project.renderQueue.item(1).outputModule(1).file.name);
*/
rndrPatch()