forked from ff6347/debugging-ae-scripts
-
Notifications
You must be signed in to change notification settings - Fork 1
/
capsulate-function.jsx
80 lines (63 loc) · 1.91 KB
/
capsulate-function.jsx
1
/** * This is not working right. The prototype function is availalble * * @param {[type]} thisObj [description] * @return {[type]} [description] */(function(thisObj){// basic panelrun_distort(thisObj); function run_distort(thisObj){// this is globaldistort_data = { 'x':10, 'y':10};Array.prototype.clear=function(){ this.length = 0; };/// THIS WILL CHECK IF PANEL IS DOCKABLE OR FLAOTING WINDOW var win = buildUI(thisObj );if ((win != null) && (win instanceof Window)) { win.center(); win.show();}; // end if win null and not a instance of window function buildUI (thisObj ) { var win = (thisObj instanceof Panel) ? thisObj : new Window('palette', 'example with proto',[0,0,150,260],{resizeable: true}); if (win != null) { var H = 25; // the height var W = 30; // the width var G = 5; // the gutter var x = G; var y = G; // win.check_box = win.add('checkbox',[x,y,x+W*2,y + H],'check'); // win.check_box.value = metaObject.setting1; win.doit_button = win.add('button', [x ,y,x+W*3,y + H], 'do it'); // win.up_button = win.add('button', [x + W*5+ G,y,x + W*6,y + H], 'Up'); // win.check_box.onClick = function (){ // alert("check"); // }; win.doit_button.onClick = function () { distort(); }; } return win}function distort(){// "in function main. From here on it is a straight run"// var curComp = app.project.activeItem; if (!curComp || !(curComp instanceof CompItem)){ alert('please select a comp'); return; } if(curComp.selectedLayers.length < 1){ alert('Please select at least one layer'); return; } app.beginUndoGroup('open-close-mask'); var props = curComp.selectedProperties app.endUndoGroup();}; };// close run_distort})(this);