#include "../yScripts/y_JSExtensions.jsx"; function YPuppetRigTool() { this.info = { name : "yPuppetRig", version : 0.1, stage : "development", description : "Tool to create nulls at puppet pin locations, and link the latter to the former.", url : "yorchnet.com" }; this.appearence = { buttonHeight : 30, buttonWidth : 126 }; this.resources = { icon : new File('yNet.png'), scriptName : 'yPuppetRigger', scriptVer : 'v0.3.3a', scriptDesc : 'Tools for streamlining puppet-based animation rigs.', string_info : 'yorchnet.com', e_000 : 'e_000 : No layers are selected.', e_001 : 'e_001 : Layer contains no effects.', e_002 : 'e_002 : Layer contains no Puppet effects.', string_001 : 'Rig Pins', string_001x : 'Rigs Selected Pins on Layer', string_002 : 'Rig Layers', string_002x : 'Rigs Selected Layers', string_003 : 'Rig All', string_003x : 'Rig All Layers in Comp' }; 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.resources.scriptName + " " + this.resources.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: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'], text:'" + this.resources.string_001 + "', helpTip:'" + this.resources.string_001x + "' }, \ btn_02: Button { preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'], text:'" + this.resources.string_002 + "', helpTip:'" + this.resources.string_002x + "' }, \ btn_03: Button { preferredSize: ['" + this.appearence.buttonWidth + "','" + this.appearence.buttonHeight + "'], text:'" + this.resources.string_003 + "', helpTip:'" + this.resources.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:'" + this.resources.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'], \ txt_info: StaticText { text:'" + this.resources.string_info + "', alignment:['fill','center'] },\ }\ }\ }"; } this.createUI = function createUI() { this.window = new Window( this.res ); this.window.layout.layout(true); this.window.center(); this.window.show(); this.window.grp.optn.enabled = false; this.window.grp.btn_01.onClick = yPuppetRigTool.runRigPin; //Defines Button Action this.window.grp.btn_02.onClick = yPuppetRigTool.runRigLayer; //Defines Button Action this.window.grp.btn_03.onClick = yPuppetRigTool.runRigAll; //Defines Button Action this.window.grp.chk_optn.onClick = yPuppetRigTool.toggleOptions; } this.yMainFunction = function yMainFunction() { this.createUI(); } this.activate = function activate() { this.yTool.yMainFunction(); } /**/ this.toggleOptions = function toggleOptions(){ if(this.window.grp.chk_optn==true){ this.window.grp.chk_optn=false; } else { this.window.grp.chk_optn=true; } this.window.grp.optn.enabled = this.window.grp.chk_optn; } this.customColors = 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; } this.getPuppetEffects = function getPuppetEffects(aLayer){ puppetEffects = [] for(i=1;i<=aLayer('Effects').numProperties;i++){ puppetEffects.push(aLayer('Effects')(i)); } return puppetEffects; } this.getPosPins = function getPosPins(aLayer){ puppetEffects = this.getPuppetEffects(aLayer); if(puppetEffects.length>0){ posPins = []; for(i=0;i