ScriptSpot

Script

ClaverTech-KeyStones

By Clavery · 2010-02-27

Version
0.2
Votes
10
Download
Download
Description

This tool just holds a list of key objects u want to quickly select or view. helpful when in a scene with a crapload of nodes when ur really only animating a few of them. Additionally if u right click an item in the list u will zoom extents of it (if geometry), or look from its perspective (camera or light). It also keeps the list variables as persistant... so u can open and close it without changin the list.. even closing and loading the scene.

 

its been especially helpful for my last two projects, where i had a scene with thousands of nodes to choose from when all i ever worked with were maybe ten of them. it will save u a few millseconds of worktime.

 

heres the Code

 


macroScript KeyStones
	category:"ClaverTech"
	toolTip:"Keystones - Quick Select Key Objects"
(
	persistent global myObjs
	myObjsNames=#()
	
	rollout KeyStoneRollout "ClaverTech - Keystones" width:273 height:290
(
	--button btnDone "Done" pos:[214,249] width:95 height:40
	listBox lbxObjects "Key Objects" pos:[10,5] width:178 height:19
	button btnSet "Set List" pos:[195,39] width:75 height:30
	button btnAdd "Add Object" pos:[195,109] width:75 height:30
	button btnSelected "Add Selected" pos:[195,149] width:75 height:30
	button btnRemove "Remove Object" pos:[195,229] width:75 height:30
	
	on KeyStoneRollout open do
	(
		if myObjs!=undefined then
		(
			myObjs=for o in myObjs where (not isDeleted o and o!=undefined) collect o
			myObjsNames=for o in myObjs collect o.name
			lbxObjects.items=myObjsNames
		)
		else
		(
			myObjs=#()
		)
	)
	
	on btnSet pressed do
	(
		objs=selectByName  title:"Select Keystones"
		if(objs!=undefined)then
		(
		myObjs=objs;myObjsNames=for o in myObjs collect o.name
		lbxObjects.items=myObjsNames
		)
	)
	
	on btnSelected pressed do
	(
		objs=getcurrentselection()
		if(objs!=undefined)then
		(
			for o in objs do
			(
			appendIfUnique myObjs o
			)
			myObjsNames=for o in myObjs collect o.name
			lbxObjects.items=myObjsNames
		)
		else
		(
			messagebox "Select somethin first"
		)
	)
	
	on btnAdd pressed do
	(
		objs=selectByName  title:"Add Keystones" showHidden:true
		if(objs!=undefined)then
		(
			for o in objs do
			(
			appendIfUnique myObjs o
			)
			myObjsNames=for o in myObjs collect o.name
			lbxObjects.items=myObjsNames
		)
	)
	
	on btnRemove pressed do
	(
		num= lbxObjects.selection
		if(num != 0)then
		(
		myObjs = deleteItem myObjs num
		myObjsNames = deleteItem myObjsNames num
		)
		lbxObjects.items=myObjsNames
	)
	
	on lbxObjects doubleClicked arg do 
	(
		select myObjs[arg]
	)
	
	on lbxObjects rightClick arg do 
	(
		--select myObjs[arg]
		if(superClassof myObjs[arg] == camera)then
		(
			viewport.setCamera myObjs[arg]
			select myObjs[arg]
		)
		else if(superClassof myObjs[arg] == light)then
		(
			--viewport.setCamera myObjs[arg]
			select myObjs[arg]
			macros.run "Lights and Cameras" "Light_ActivateView"
		)
		else
		(
			actionMan.executeAction 0 "40182"  -- Views: Perspective User View
			select myObjs[arg]
			actionMan.executeAction 0 "310"  -- Tools: Zoom Extents Selected
		)
		lbxObjects.selection=arg
	)
	
)

CreateDialog KeyStoneRollout 273 290
	
) 

Feel free to copy this and save it as a .mcr and put it in ur userMacros folder (i think its in the appdata section). or u can download it below,or in 3ds max u make a new script paste the code, evaluate it with Ctrl+E and then it should show up in ur list of menu macros under 'ClaverTech'

Tags: viewport changing, select, lister, quick, views

Comments (2)

Clavery · 2010-03-05

anybody gettin any use out of this?

Graphix72 · 2010-05-24

I am getting use out of this! I hope others will find it useful too.