Shy other Layers (littleHelper)

All things .jsx

Moderator: Paul Tuersley

Post Reply
berniebernie
Posts: 33
Joined: February 7th, 2005, 7:32 am
Contact:

May 22nd, 2007, 10:09 am

Dirty code, but who cares - if it works.
littleHelper.jsx

This script is meant to help people like me who have little screens and a huge number of layers in the timeline. The small UI allows you to select all layers in the comp, select none, view as wireframe ('draft') mode, toggle shy mode (yes I know there's a button for that on the timeline, but it's not always next to your mouse) and most importantly a button which allow to shy all other layers (you can select the object in the window

Image

Code: Select all

AI = app.project.activeItem;

		function b1(){
		AI = app.project.activeItem;
			 for (a=1;a<AI.layers.length+1; a++){
				AI.layers[a].selected=false;
			 }
			 
		};
		function b4(){
		AI = app.project.activeItem;
			 for (a=1;a<AI.layers.length+1; a++){
				AI.layers[a].selected=true;
			 }
		};
		function b3(){
		app.project.activeItem.hideShyLayers = (app.project.activeItem.hideShyLayers)?false:true;
		};
		function b2(){
		AI = app.project.activeItem;
			app.beginUndoGroup("Wireframe");
			if(AI.layers[1].quality == LayerQuality.BEST){
				for (a=1;a<AI.layers.length+1; a++){
					AI.layers[a].quality=LayerQuality.WIREFRAME;
				}
			}else{
				for (a=1;a<AI> 0){
		 	AL = AI.selectedLayers;
		 	AI.hideShyLayers = true;
			 for (a=1;a<AI.layers.length+1; a++){
				AI.layers[a].shy=true;
			 }
			 for (a=0;a<AL.length;a++){
			AL[a].shy = false;
			 }
		 }
		};
		
				
	function createUI()
	{
		littleWindow = new Window("palette", "undefined");
		littleWindow.bounds = [230,25,422,164];
		
		btnwid =55;
		btnmarg=3;
		btnstrtx = 10;
		btnstrty = 10;

		Button1 = littleWindow.add("button", [btnstrtx,btnstrty,btnstrtx+btnwid,btnstrty+btnwid],'Sel None' );
		Button2 = littleWindow.add("button", [btnstrtx+btnwid*1+btnmarg,btnstrty,btnstrtx+btnwid*2+btnmarg,btnstrty+btnwid],"Wires" );
		Button3 = littleWindow.add("button", [btnstrtx+btnwid*2+btnmarg*2,btnstrty,btnstrtx+btnwid*3+btnmarg*2,btnstrty+btnwid],"Shy Toggle");
		Button4 = littleWindow.add("button", [btnstrtx,btnstrty+btnwid+btnmarg,btnstrtx+btnwid,btnstrty+btnwid+btnwid+btnmarg],"Sel All" );
		Button6 = littleWindow.add("button", [btnstrtx+btnwid*1+btnmarg,btnstrty+btnwid+btnmarg,btnstrtx+btnwid*3+btnmarg*2,btnstrty+btnwid+btnwid+btnmarg],"Shy Unselected" );
				
		Button1.onClick = b1;
		Button2.onClick = b2;
		Button3.onClick = b3;
		Button4.onClick = b4;
		Button6.onClick = b6;

		littleWindow.center();
		littleWindow.show();
	} 

createUI();

Boom boom boom.
Post Reply