commit 0bfe359e55bff97e3491099a06b9b5a1aa811767 Author: yorch Date: Wed Dec 3 17:11:38 2014 -0800 Got the old tools into git diff --git a/ScriptUI Panels/yToolBox_0.4.2.1a.jsx b/ScriptUI Panels/yToolBox_0.4.2.1a.jsx new file mode 100644 index 0000000..a14abca --- /dev/null +++ b/ScriptUI Panels/yToolBox_0.4.2.1a.jsx @@ -0,0 +1 @@ +function yToolBox(thisObj){ yToolBox_data = new Object(); yToolBox_data.icon = new File('../yScripts/yNet.png'); yToolBox_data.header = new File('../yScripts/header.png'); yToolBox_data.info = 'yorchnet.com'; yToolBox_data.name ='yToolBox'; yToolBox_data.ver ='0.4.2.1 alpha'; yToolBox_data.desc='Working tools so far...'; yToolBox_data.buttonWidth=126; yToolBox_data.buttonHeight=30; yToolBox_data.tools = []; #include "../yScripts/y_JSExtensions.jsx"; //INCLUDED TOOLS #include "../yScripts/y_setStructure_0.1a.jsx"; #include "../yScripts/y_puppetRig_0.3.7a.jsx"; #include "../yScripts/y_colorProbe_0.2a.jsx"; #include "../yScripts/y_yBindBetween2_0.12b.jsx"; #include "../yScripts/y_stopMotionLayer_0.3a.jsx"; #include "../yScripts/y_CornerPin_0.11a.jsx"; yToolBox_data.window = (thisObj instanceof Panel) ? thisObj : new Window("palette", yToolBox_data.info , undefined, {resizeable:true}); //MAIN WINDOW STRUCTURE. var res_header ="group { orientation:'column', alignment:['fill','fill'],margins:[0,0,0,0] \ header: Group { orientation:'column', alignment:['center','top'],margins:[0,0,0,0]\ title: Image {icon:'"+yToolBox_data.header.path+'/'+yToolBox_data.header.name+"',preferredSize: [175, 35]},\ ver: StaticText { text:'"+yToolBox_data.ver+"', alignment:['center','center']}\ desc: StaticText { text:'"+yToolBox_data.desc+"', alignment:['center','center']}, \ }, \ main: Group { orientation:'column',alignment:['fill','fill'], alignChildren:['center','center']," var res = ""; //To be populated with the included Tools var res_footer ="}, \ cmds: Group { alignment:['center','bottom'], \ icn_app: Image {icon:'"+ yToolBox_data.icon.path+'/'+ yToolBox_data.icon.name+"',preferredSize: [15, 18]},\ txt_info: StaticText { text:'"+yToolBox_data.info+"', alignment:['fill','center'] },\ }, \ }"; //POPULATE res with included tools. for (i=0;i=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 diff --git a/yScripts/yNet.png b/yScripts/yNet.png new file mode 100755 index 0000000..31c927e Binary files /dev/null and b/yScripts/yNet.png differ diff --git a/yScripts/y_AFXExtensions.jsx b/yScripts/y_AFXExtensions.jsx new file mode 100755 index 0000000..05282a7 --- /dev/null +++ b/yScripts/y_AFXExtensions.jsx @@ -0,0 +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. + this.selectedPins = []; + for(prop=0;propf)){ + value = n - (n%f); + return(value); + }else{ + alert('error'); + } +} diff --git a/yScripts/y_MultiRenamer_0.1a.jsx b/yScripts/y_MultiRenamer_0.1a.jsx new file mode 100755 index 0000000..dfed917 --- /dev/null +++ b/yScripts/y_MultiRenamer_0.1a.jsx @@ -0,0 +1,176 @@ +yMultiRenamer_data = new Object(); + +yMultiRenamer_data.scriptName = 'yMultiRenamer'; +yMultiRenamer_data.scriptDesc = 'Tool to make it easy to rename multiple project items and/or comp layers'; +yMultiRenamer_data.scriptVer = '0.1a'; +yMultiRenamer_data.webLink = 'yorchnet.com'; + +//if yToolBox Exists add it to its tool list. +if (typeof(yToolBox_data)!=='undefined'){ + yToolBox_data.tools.push(yMultiRenamer_data); + + //it should be called from toolbox. + + yMultiRenamer_data.buttonWidth=76; + yMultiRenamer_data.buttonHeight=30; + + yMultiRenamer_data.btnLayout = "btn_"+yMultiRenamer_data.scriptName+": Button { preferredSize: ['"+ yToolBox_data.buttonWidth+"','"+ yToolBox_data.buttonHeight+"'], text:'"+yMultiRenamer_data.scriptName+"', helpTip:'"+yMultiRenamer_data.scriptDesc+"' }"; + + } + +yMultiRenamer_data.res = "window { \ + type:'palette' , text:'"+yMultiRenamer_data.scriptName+' '+yMultiRenamer_data.scriptVer+"', margins:[10,10,10,10],spacing:[5,5,5,5],\ + \ + root_str_chk: Checkbox { text:'New root name:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',value:true },\ + root_str: EditText { text:'', alignment:['fill','center'],helpTip:'Includes Items and folders within folders and subfolders.' },\ + search_str_chk: Checkbox { text:'Search for:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ + search_str: EditText { text:'', alignment:['fill','center'],helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\ + search_rplc_tit: StaticText { text:'Replace with:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ + search_rplc: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false},\ + pre_chk: Checkbox { text:'AddAsPrefix', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ + pre: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\ + pre_chk: Checkbox { text:'AddAsSuffix', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ + su: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\ + recursive_optn: Checkbox { text:'Recursive', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ + selectedCompsOnly_optn: Checkbox { text:'Selected Comps Only', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ + globalItems_optn: Checkbox { text:'All Items', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ + globalLayers_optn: Checkbox { text:'All Layers', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ + global_optn: Checkbox { text:'Global', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ + exec_btn: Button {text:'do It',preferredSize:[150,35],helpTip:'do it'}\ + info: Group { \ + alignment:['center','bottom'], \ + icon: Image {preferredSize: [15, 18]},\ + website: StaticText { text:'"+yMultiRenamer_data.webLink+"', alignment:['fill','center'] },\ + }\ + \ + }"; + + //--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//-------- + // MAIN SCRIPT GOES HERE. + + + + + +function yMultiRenamer(){ + + recursive_sw = yMultiRenamer_data.window.recursive_optn.value; + selectedCompsOnly_sw = yMultiRenamer_data.window.selectedCompsOnly_optn.value; + globalItems_sw = yMultiRenamer_data.window.globalItems_optn.value; + globalLayers_sw = yMultiRenamer_data.window.globalLayers_optn.value; + global_sw = yMultiRenamer_data.window.global_optn.value; + + //Gathers all SELECTED items into projectItems, + + var rawItems = app.project.items; + var projectItems = []; + for(i=1;i<=rawItems.length;i++){ + currentItem = rawItems[i]; + if( (currentItem.selected||(currentItem.parentFolder.selected&recursive_sw))||(globalItems_sw||global_sw) ){ + projectItems.push(currentItem); + } + } + + //Gathers all SELECTED layers into projectLayers, + var projectComps = []; + for(i=1;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(yToolBox_data)=='undefined'){ + yMultiRenamer_data.activate(); + }else{ + } + + +// a= yMultiRenamer() \ No newline at end of file diff --git a/yScripts/y_MultiRenamer_0.2a.jsx b/yScripts/y_MultiRenamer_0.2a.jsx new file mode 100755 index 0000000..1cddc3f --- /dev/null +++ b/yScripts/y_MultiRenamer_0.2a.jsx @@ -0,0 +1,151 @@ +yMultiRenamer_data = new Object(); + +yMultiRenamer_data.scriptName = 'yMultiRenamer'; +yMultiRenamer_data.scriptDesc = 'Tool to make it easy to rename multiple project items and/or comp layers'; +yMultiRenamer_data.scriptVer = '0.2a'; +yMultiRenamer_data.webLink = 'yorchnet.com'; + +//if yToolBox Exists add it to its tool list. +if (typeof(yToolBox_data)!=='undefined'){ + yToolBox_data.tools.push(yMultiRenamer_data); + + //it should be called from toolbox. + + yMultiRenamer_data.buttonWidth=76; + yMultiRenamer_data.buttonHeight=30; + + yMultiRenamer_data.btnLayout = "btn_"+yMultiRenamer_data.scriptName+": Button { preferredSize: ['"+ yToolBox_data.buttonWidth+"','"+ yToolBox_data.buttonHeight+"'], text:'"+yMultiRenamer_data.scriptName+"', helpTip:'"+yMultiRenamer_data.scriptDesc+"' }"; + + } + +yMultiRenamer_data.res = "window { \ + type:'palette' , text:'"+yMultiRenamer_data.scriptName+' '+yMultiRenamer_data.scriptVer+"', margins:[10,10,10,10],spacing:[5,5,5,5],\ + \ + }"; + /* + items_tab:Tab{text:'asdasd',helpTip:'asdasdasd'},\ + root_str_chk: Checkbox { text:'New root name:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',value:true },\ + root_str: EditText { text:'', alignment:['fill','center'],helpTip:'Includes Items and folders within folders and subfolders.' },\ + search_str_chk: Checkbox { text:'Search for:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ + search_str: EditText { text:'', alignment:['fill','center'],helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\ + search_rplc_tit: StaticText { text:'Replace with:', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ + search_rplc: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false},\ + pre_chk: Checkbox { text:'AddAsPrefix', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ + pre: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\ + pre_chk: Checkbox { text:'AddAsSuffix', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ + su: EditText { text:'', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.',enabled:false },\ + recursive_optn: Checkbox { text:'Recursive', alignment:['fill','center'] , helpTip:'Includes Items and folders within folders and subfolders.' },\ + selectedCompsOnly_optn: Checkbox { text:'Selected Comps Only', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ + globalItems_optn: Checkbox { text:'All Items', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ + globalLayers_optn: Checkbox { text:'All Layers', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ + global_optn: Checkbox { text:'Global', alignment:['fill','center'] , helpTip:'Inlcudes selected Layers even in UnActive Comps' },\ + exec_btn: Button {text:'do It',preferredSize:[150,35],helpTip:'do it'}\ + info: Group { \ + alignment:['center','bottom'], \ + icon: Image {preferredSize: [15, 18]},\ + website: StaticText { text:'"+yMultiRenamer_data.webLink+"', alignment:['fill','center'] },\ + }\ + \ + }"; + */ + //--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//-------- + // MAIN SCRIPT GOES HERE. + +/* + + + +function yMultiRenamer(){ + + recursive_sw = yMultiRenamer_data.window.recursive_optn.value; + selectedCompsOnly_sw = yMultiRenamer_data.window.selectedCompsOnly_optn.value; + globalItems_sw = yMultiRenamer_data.window.globalItems_optn.value; + globalLayers_sw = yMultiRenamer_data.window.globalLayers_optn.value; + global_sw = yMultiRenamer_data.window.global_optn.value; + + + //Gathers all SELECTED items into projectItems, + + var rawItems = app.project.items; + var projectItems = []; + for(i=1;i<=rawItems.length;i++){ + currentItem = rawItems[i]; + if( (currentItem.selected||(currentItem.parentFolder.selected&recursive_sw))||(globalItems_sw||global_sw) ){ + projectItems.push(currentItem); + } + } + + //Gathers all SELECTED layers into projectLayers, + var projectComps = []; + for(i=1;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(yToolBox_data)=='undefined'){ + */ + yMultiRenamer_data.activate(); + /*}else{ + } +*/ + +// a= yMultiRenamer() \ No newline at end of file diff --git a/yScripts/y_colorProbe_0.2a.jsx b/yScripts/y_colorProbe_0.2a.jsx new file mode 100755 index 0000000..c0b6911 --- /dev/null +++ b/yScripts/y_colorProbe_0.2a.jsx @@ -0,0 +1,72 @@ +yColorProbe_data = new Object(); + +yColorProbe_data.scriptName = 'yColorProbe'; +yColorProbe_data.scriptDesc = 'Creates a Null that will Sample the selected layer within the specified radius.'; +yColorProbe_data.scriptVer = '0.2a'; +yColorProbe_data.webLink = 'yorchnet.com'; + +//if yToolBox Exists add it to its tool list. +if (typeof(yToolBox_data)!=='undefined'){ + yToolBox_data.tools.push(yColorProbe_data); + + //it should be called from toolbox. + /* yColorProbe_data.buttonWidth=76; + yColorProbe_data.buttonHeight=30; +*/ + yColorProbe_data.btnLayout = "btn_"+yColorProbe_data.scriptName+": Button { preferredSize: ['"+ yToolBox_data.buttonWidth+"','"+ yToolBox_data.buttonHeight+"'], text:'"+yColorProbe_data.scriptName+"', helpTip:'"+yColorProbe_data.scriptDesc+"' }"; + + } + +yColorProbe_data.res = "window { \ + type:'palette' , text:'"+yColorProbe_data.scriptName+' '+yColorProbe_data.scriptVer+"',\ + \ + \ + info: Group { \ + alignment:['center','bottom'], \ + icon: Image {preferredSize: [15, 18]},\ + website: StaticText { text:'"+yColorProbe_data.webLink+"', alignment:['fill','center'] },\ + }\ + \ + }"; + + //--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//-------- + // MAIN SCRIPT GOES HERE. + + #include "usefulFunctions.jsx"; + +function yColorProbe(){ + app.beginUndoGroup('Create ColorProbe'); + + 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(0.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; + + app.endUndoGroup(); + return 'ok' + } + + //--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//--------//-------- + +function build_yColorProbe_data_UI(){ + yColorProbe_data.window = new Window ( yColorProbe_data.res); + yColorProbe_data.window.show(); + } +yColorProbe_data.activate =yColorProbe ; + +//CHECKS that the toolbox exists, and if it doesn´t it runs the script on its own. +if (typeof(yToolBox_data)=='undefined'){ + yColorProbe_data.activate(); + }else{ + } diff --git a/yScripts/y_puppetRig_0.3.7a.jsx b/yScripts/y_puppetRig_0.3.7a.jsx new file mode 100755 index 0000000..189226d --- /dev/null +++ b/yScripts/y_puppetRig_0.3.7a.jsx @@ -0,0 +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(yToolBox_data)!=='undefined'){ + yToolBox_data.tools.push(yPuppetRig_data); + yPuppetRig_data.btnLayout = "btn_"+ yPuppetRig_data.scriptName+": Button { preferredSize: ['"+yToolBox_data.buttonWidth+"','"+ yToolBox_data.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:'"+ yToolBox_data.icon.path+'/'+ yToolBox_data.icon.name+"',preferredSize: [15, 18]},\ + txt_info: StaticText { text:'"+yPuppetRig_data.string_info+"', alignment:['fill','center'] },\ + }\ + }\ + }"; + + //if (typeof(yToolBox_data)!=='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 = yToolBox_data.icon.substring(3,yToolBox_data.icon.length); + yPuppetRigDialog.grp.btn_01.onClick = runRigPin; //Defines Button Action + yPuppetRigDialog.grp.btn_02.onClick = runRigLayer; //Defines Button Action + yPuppetRigDialog.grp.btn_03.onClick = runRigAll; //Defines Button Action + yPuppetRigDialog.grp.chk_optn.onClick = toggleOptions; +} +yPuppetRig_data.activate = build_yPuppetRig_data_UI ; + + +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){ + 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(yToolBox_data)=='undefined'){ + yStopMotion_data.activate(); + }else{ + } diff --git a/yScripts/y_yBindBetween2_0.12_old.jsx b/yScripts/y_yBindBetween2_0.12_old.jsx new file mode 100755 index 0000000..a2487a6 --- /dev/null +++ b/yScripts/y_yBindBetween2_0.12_old.jsx @@ -0,0 +1,182 @@ +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(yToolBox_data)!=='undefined'){ + yToolBox_data.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: ['"+yToolBox_data.buttonWidth+"','"+ yToolBox_data.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 + 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 = yToolBox_data.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(90); + posExp ='a = effect("ctrl01")("Layer");\ +b = effect("ctrl02")("Layer");\ +aPos = a.toComp(a.anchorPoint);\ +bPos = b.toComp(b.anchorPoint);\ +(aPos+bPos)/2' + 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\ +}' + layer.transform.position.expression = posExp; + layer.transform.rotation.expression= rotExp; + + + /* + 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(0.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; + */ + + 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