mirror of
https://github.com/jorgevasquezp/AFX_yTools.git
synced 2026-08-16 15:30:59 +00:00
Switched line endings to Unix-like on all scripts
This commit is contained in:
+130
-130
@@ -1,130 +1,130 @@
|
|||||||
#include "y_JSExtensions.jsx";
|
#include "y_JSExtensions.jsx";
|
||||||
/*
|
/*
|
||||||
if (Array.prototype.getOne==null) Array.prototype.getOne=function(item){ //Extends the Array class with the getOne functions wich
|
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){
|
||||||
var val = i;
|
var val = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
function sortNumber(a,b)
|
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)
|
||||||
}else{
|
}else{
|
||||||
dif = i- (String(n)).length;
|
dif = i- (String(n)).length;
|
||||||
padding = "";
|
padding = "";
|
||||||
for (p=0;p<dif;p++){
|
for (p=0;p<dif;p++){
|
||||||
padding = padding+"0"
|
padding = padding+"0"
|
||||||
}
|
}
|
||||||
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;
|
||||||
//myLayerNames = [];
|
//myLayerNames = [];
|
||||||
nameMatches = [];
|
nameMatches = [];
|
||||||
for (i=1;i<=myLayers.length;i++){
|
for (i=1;i<=myLayers.length;i++){
|
||||||
if(getBaseName(myLayers[i].name) == getBaseName(str)){
|
if(getBaseName(myLayers[i].name) == getBaseName(str)){
|
||||||
nameMatches.push(getN(myLayers[i].name))
|
nameMatches.push(getN(myLayers[i].name))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
newN = getFirstGap(nameMatches);
|
newN = getFirstGap(nameMatches);
|
||||||
if(nameMatches.length == 0 | (newN==0)){
|
if(nameMatches.length == 0 | (newN==0)){
|
||||||
return str
|
return str
|
||||||
}else{
|
}else{
|
||||||
return str+' '+newN
|
return str+' '+newN
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
alert('E01 : No Comp is ACTIVE')
|
alert('E01 : No Comp is ACTIVE')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function getN(str){
|
function getN(str){
|
||||||
lastChunk = str.substr(str.lastIndexOf(' '),str.length);
|
lastChunk = str.substr(str.lastIndexOf(' '),str.length);
|
||||||
if(lastChunk == parseInt(lastChunk)){
|
if(lastChunk == parseInt(lastChunk)){
|
||||||
return parseInt(lastChunk);
|
return parseInt(lastChunk);
|
||||||
}else{
|
}else{
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function getBaseName(str){
|
function getBaseName(str){
|
||||||
lastChunk = str.substr(str.lastIndexOf(' '),str.length);
|
lastChunk = str.substr(str.lastIndexOf(' '),str.length);
|
||||||
if(lastChunk == parseInt(lastChunk)){
|
if(lastChunk == parseInt(lastChunk)){
|
||||||
return str.substr(0,str.lastIndexOf(' '));
|
return str.substr(0,str.lastIndexOf(' '));
|
||||||
}else{
|
}else{
|
||||||
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})
|
||||||
max = array[array.length-1]
|
max = array[array.length-1]
|
||||||
for (n=0;n<=max;n++){
|
for (n=0;n<=max;n++){
|
||||||
entry = array.getOne(n);
|
entry = array.getOne(n);
|
||||||
if (entry == -1){
|
if (entry == -1){
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return max+1
|
return max+1
|
||||||
return array[0];
|
return array[0];
|
||||||
}
|
}
|
||||||
function yReplace(inputSTR,replaceSTR,replacementSTR){
|
function yReplace(inputSTR,replaceSTR,replacementSTR){
|
||||||
tmpArray = inputSTR.split(replaceSTR);
|
tmpArray = inputSTR.split(replaceSTR);
|
||||||
tmpSTR = '';
|
tmpSTR = '';
|
||||||
for(i=0;i<tmpArray.length;i++){
|
for(i=0;i<tmpArray.length;i++){
|
||||||
tmpSTR = tmpSTR+tmpArray[i]
|
tmpSTR = tmpSTR+tmpArray[i]
|
||||||
if(i<tmpArray.length-1){
|
if(i<tmpArray.length-1){
|
||||||
tmpSTR = tmpSTR+replacementSTR;
|
tmpSTR = tmpSTR+replacementSTR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return tmpSTR;
|
return tmpSTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function genStamp(args){
|
function genStamp(args){
|
||||||
d = new Date();
|
d = new Date();
|
||||||
//alert(d.getMonth());
|
//alert(d.getMonth());
|
||||||
y = String(d.getFullYear()).substring(2,4);
|
y = String(d.getFullYear()).substring(2,4);
|
||||||
m = pad(d.getMonth()+1,2);
|
m = pad(d.getMonth()+1,2);
|
||||||
d = pad(d.getUTCDate(),2);
|
d = pad(d.getUTCDate(),2);
|
||||||
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);
|
||||||
newStr = '';
|
newStr = '';
|
||||||
|
|
||||||
if(_lines.length>1){
|
if(_lines.length>1){
|
||||||
for(L=0;L<_lines.length;L++){
|
for(L=0;L<_lines.length;L++){
|
||||||
alert(_lines[L]);
|
alert(_lines[L]);
|
||||||
if(L==_lines.length-1||_lines[L]==''){
|
if(L==_lines.length-1||_lines[L]==''){
|
||||||
dash = '';
|
dash = '';
|
||||||
}else{
|
}else{
|
||||||
dash = '.';
|
dash = '.';
|
||||||
}
|
}
|
||||||
if(_lines[L]!=''){
|
if(_lines[L]!=''){
|
||||||
newStr = newStr+_lines[L]+dash;
|
newStr = newStr+_lines[L]+dash;
|
||||||
}else{
|
}else{
|
||||||
newStr = newStr;
|
newStr = newStr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
newStr = _str;
|
newStr = _str;
|
||||||
}
|
}
|
||||||
return newStr;
|
return newStr;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1 +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();␍
|
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();
|
||||||
|
|||||||
@@ -1,52 +1,52 @@
|
|||||||
yGeneric_data = new Object();
|
yGeneric_data = new Object();
|
||||||
|
|
||||||
yGeneric_data.scriptName = 'YTBGen';
|
yGeneric_data.scriptName = 'YTBGen';
|
||||||
yGeneric_data.scriptDesc = 'YToolBox Generic Script is the base for adding tools.';
|
yGeneric_data.scriptDesc = 'YToolBox Generic Script is the base for adding tools.';
|
||||||
yGeneric_data.scriptVer = '0.1a';
|
yGeneric_data.scriptVer = '0.1a';
|
||||||
yGeneric_data.webLink = 'yorchnet.com';
|
yGeneric_data.webLink = 'yorchnet.com';
|
||||||
yGeneric_data.img = YTB.icon;
|
yGeneric_data.img = YTB.icon;
|
||||||
|
|
||||||
//if yToolBox Exists add it to its tool list.
|
//if yToolBox Exists add it to its tool list.
|
||||||
if (typeof(YTB)!=='undefined'){
|
if (typeof(YTB)!=='undefined'){
|
||||||
|
|
||||||
//it should be called from toolbox.
|
//it should be called from toolbox.
|
||||||
yGeneric_data.buttonWidth=76;
|
yGeneric_data.buttonWidth=76;
|
||||||
yGeneric_data.buttonHeight=30;
|
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.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 { \
|
yGeneric_data.res = "window { \
|
||||||
type:'palette' , text:'"+yGeneric_data.scriptName+' '+yGeneric_data.scriptVer+"',\
|
type:'palette' , text:'"+yGeneric_data.scriptName+' '+yGeneric_data.scriptVer+"',\
|
||||||
\
|
\
|
||||||
\
|
\
|
||||||
info: Group { \
|
info: Group { \
|
||||||
alignment:['center','bottom'], \
|
alignment:['center','bottom'], \
|
||||||
icon: Image {icon:'"+String(yGeneric_data.img.path+"/"+yGeneric_data.img.name)+"',preferredSize: [15, 18]},\
|
icon: Image {icon:'"+String(yGeneric_data.img.path+"/"+yGeneric_data.img.name)+"',preferredSize: [15, 18]},\
|
||||||
website: StaticText { text:'"+yGeneric_data.webLink+"', alignment:['fill','center'] }\
|
website: StaticText { text:'"+yGeneric_data.webLink+"', alignment:['fill','center'] }\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
}";
|
}";
|
||||||
|
|
||||||
//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------
|
//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------
|
||||||
// MAIN SCRIPT GOES HERE.
|
// MAIN SCRIPT GOES HERE.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------
|
//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------
|
||||||
|
|
||||||
function build_yGeneric_data_UI(){
|
function build_yGeneric_data_UI(){
|
||||||
yGeneric_data.window = new Window ( yGeneric_data.res);
|
yGeneric_data.window = new Window ( yGeneric_data.res);
|
||||||
yGeneric_data.window.show();
|
yGeneric_data.window.show();
|
||||||
}
|
}
|
||||||
yGeneric_data.activate = build_yGeneric_data_UI ;
|
yGeneric_data.activate = build_yGeneric_data_UI ;
|
||||||
//alert();
|
//alert();
|
||||||
//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'){
|
||||||
yGeneric_data.activate();
|
yGeneric_data.activate();
|
||||||
//}else{
|
//}else{
|
||||||
//}
|
//}
|
||||||
|
|||||||
@@ -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(YTB)!=='undefined'){
|
if (typeof(YTB)!=='undefined'){
|
||||||
YTB.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: ['"+ YTB.buttonWidth+"','"+ YTB.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(YTB)=='undefined'){
|
if (typeof(YTB)=='undefined'){
|
||||||
yMultiRenamer_data.activate();
|
yMultiRenamer_data.activate();
|
||||||
}else{
|
}else{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// a= yMultiRenamer()
|
// a= yMultiRenamer()
|
||||||
|
|||||||
@@ -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(YTB)!=='undefined'){
|
if (typeof(YTB)!=='undefined'){
|
||||||
YTB.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: ['"+ YTB.buttonWidth+"','"+ YTB.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(YTB)=='undefined'){
|
if (typeof(YTB)=='undefined'){
|
||||||
*/
|
*/
|
||||||
yMultiRenamer_data.activate();
|
yMultiRenamer_data.activate();
|
||||||
/*}else{
|
/*}else{
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// a= yMultiRenamer()
|
// a= yMultiRenamer()
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
@@ -1,24 +1,24 @@
|
|||||||
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.
|
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];
|
||||||
if(p.matchName=="ADBE FreePin3 PosPin Atom"){
|
if(p.matchName=="ADBE FreePin3 PosPin Atom"){
|
||||||
this.selectedPins.push(p);
|
this.selectedPins.push(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this.selectedPins;
|
return this.selectedPins;
|
||||||
}
|
}
|
||||||
|
|
||||||
function yMkUnique(aString){
|
function yMkUnique(aString){
|
||||||
myLayers = app.project.activeItem.layers;
|
myLayers = app.project.activeItem.layers;
|
||||||
uniqueness = 1;
|
uniqueness = 1;
|
||||||
for(i=1;i<=myLayers.length;i++){
|
for(i=1;i<=myLayers.length;i++){
|
||||||
if(aString == myLayers[i].name){
|
if(aString == myLayers[i].name){
|
||||||
uniqueness++;
|
uniqueness++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(aString+'_'+uniqueness);
|
return(aString+'_'+uniqueness);
|
||||||
}
|
}
|
||||||
s = 'asdas_1';
|
s = 'asdas_1';
|
||||||
alert(s.length);
|
alert(s.length);
|
||||||
alert(yMkUnique('apple'))
|
alert(yMkUnique('apple'))
|
||||||
|
|||||||
+108
-108
@@ -1,108 +1,108 @@
|
|||||||
#include "../yScripts/y_JSExtensions.jsx";
|
#include "../yScripts/y_JSExtensions.jsx";
|
||||||
|
|
||||||
yOffsetCornerPin_data = new Object();
|
yOffsetCornerPin_data = new Object();
|
||||||
|
|
||||||
yOffsetCornerPin_data.scriptName = 'YCornerPinOffset';
|
yOffsetCornerPin_data.scriptName = 'YCornerPinOffset';
|
||||||
yOffsetCornerPin_data.scriptDesc = 'Offsets each corner of a CornerPin Effect';
|
yOffsetCornerPin_data.scriptDesc = 'Offsets each corner of a CornerPin Effect';
|
||||||
yOffsetCornerPin_data.scriptVer = '0.1a';
|
yOffsetCornerPin_data.scriptVer = '0.1a';
|
||||||
yOffsetCornerPin_data.webLink = 'yorchnet.com';
|
yOffsetCornerPin_data.webLink = 'yorchnet.com';
|
||||||
|
|
||||||
//if yToolBox Exists add it to its tool list.
|
//if yToolBox Exists add it to its tool list.
|
||||||
if (typeof(YTB)!=='undefined'){
|
if (typeof(YTB)!=='undefined'){
|
||||||
YTB.tools.push(yOffsetCornerPin_data);
|
YTB.tools.push(yOffsetCornerPin_data);
|
||||||
|
|
||||||
//it should be called from toolbox.
|
//it should be called from toolbox.
|
||||||
/*
|
/*
|
||||||
yOffsetCornerPin_data.buttonWidth=76;
|
yOffsetCornerPin_data.buttonWidth=76;
|
||||||
yOffsetCornerPin_data.buttonHeight=30;
|
yOffsetCornerPin_data.buttonHeight=30;
|
||||||
*/
|
*/
|
||||||
yOffsetCornerPin_data.btnLayout = "btn_"+ yOffsetCornerPin_data.scriptName+": Button { preferredSize: ['"+ YTB.buttonWidth+"','"+ YTB.buttonHeight+"'], text:'"+yOffsetCornerPin_data.scriptName+"', helpTip:'"+yOffsetCornerPin_data.scriptDesc+"' }";
|
yOffsetCornerPin_data.btnLayout = "btn_"+ yOffsetCornerPin_data.scriptName+": Button { preferredSize: ['"+ YTB.buttonWidth+"','"+ YTB.buttonHeight+"'], text:'"+yOffsetCornerPin_data.scriptName+"', helpTip:'"+yOffsetCornerPin_data.scriptDesc+"' }";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
yOffsetCornerPin_data.res = "window { \
|
yOffsetCornerPin_data.res = "window { \
|
||||||
type:'palette' , text:'"+yOffsetCornerPin_data.scriptName+' '+yOffsetCornerPin_data.scriptVer+"',\
|
type:'palette' , text:'"+yOffsetCornerPin_data.scriptName+' '+yOffsetCornerPin_data.scriptVer+"',\
|
||||||
\
|
\
|
||||||
\
|
\
|
||||||
info: Group { \
|
info: Group { \
|
||||||
alignment:['center','bottom'], \
|
alignment:['center','bottom'], \
|
||||||
icon: Image {preferredSize: [15, 18]},\
|
icon: Image {preferredSize: [15, 18]},\
|
||||||
website: StaticText { text:'"+yOffsetCornerPin_data.webLink+"', alignment:['fill','center'] },\
|
website: StaticText { text:'"+yOffsetCornerPin_data.webLink+"', alignment:['fill','center'] },\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
}";
|
}";
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------
|
||||||
function getSelectedCornerPins() {
|
function getSelectedCornerPins() {
|
||||||
/* Function that returns a list of effect objects
|
/* Function that returns a list of effect objects
|
||||||
that match any of the names
|
that match any of the names
|
||||||
specified in validCornerPinNames. */
|
specified in validCornerPinNames. */
|
||||||
validCornerPinNames = ["ADBE Corner Pin","CC Power Pin"]
|
validCornerPinNames = ["ADBE Corner Pin","CC Power Pin"]
|
||||||
selectedLayers = app.project.activeItem.selectedLayers
|
selectedLayers = app.project.activeItem.selectedLayers
|
||||||
cornerPins = []
|
cornerPins = []
|
||||||
for (layer=0;layer<selectedLayers.length;layer++){
|
for (layer=0;layer<selectedLayers.length;layer++){
|
||||||
myLayer = selectedLayers[layer];
|
myLayer = selectedLayers[layer];
|
||||||
myEffects = myLayer.property("ADBE Effect Parade");
|
myEffects = myLayer.property("ADBE Effect Parade");
|
||||||
for(effect=1;effect<=myEffects.numProperties;effect++){
|
for(effect=1;effect<=myEffects.numProperties;effect++){
|
||||||
for(validCornerPinName=0;validCornerPinName<validCornerPinNames.length;validCornerPinName++){
|
for(validCornerPinName=0;validCornerPinName<validCornerPinNames.length;validCornerPinName++){
|
||||||
if ( myEffects.property(effect).matchName == validCornerPinNames[validCornerPinName] && myEffects.property(effect).selected == true){
|
if ( myEffects.property(effect).matchName == validCornerPinNames[validCornerPinName] && myEffects.property(effect).selected == true){
|
||||||
cornerPins.push(myEffects.property(effect))
|
cornerPins.push(myEffects.property(effect))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cornerPins
|
return cornerPins
|
||||||
}
|
}
|
||||||
function getLayer(effect){
|
function getLayer(effect){
|
||||||
/* If given a layer's effect object
|
/* If given a layer's effect object
|
||||||
this function returns the layer object */
|
this function returns the layer object */
|
||||||
layer = effect.parentProperty.parentProperty
|
layer = effect.parentProperty.parentProperty
|
||||||
return layer
|
return layer
|
||||||
}
|
}
|
||||||
function addEffect(layer,effect_string,effect_name){
|
function addEffect(layer,effect_string,effect_name){
|
||||||
new_effect = layer.property("ADBE Effect Parade").addProperty(effect_string);
|
new_effect = layer.property("ADBE Effect Parade").addProperty(effect_string);
|
||||||
new_effect.name = effect_name;
|
new_effect.name = effect_name;
|
||||||
return new_effect
|
return new_effect
|
||||||
}
|
}
|
||||||
function addPointControls(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.*/
|
/*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 = {};
|
||||||
local.effect = effect;
|
local.effect = effect;
|
||||||
base_name = local.effect.name;
|
base_name = local.effect.name;
|
||||||
names = ["Upper Left","Upper Right","Lower Left","Lower Right"];
|
names = ["Upper Left","Upper Right","Lower Left","Lower Right"];
|
||||||
|
|
||||||
for (i=1;i<=4;i++){
|
for (i=1;i<=4;i++){
|
||||||
expression = 'try{\
|
expression = 'try{\
|
||||||
effect("'+base_name+'")('+(i)+')+effect("'+base_name+'_'+names[i-1]+'_'+'Offset'+'")("Point")\
|
effect("'+base_name+'")('+(i)+')+effect("'+base_name+'_'+names[i-1]+'_'+'Offset'+'")("Point")\
|
||||||
}catch(err){\
|
}catch(err){\
|
||||||
[0,0]\
|
[0,0]\
|
||||||
}'
|
}'
|
||||||
local.effect.property(i).expression = expression;
|
local.effect.property(i).expression = expression;
|
||||||
}
|
}
|
||||||
layer = getLayer(effect);
|
layer = getLayer(effect);
|
||||||
for(i=0;i<=3;i++){
|
for(i=0;i<=3;i++){
|
||||||
new_effect = addEffect(layer,"Point Control",base_name+"_"+names[i]+"_"+"Offset");
|
new_effect = addEffect(layer,"Point Control",base_name+"_"+names[i]+"_"+"Offset");
|
||||||
new_effect.property("Point").setValue([0,0]);
|
new_effect.property("Point").setValue([0,0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function processCornerPins(){
|
function processCornerPins(){
|
||||||
app.beginUndoGroup('ySetProject');
|
app.beginUndoGroup('ySetProject');
|
||||||
pins = getSelectedCornerPins();
|
pins = getSelectedCornerPins();
|
||||||
for(pin=0;pin<pins.length;pin++){
|
for(pin=0;pin<pins.length;pin++){
|
||||||
addPointControls(pins[pin])
|
addPointControls(pins[pin])
|
||||||
}
|
}
|
||||||
app.endUndoGroup();
|
app.endUndoGroup();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
function build_yOffsetCornerPin_data_UI(){
|
function build_yOffsetCornerPin_data_UI(){
|
||||||
yOffsetCornerPin_data.window = new Window ( yOffsetCornerPin_data.res);
|
yOffsetCornerPin_data.window = new Window ( yOffsetCornerPin_data.res);
|
||||||
yOffsetCornerPin_data.window.show();
|
yOffsetCornerPin_data.window.show();
|
||||||
}
|
}
|
||||||
yOffsetCornerPin_data.activate =processCornerPins ;
|
yOffsetCornerPin_data.activate =processCornerPins ;
|
||||||
|
|
||||||
//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'){
|
||||||
yOffsetCornerPin_data.activate();
|
yOffsetCornerPin_data.activate();
|
||||||
}else{
|
}else{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,80 +1,89 @@
|
|||||||
#include "../yScripts/y_JSExtensions.jsx";
|
#include "../yScripts/y_JSExtensions.jsx";
|
||||||
function YGenericTool()
|
function YGenericTool()
|
||||||
{
|
{
|
||||||
this.info =
|
this.info =
|
||||||
{
|
{
|
||||||
name : "yGenericTool",
|
name : "yGenericTool",
|
||||||
version : 0.0,
|
version : 0.0,
|
||||||
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.",
|
||||||
url : "yorchnet.com"
|
url : "yorchnet.com"
|
||||||
};
|
};
|
||||||
this.appearence =
|
this.appearence =
|
||||||
{
|
{
|
||||||
buttonHeight : 30,
|
buttonHeight : 30,
|
||||||
buttonWidth : 126
|
buttonWidth : 126
|
||||||
};
|
};
|
||||||
this.resources =
|
this.resources =
|
||||||
{
|
{
|
||||||
icon : new File('yNet.png'),
|
icon : new File('yNet.png'),
|
||||||
};
|
};
|
||||||
this.init = function init()
|
this.init = function init()
|
||||||
{
|
{
|
||||||
|
|
||||||
this.btnLauyout =
|
this.btnLauyout =
|
||||||
"button\
|
"button\
|
||||||
{\
|
{\
|
||||||
preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'],\
|
preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'],\
|
||||||
text:'" + this.info.name + "',\
|
text:'" + this.info.name + "',\
|
||||||
helpTip:'" + this.info.description + "'\
|
helpTip:'" + this.info.description + "'\
|
||||||
}";
|
}";
|
||||||
|
|
||||||
this. res =
|
this. res =
|
||||||
"window\
|
"window\
|
||||||
{\
|
{\
|
||||||
type:'palette',\
|
type:'palette',\
|
||||||
text:'" + this.info.name + ' ' + this.info.ver + ' ' + this.info.stage + "',\
|
text:'" + this.info.name + ' ' + this.info.ver + ' ' + this.info.stage + "',\
|
||||||
info: Group \
|
info: Group \
|
||||||
{\
|
{\
|
||||||
alignment:['center','bottom'],\
|
alignment:['center','bottom'],\
|
||||||
icon: Image \
|
icon: Image \
|
||||||
{\
|
{\
|
||||||
icon:'" + this.resources.icon.path + '/' + this.resources.icon.name + "',\
|
icon:'" + this.resources.icon.path + '/' + this.resources.icon.name + "',\
|
||||||
preferredSize: [15, 18]\
|
preferredSize: [15, 18]\
|
||||||
},\
|
},\
|
||||||
website: StaticText\
|
website: StaticText\
|
||||||
{\
|
{\
|
||||||
text:'" + this.info.url + "',\
|
text:'" + this.info.url + "',\
|
||||||
alignment:['fill','center']\
|
alignment:['fill','center']\
|
||||||
},\
|
},\
|
||||||
}\
|
}\
|
||||||
}";
|
}";
|
||||||
}
|
}
|
||||||
this.createUI = function createUI()
|
this.createUI = function createUI()
|
||||||
{
|
{
|
||||||
this.window = new Window ( this.res );
|
res =
|
||||||
this.window.show() ;
|
"window {\
|
||||||
}
|
resizeable : true\
|
||||||
this.yMainFunction = function yMainFunction()
|
closeButton : true\
|
||||||
{
|
text:'wtf'\
|
||||||
this.createUI();
|
}"
|
||||||
app.beginUndoGroup( this.info.name );
|
|
||||||
app.endUndoGroup();
|
this.window = new Window( res );
|
||||||
}
|
this.window.layout.layout(true);
|
||||||
|
this.window.center();
|
||||||
this.activate = this.yMainFunction;
|
this.window.show();
|
||||||
|
}
|
||||||
this.init();
|
this.yMainFunction = function yMainFunction()
|
||||||
return this;
|
{
|
||||||
}
|
this.createUI();
|
||||||
|
}
|
||||||
//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own.
|
this.activate = function activate()
|
||||||
if (typeof(YTB)=='undefined')
|
{
|
||||||
{
|
this.yTool.yMainFunction();
|
||||||
yGenericTool = new YGenericTool();
|
}
|
||||||
yGenericTool.activate();
|
|
||||||
}
|
this.init();
|
||||||
else
|
return this;
|
||||||
{
|
}
|
||||||
YTB.addTool(new YGenericTool());
|
|
||||||
}
|
//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own.
|
||||||
|
if (typeof(YTB)=='undefined')
|
||||||
|
{
|
||||||
|
yGenericTool = new YGenericTool();
|
||||||
|
yGenericTool.activate();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
YTB.addTool(new YGenericTool());
|
||||||
|
}
|
||||||
|
|||||||
+17
-17
@@ -1,17 +1,17 @@
|
|||||||
if (Array.prototype.getOne==null) Array.prototype.getOne=function(item){ //Extends the Array class with the getOne functions wich
|
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){
|
||||||
var val = i;
|
var val = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
function yFactor(n,f){
|
function yFactor(n,f){
|
||||||
if((typeof(n)=='number'&&typeof(f)=='number')&&(n>f)){
|
if((typeof(n)=='number'&&typeof(f)=='number')&&(n>f)){
|
||||||
value = n - (n%f);
|
value = n - (n%f);
|
||||||
return(value);
|
return(value);
|
||||||
}else{
|
}else{
|
||||||
alert('error');
|
alert('error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+120
-120
@@ -1,120 +1,120 @@
|
|||||||
#include "../yScripts/y_JSExtensions.jsx";
|
#include "../yScripts/y_JSExtensions.jsx";
|
||||||
#include "usefulFunctions.jsx";
|
#include "usefulFunctions.jsx";
|
||||||
|
|
||||||
function YColorProbe()
|
function YColorProbe()
|
||||||
{
|
{
|
||||||
this.info =
|
this.info =
|
||||||
{
|
{
|
||||||
name : "yColorProbe",
|
name : "yColorProbe",
|
||||||
version : 0.0,
|
version : 0.0,
|
||||||
stage : "development",
|
stage : "development",
|
||||||
description : "Creates a Null that will Sample the selected layer within the specified radius.",
|
description : "Creates a Null that will Sample the selected layer within the specified radius.",
|
||||||
url : "yorchnet.com"
|
url : "yorchnet.com"
|
||||||
};
|
};
|
||||||
this.appearence =
|
this.appearence =
|
||||||
{
|
{
|
||||||
buttonHeight : 30,
|
buttonHeight : 30,
|
||||||
buttonWidth : 126
|
buttonWidth : 126
|
||||||
};
|
};
|
||||||
this.resources =
|
this.resources =
|
||||||
{
|
{
|
||||||
icon : new File('yNet.png'),
|
icon : new File('yNet.png'),
|
||||||
};
|
};
|
||||||
this.init = function init()
|
this.init = function init()
|
||||||
{
|
{
|
||||||
|
|
||||||
this.btnLauyout =
|
this.btnLauyout =
|
||||||
"button\
|
"button\
|
||||||
{\
|
{\
|
||||||
preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'],\
|
preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'],\
|
||||||
text:'" + this.info.name + "',\
|
text:'" + this.info.name + "',\
|
||||||
helpTip:'" + this.info.description + "'\
|
helpTip:'" + this.info.description + "'\
|
||||||
}";
|
}";
|
||||||
|
|
||||||
this. res =
|
this. res =
|
||||||
"window\
|
"window\
|
||||||
{\
|
{\
|
||||||
type:'palette',\
|
type:'palette',\
|
||||||
text:'" + this.info.name + ' ' + this.info.ver + ' ' + this.info.stage + "',\
|
text:'" + this.info.name + ' ' + this.info.ver + ' ' + this.info.stage + "',\
|
||||||
info: Group \
|
info: Group \
|
||||||
{\
|
{\
|
||||||
alignment:['center','bottom'],\
|
alignment:['center','bottom'],\
|
||||||
icon: Image \
|
icon: Image \
|
||||||
{\
|
{\
|
||||||
icon:'" + this.resources.icon.path + '/' + this.resources.icon.name + "',\
|
icon:'" + this.resources.icon.path + '/' + this.resources.icon.name + "',\
|
||||||
preferredSize: [15, 18]\
|
preferredSize: [15, 18]\
|
||||||
},\
|
},\
|
||||||
website: StaticText\
|
website: StaticText\
|
||||||
{\
|
{\
|
||||||
text:'" + this.info.url + "',\
|
text:'" + this.info.url + "',\
|
||||||
alignment:['fill','center']\
|
alignment:['fill','center']\
|
||||||
},\
|
},\
|
||||||
}\
|
}\
|
||||||
}";
|
}";
|
||||||
}
|
}
|
||||||
this.getInfo = function getInfo( )
|
this.getInfo = function getInfo( )
|
||||||
{
|
{
|
||||||
alert("asdasdasd");
|
alert("asdasdasd");
|
||||||
}
|
}
|
||||||
this.createUI = function createUI()
|
this.createUI = function createUI()
|
||||||
{
|
{
|
||||||
this.window = new Window ( this.res );
|
this.window = new Window ( this.res );
|
||||||
this.window.show() ;
|
this.window.show() ;
|
||||||
}
|
}
|
||||||
this.yMainFunction = function yMainFunction()
|
this.yMainFunction = function yMainFunction()
|
||||||
{
|
{
|
||||||
app.beginUndoGroup(this.yTool.info.name); // yTool is a refernece to the Tool object, because THIS in this context returns the ButtonObject....
|
app.beginUndoGroup(this.yTool.info.name); // yTool is a refernece to the Tool object, because THIS in this context returns the ButtonObject....
|
||||||
|
|
||||||
//It works with Sampled layers at a 100% scale only.
|
//It works with Sampled layers at a 100% scale only.
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
sel = app.project.activeItem.selectedLayers[0];
|
sel = app.project.activeItem.selectedLayers[0];
|
||||||
}
|
}
|
||||||
catch (err)
|
catch (err)
|
||||||
{
|
{
|
||||||
sel = undefined;
|
sel = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
myNull = app.project.activeItem.layers.addNull();
|
myNull = app.project.activeItem.layers.addNull();
|
||||||
myNull.transform.anchorPoint.setValue([50,50]);
|
myNull.transform.anchorPoint.setValue([50,50]);
|
||||||
myNull.name = yUniStr('colorProbe'); //Generates a Unique Name by adding numbers at the end of the main string.
|
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 = myNull("Effects").addProperty("Layer Control");
|
||||||
layerCTRL.name='sampledLayer';
|
layerCTRL.name='sampledLayer';
|
||||||
colorCTRL = myNull("Effects").addProperty("Color Control");
|
colorCTRL = myNull("Effects").addProperty("Color Control");
|
||||||
colorCTRL.name='outColor';
|
colorCTRL.name='outColor';
|
||||||
radiusCTRL = myNull("Effects").addProperty("Slider Control");
|
radiusCTRL = myNull("Effects").addProperty("Slider Control");
|
||||||
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 = thisLayer.toWorld(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;
|
||||||
myNull.source.width=30;
|
myNull.source.width=30;
|
||||||
myNull.anchorPoint=(15,15);
|
myNull.anchorPoint=(15,15);
|
||||||
|
|
||||||
if(sel!==undefined){
|
if(sel!==undefined){
|
||||||
myNull("Effects")('sampledLayer')(1).setValue(sel.index);
|
myNull("Effects")('sampledLayer')(1).setValue(sel.index);
|
||||||
}
|
}
|
||||||
|
|
||||||
app.endUndoGroup();
|
app.endUndoGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.activate = this.yMainFunction;
|
this.activate = this.yMainFunction;
|
||||||
|
|
||||||
this.init();
|
this.init();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
//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')
|
||||||
{
|
{
|
||||||
yColorProbe = new YColorProbe();
|
yColorProbe = new YColorProbe();
|
||||||
yColorProbe.activate();
|
yColorProbe.activate();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
YTB.addTool(new YColorProbe());
|
YTB.addTool(new YColorProbe());
|
||||||
}
|
}
|
||||||
|
|||||||
+245
-245
@@ -1,245 +1,245 @@
|
|||||||
yPuppetRig_data = new Object();
|
yPuppetRig_data = new Object();
|
||||||
|
|
||||||
yPuppetRig_data.scriptName = 'yPuppetRigger';
|
yPuppetRig_data.scriptName = 'yPuppetRigger';
|
||||||
yPuppetRig_data.scriptVer = 'v0.3.3a';
|
yPuppetRig_data.scriptVer = 'v0.3.3a';
|
||||||
yPuppetRig_data.scriptDesc = 'Tools for streamlining puppet-based animation rigs.';
|
yPuppetRig_data.scriptDesc = 'Tools for streamlining puppet-based animation rigs.';
|
||||||
yPuppetRig_data.string_info = 'yorchnet.com';
|
yPuppetRig_data.string_info = 'yorchnet.com';
|
||||||
yPuppetRig_data.e_000 = 'e_000 : No layers are selected.';
|
yPuppetRig_data.e_000 = 'e_000 : No layers are selected.';
|
||||||
yPuppetRig_data.e_001 = 'e_001 : Layer contains no effects.';
|
yPuppetRig_data.e_001 = 'e_001 : Layer contains no effects.';
|
||||||
yPuppetRig_data.e_002 = 'e_002 : Layer contains no Puppet effects.';
|
yPuppetRig_data.e_002 = 'e_002 : Layer contains no Puppet effects.';
|
||||||
yPuppetRig_data.string_001 = 'Rig Pins';
|
yPuppetRig_data.string_001 = 'Rig Pins';
|
||||||
yPuppetRig_data.string_001x = 'Rigs Selected Pins on Layer';
|
yPuppetRig_data.string_001x = 'Rigs Selected Pins on Layer';
|
||||||
yPuppetRig_data.string_002 = 'Rig Layers';
|
yPuppetRig_data.string_002 = 'Rig Layers';
|
||||||
yPuppetRig_data.string_002x = 'Rigs Selected Layers';
|
yPuppetRig_data.string_002x = 'Rigs Selected Layers';
|
||||||
yPuppetRig_data.string_003 = 'Rig All';
|
yPuppetRig_data.string_003 = 'Rig All';
|
||||||
yPuppetRig_data.string_003x = 'Rig All Layers in Comp';
|
yPuppetRig_data.string_003x = 'Rig All Layers in Comp';
|
||||||
|
|
||||||
|
|
||||||
//it should be called from toolbox.
|
//it should be called from toolbox.
|
||||||
yPuppetRig_data.buttonWidth=76;
|
yPuppetRig_data.buttonWidth=76;
|
||||||
yPuppetRig_data.buttonHeight=30;
|
yPuppetRig_data.buttonHeight=30;
|
||||||
|
|
||||||
//if yToolBox Exists add it to its tool list.
|
//if yToolBox Exists add it to its tool list.
|
||||||
if (typeof(YTB)!=='undefined'){
|
if (typeof(YTB)!=='undefined'){
|
||||||
YTB.tools.push(yPuppetRig_data);
|
YTB.tools.push(yPuppetRig_data);
|
||||||
yPuppetRig_data.btnLayout = "btn_"+ yPuppetRig_data.scriptName+": Button { preferredSize: ['"+YTB.buttonWidth+"','"+ YTB.buttonHeight+"'], text:'"+yPuppetRig_data.scriptName+"', helpTip:'"+yPuppetRig_data.scriptDesc+"' }";
|
yPuppetRig_data.btnLayout = "btn_"+ yPuppetRig_data.scriptName+": Button { preferredSize: ['"+YTB.buttonWidth+"','"+ YTB.buttonHeight+"'], text:'"+yPuppetRig_data.scriptName+"', helpTip:'"+yPuppetRig_data.scriptDesc+"' }";
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_yPuppetRig_data_UI(){
|
function build_yPuppetRig_data_UI(){
|
||||||
//define custom strings for error messages, names, button names and helpTips. //Defines Layout variables.
|
//define custom strings for error messages, names, button names and helpTips. //Defines Layout variables.
|
||||||
|
|
||||||
yPuppetRig_data.res = "window { \
|
yPuppetRig_data.res = "window { \
|
||||||
type:'palette' , text:'"+yPuppetRig_data.scriptName+" "+yPuppetRig_data.scriptVer+"',margins:[10,10,10,10],spacing:[5,5,5,5],\
|
type:'palette' , text:'"+yPuppetRig_data.scriptName+" "+yPuppetRig_data.scriptVer+"',margins:[10,10,10,10],spacing:[5,5,5,5],\
|
||||||
grp: Group { orientation:'column' , alignment:['fill','fill'] , alignChildren:['fill','fill'] , spacing:'2' , margin:'5', \
|
grp: Group { orientation:'column' , alignment:['fill','fill'] , alignChildren:['fill','fill'] , spacing:'2' , margin:'5', \
|
||||||
btn_01: Button { preferredSize: ['"+yPuppetRig_data.buttonWidth+"','"+yPuppetRig_data.buttonHeight+"'], text:'"+yPuppetRig_data.string_001+"', helpTip:'"+yPuppetRig_data.string_001x+"' }, \
|
btn_01: Button { preferredSize: ['"+yPuppetRig_data.buttonWidth+"','"+yPuppetRig_data.buttonHeight+"'], text:'"+yPuppetRig_data.string_001+"', helpTip:'"+yPuppetRig_data.string_001x+"' }, \
|
||||||
btn_02: Button { preferredSize: ['"+yPuppetRig_data.buttonWidth+"','"+yPuppetRig_data.buttonHeight+"'], text:'"+yPuppetRig_data.string_002+"', helpTip:'"+yPuppetRig_data.string_002x+"' }, \
|
btn_02: Button { preferredSize: ['"+yPuppetRig_data.buttonWidth+"','"+yPuppetRig_data.buttonHeight+"'], text:'"+yPuppetRig_data.string_002+"', helpTip:'"+yPuppetRig_data.string_002x+"' }, \
|
||||||
btn_03: Button { preferredSize: ['"+yPuppetRig_data.buttonWidth+"','"+yPuppetRig_data.buttonHeight+"'], text:'"+yPuppetRig_data.string_003+"', helpTip:'"+yPuppetRig_data.string_003x+"' }, \
|
btn_03: Button { preferredSize: ['"+yPuppetRig_data.buttonWidth+"','"+yPuppetRig_data.buttonHeight+"'], text:'"+yPuppetRig_data.string_003+"', helpTip:'"+yPuppetRig_data.string_003x+"' }, \
|
||||||
chk_optn: Checkbox { text:'Enable Options', alignment:['fill','center'] , helpTip:'Enable Advanced Options' },\
|
chk_optn: Checkbox { text:'Enable Options', alignment:['fill','center'] , helpTip:'Enable Advanced Options' },\
|
||||||
optn: Panel{ text:'Options' , visible:'false', orientation:'row' , alignment:['fill','fill'] , alignChildren:['fill','fill'] , spacing:'2' , margin:'5', \
|
optn: Panel{ text:'Options' , visible:'false', orientation:'row' , alignment:['fill','fill'] , alignChildren:['fill','fill'] , spacing:'2' , margin:'5', \
|
||||||
nullSizeGrp: Group{ \
|
nullSizeGrp: Group{ \
|
||||||
orientation:'column' , alignment:['fill','fill'] , alignChildren:['fill','fill'] , spacing:'2' , margin:'5', \
|
orientation:'column' , alignment:['fill','fill'] , alignChildren:['fill','fill'] , spacing:'2' , margin:'5', \
|
||||||
sldr_tit: StaticText { text:'Set Null Size in Pixels.', alignment:['fill','center'] },\
|
sldr_tit: StaticText { text:'Set Null Size in Pixels.', alignment:['fill','center'] },\
|
||||||
sldr: Slider { value:'125' , minvalue:'6' , maxvalue:'250' , text:'alaverga', helpTip:'"+yPuppetRig_data.string_001x+"' }, \
|
sldr: Slider { value:'125' , minvalue:'6' , maxvalue:'250' , text:'alaverga', helpTip:'"+yPuppetRig_data.string_001x+"' }, \
|
||||||
sldr_Values_txt: Group{\
|
sldr_Values_txt: Group{\
|
||||||
orientation:'row' , alignment:['fill','fill'] , alignChildren:['center','fill'] , spacing:'2' , margin:'5', \
|
orientation:'row' , alignment:['fill','fill'] , alignChildren:['center','fill'] , spacing:'2' , margin:'5', \
|
||||||
mintxt: StaticText { text:'small', alignment:['left','fill'] },\
|
mintxt: StaticText { text:'small', alignment:['left','fill'] },\
|
||||||
medtxt: StaticText { text:'medium', alignment:['center','fill'] },\
|
medtxt: StaticText { text:'medium', alignment:['center','fill'] },\
|
||||||
maxtxt: StaticText { text:'big', alignment:['right','fill'] },\
|
maxtxt: StaticText { text:'big', alignment:['right','fill'] },\
|
||||||
}\
|
}\
|
||||||
otherOptionsGrp: Group{ \
|
otherOptionsGrp: Group{ \
|
||||||
orientation:'row' , alignment:['fill','fill'] , alignChildren:['fill','fill'] , spacing:'8' , margin:'5', \
|
orientation:'row' , alignment:['fill','fill'] , alignChildren:['fill','fill'] , spacing:'8' , margin:'5', \
|
||||||
chk_box_01: Checkbox { text:'Enable Draft Mode.', alignment:['fill','center'] , helpTip:'Mostly for oldschool pixelated stuff' },\
|
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.' },\
|
chk_box_02: Checkbox { text:'Lock Layer', alignment:['fill','center'] , helpTip:'Lock layer after rigging.' },\
|
||||||
},\
|
},\
|
||||||
}\
|
}\
|
||||||
},\
|
},\
|
||||||
info: Group { \
|
info: Group { \
|
||||||
alignment:['center','bottom'], \
|
alignment:['center','bottom'], \
|
||||||
icn_app: Image {icon:'"+ YTB.icon.path+'/'+ YTB.icon.name+"',preferredSize: [15, 18]},\
|
icn_app: Image {icon:'"+ YTB.icon.path+'/'+ YTB.icon.name+"',preferredSize: [15, 18]},\
|
||||||
txt_info: StaticText { text:'"+yPuppetRig_data.string_info+"', alignment:['fill','center'] },\
|
txt_info: StaticText { text:'"+yPuppetRig_data.string_info+"', alignment:['fill','center'] },\
|
||||||
}\
|
}\
|
||||||
}\
|
}\
|
||||||
}";
|
}";
|
||||||
|
|
||||||
//if (typeof(YTB)!=='undefined'){
|
//if (typeof(YTB)!=='undefined'){
|
||||||
yPuppetRigDialog = new Window (yPuppetRig_data.res); // Creates Window
|
yPuppetRigDialog = new Window (yPuppetRig_data.res); // Creates Window
|
||||||
//}
|
//}
|
||||||
//yPuppetRigDialog.onDraw = customColors(yPuppetRigDialog);
|
//yPuppetRigDialog.onDraw = customColors(yPuppetRigDialog);
|
||||||
yPuppetRigDialog.grp.optn.enabled = false;
|
yPuppetRigDialog.grp.optn.enabled = false;
|
||||||
yPuppetRigDialog.show(); //Shows Window.
|
yPuppetRigDialog.show(); //Shows Window.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//yPuppetRigDialog.grp.info.icn_app.image = YTB.icon.substring(3,YTB.icon.length);
|
//yPuppetRigDialog.grp.info.icn_app.image = YTB.icon.substring(3,YTB.icon.length);
|
||||||
yPuppetRigDialog.grp.btn_01.onClick = runRigPin; //Defines Button Action
|
yPuppetRigDialog.grp.btn_01.onClick = runRigPin; //Defines Button Action
|
||||||
yPuppetRigDialog.grp.btn_02.onClick = runRigLayer; //Defines Button Action
|
yPuppetRigDialog.grp.btn_02.onClick = runRigLayer; //Defines Button Action
|
||||||
yPuppetRigDialog.grp.btn_03.onClick = runRigAll; //Defines Button Action
|
yPuppetRigDialog.grp.btn_03.onClick = runRigAll; //Defines Button Action
|
||||||
yPuppetRigDialog.grp.chk_optn.onClick = toggleOptions;
|
yPuppetRigDialog.grp.chk_optn.onClick = toggleOptions;
|
||||||
}
|
}
|
||||||
yPuppetRig_data.activate = build_yPuppetRig_data_UI ;
|
yPuppetRig_data.activate = build_yPuppetRig_data_UI ;
|
||||||
|
|
||||||
|
|
||||||
function toggleOptions(){
|
function toggleOptions(){
|
||||||
if(yPuppetRigDialog.grp.chk_optn==true){
|
if(yPuppetRigDialog.grp.chk_optn==true){
|
||||||
yPuppetRigDialog.grp.chk_optn=false;
|
yPuppetRigDialog.grp.chk_optn=false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
yPuppetRigDialog.grp.chk_optn=true;
|
yPuppetRigDialog.grp.chk_optn=true;
|
||||||
}
|
}
|
||||||
yPuppetRigDialog.grp.optn.enabled = yPuppetRigDialog.grp.chk_optn;
|
yPuppetRigDialog.grp.optn.enabled = yPuppetRigDialog.grp.chk_optn;
|
||||||
}
|
}
|
||||||
function customColors(rsr){
|
function customColors(rsr){
|
||||||
g = rsr.graphics;
|
g = rsr.graphics;
|
||||||
myBrush = g.newBrush(g.BrushType.SOLID_COLOR, [0.25, 0.05, 0.25, 1]);
|
myBrush = g.newBrush(g.BrushType.SOLID_COLOR, [0.25, 0.05, 0.25, 1]);
|
||||||
g.backgroundColor = yToolBoxPalette.graphics.backgroundColor;
|
g.backgroundColor = yToolBoxPalette.graphics.backgroundColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPuppetEffects(aLayer){
|
function getPuppetEffects(aLayer){
|
||||||
puppetEffects = []
|
puppetEffects = []
|
||||||
for(i=1;i<=aLayer('Effects').numProperties;i++){
|
for(i=1;i<=aLayer('Effects').numProperties;i++){
|
||||||
puppetEffects.push(aLayer('Effects')(i));
|
puppetEffects.push(aLayer('Effects')(i));
|
||||||
}
|
}
|
||||||
return puppetEffects;
|
return puppetEffects;
|
||||||
}
|
}
|
||||||
function getPosPins(aLayer){
|
function getPosPins(aLayer){
|
||||||
puppetEffects = getPuppetEffects(aLayer);
|
puppetEffects = getPuppetEffects(aLayer);
|
||||||
if(puppetEffects.length>0){
|
if(puppetEffects.length>0){
|
||||||
posPins = [];
|
posPins = [];
|
||||||
for(i=0;i<puppetEffects.length;i++){
|
for(i=0;i<puppetEffects.length;i++){
|
||||||
posPinGroup = puppetEffects[i]('ADBE FreePin3 ARAP Group')('ADBE FreePin3 Mesh Group')('ADBE FreePin3 Mesh Atom')('ADBE FreePin3 PosPins');
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return posPins;
|
return posPins;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
writeLn('No FreePin3 Effect found on Layer');
|
writeLn('No FreePin3 Effect found on Layer');
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function rigPins(aLayer,selectedOnly){
|
function rigPins(aLayer,selectedOnly){
|
||||||
pins = getPosPins(aLayer);
|
pins = getPosPins(aLayer);
|
||||||
selectedPins = [];
|
selectedPins = [];
|
||||||
createdNulls =[];
|
createdNulls =[];
|
||||||
for(i=0;i<pins.length;i++){
|
for(i=0;i<pins.length;i++){
|
||||||
selectedPins.push(pins[i].selected)
|
selectedPins.push(pins[i].selected)
|
||||||
}
|
}
|
||||||
setPropsFromUI();
|
setPropsFromUI();
|
||||||
|
|
||||||
for(i=0;i<pins.length;i++){
|
for(i=0;i<pins.length;i++){
|
||||||
if(selectedPins[i]||!selectedOnly){
|
if(selectedPins[i]||!selectedOnly){
|
||||||
|
|
||||||
createdNulls.push([app.project.activeItem.layers.addNull(),pins[i]]);// populate register of created Nulls, associated with the pin property groups that will be controlled by them.
|
createdNulls.push([app.project.activeItem.layers.addNull(),pins[i]]);// populate register of created Nulls, associated with the pin property groups that will be controlled by them.
|
||||||
createdNulls[i][0].source.height = createdNulls[i][0].source.width = nullSize;
|
createdNulls[i][0].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].name = aLayer.name+"_"+createdNulls[i][1].name; //set nulls name to it's parent layer's name + the puppuet point name.
|
||||||
createdNulls[i][0].label = aLayer.label; // set nulls label equalt to its parent layer.
|
createdNulls[i][0].label = aLayer.label; // set nulls label equalt to its parent layer.
|
||||||
createdNulls[i][0].transform.anchorPoint.setValue([createdNulls[i][0].source.width/2,createdNulls[i][0].source.height/2]); //center pivot of created nulls
|
createdNulls[i][0].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.
|
createdNulls[i][0].moveBefore(aLayer); //stack created null on top of original layer.
|
||||||
pinPosition = createdNulls[i][1]('ADBE FreePin3 PosPin Position').value;
|
pinPosition = createdNulls[i][1]('ADBE FreePin3 PosPin Position').value;
|
||||||
aLayerPosition = aLayer('ADBE Transform Group')('ADBE Position').value;
|
aLayerPosition = aLayer('ADBE Transform Group')('ADBE Position').value;
|
||||||
aLayerAnchorPoint = aLayer('ADBE Transform Group')('ADBE Anchor Point').value;
|
aLayerAnchorPoint = aLayer('ADBE Transform Group')('ADBE Anchor Point').value;
|
||||||
createdNulls[i][0].transform.position.setValue(pinPosition+aLayerPosition-aLayerAnchorPoint); //needs a toWorld Function
|
createdNulls[i][0].transform.position.setValue(pinPosition+aLayerPosition-aLayerAnchorPoint); //needs a toWorld Function
|
||||||
txtExpression = 'l = thisComp.layer('+'"'+createdNulls[i][0].name+'"'+');\
|
txtExpression = 'l = thisComp.layer('+'"'+createdNulls[i][0].name+'"'+');\
|
||||||
'+'fromWorld(l.toComp(l.transform.anchorPoint))';
|
'+'fromWorld(l.toComp(l.transform.anchorPoint))';
|
||||||
createdNulls[i][1]('ADBE FreePin3 PosPin Position').expression = txtExpression;
|
createdNulls[i][1]('ADBE FreePin3 PosPin Position').expression = txtExpression;
|
||||||
|
|
||||||
//there has to be a way to re select the original layer one had selected.
|
//there has to be a way to re select the original layer one had selected.
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
createdNulls.push([null,null])
|
createdNulls.push([null,null])
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//stuff to apply to main layer
|
//stuff to apply to main layer
|
||||||
aLayer.quality = layerQuality;
|
aLayer.quality = layerQuality;
|
||||||
aLayer.locked = layerLock;
|
aLayer.locked = layerLock;
|
||||||
|
|
||||||
pins = null;
|
pins = null;
|
||||||
selectedPins = null;
|
selectedPins = null;
|
||||||
createdNulls = null;
|
createdNulls = null;
|
||||||
pinPosition = null;
|
pinPosition = null;
|
||||||
aLayerPosition= null;
|
aLayerPosition= null;
|
||||||
aLayerAnchorPoint = null;
|
aLayerAnchorPoint = null;
|
||||||
txtExpression = null;
|
txtExpression = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
function runRigPin(){
|
function runRigPin(){
|
||||||
|
|
||||||
/* NOT WORKING YET
|
/* NOT WORKING YET
|
||||||
app.beginUndoGroup(string_001);
|
app.beginUndoGroup(string_001);
|
||||||
allLayers = app.project.activeItem.layers;
|
allLayers = app.project.activeItem.layers;
|
||||||
workLayers = [];
|
workLayers = [];
|
||||||
for(i=1;i<=allLayers.length;i++){
|
for(i=1;i<=allLayers.length;i++){
|
||||||
if(allLayers[i].selected){
|
if(allLayers[i].selected){
|
||||||
workLayers.push(allLayers[i]);
|
workLayers.push(allLayers[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(x=0;x<workLayers.length;x++){
|
for(x=0;x<workLayers.length;x++){
|
||||||
rigPins(workLayers[x],false);
|
rigPins(workLayers[x],false);
|
||||||
}
|
}
|
||||||
app.endUndoGroup();
|
app.endUndoGroup();
|
||||||
*/
|
*/
|
||||||
app.beginUndoGroup(yPuppetRig_data.string_001);
|
app.beginUndoGroup(yPuppetRig_data.string_001);
|
||||||
sel =app.project.activeItem.selectedLayers;
|
sel =app.project.activeItem.selectedLayers;
|
||||||
setPropsFromUI();
|
setPropsFromUI();
|
||||||
rigPins(sel[0],true);
|
rigPins(sel[0],true);
|
||||||
app.endUndoGroup();
|
app.endUndoGroup();
|
||||||
}
|
}
|
||||||
function runRigLayer(){
|
function runRigLayer(){
|
||||||
app.beginUndoGroup(yPuppetRig_data.string_002);
|
app.beginUndoGroup(yPuppetRig_data.string_002);
|
||||||
allLayers = app.project.activeItem.layers;
|
allLayers = app.project.activeItem.layers;
|
||||||
workLayers = [];
|
workLayers = [];
|
||||||
for(i=1;i<=allLayers.length;i++){
|
for(i=1;i<=allLayers.length;i++){
|
||||||
if(allLayers[i].selected){
|
if(allLayers[i].selected){
|
||||||
workLayers.push(allLayers[i]);
|
workLayers.push(allLayers[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(x=0;x<workLayers.length;x++){
|
for(x=0;x<workLayers.length;x++){
|
||||||
rigPins(workLayers[x],false);
|
rigPins(workLayers[x],false);
|
||||||
}
|
}
|
||||||
app.endUndoGroup();
|
app.endUndoGroup();
|
||||||
|
|
||||||
}
|
}
|
||||||
function runRigAll(){
|
function runRigAll(){
|
||||||
app.beginUndoGroup(yPuppetRig_data.string_003);
|
app.beginUndoGroup(yPuppetRig_data.string_003);
|
||||||
allLayers = app.project.activeItem.layers;
|
allLayers = app.project.activeItem.layers;
|
||||||
workLayers = [];
|
workLayers = [];
|
||||||
for(i=1;i<=allLayers.length;i++){
|
for(i=1;i<=allLayers.length;i++){
|
||||||
workLayers.push(allLayers[i]);
|
workLayers.push(allLayers[i]);
|
||||||
}
|
}
|
||||||
for(x=0;x<workLayers.length;x++){
|
for(x=0;x<workLayers.length;x++){
|
||||||
rigPins(workLayers[x],false);
|
rigPins(workLayers[x],false);
|
||||||
}
|
}
|
||||||
app.endUndoGroup();
|
app.endUndoGroup();
|
||||||
}
|
}
|
||||||
function setPropsFromUI(){
|
function setPropsFromUI(){
|
||||||
nullSize = yFactor(parseInt(yPuppetRigDialog.grp.optn.nullSizeGrp.sldr.value),5)
|
nullSize = yFactor(parseInt(yPuppetRigDialog.grp.optn.nullSizeGrp.sldr.value),5)
|
||||||
if(yPuppetRigDialog.grp.optn.nullSizeGrp.otherOptionsGrp.chk_box_02.value==true){
|
if(yPuppetRigDialog.grp.optn.nullSizeGrp.otherOptionsGrp.chk_box_02.value==true){
|
||||||
layerLock =true // solo si vamos a hacer vainas pixeladas.
|
layerLock =true // solo si vamos a hacer vainas pixeladas.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
layerLock =false // solo si vamos a hacer vainas pixeladas.
|
layerLock =false // solo si vamos a hacer vainas pixeladas.
|
||||||
}
|
}
|
||||||
|
|
||||||
if(yPuppetRigDialog.grp.optn.nullSizeGrp.otherOptionsGrp.chk_box_01.value==true){
|
if(yPuppetRigDialog.grp.optn.nullSizeGrp.otherOptionsGrp.chk_box_01.value==true){
|
||||||
layerQuality =LayerQuality.DRAFT // solo si vamos a hacer vainas pixeladas.
|
layerQuality =LayerQuality.DRAFT // solo si vamos a hacer vainas pixeladas.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
layerQuality =LayerQuality.BEST // solo si vamos a hacer vainas pixeladas.
|
layerQuality =LayerQuality.BEST // solo si vamos a hacer vainas pixeladas.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//build_yPuppetRig_UI();
|
//build_yPuppetRig_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(YTB)=='undefined'){
|
if (typeof(YTB)=='undefined'){
|
||||||
yPuppetRig_data.activate();
|
yPuppetRig_data.activate();
|
||||||
}else{
|
}else{
|
||||||
}
|
}
|
||||||
|
|||||||
+121
-121
@@ -1,121 +1,121 @@
|
|||||||
#include "../yScripts/y_JSExtensions.jsx";
|
#include "../yScripts/y_JSExtensions.jsx";
|
||||||
function YSetProjectTool()
|
function YSetProjectTool()
|
||||||
{
|
{
|
||||||
this.info =
|
this.info =
|
||||||
{
|
{
|
||||||
name : "YSetStructure",
|
name : "YSetStructure",
|
||||||
version : 0.11,
|
version : 0.11,
|
||||||
stage : "alpha",
|
stage : "alpha",
|
||||||
description : "Set the Folder Structure for a new Project",
|
description : "Set the Folder Structure for a new Project",
|
||||||
url : "yorchnet.com"
|
url : "yorchnet.com"
|
||||||
};
|
};
|
||||||
this.appearence =
|
this.appearence =
|
||||||
{
|
{
|
||||||
buttonHeight : 30,
|
buttonHeight : 30,
|
||||||
buttonWidth : 126
|
buttonWidth : 126
|
||||||
};
|
};
|
||||||
this.resources =
|
this.resources =
|
||||||
{
|
{
|
||||||
icon : new File('yNet.png'),
|
icon : new File('yNet.png'),
|
||||||
};
|
};
|
||||||
this.init = function init()
|
this.init = function init()
|
||||||
{
|
{
|
||||||
//alert("my name is:" + this.info.name);
|
//alert("my name is:" + this.info.name);
|
||||||
this.btnLauyout =
|
this.btnLauyout =
|
||||||
"button\
|
"button\
|
||||||
{\
|
{\
|
||||||
preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'],\
|
preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'],\
|
||||||
text:'" + this.info.name + "',\
|
text:'" + this.info.name + "',\
|
||||||
helpTip:'" + this.info.description + "'\
|
helpTip:'" + this.info.description + "'\
|
||||||
}";
|
}";
|
||||||
|
|
||||||
this. res =
|
this. res =
|
||||||
"window\
|
"window\
|
||||||
{\
|
{\
|
||||||
type:'palette',\
|
type:'palette',\
|
||||||
text:'" + this.info.name + ' ' + this.info.ver + ' ' + this.info.stage + "',\
|
text:'" + this.info.name + ' ' + this.info.ver + ' ' + this.info.stage + "',\
|
||||||
info: Group \
|
info: Group \
|
||||||
{\
|
{\
|
||||||
alignment:['center','bottom'],\
|
alignment:['center','bottom'],\
|
||||||
icon: Image \
|
icon: Image \
|
||||||
{\
|
{\
|
||||||
icon:'" + this.resources.icon.path + '/' + this.resources.icon.name + "',\
|
icon:'" + this.resources.icon.path + '/' + this.resources.icon.name + "',\
|
||||||
preferredSize: [15, 18]\
|
preferredSize: [15, 18]\
|
||||||
},\
|
},\
|
||||||
website: StaticText\
|
website: StaticText\
|
||||||
{\
|
{\
|
||||||
text:'" + this.info.url + "',\
|
text:'" + this.info.url + "',\
|
||||||
alignment:['fill','center']\
|
alignment:['fill','center']\
|
||||||
},\
|
},\
|
||||||
}\
|
}\
|
||||||
}";
|
}";
|
||||||
}
|
}
|
||||||
this.createUI = function createUI()
|
this.createUI = function createUI()
|
||||||
{
|
{
|
||||||
this.window = new Window ( this.res );
|
this.window = new Window ( this.res );
|
||||||
this.window.show() ;
|
this.window.show() ;
|
||||||
}
|
}
|
||||||
this.ySetProject = function ySetProject()
|
this.ySetProject = function ySetProject()
|
||||||
{
|
{
|
||||||
//alert("is this working");
|
//alert("is this working");
|
||||||
app.beginUndoGroup('ySetProject');
|
app.beginUndoGroup('ySetProject');
|
||||||
var preStruct = ["01 MAIN","02 PComp","03 Source Layers" ,"04 Movies","05 Other Projects","06 Audio" , "07 Reference"];
|
var preStruct = ["01 MAIN","02 PComp","03 Source Layers" ,"04 Movies","05 Other Projects","06 Audio" , "07 Reference"];
|
||||||
var newStruct = [];
|
var newStruct = [];
|
||||||
var projectItems = [];
|
var projectItems = [];
|
||||||
|
|
||||||
for(i=1;i<=app.project.items.length;i++)
|
for(i=1;i<=app.project.items.length;i++)
|
||||||
{
|
{
|
||||||
if(app.project.items[i].parentFolder.name=='Root')
|
if(app.project.items[i].parentFolder.name=='Root')
|
||||||
{
|
{
|
||||||
projectItems.push(app.project.items[i].name);
|
projectItems.push(app.project.items[i].name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//to start a new organized project since the beginning
|
//to start a new organized project since the beginning
|
||||||
|
|
||||||
if (projectItems.length == 0)
|
if (projectItems.length == 0)
|
||||||
{
|
{
|
||||||
newStruct = preStruct;
|
newStruct = preStruct;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(a=0;a<preStruct.length;a++)
|
for(a=0;a<preStruct.length;a++)
|
||||||
{
|
{
|
||||||
if ((projectItems.getOne(preStruct[a]))==-1)
|
if ((projectItems.getOne(preStruct[a]))==-1)
|
||||||
{
|
{
|
||||||
newStruct.push(preStruct[a]);
|
newStruct.push(preStruct[a]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = 0;i<newStruct.length;i++)
|
for(i = 0;i<newStruct.length;i++)
|
||||||
{
|
{
|
||||||
app.project.items.addFolder(newStruct[i]);
|
app.project.items.addFolder(newStruct[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
saveNow = confirm("Project Succesfully Set, Save Project?",true,"ySetProject");
|
saveNow = confirm("Project Succesfully Set, Save Project?",true,"ySetProject");
|
||||||
|
|
||||||
if(saveNow==true){
|
if(saveNow==true){
|
||||||
app.project.save()
|
app.project.save()
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
}
|
}
|
||||||
app.endUndoGroup();
|
app.endUndoGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.activate = this.ySetProject;
|
this.activate = this.ySetProject;
|
||||||
|
|
||||||
this.init();
|
this.init();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
//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')
|
||||||
{
|
{
|
||||||
ySetProjectTool = new YSetProjectTool();
|
ySetProjectTool = new YSetProjectTool();
|
||||||
ySetProjectTool.activate();
|
ySetProjectTool.activate();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
YTB.addTool(new YSetProjectTool());
|
YTB.addTool(new YSetProjectTool());
|
||||||
}
|
}
|
||||||
|
|||||||
+101
-101
@@ -1,101 +1,101 @@
|
|||||||
yStopMotion_data = new Object();
|
yStopMotion_data = new Object();
|
||||||
|
|
||||||
yStopMotion_data.scriptName = 'yStopMotion';
|
yStopMotion_data.scriptName = 'yStopMotion';
|
||||||
yStopMotion_data.scriptDesc = 'Dynamically change layer sequence opacity from a slider in pComp';
|
yStopMotion_data.scriptDesc = 'Dynamically change layer sequence opacity from a slider in pComp';
|
||||||
yStopMotion_data.scriptVer = '0.1a';
|
yStopMotion_data.scriptVer = '0.1a';
|
||||||
yStopMotion_data.webLink = 'yorchnet.com';
|
yStopMotion_data.webLink = 'yorchnet.com';
|
||||||
|
|
||||||
//if yToolBox Exists add it to its tool list.
|
//if yToolBox Exists add it to its tool list.
|
||||||
if (typeof(YTB)!=='undefined'){
|
if (typeof(YTB)!=='undefined'){
|
||||||
YTB.tools.push(yStopMotion_data);
|
YTB.tools.push(yStopMotion_data);
|
||||||
|
|
||||||
//it should be called from toolbox.
|
//it should be called from toolbox.
|
||||||
/* yStopMotion_data.buttonWidth=76;
|
/* yStopMotion_data.buttonWidth=76;
|
||||||
yStopMotion_data.buttonHeight=30;
|
yStopMotion_data.buttonHeight=30;
|
||||||
*/
|
*/
|
||||||
yStopMotion_data.btnLayout = "btn_"+yStopMotion_data.scriptName+": Button { preferredSize: ['"+ YTB.buttonWidth+"','"+ YTB.buttonHeight+"'], text:'"+yStopMotion_data.scriptName+"', helpTip:'"+yStopMotion_data.scriptDesc+"' }";
|
yStopMotion_data.btnLayout = "btn_"+yStopMotion_data.scriptName+": Button { preferredSize: ['"+ YTB.buttonWidth+"','"+ YTB.buttonHeight+"'], text:'"+yStopMotion_data.scriptName+"', helpTip:'"+yStopMotion_data.scriptDesc+"' }";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
yStopMotion_data.res = "window { \
|
yStopMotion_data.res = "window { \
|
||||||
type:'palette' , text:'"+yStopMotion_data.scriptName+' '+yStopMotion_data.scriptVer+"',\
|
type:'palette' , text:'"+yStopMotion_data.scriptName+' '+yStopMotion_data.scriptVer+"',\
|
||||||
\
|
\
|
||||||
\
|
\
|
||||||
info: Group { \
|
info: Group { \
|
||||||
alignment:['center','bottom'], \
|
alignment:['center','bottom'], \
|
||||||
icon: Image {preferredSize: [15, 18]},\
|
icon: Image {preferredSize: [15, 18]},\
|
||||||
website: StaticText { text:'"+yStopMotion_data.webLink+"', alignment:['fill','center'] },\
|
website: StaticText { text:'"+yStopMotion_data.webLink+"', alignment:['fill','center'] },\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
}";
|
}";
|
||||||
|
|
||||||
//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------
|
//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------
|
||||||
// MAIN SCRIPT GOES HERE.
|
// MAIN SCRIPT GOES HERE.
|
||||||
|
|
||||||
e_0000 = "There are no comps in project."
|
e_0000 = "There are no comps in project."
|
||||||
e_0001 = "No Comps selected."
|
e_0001 = "No Comps selected."
|
||||||
|
|
||||||
function yStopMotionLayer(){
|
function yStopMotionLayer(){
|
||||||
myName = "yStopMotionLayer";
|
myName = "yStopMotionLayer";
|
||||||
myVer = "0.2a";
|
myVer = "0.2a";
|
||||||
nComps = app.project.items.length;
|
nComps = app.project.items.length;
|
||||||
app.beginUndoGroup(myName);
|
app.beginUndoGroup(myName);
|
||||||
if(nComps>0){
|
if(nComps>0){
|
||||||
sel = app.project.activeItem.selectedLayers; //array containing selection;
|
sel = app.project.activeItem.selectedLayers; //array containing selection;
|
||||||
if(sel.length == 1&&sel[0].source!= null){
|
if(sel.length == 1&&sel[0].source!= null){
|
||||||
|
|
||||||
myItem = sel[0].source;
|
myItem = sel[0].source;
|
||||||
myItemType = myItem.typeName;
|
myItemType = myItem.typeName;
|
||||||
|
|
||||||
if(myItemType!="Composition"){
|
if(myItemType!="Composition"){
|
||||||
alert(e_0001,myName+' '+myVer);
|
alert(e_0001,myName+' '+myVer);
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
sliderCtrl = sel[0]("Effects").addProperty("Slider Control");
|
sliderCtrl = sel[0]("Effects").addProperty("Slider Control");
|
||||||
sliderCtrl.name = "Animation State"; //should check for previously created sliders named the same and name uniquely accordingly.
|
sliderCtrl.name = "Animation State"; //should check for previously created sliders named the same and name uniquely accordingly.
|
||||||
txtExpression = 'myLayer = thisLayer;myComp =comp(myLayer.name);\
|
txtExpression = 'myLayer = thisLayer;myComp =comp(myLayer.name);\
|
||||||
max = myComp.numLayers;\
|
max = myComp.numLayers;\
|
||||||
myValue = effect("'+sliderCtrl.name+'")("'+sliderCtrl("Slider").name+'");\
|
myValue = effect("'+sliderCtrl.name+'")("'+sliderCtrl("Slider").name+'");\
|
||||||
if(myValue<=max&&myValue>1){\
|
if(myValue<=max&&myValue>1){\
|
||||||
parseInt(myValue)\
|
parseInt(myValue)\
|
||||||
}else if (myValue>max){\
|
}else if (myValue>max){\
|
||||||
max\
|
max\
|
||||||
}else if(myValue<1){1}';
|
}else if(myValue<1){1}';
|
||||||
//'l = thisComp.layer('+'"'+app.project.activeItem.selectedLayers[0].name+'"'+');'+'fromWorld(l.toComp(l.transform.anchorPoint))';
|
//'l = thisComp.layer('+'"'+app.project.activeItem.selectedLayers[0].name+'"'+');'+'fromWorld(l.toComp(l.transform.anchorPoint))';
|
||||||
sliderCtrl("Slider").expression = txtExpression;
|
sliderCtrl("Slider").expression = txtExpression;
|
||||||
sliderCtrl("Slider").setValue(1);
|
sliderCtrl("Slider").setValue(1);
|
||||||
txtExpression = null;
|
txtExpression = null;
|
||||||
nLayers =myItem.numLayers;
|
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}';
|
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++){
|
for (z=1;z<=nLayers;z++){
|
||||||
myItem.layer(z).opacity.expression=txtExpression;
|
myItem.layer(z).opacity.expression=txtExpression;
|
||||||
}
|
}
|
||||||
txtExpression = null;
|
txtExpression = null;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
alert(e_0001,myName+' '+myVer);
|
alert(e_0001,myName+' '+myVer);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
alert(e_0000,myName+' '+myVer+" : Error");
|
alert(e_0000,myName+' '+myVer+" : Error");
|
||||||
}
|
}
|
||||||
app.endUndoGroup();
|
app.endUndoGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------
|
//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------
|
||||||
|
|
||||||
function build_yStopMotion_data_UI(){
|
function build_yStopMotion_data_UI(){
|
||||||
yStopMotion_data.window = new Window ( yStopMotion_data.res);
|
yStopMotion_data.window = new Window ( yStopMotion_data.res);
|
||||||
yStopMotion_data.window.show();
|
yStopMotion_data.window.show();
|
||||||
}
|
}
|
||||||
yStopMotion_data.activate = yStopMotionLayer ;
|
yStopMotion_data.activate = yStopMotionLayer ;
|
||||||
|
|
||||||
//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'){
|
||||||
yStopMotion_data.activate();
|
yStopMotion_data.activate();
|
||||||
}else{
|
}else{
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user