diff --git a/yScripts/usefulFunctions.jsx b/yScripts/usefulFunctions.jsx index 17a75d8..b6b35e0 100755 --- a/yScripts/usefulFunctions.jsx +++ b/yScripts/usefulFunctions.jsx @@ -1,130 +1,130 @@ -#include "y_JSExtensions.jsx"; -/* -if (Array.prototype.getOne==null) Array.prototype.getOne=function(item){ //Extends the Array class with the getOne functions wich - var val = -1; - for(i=0;i<=this.length;i++){ - if(this[i]==item){ - var val = i; - } - } - return val; -} -*/ -function sortNumber(a,b) -{ -return a - b; -} - -function pad(n,i){ //pad n with ceroes up to i places. - if (String(n).length>=i){ - return String(n) - }else{ - dif = i- (String(n)).length; - padding = ""; - for (p=0;p1){ - for(L=0;L<_lines.length;L++){ - alert(_lines[L]); - if(L==_lines.length-1||_lines[L]==''){ - dash = ''; - }else{ - dash = '.'; - } - if(_lines[L]!=''){ - newStr = newStr+_lines[L]+dash; - }else{ - newStr = newStr; - } - } - }else{ - newStr = _str; - } - return newStr; -} \ No newline at end of file +#include "y_JSExtensions.jsx"; +/* +if (Array.prototype.getOne==null) Array.prototype.getOne=function(item){ //Extends the Array class with the getOne functions wich + var val = -1; + for(i=0;i<=this.length;i++){ + if(this[i]==item){ + var val = i; + } + } + return val; +} +*/ +function sortNumber(a,b) +{ +return a - b; +} + +function pad(n,i){ //pad n with ceroes up to i places. + if (String(n).length>=i){ + return String(n) + }else{ + dif = i- (String(n)).length; + padding = ""; + for (p=0;p1){ + for(L=0;L<_lines.length;L++){ + alert(_lines[L]); + if(L==_lines.length-1||_lines[L]==''){ + dash = ''; + }else{ + dash = '.'; + } + if(_lines[L]!=''){ + newStr = newStr+_lines[L]+dash; + }else{ + newStr = newStr; + } + } + }else{ + newStr = _str; + } + return newStr; +} diff --git a/yScripts/wip/replaceLogos.jsx b/yScripts/wip/replaceLogos.jsx index 84f973e..f12868f 100755 --- a/yScripts/wip/replaceLogos.jsx +++ b/yScripts/wip/replaceLogos.jsx @@ -1,85 +1,85 @@ -#include '/c/Program Files/01_Design/Adobe After Effects CS5.5/Support Files/Scripts/yScripts/y_JSExtensions.jsx' -function getComps(folderItem){ - _comps = []; - for(i=1;i<=folderItem.numItems;i++){ - item = folderItem.item(i); - if(item.typeName=='Composition'){ - _comps.push(item); - } - } - return _comps -} -function getFolders(folderItem){ - _folders = []; - for(i=1;i<=folderItem.numItems;i++){ - item = folderItem.item(i); - if(item.typeName=='Folder'){ - _folders.push(item); - } - } - return _folders -} -function getItems(folderItem){ - _folders = getFolders(folderItem); - _comps = getComps(folderItem); - while(_folders.length!=0){ - newFolderItem = _folders.shift(); - _comps = _comps.concat(getComps(newFolderItem)); - _folders = _folders.concat(getFolders(newFolderItem)); - } - return _comps -} -function getLayers(compItem){ - layers = []; - for(i=1;i<=compItem.numLayers;i++){ - item = compItem.layer(i); - if(item.matchName == 'ADBE AV Layer'){ - if(item.source.typeName == 'Composition'){ - layers.push(item) - } - } - } - return layers -} - - -//_replaceMe = getLayers(app.project.item(6)) -//b = app.project.ac -function doIt(){ -app.beginUndoGroup('a') -for(i=0;i<_replaceMe.length;i++){ - replaceable = _replaceMe[i]; - - hit = null; - - for(k=0;k<_replaceWith.length;k++){ - replacement = _replaceWith[k]; - //alert(String(replaceable.source.name)+','+String(replacement.name)) - - if(replaceable.source.name==replacement.name){ - hit = replacement; - } - } - if(hit!=null){ - _replaceMe[i].replaceSource(hit,false) - }else{ - _replaceMe[i].property("Marker").addKey(0) - } -} -app.endUndoGroup() -} - -function getComp(){ - comp = app.project.activeItem - return comp - } - -/* -//STEP 1 -_replaceMe = getLayers(getComp()) - -//STEP 2 -_replaceWith = getItems(app.project.activeItem) -doIt() - -*/ \ No newline at end of file +#include '/c/Program Files/01_Design/Adobe After Effects CS5.5/Support Files/Scripts/yScripts/y_JSExtensions.jsx' +function getComps(folderItem){ + _comps = []; + for(i=1;i<=folderItem.numItems;i++){ + item = folderItem.item(i); + if(item.typeName=='Composition'){ + _comps.push(item); + } + } + return _comps +} +function getFolders(folderItem){ + _folders = []; + for(i=1;i<=folderItem.numItems;i++){ + item = folderItem.item(i); + if(item.typeName=='Folder'){ + _folders.push(item); + } + } + return _folders +} +function getItems(folderItem){ + _folders = getFolders(folderItem); + _comps = getComps(folderItem); + while(_folders.length!=0){ + newFolderItem = _folders.shift(); + _comps = _comps.concat(getComps(newFolderItem)); + _folders = _folders.concat(getFolders(newFolderItem)); + } + return _comps +} +function getLayers(compItem){ + layers = []; + for(i=1;i<=compItem.numLayers;i++){ + item = compItem.layer(i); + if(item.matchName == 'ADBE AV Layer'){ + if(item.source.typeName == 'Composition'){ + layers.push(item) + } + } + } + return layers +} + + +//_replaceMe = getLayers(app.project.item(6)) +//b = app.project.ac +function doIt(){ +app.beginUndoGroup('a') +for(i=0;i<_replaceMe.length;i++){ + replaceable = _replaceMe[i]; + + hit = null; + + for(k=0;k<_replaceWith.length;k++){ + replacement = _replaceWith[k]; + //alert(String(replaceable.source.name)+','+String(replacement.name)) + + if(replaceable.source.name==replacement.name){ + hit = replacement; + } + } + if(hit!=null){ + _replaceMe[i].replaceSource(hit,false) + }else{ + _replaceMe[i].property("Marker").addKey(0) + } +} +app.endUndoGroup() +} + +function getComp(){ + comp = app.project.activeItem + return comp + } + +/* +//STEP 1 +_replaceMe = getLayers(getComp()) + +//STEP 2 +_replaceWith = getItems(app.project.activeItem) +doIt() + +*/ diff --git a/yScripts/wip/tabbed_structure.jsx b/yScripts/wip/tabbed_structure.jsx index cf84ad4..a778cfa 100644 --- a/yScripts/wip/tabbed_structure.jsx +++ b/yScripts/wip/tabbed_structure.jsx @@ -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(); \ No newline at end of file +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(); diff --git a/yScripts/wip/y_GenericNewScript_0.1a.jsx b/yScripts/wip/y_GenericNewScript_0.1a.jsx index 863214f..a5cee14 100755 --- a/yScripts/wip/y_GenericNewScript_0.1a.jsx +++ b/yScripts/wip/y_GenericNewScript_0.1a.jsx @@ -1,52 +1,52 @@ -yGeneric_data = new Object(); - -yGeneric_data.scriptName = 'YTBGen'; -yGeneric_data.scriptDesc = 'YToolBox Generic Script is the base for adding tools.'; -yGeneric_data.scriptVer = '0.1a'; -yGeneric_data.webLink = 'yorchnet.com'; -yGeneric_data.img = YTB.icon; - -//if yToolBox Exists add it to its tool list. -if (typeof(YTB)!=='undefined'){ - - //it should be called from toolbox. - yGeneric_data.buttonWidth=76; - yGeneric_data.buttonHeight=30; - - yGeneric_data.btnLayout = "btn_"+yGeneric_data.scriptName+": Button { preferredSize: ['"+ yGeneric_data.buttonWidth+"','"+ yGeneric_data.buttonHeight+"'], text:'"+yGeneric_data.scriptName+"', helpTip:'"+yGeneric_data.scriptDesc+"' }"; - - } - -yGeneric_data.res = "window { \ - type:'palette' , text:'"+yGeneric_data.scriptName+' '+yGeneric_data.scriptVer+"',\ - \ - \ - info: Group { \ - alignment:['center','bottom'], \ - icon: Image {icon:'"+String(yGeneric_data.img.path+"/"+yGeneric_data.img.name)+"',preferredSize: [15, 18]},\ - website: StaticText { text:'"+yGeneric_data.webLink+"', alignment:['fill','center'] }\ - }\ - \ - }"; - - //--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//-------- - // MAIN SCRIPT GOES HERE. - - - - - - - //--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//-------- - -function build_yGeneric_data_UI(){ - yGeneric_data.window = new Window ( yGeneric_data.res); - yGeneric_data.window.show(); - } -yGeneric_data.activate = build_yGeneric_data_UI ; -//alert(); -//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own. -//if (typeof(YTB)=='undefined'){ - yGeneric_data.activate(); - //}else{ - //} +yGeneric_data = new Object(); + +yGeneric_data.scriptName = 'YTBGen'; +yGeneric_data.scriptDesc = 'YToolBox Generic Script is the base for adding tools.'; +yGeneric_data.scriptVer = '0.1a'; +yGeneric_data.webLink = 'yorchnet.com'; +yGeneric_data.img = YTB.icon; + +//if yToolBox Exists add it to its tool list. +if (typeof(YTB)!=='undefined'){ + + //it should be called from toolbox. + yGeneric_data.buttonWidth=76; + yGeneric_data.buttonHeight=30; + + yGeneric_data.btnLayout = "btn_"+yGeneric_data.scriptName+": Button { preferredSize: ['"+ yGeneric_data.buttonWidth+"','"+ yGeneric_data.buttonHeight+"'], text:'"+yGeneric_data.scriptName+"', helpTip:'"+yGeneric_data.scriptDesc+"' }"; + + } + +yGeneric_data.res = "window { \ + type:'palette' , text:'"+yGeneric_data.scriptName+' '+yGeneric_data.scriptVer+"',\ + \ + \ + info: Group { \ + alignment:['center','bottom'], \ + icon: Image {icon:'"+String(yGeneric_data.img.path+"/"+yGeneric_data.img.name)+"',preferredSize: [15, 18]},\ + website: StaticText { text:'"+yGeneric_data.webLink+"', alignment:['fill','center'] }\ + }\ + \ + }"; + + //--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//-------- + // MAIN SCRIPT GOES HERE. + + + + + + + //--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//-------- + +function build_yGeneric_data_UI(){ + yGeneric_data.window = new Window ( yGeneric_data.res); + yGeneric_data.window.show(); + } +yGeneric_data.activate = build_yGeneric_data_UI ; +//alert(); +//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own. +//if (typeof(YTB)=='undefined'){ + yGeneric_data.activate(); + //}else{ + //} diff --git a/yScripts/wip/y_MultiRenamer_0.1a.jsx b/yScripts/wip/y_MultiRenamer_0.1a.jsx index 742093d..1603469 100755 --- a/yScripts/wip/y_MultiRenamer_0.1a.jsx +++ b/yScripts/wip/y_MultiRenamer_0.1a.jsx @@ -1,176 +1,176 @@ -yMultiRenamer_data = new Object(); - -yMultiRenamer_data.scriptName = 'yMultiRenamer'; -yMultiRenamer_data.scriptDesc = 'Tool to make it easy to rename multiple project items and/or comp layers'; -yMultiRenamer_data.scriptVer = '0.1a'; -yMultiRenamer_data.webLink = 'yorchnet.com'; - -//if yToolBox Exists add it to its tool list. -if (typeof(YTB)!=='undefined'){ - YTB.tools.push(yMultiRenamer_data); - - //it should be called from toolbox. - - yMultiRenamer_data.buttonWidth=76; - yMultiRenamer_data.buttonHeight=30; - - yMultiRenamer_data.btnLayout = "btn_"+yMultiRenamer_data.scriptName+": Button { preferredSize: ['"+ YTB.buttonWidth+"','"+ YTB.buttonHeight+"'], text:'"+yMultiRenamer_data.scriptName+"', helpTip:'"+yMultiRenamer_data.scriptDesc+"' }"; - - } - -yMultiRenamer_data.res = "window { \ - type:'palette' , text:'"+yMultiRenamer_data.scriptName+' '+yMultiRenamer_data.scriptVer+"', margins:[10,10,10,10],spacing:[5,5,5,5],\ - \ - root_str_chk: Checkbox { text:'New root name:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',value:true },\ - root_str: EditText { text:'', alignment:['fill','center'],helpTip:'Includes Items and folders within folders and subfolders.' },\ - search_str_chk: Checkbox { text:'Search for:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ - search_str: EditText { text:'', alignment:['fill','center'],helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\ - search_rplc_tit: StaticText { text:'Replace with:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ - search_rplc: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false},\ - pre_chk: Checkbox { text:'AddAsPrefix', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ - pre: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\ - pre_chk: Checkbox { text:'AddAsSuffix', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ - su: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\ - recursive_optn: Checkbox { text:'Recursive', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ - selectedCompsOnly_optn: Checkbox { text:'Selected Comps Only', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ - globalItems_optn: Checkbox { text:'All Items', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ - globalLayers_optn: Checkbox { text:'All Layers', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ - global_optn: Checkbox { text:'Global', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ - exec_btn: Button {text:'do It',preferredSize:[150,35],helpTip:'do it'}\ - info: Group { \ - alignment:['center','bottom'], \ - icon: Image {preferredSize: [15, 18]},\ - website: StaticText { text:'"+yMultiRenamer_data.webLink+"', alignment:['fill','center'] },\ - }\ - \ - }"; - - //--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//-------- - // MAIN SCRIPT GOES HERE. - - - - - -function yMultiRenamer(){ - - recursive_sw = yMultiRenamer_data.window.recursive_optn.value; - selectedCompsOnly_sw = yMultiRenamer_data.window.selectedCompsOnly_optn.value; - globalItems_sw = yMultiRenamer_data.window.globalItems_optn.value; - globalLayers_sw = yMultiRenamer_data.window.globalLayers_optn.value; - global_sw = yMultiRenamer_data.window.global_optn.value; - - //Gathers all SELECTED items into projectItems, - - var rawItems = app.project.items; - var projectItems = []; - for(i=1;i<=rawItems.length;i++){ - currentItem = rawItems[i]; - if( (currentItem.selected||(currentItem.parentFolder.selected&recursive_sw))||(globalItems_sw||global_sw) ){ - projectItems.push(currentItem); - } - } - - //Gathers all SELECTED layers into projectLayers, - var projectComps = []; - for(i=1;i0)&(yMultiRenamer_data.window.subFolders_optn.value==true)){ - for(a=1;a<=subItems.length;a++){ - projectItems.push(subItems[a]) - } - } - } - } - } -if(yMultiRenamer_data.window.allComps_optn.value==false ){ - - if((app.project.activeItem!=null )&(app.project.activeItem.typeName=='Composition')){ - layers = app.project.activeItem.selectedLayers; - for (i=0;i0){ - n = ' '+String(i); - } - if(!allRenamable[i].locked){ - allRenamable[i].name = yMultiRenamer_data.window.root_str.text+n; - //allRenamable[i].name = String(Math.random()); //EVIL LAUGHS - } - - - } - app.endUndoGroup(); - -} - //--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//-------- - -function build_yMultiRenamer_data_UI(){ - yMultiRenamer_data.window = new Window ( yMultiRenamer_data.res); - yMultiRenamer_data.window.exec_btn.onClick = yMultiRenamer; - yMultiRenamer_data.window.show(); - } -yMultiRenamer_data.activate = build_yMultiRenamer_data_UI ; - -//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own. -if (typeof(YTB)=='undefined'){ - yMultiRenamer_data.activate(); - }else{ - } - - -// a= yMultiRenamer() +yMultiRenamer_data = new Object(); + +yMultiRenamer_data.scriptName = 'yMultiRenamer'; +yMultiRenamer_data.scriptDesc = 'Tool to make it easy to rename multiple project items and/or comp layers'; +yMultiRenamer_data.scriptVer = '0.1a'; +yMultiRenamer_data.webLink = 'yorchnet.com'; + +//if yToolBox Exists add it to its tool list. +if (typeof(YTB)!=='undefined'){ + YTB.tools.push(yMultiRenamer_data); + + //it should be called from toolbox. + + yMultiRenamer_data.buttonWidth=76; + yMultiRenamer_data.buttonHeight=30; + + yMultiRenamer_data.btnLayout = "btn_"+yMultiRenamer_data.scriptName+": Button { preferredSize: ['"+ YTB.buttonWidth+"','"+ YTB.buttonHeight+"'], text:'"+yMultiRenamer_data.scriptName+"', helpTip:'"+yMultiRenamer_data.scriptDesc+"' }"; + + } + +yMultiRenamer_data.res = "window { \ + type:'palette' , text:'"+yMultiRenamer_data.scriptName+' '+yMultiRenamer_data.scriptVer+"', margins:[10,10,10,10],spacing:[5,5,5,5],\ + \ + root_str_chk: Checkbox { text:'New root name:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',value:true },\ + root_str: EditText { text:'', alignment:['fill','center'],helpTip:'Includes Items and folders within folders and subfolders.' },\ + search_str_chk: Checkbox { text:'Search for:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ + search_str: EditText { text:'', alignment:['fill','center'],helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\ + search_rplc_tit: StaticText { text:'Replace with:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ + search_rplc: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false},\ + pre_chk: Checkbox { text:'AddAsPrefix', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ + pre: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\ + pre_chk: Checkbox { text:'AddAsSuffix', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ + su: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\ + recursive_optn: Checkbox { text:'Recursive', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ + selectedCompsOnly_optn: Checkbox { text:'Selected Comps Only', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ + globalItems_optn: Checkbox { text:'All Items', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ + globalLayers_optn: Checkbox { text:'All Layers', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ + global_optn: Checkbox { text:'Global', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ + exec_btn: Button {text:'do It',preferredSize:[150,35],helpTip:'do it'}\ + info: Group { \ + alignment:['center','bottom'], \ + icon: Image {preferredSize: [15, 18]},\ + website: StaticText { text:'"+yMultiRenamer_data.webLink+"', alignment:['fill','center'] },\ + }\ + \ + }"; + + //--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//-------- + // MAIN SCRIPT GOES HERE. + + + + + +function yMultiRenamer(){ + + recursive_sw = yMultiRenamer_data.window.recursive_optn.value; + selectedCompsOnly_sw = yMultiRenamer_data.window.selectedCompsOnly_optn.value; + globalItems_sw = yMultiRenamer_data.window.globalItems_optn.value; + globalLayers_sw = yMultiRenamer_data.window.globalLayers_optn.value; + global_sw = yMultiRenamer_data.window.global_optn.value; + + //Gathers all SELECTED items into projectItems, + + var rawItems = app.project.items; + var projectItems = []; + for(i=1;i<=rawItems.length;i++){ + currentItem = rawItems[i]; + if( (currentItem.selected||(currentItem.parentFolder.selected&recursive_sw))||(globalItems_sw||global_sw) ){ + projectItems.push(currentItem); + } + } + + //Gathers all SELECTED layers into projectLayers, + var projectComps = []; + for(i=1;i0)&(yMultiRenamer_data.window.subFolders_optn.value==true)){ + for(a=1;a<=subItems.length;a++){ + projectItems.push(subItems[a]) + } + } + } + } + } +if(yMultiRenamer_data.window.allComps_optn.value==false ){ + + if((app.project.activeItem!=null )&(app.project.activeItem.typeName=='Composition')){ + layers = app.project.activeItem.selectedLayers; + for (i=0;i0){ + n = ' '+String(i); + } + if(!allRenamable[i].locked){ + allRenamable[i].name = yMultiRenamer_data.window.root_str.text+n; + //allRenamable[i].name = String(Math.random()); //EVIL LAUGHS + } + + + } + app.endUndoGroup(); + +} + //--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//-------- + +function build_yMultiRenamer_data_UI(){ + yMultiRenamer_data.window = new Window ( yMultiRenamer_data.res); + yMultiRenamer_data.window.exec_btn.onClick = yMultiRenamer; + yMultiRenamer_data.window.show(); + } +yMultiRenamer_data.activate = build_yMultiRenamer_data_UI ; + +//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own. +if (typeof(YTB)=='undefined'){ + yMultiRenamer_data.activate(); + }else{ + } + + +// a= yMultiRenamer() diff --git a/yScripts/wip/y_MultiRenamer_0.2a.jsx b/yScripts/wip/y_MultiRenamer_0.2a.jsx index 7e1e502..add5d32 100755 --- a/yScripts/wip/y_MultiRenamer_0.2a.jsx +++ b/yScripts/wip/y_MultiRenamer_0.2a.jsx @@ -1,151 +1,151 @@ -yMultiRenamer_data = new Object(); - -yMultiRenamer_data.scriptName = 'yMultiRenamer'; -yMultiRenamer_data.scriptDesc = 'Tool to make it easy to rename multiple project items and/or comp layers'; -yMultiRenamer_data.scriptVer = '0.2a'; -yMultiRenamer_data.webLink = 'yorchnet.com'; - -//if yToolBox Exists add it to its tool list. -if (typeof(YTB)!=='undefined'){ - YTB.tools.push(yMultiRenamer_data); - - //it should be called from toolbox. - - yMultiRenamer_data.buttonWidth=76; - yMultiRenamer_data.buttonHeight=30; - - yMultiRenamer_data.btnLayout = "btn_"+yMultiRenamer_data.scriptName+": Button { preferredSize: ['"+ YTB.buttonWidth+"','"+ YTB.buttonHeight+"'], text:'"+yMultiRenamer_data.scriptName+"', helpTip:'"+yMultiRenamer_data.scriptDesc+"' }"; - - } - -yMultiRenamer_data.res = "window { \ - type:'palette' , text:'"+yMultiRenamer_data.scriptName+' '+yMultiRenamer_data.scriptVer+"', margins:[10,10,10,10],spacing:[5,5,5,5],\ - \ - }"; - /* - items_tab:Tab{text:'asdasd',helpTip:'asdasdasd'},\ - root_str_chk: Checkbox { text:'New root name:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',value:true },\ - root_str: EditText { text:'', alignment:['fill','center'],helpTip:'Includes Items and folders within folders and subfolders.' },\ - search_str_chk: Checkbox { text:'Search for:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ - search_str: EditText { text:'', alignment:['fill','center'],helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\ - search_rplc_tit: StaticText { text:'Replace with:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ - search_rplc: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false},\ - pre_chk: Checkbox { text:'AddAsPrefix', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ - pre: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\ - pre_chk: Checkbox { text:'AddAsSuffix', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ - su: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\ - recursive_optn: Checkbox { text:'Recursive', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ - selectedCompsOnly_optn: Checkbox { text:'Selected Comps Only', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ - globalItems_optn: Checkbox { text:'All Items', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ - globalLayers_optn: Checkbox { text:'All Layers', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ - global_optn: Checkbox { text:'Global', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ - exec_btn: Button {text:'do It',preferredSize:[150,35],helpTip:'do it'}\ - info: Group { \ - alignment:['center','bottom'], \ - icon: Image {preferredSize: [15, 18]},\ - website: StaticText { text:'"+yMultiRenamer_data.webLink+"', alignment:['fill','center'] },\ - }\ - \ - }"; - */ - //--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//-------- - // MAIN SCRIPT GOES HERE. - -/* - - - -function yMultiRenamer(){ - - recursive_sw = yMultiRenamer_data.window.recursive_optn.value; - selectedCompsOnly_sw = yMultiRenamer_data.window.selectedCompsOnly_optn.value; - globalItems_sw = yMultiRenamer_data.window.globalItems_optn.value; - globalLayers_sw = yMultiRenamer_data.window.globalLayers_optn.value; - global_sw = yMultiRenamer_data.window.global_optn.value; - - - //Gathers all SELECTED items into projectItems, - - var rawItems = app.project.items; - var projectItems = []; - for(i=1;i<=rawItems.length;i++){ - currentItem = rawItems[i]; - if( (currentItem.selected||(currentItem.parentFolder.selected&recursive_sw))||(globalItems_sw||global_sw) ){ - projectItems.push(currentItem); - } - } - - //Gathers all SELECTED layers into projectLayers, - var projectComps = []; - for(i=1;i0){ - n = ' '+String(i); - } - if(!allRenamable[i].locked){ - allRenamable[i].name = yMultiRenamer_data.window.root_str.text+n; - //allRenamable[i].name = String(Math.random()); //EVIL LAUGHS - } - - - } - app.endUndoGroup(); - -} -*/ - //--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//-------- - -function build_yMultiRenamer_data_UI(){ - yMultiRenamer_data.window = new Window ( yMultiRenamer_data.res); - yMultiRenamer_data.window.tbdpnl = yMultiRenamer_data.window.add("tabbedpanel"); - yMultiRenamer_data.window.tbdpnl.itemsTab = yMultiRenamer_data.window.tbdpnl.add("tab",undefined,"Layers"); - yMultiRenamer_data.window.tbdpnl.layersTab = yMultiRenamer_data.window.tbdpnl.add("tab",undefined,"Items"); - yMultiRenamer_data.window.tbdpnl.bothTab = yMultiRenamer_data.window.tbdpnl.add("tab",undefined,"Both"); - yMultiRenamer_data.window.tbdpnl.txt = yMultiRenamer_data.window.add("statictext",undefined,"adsad"); - yMultiRenamer_data.window.tbdpnl.onChange = update; - - - - //yMultiRenamer_data.window.exec_btn.onClick = yMultiRenamer; - yMultiRenamer_data.window.show(); - } -function update(){ - yMultiRenamer_data.window.tbdpnl.txt.text = yMultiRenamer_data.window.tbdpnl.selection.text; - } -yMultiRenamer_data.activate = build_yMultiRenamer_data_UI ; - -//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own. - -/* - if (typeof(YTB)=='undefined'){ - */ - yMultiRenamer_data.activate(); - /*}else{ - } -*/ - -// a= yMultiRenamer() +yMultiRenamer_data = new Object(); + +yMultiRenamer_data.scriptName = 'yMultiRenamer'; +yMultiRenamer_data.scriptDesc = 'Tool to make it easy to rename multiple project items and/or comp layers'; +yMultiRenamer_data.scriptVer = '0.2a'; +yMultiRenamer_data.webLink = 'yorchnet.com'; + +//if yToolBox Exists add it to its tool list. +if (typeof(YTB)!=='undefined'){ + YTB.tools.push(yMultiRenamer_data); + + //it should be called from toolbox. + + yMultiRenamer_data.buttonWidth=76; + yMultiRenamer_data.buttonHeight=30; + + yMultiRenamer_data.btnLayout = "btn_"+yMultiRenamer_data.scriptName+": Button { preferredSize: ['"+ YTB.buttonWidth+"','"+ YTB.buttonHeight+"'], text:'"+yMultiRenamer_data.scriptName+"', helpTip:'"+yMultiRenamer_data.scriptDesc+"' }"; + + } + +yMultiRenamer_data.res = "window { \ + type:'palette' , text:'"+yMultiRenamer_data.scriptName+' '+yMultiRenamer_data.scriptVer+"', margins:[10,10,10,10],spacing:[5,5,5,5],\ + \ + }"; + /* + items_tab:Tab{text:'asdasd',helpTip:'asdasdasd'},\ + root_str_chk: Checkbox { text:'New root name:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',value:true },\ + root_str: EditText { text:'', alignment:['fill','center'],helpTip:'Includes Items and folders within folders and subfolders.' },\ + search_str_chk: Checkbox { text:'Search for:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ + search_str: EditText { text:'', alignment:['fill','center'],helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\ + search_rplc_tit: StaticText { text:'Replace with:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ + search_rplc: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false},\ + pre_chk: Checkbox { text:'AddAsPrefix', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ + pre: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\ + pre_chk: Checkbox { text:'AddAsSuffix', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ + su: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\ + recursive_optn: Checkbox { text:'Recursive', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ + selectedCompsOnly_optn: Checkbox { text:'Selected Comps Only', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ + globalItems_optn: Checkbox { text:'All Items', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ + globalLayers_optn: Checkbox { text:'All Layers', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ + global_optn: Checkbox { text:'Global', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ + exec_btn: Button {text:'do It',preferredSize:[150,35],helpTip:'do it'}\ + info: Group { \ + alignment:['center','bottom'], \ + icon: Image {preferredSize: [15, 18]},\ + website: StaticText { text:'"+yMultiRenamer_data.webLink+"', alignment:['fill','center'] },\ + }\ + \ + }"; + */ + //--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//-------- + // MAIN SCRIPT GOES HERE. + +/* + + + +function yMultiRenamer(){ + + recursive_sw = yMultiRenamer_data.window.recursive_optn.value; + selectedCompsOnly_sw = yMultiRenamer_data.window.selectedCompsOnly_optn.value; + globalItems_sw = yMultiRenamer_data.window.globalItems_optn.value; + globalLayers_sw = yMultiRenamer_data.window.globalLayers_optn.value; + global_sw = yMultiRenamer_data.window.global_optn.value; + + + //Gathers all SELECTED items into projectItems, + + var rawItems = app.project.items; + var projectItems = []; + for(i=1;i<=rawItems.length;i++){ + currentItem = rawItems[i]; + if( (currentItem.selected||(currentItem.parentFolder.selected&recursive_sw))||(globalItems_sw||global_sw) ){ + projectItems.push(currentItem); + } + } + + //Gathers all SELECTED layers into projectLayers, + var projectComps = []; + for(i=1;i0){ + n = ' '+String(i); + } + if(!allRenamable[i].locked){ + allRenamable[i].name = yMultiRenamer_data.window.root_str.text+n; + //allRenamable[i].name = String(Math.random()); //EVIL LAUGHS + } + + + } + app.endUndoGroup(); + +} +*/ + //--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//-------- + +function build_yMultiRenamer_data_UI(){ + yMultiRenamer_data.window = new Window ( yMultiRenamer_data.res); + yMultiRenamer_data.window.tbdpnl = yMultiRenamer_data.window.add("tabbedpanel"); + yMultiRenamer_data.window.tbdpnl.itemsTab = yMultiRenamer_data.window.tbdpnl.add("tab",undefined,"Layers"); + yMultiRenamer_data.window.tbdpnl.layersTab = yMultiRenamer_data.window.tbdpnl.add("tab",undefined,"Items"); + yMultiRenamer_data.window.tbdpnl.bothTab = yMultiRenamer_data.window.tbdpnl.add("tab",undefined,"Both"); + yMultiRenamer_data.window.tbdpnl.txt = yMultiRenamer_data.window.add("statictext",undefined,"adsad"); + yMultiRenamer_data.window.tbdpnl.onChange = update; + + + + //yMultiRenamer_data.window.exec_btn.onClick = yMultiRenamer; + yMultiRenamer_data.window.show(); + } +function update(){ + yMultiRenamer_data.window.tbdpnl.txt.text = yMultiRenamer_data.window.tbdpnl.selection.text; + } +yMultiRenamer_data.activate = build_yMultiRenamer_data_UI ; + +//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own. + +/* + if (typeof(YTB)=='undefined'){ + */ + yMultiRenamer_data.activate(); + /*}else{ + } +*/ + +// a= yMultiRenamer() diff --git a/yScripts/wip/y_renderMarkers.jsx b/yScripts/wip/y_renderMarkers.jsx index b90b28f..1b00f78 100755 --- a/yScripts/wip/y_renderMarkers.jsx +++ b/yScripts/wip/y_renderMarkers.jsx @@ -1,40 +1,40 @@ -//app.project.renderQueue.render() -sl = app.project.activeItem.selectedLayers; -//a = app.project.renderQueue.items[1] - -function Marker(time,comment,layer){ - - this.time = time; - this.comment = comment; - this.layer = layer; - - return this - } -markers = []; - -//alert(new marker(50,'asdads').time); - -for(i=0;if)){ - value = n - (n%f); - return(value); - }else{ - alert('error'); - } -} +if (Array.prototype.getOne==null) Array.prototype.getOne=function(item){ //Extends the Array class with the getOne functions wich + var val = -1; + for(i=0;i<=this.length;i++){ + if(this[i]==item){ + var val = i; + } + } + return val; +} +function yFactor(n,f){ + if((typeof(n)=='number'&&typeof(f)=='number')&&(n>f)){ + value = n - (n%f); + return(value); + }else{ + alert('error'); + } +} diff --git a/yScripts/y_colorProbe.jsx b/yScripts/y_colorProbe.jsx index 4784a5c..de9d248 100755 --- a/yScripts/y_colorProbe.jsx +++ b/yScripts/y_colorProbe.jsx @@ -1,120 +1,120 @@ -#include "../yScripts/y_JSExtensions.jsx"; -#include "usefulFunctions.jsx"; - -function YColorProbe() -{ - this.info = - { - name : "yColorProbe", - version : 0.0, - stage : "development", - description : "Creates a Null that will Sample the selected layer within the specified radius.", - url : "yorchnet.com" - }; - this.appearence = - { - buttonHeight : 30, - buttonWidth : 126 - }; - this.resources = - { - icon : new File('yNet.png'), - }; - this.init = function init() - { - - this.btnLauyout = - "button\ - {\ - preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'],\ - text:'" + this.info.name + "',\ - helpTip:'" + this.info.description + "'\ - }"; - - this. res = - "window\ - {\ - type:'palette',\ - text:'" + this.info.name + ' ' + this.info.ver + ' ' + this.info.stage + "',\ - info: Group \ - {\ - alignment:['center','bottom'],\ - icon: Image \ - {\ - icon:'" + this.resources.icon.path + '/' + this.resources.icon.name + "',\ - preferredSize: [15, 18]\ - },\ - website: StaticText\ - {\ - text:'" + this.info.url + "',\ - alignment:['fill','center']\ - },\ - }\ - }"; - } - this.getInfo = function getInfo( ) - { - alert("asdasdasd"); - } - this.createUI = function createUI() - { - this.window = new Window ( this.res ); - this.window.show() ; - } - 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.... - - //It works with Sampled layers at a 100% scale only. - try - { - sel = app.project.activeItem.selectedLayers[0]; - } - catch (err) - { - sel = undefined; - } - - myNull = app.project.activeItem.layers.addNull(); - myNull.transform.anchorPoint.setValue([50,50]); - myNull.name = yUniStr('colorProbe'); //Generates a Unique Name by adding numbers at the end of the main string. - layerCTRL = myNull("Effects").addProperty("Layer Control"); - layerCTRL.name='sampledLayer'; - colorCTRL = myNull("Effects").addProperty("Color Control"); - colorCTRL.name='outColor'; - radiusCTRL = myNull("Effects").addProperty("Slider Control"); - radiusCTRL.name ='radius'; - myNull("Effects")("radius")('Slider').setValue(5); - colExp = 'myLayer = thisLayer("Effects")("sampledLayer")("Layer");\ - p = thisLayer.toWorld(thisLayer.transform.anchorPoint);\ - r = thisLayer("Effects")("radius")("Slider");\ - myLayer.sampleImage(p, radius = [r, r], postEffect=true, t=time)'; - myNull("Effects")('outColor')('Color').expression=colExp; - myNull.label=2; - myNull.source.height=30; - myNull.source.width=30; - myNull.anchorPoint=(15,15); - - if(sel!==undefined){ - myNull("Effects")('sampledLayer')(1).setValue(sel.index); - } - - app.endUndoGroup(); - } - - this.activate = this.yMainFunction; - - this.init(); - return this; -} - -//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own. -if (typeof(YTB)=='undefined') -{ - yColorProbe = new YColorProbe(); - yColorProbe.activate(); -} -else -{ - YTB.addTool(new YColorProbe()); -} +#include "../yScripts/y_JSExtensions.jsx"; +#include "usefulFunctions.jsx"; + +function YColorProbe() +{ + this.info = + { + name : "yColorProbe", + version : 0.0, + stage : "development", + description : "Creates a Null that will Sample the selected layer within the specified radius.", + url : "yorchnet.com" + }; + this.appearence = + { + buttonHeight : 30, + buttonWidth : 126 + }; + this.resources = + { + icon : new File('yNet.png'), + }; + this.init = function init() + { + + this.btnLauyout = + "button\ + {\ + preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'],\ + text:'" + this.info.name + "',\ + helpTip:'" + this.info.description + "'\ + }"; + + this. res = + "window\ + {\ + type:'palette',\ + text:'" + this.info.name + ' ' + this.info.ver + ' ' + this.info.stage + "',\ + info: Group \ + {\ + alignment:['center','bottom'],\ + icon: Image \ + {\ + icon:'" + this.resources.icon.path + '/' + this.resources.icon.name + "',\ + preferredSize: [15, 18]\ + },\ + website: StaticText\ + {\ + text:'" + this.info.url + "',\ + alignment:['fill','center']\ + },\ + }\ + }"; + } + this.getInfo = function getInfo( ) + { + alert("asdasdasd"); + } + this.createUI = function createUI() + { + this.window = new Window ( this.res ); + this.window.show() ; + } + 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.... + + //It works with Sampled layers at a 100% scale only. + try + { + sel = app.project.activeItem.selectedLayers[0]; + } + catch (err) + { + sel = undefined; + } + + myNull = app.project.activeItem.layers.addNull(); + myNull.transform.anchorPoint.setValue([50,50]); + myNull.name = yUniStr('colorProbe'); //Generates a Unique Name by adding numbers at the end of the main string. + layerCTRL = myNull("Effects").addProperty("Layer Control"); + layerCTRL.name='sampledLayer'; + colorCTRL = myNull("Effects").addProperty("Color Control"); + colorCTRL.name='outColor'; + radiusCTRL = myNull("Effects").addProperty("Slider Control"); + radiusCTRL.name ='radius'; + myNull("Effects")("radius")('Slider').setValue(5); + colExp = 'myLayer = thisLayer("Effects")("sampledLayer")("Layer");\ + p = thisLayer.toWorld(thisLayer.transform.anchorPoint);\ + r = thisLayer("Effects")("radius")("Slider");\ + myLayer.sampleImage(p, radius = [r, r], postEffect=true, t=time)'; + myNull("Effects")('outColor')('Color').expression=colExp; + myNull.label=2; + myNull.source.height=30; + myNull.source.width=30; + myNull.anchorPoint=(15,15); + + if(sel!==undefined){ + myNull("Effects")('sampledLayer')(1).setValue(sel.index); + } + + app.endUndoGroup(); + } + + this.activate = this.yMainFunction; + + this.init(); + return this; +} + +//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own. +if (typeof(YTB)=='undefined') +{ + yColorProbe = new YColorProbe(); + yColorProbe.activate(); +} +else +{ + YTB.addTool(new YColorProbe()); +} diff --git a/yScripts/y_puppetRig.jsx b/yScripts/y_puppetRig.jsx index dd797b8..24a6456 100755 --- a/yScripts/y_puppetRig.jsx +++ b/yScripts/y_puppetRig.jsx @@ -1,245 +1,245 @@ -yPuppetRig_data = new Object(); - -yPuppetRig_data.scriptName = 'yPuppetRigger'; -yPuppetRig_data.scriptVer = 'v0.3.3a'; -yPuppetRig_data.scriptDesc = 'Tools for streamlining puppet-based animation rigs.'; -yPuppetRig_data.string_info = 'yorchnet.com'; -yPuppetRig_data.e_000 = 'e_000 : No layers are selected.'; -yPuppetRig_data.e_001 = 'e_001 : Layer contains no effects.'; -yPuppetRig_data.e_002 = 'e_002 : Layer contains no Puppet effects.'; -yPuppetRig_data.string_001 = 'Rig Pins'; -yPuppetRig_data.string_001x = 'Rigs Selected Pins on Layer'; -yPuppetRig_data.string_002 = 'Rig Layers'; -yPuppetRig_data.string_002x = 'Rigs Selected Layers'; -yPuppetRig_data.string_003 = 'Rig All'; -yPuppetRig_data.string_003x = 'Rig All Layers in Comp'; - - -//it should be called from toolbox. -yPuppetRig_data.buttonWidth=76; -yPuppetRig_data.buttonHeight=30; - -//if yToolBox Exists add it to its tool list. -if (typeof(YTB)!=='undefined'){ - 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+"' }"; - } - -function build_yPuppetRig_data_UI(){ - //define custom strings for error messages, names, button names and helpTips. //Defines Layout variables. - -yPuppetRig_data.res = "window { \ - type:'palette' , text:'"+yPuppetRig_data.scriptName+" "+yPuppetRig_data.scriptVer+"',margins:[10,10,10,10],spacing:[5,5,5,5],\ - grp: Group { orientation:'column' , alignment:['fill','fill'] , alignChildren:['fill','fill'] , spacing:'2' , margin:'5', \ - btn_01: Button { preferredSize: ['"+yPuppetRig_data.buttonWidth+"','"+yPuppetRig_data.buttonHeight+"'], text:'"+yPuppetRig_data.string_001+"', helpTip:'"+yPuppetRig_data.string_001x+"' }, \ - btn_02: Button { preferredSize: ['"+yPuppetRig_data.buttonWidth+"','"+yPuppetRig_data.buttonHeight+"'], text:'"+yPuppetRig_data.string_002+"', helpTip:'"+yPuppetRig_data.string_002x+"' }, \ - btn_03: Button { preferredSize: ['"+yPuppetRig_data.buttonWidth+"','"+yPuppetRig_data.buttonHeight+"'], text:'"+yPuppetRig_data.string_003+"', helpTip:'"+yPuppetRig_data.string_003x+"' }, \ - chk_optn: Checkbox { text:'Enable Options', alignment:['fill','center'] , helpTip:'Enable Advanced Options' },\ - optn: Panel{ text:'Options' , visible:'false', orientation:'row' , alignment:['fill','fill'] , alignChildren:['fill','fill'] , spacing:'2' , margin:'5', \ - nullSizeGrp: Group{ \ - orientation:'column' , alignment:['fill','fill'] , alignChildren:['fill','fill'] , spacing:'2' , margin:'5', \ - sldr_tit: StaticText { text:'Set Null Size in Pixels.', alignment:['fill','center'] },\ - sldr: Slider { value:'125' , minvalue:'6' , maxvalue:'250' , text:'alaverga', helpTip:'"+yPuppetRig_data.string_001x+"' }, \ - sldr_Values_txt: Group{\ - orientation:'row' , alignment:['fill','fill'] , alignChildren:['center','fill'] , spacing:'2' , margin:'5', \ - mintxt: StaticText { text:'small', alignment:['left','fill'] },\ - medtxt: StaticText { text:'medium', alignment:['center','fill'] },\ - maxtxt: StaticText { text:'big', alignment:['right','fill'] },\ - }\ - otherOptionsGrp: Group{ \ - 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_02: Checkbox { text:'Lock Layer', alignment:['fill','center'] , helpTip:'Lock layer after rigging.' },\ - },\ - }\ - },\ - info: Group { \ - alignment:['center','bottom'], \ - icn_app: Image {icon:'"+ YTB.icon.path+'/'+ YTB.icon.name+"',preferredSize: [15, 18]},\ - txt_info: StaticText { text:'"+yPuppetRig_data.string_info+"', alignment:['fill','center'] },\ - }\ - }\ - }"; - - //if (typeof(YTB)!=='undefined'){ - yPuppetRigDialog = new Window (yPuppetRig_data.res); // Creates Window - //} - //yPuppetRigDialog.onDraw = customColors(yPuppetRigDialog); - yPuppetRigDialog.grp.optn.enabled = false; - yPuppetRigDialog.show(); //Shows Window. - - - - //yPuppetRigDialog.grp.info.icn_app.image = YTB.icon.substring(3,YTB.icon.length); - yPuppetRigDialog.grp.btn_01.onClick = runRigPin; //Defines Button Action - yPuppetRigDialog.grp.btn_02.onClick = runRigLayer; //Defines Button Action - yPuppetRigDialog.grp.btn_03.onClick = runRigAll; //Defines Button Action - yPuppetRigDialog.grp.chk_optn.onClick = toggleOptions; -} -yPuppetRig_data.activate = build_yPuppetRig_data_UI ; - - -function toggleOptions(){ - if(yPuppetRigDialog.grp.chk_optn==true){ - yPuppetRigDialog.grp.chk_optn=false; - } - else - { - yPuppetRigDialog.grp.chk_optn=true; - } - yPuppetRigDialog.grp.optn.enabled = yPuppetRigDialog.grp.chk_optn; -} -function customColors(rsr){ - g = rsr.graphics; - myBrush = g.newBrush(g.BrushType.SOLID_COLOR, [0.25, 0.05, 0.25, 1]); - g.backgroundColor = yToolBoxPalette.graphics.backgroundColor; - } - -function getPuppetEffects(aLayer){ - puppetEffects = [] - for(i=1;i<=aLayer('Effects').numProperties;i++){ - puppetEffects.push(aLayer('Effects')(i)); - } - return puppetEffects; - } -function getPosPins(aLayer){ - puppetEffects = getPuppetEffects(aLayer); - if(puppetEffects.length>0){ - posPins = []; - for(i=0;i0){ + posPins = []; + for(i=0;i0){ - sel = app.project.activeItem.selectedLayers; //array containing selection; - if(sel.length == 1&&sel[0].source!= null){ - - myItem = sel[0].source; - myItemType = myItem.typeName; - - if(myItemType!="Composition"){ - alert(e_0001,myName+' '+myVer); - }else{ - - sliderCtrl = sel[0]("Effects").addProperty("Slider Control"); - sliderCtrl.name = "Animation State"; //should check for previously created sliders named the same and name uniquely accordingly. - txtExpression = 'myLayer = thisLayer;myComp =comp(myLayer.name);\ -max = myComp.numLayers;\ -myValue = effect("'+sliderCtrl.name+'")("'+sliderCtrl("Slider").name+'");\ -if(myValue<=max&&myValue>1){\ -parseInt(myValue)\ -}else if (myValue>max){\ -max\ -}else if(myValue<1){1}'; - //'l = thisComp.layer('+'"'+app.project.activeItem.selectedLayers[0].name+'"'+');'+'fromWorld(l.toComp(l.transform.anchorPoint))'; - sliderCtrl("Slider").expression = txtExpression; - sliderCtrl("Slider").setValue(1); - txtExpression = null; - nLayers =myItem.numLayers; - txtExpression = 'extValue = comp("'+sel[0].containingComp.name+'").layer("'+myItem.name+'").effect("'+sliderCtrl.name+'")("'+sliderCtrl("Slider").name+'");if(extValue == thisLayer.index){100}else{0}'; - for (z=1;z<=nLayers;z++){ - myItem.layer(z).opacity.expression=txtExpression; - } - txtExpression = null; - } - }else{ - alert(e_0001,myName+' '+myVer); - } - }else{ - alert(e_0000,myName+' '+myVer+" : Error"); - } -app.endUndoGroup(); -} - - - - - - - //--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//-------- - -function build_yStopMotion_data_UI(){ - yStopMotion_data.window = new Window ( yStopMotion_data.res); - yStopMotion_data.window.show(); - } -yStopMotion_data.activate = yStopMotionLayer ; - -//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own. -if (typeof(YTB)=='undefined'){ - yStopMotion_data.activate(); - }else{ - } +yStopMotion_data = new Object(); + +yStopMotion_data.scriptName = 'yStopMotion'; +yStopMotion_data.scriptDesc = 'Dynamically change layer sequence opacity from a slider in pComp'; +yStopMotion_data.scriptVer = '0.1a'; +yStopMotion_data.webLink = 'yorchnet.com'; + +//if yToolBox Exists add it to its tool list. +if (typeof(YTB)!=='undefined'){ + YTB.tools.push(yStopMotion_data); + + //it should be called from toolbox. + /* yStopMotion_data.buttonWidth=76; + yStopMotion_data.buttonHeight=30; +*/ + yStopMotion_data.btnLayout = "btn_"+yStopMotion_data.scriptName+": Button { preferredSize: ['"+ YTB.buttonWidth+"','"+ YTB.buttonHeight+"'], text:'"+yStopMotion_data.scriptName+"', helpTip:'"+yStopMotion_data.scriptDesc+"' }"; + + } + +yStopMotion_data.res = "window { \ + type:'palette' , text:'"+yStopMotion_data.scriptName+' '+yStopMotion_data.scriptVer+"',\ + \ + \ + info: Group { \ + alignment:['center','bottom'], \ + icon: Image {preferredSize: [15, 18]},\ + website: StaticText { text:'"+yStopMotion_data.webLink+"', alignment:['fill','center'] },\ + }\ + \ + }"; + + //--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//-------- + // MAIN SCRIPT GOES HERE. + + e_0000 = "There are no comps in project." +e_0001 = "No Comps selected." + +function yStopMotionLayer(){ + myName = "yStopMotionLayer"; + myVer = "0.2a"; + nComps = app.project.items.length; + app.beginUndoGroup(myName); + if(nComps>0){ + sel = app.project.activeItem.selectedLayers; //array containing selection; + if(sel.length == 1&&sel[0].source!= null){ + + myItem = sel[0].source; + myItemType = myItem.typeName; + + if(myItemType!="Composition"){ + alert(e_0001,myName+' '+myVer); + }else{ + + sliderCtrl = sel[0]("Effects").addProperty("Slider Control"); + sliderCtrl.name = "Animation State"; //should check for previously created sliders named the same and name uniquely accordingly. + txtExpression = 'myLayer = thisLayer;myComp =comp(myLayer.name);\ +max = myComp.numLayers;\ +myValue = effect("'+sliderCtrl.name+'")("'+sliderCtrl("Slider").name+'");\ +if(myValue<=max&&myValue>1){\ +parseInt(myValue)\ +}else if (myValue>max){\ +max\ +}else if(myValue<1){1}'; + //'l = thisComp.layer('+'"'+app.project.activeItem.selectedLayers[0].name+'"'+');'+'fromWorld(l.toComp(l.transform.anchorPoint))'; + sliderCtrl("Slider").expression = txtExpression; + sliderCtrl("Slider").setValue(1); + txtExpression = null; + nLayers =myItem.numLayers; + txtExpression = 'extValue = comp("'+sel[0].containingComp.name+'").layer("'+myItem.name+'").effect("'+sliderCtrl.name+'")("'+sliderCtrl("Slider").name+'");if(extValue == thisLayer.index){100}else{0}'; + for (z=1;z<=nLayers;z++){ + myItem.layer(z).opacity.expression=txtExpression; + } + txtExpression = null; + } + }else{ + alert(e_0001,myName+' '+myVer); + } + }else{ + alert(e_0000,myName+' '+myVer+" : Error"); + } +app.endUndoGroup(); +} + + + + + + + //--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//-------- + +function build_yStopMotion_data_UI(){ + yStopMotion_data.window = new Window ( yStopMotion_data.res); + yStopMotion_data.window.show(); + } +yStopMotion_data.activate = yStopMotionLayer ; + +//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own. +if (typeof(YTB)=='undefined'){ + yStopMotion_data.activate(); + }else{ + } diff --git a/yScripts/y_yBindBetween2.jsx b/yScripts/y_yBindBetween2.jsx index 9d111dd..4d29609 100644 --- a/yScripts/y_yBindBetween2.jsx +++ b/yScripts/y_yBindBetween2.jsx @@ -1 +1,197 @@ -yEntreDeux_data = new Object(); yEntreDeux_data.scriptName = 'yBindBetween2'; yEntreDeux_data.scriptDesc = 'Constraints a layer between two others, position and rotation-wise'; yEntreDeux_data.scriptVer = '0.12a'; yEntreDeux_data.webLink = 'yorchnet.com'; //if yToolBox Exists add it to its tool list. if (typeof(YTB)!=='undefined'){ YTB.tools.push(yEntreDeux_data); //it should be called from toolbox. /* yEntreDeux_data.buttonWidth=76; yEntreDeux_data.buttonHeight=30; */ yEntreDeux_data.btnLayout = "btn_"+yEntreDeux_data.scriptName+": Button { preferredSize: ['"+YTB.buttonWidth+"','"+ YTB.buttonHeight+"'], text:'"+yEntreDeux_data.scriptName+"', helpTip:'"+yEntreDeux_data.scriptDesc+"' }"; } //--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//-------- // MAIN SCRIPT GOES HERE. function build_yEntreDeux_data_UI(){ //script info yEntreDeux_data = new Object(); yEntreDeux_data.scriptName = 'yEntreDeux'; yEntreDeux_data.scriptVer = '0.1a'; yEntreDeux_data.webLink = 'yorchnet.com'; // GUI //chk_stretch: Checkbox { text:'Stretch', alignment:['fill','center'] , helpTip:'Stretch between parents'},\ yEntreDeux_data.res= "window { \ type:'palette' , text:'"+yEntreDeux_data.scriptName+' '+yEntreDeux_data.scriptVer+"',margins:[10,10,10,10],spacing:[5,5,5,5]\ \ lst_layer: DropDownList {title:'layer to constrain',preferredSize:[150,35],textSelection:'Escoge',helpTip:'Select the layer you wish to constrain'}\ lst_pa: DropDownList {title:'parent a',preferredSize:[150,35],textSelection:'Escoge',helpTip:'Select the first parent'}\ lst_pb: DropDownList {title:'parent b',preferredSize:[150,35],textSelection:'Escoge',helpTip:'Select the second parent'}\ exec_btn: Button {text:'do It',preferredSize:[150,35],helpTip:'do it'}\ \ info: Group { \ alignment:['center','bottom'], \ icon: Image {preferredSize: [15, 18]},\ website: StaticText { text:'"+yEntreDeux_data.webLink+"', alignment:['fill','center'] },\ }\ \ }"; yEntreDeux_data.window = new Window (yEntreDeux_data.res); //never got around of assigning the icon any other way, but it works. yEntreDeux_data.window.info.icon.image = YTB.icon; refresh(); // reloads the possible layers in the gui. yEntreDeux_data.window.exec_btn.onClick = run; yEntreDeux_data.window.show(); } function run(){ app.beginUndoGroup('Bind Between Two'); selectedLayerName=String(yEntreDeux_data.window.lst_layer.selection); parentALayerName=String(yEntreDeux_data.window.lst_pa.selection); parentBLayerName=String(yEntreDeux_data.window.lst_pb.selection); layerN = selectedLayerName.substr(0, selectedLayerName.indexOf('.')); paN = parentALayerName.substr(0, parentALayerName.indexOf('.')); pbN = parentBLayerName.substr(0, parentBLayerName.indexOf('.')); layer = app.project.activeItem.layers[layerN]; pa = app.project.activeItem.layers[paN]; pb = app.project.activeItem.layers[pbN]; layer("Effects").addProperty("Layer Control"); layer("Effects")("Layer Control").name = 'ctrl01'; layer("Effects")("ctrl01")("Layer").setValue(pa.index); layer("Effects").addProperty("Layer Control"); layer("Effects")("Layer Control").name = 'ctrl02'; layer("Effects")("ctrl02")("Layer").setValue(pb.index); layer("Effects").addProperty("Angle Control"); layer("Effects")("Angle Control").name = 'offset'; layer("Effects")("offset")("Angle").setValue(0); layer("Effects").addProperty("Slider Control"); layer("Effects")("Slider Control").name = 'weight'; layer("Effects")("weight")(1).setValue(50); layer("Effects").addProperty("Checkbox Control"); layer("Effects")("Checkbox Control").name = 'stretch'; posExp = 'a = effect("ctrl01")("Layer");\ b = effect("ctrl02")("Layer");\ aPos = a.toComp(a.anchorPoint);\ bPos = b.toComp(b.anchorPoint);\ w= effect("weight")(1)/100;\ (aPos*(1-w)+bPos*(w))' rotExp = 'a =effect("ctrl01")("Layer");\ b = effect("ctrl02")("Layer");\ aPos = a.toComp(a.anchorPoint);\ bPos = b.toComp(b.anchorPoint);\ rx = lookAt(aPos,bPos)[0];\ ry = lookAt(aPos,bPos)[1];\ offset = effect("offset")("Angle");\ if (aPos[1] > bPos[1])\ {\ (ry) -90 + offset\ }\ else\ {\ 90 - (ry) + offset\ }' scaleExp = 'a = effect("ctrl01")("Layer");\ b = effect("ctrl02")("Layer");\ aPos = a.toComp(a.anchorPoint);\ bPos = b.toComp(b.anchorPoint);\ d = Math.sqrt(Math.pow((aPos[0]-bPos[0]),2)+Math.pow((aPos[1]-bPos[1]),2));\ x = transform.scale[0];\ y = transform.scale[1];\ sx = ((d*100)/this.width)/100;\ stretch = effect("stretch")("Checkbox");\ if(stretch==true)\ {\ [x*sx,y]\ }\ else\ {\ [x,y]\ }' layer.transform.position.expression = posExp; layer.transform.rotation.expression= rotExp; layer.transform.scale.expression= scaleExp; app.endUndoGroup(); } function refresh(){ //alert('going'); lists=[yEntreDeux_data.window.lst_pa,yEntreDeux_data.window.lst_layer,yEntreDeux_data.window.lst_pb]//they should be in this order for the assignment of the selection index works right/ for(i=0;i bPos[1])\ + {\ + (ry) -90 + offset\ + }\ + else\ + {\ + 90 - (ry) + offset\ + }' + scaleExp = + 'a = effect("ctrl01")("Layer");\ + b = effect("ctrl02")("Layer");\ + aPos = a.toComp(a.anchorPoint);\ + bPos = b.toComp(b.anchorPoint);\ + d = Math.sqrt(Math.pow((aPos[0]-bPos[0]),2)+Math.pow((aPos[1]-bPos[1]),2));\ + x = transform.scale[0];\ + y = transform.scale[1];\ + sx = ((d*100)/this.width)/100;\ + stretch = effect("stretch")("Checkbox");\ + if(stretch==true)\ + {\ + [x*sx,y]\ + }\ + else\ + {\ + [x,y]\ + }' + + layer.transform.position.expression = posExp; + layer.transform.rotation.expression= rotExp; + layer.transform.scale.expression= scaleExp; + + app.endUndoGroup(); + } + +function refresh(){ + //alert('going'); + lists=[yEntreDeux_data.window.lst_pa,yEntreDeux_data.window.lst_layer,yEntreDeux_data.window.lst_pb]//they should be in this order for the assignment of the selection index works right/ + for(i=0;i