From b038e666150660e88dfe2a92b1f9e79e470eeac2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20V=C3=A1squez=20P=C3=A9rez?= Date: Thu, 13 Apr 2017 15:30:13 -0700 Subject: [PATCH] Reorganized some functions on corresponding scripts to make it clearer of what was supposed to go in each one --- ScriptUI Panels/yToolBox.jsx | 4 ++ yScripts/usefulFunctions.jsx | 29 ++++------- yScripts/y_AFXExtensions.jsx | 4 +- yScripts/y_GenericNewScript.jsx | 90 +-------------------------------- yScripts/y_JSExtensions.jsx | 12 ++--- 5 files changed, 20 insertions(+), 119 deletions(-) diff --git a/ScriptUI Panels/yToolBox.jsx b/ScriptUI Panels/yToolBox.jsx index 32afe68..971fe78 100644 --- a/ScriptUI Panels/yToolBox.jsx +++ b/ScriptUI Panels/yToolBox.jsx @@ -81,6 +81,7 @@ YTB = /**** TO DO ****/ // Check that the tool object is unique. // Call for a window resize so it refreshes propperly. + //alert( aTool.info.name ); this.tools.push( aTool ); @@ -92,6 +93,7 @@ YTB = //alert(btn.onClick); this.window.layout.layout(true); + this.window.layout.resize(); return aTool; @@ -117,8 +119,10 @@ YTB = YTB.init(); #include "../yScripts/y_setStructure.jsx"; +#include "../yScripts/y_CompHerder.jsx"; #include "../yScripts/y_colorProbe.jsx"; #include "../yScripts/y_BindBetween2.jsx"; #include "../yScripts/y_CPOffset.jsx"; #include "../yScripts/y_puppetRig.jsx"; #include "../yScripts/y_stopMotionLayer.jsx"; + diff --git a/yScripts/usefulFunctions.jsx b/yScripts/usefulFunctions.jsx index b6b35e0..cb679a5 100755 --- a/yScripts/usefulFunctions.jsx +++ b/yScripts/usefulFunctions.jsx @@ -1,20 +1,7 @@ #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) -{ +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) @@ -27,8 +14,6 @@ function pad(n,i){ //pad n with ceroes up to i places. return padding+String(n) } } - - function yUniStr(str){ if (app.project.activeItem != null) { myLayers = app.project.activeItem.layers; @@ -67,7 +52,6 @@ function getBaseName(str){ return str; }; } - function getFirstGap(array){ length = array.length array.sort(function sortNumber(a,b){return a-b}) @@ -92,8 +76,6 @@ function yReplace(inputSTR,replaceSTR,replacementSTR){ } return tmpSTR; } - - function genStamp(args){ d = new Date(); //alert(d.getMonth()); @@ -103,7 +85,6 @@ function genStamp(args){ str = String(m)+String(d)+String(y); return str } - function mergeMultiLine(_str){ var re = new RegExp('[\n\r]'); _lines = _str.split(re); @@ -128,3 +109,11 @@ function mergeMultiLine(_str){ } return newStr; } +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_AFXExtensions.jsx b/yScripts/y_AFXExtensions.jsx index 9a2b119..6d627b6 100755 --- a/yScripts/y_AFXExtensions.jsx +++ b/yScripts/y_AFXExtensions.jsx @@ -1,4 +1,6 @@ -if (AVLayer.prototype. getPins==null) AVLayer.prototype. getPins=function(){ //Extends the AVLayer class with the getPinsfunctions which returns the Layer's property groups which are pins. +//Useful extensions to AFX Extendscript classes. + +if (AVLayer.prototype. getPins==null) AVLayer.prototype. getPins=function(){ //Extends the AVLayer class with the getPinsfunctions which returns the Layer's property groups which are pins. this.selectedPins = []; for(prop=0;propf)){ - value = n - (n%f); - return(value); - }else{ - alert('error'); - } -}