ClaverTech-LightCluder

10 votes
Version: 
0.2

This is just a simple Tool i used for my last project, its just a quick way to setup some lights to only include/exclude a group of geometry.

usage. u can simply select the geometry and lights via the select buttons, or (my prefered way) manually drag select them in viewport and then click the "$" button to add objects to their lists then click either exclude or include to make the lights in the list exclude or include the objects in the geometry list.

most of my light rigs were world oriented but needed to be attached to moving objects(a bunch of spaceships), and since i wanted different shadow qualities on each of these objects it was really handy to make a bunch of light rigs that were only including their particular moving objects.

 

Heres the code

macroScript LightCluder
	category:"ClaverTech"
	toolTip:"LightCluder-Quick Light Clusions"
(
	objs=#()
	Lits=#()
 
	fn g_filter o =((isKindOf o GeometryClass) And classOf o!=TargetObject) or(isKindOf o Dummy and isGroupHead o)
	fn l_filter o =isKindOf o Light
 
	rollout unnamedRollout "ClaverTech - LightCluder" width:368 height:194
(
	button btnLits "Select Lights" pos:[230,14] width:117 height:23
	listBox lbxLits "Light List" pos:[231,41] width:116 height:9
	button btnGeom "Select Geometry" pos:[20,14] width:117 height:23
	button btnGrab " $ " pos:[165,14] width:40 height:23 align:#center toolTip:"Grab Selected Nodes"
	listBox lbxGeom "Geometry List" pos:[21,41] width:116 height:9
	button btnExcluder "Exclude" pos:[150,77] width:73 height:24
	button btnIncluder "Include" pos:[150,136] width:73 height:24
 
	on btnGrab pressed do
	(
		objs=#()
		Lits=#()
		Temp=getCurrentSelection()
		print Temp
		if(Temp.count>0) then
		(
		objs=for j in Temp where ((isKindOf j GeometryClass and not isGroupMember j And classOf j!=TargetObject) or (isKindOf j Dummy and isGroupHead j)) collect j
		names=for k in objs collect k.name
		lbxGeom.items=names
 
		Temp=getCurrentSelection()
		Lits=for j in Temp where (isKindOf j Light) collect j
		names=for k in Lits collect k.name
		lbxLits.items=names
		)
		else
		(
			messageBox "Select the Objects in the scene then Click this"
		)
	)
 
	on btnGeom pressed do
	(
		Temp=selectByName  title:"Select Geometry To CLude" filter:g_filter
		print Temp
		if(Temp!=undefined)then
		(
		objs=(for j in Temp where ((isKindOf j GeometryClass And classOf j!=TargetObject) or (isKindOf j Dummy and isGroupHead j)) collect j)
		names=for k in objs collect k.name
		lbxGeom.items=names
		)
	)
	on btnLits pressed do
	(
		Temp=selectByName  title:"Select Light To CLude" filter:l_filter
		if(Temp!=undefined)then
		(
		Lits=for j in Temp where (isKindOf j Light) collect j
		names=for k in Lits collect k.name
		lbxLits.items=names
		)
	)
	on btnExcluder pressed do
	(
		for lt in Lits do
		(
			if(lt.excludeList==undefined)then(lt.excludeList=#())
			if(objs.count>0)then
			(
				lt.excludeList=join lt.excludeList objs
			)
			else
			(
				lt.excludeList=#()
			)
		)
	)
	on btnIncluder pressed do
	(
		for lt in Lits do
		(
			if(lt.includeList==undefined)then(lt.includeList=#())
			if(objs.count>0)then
			(
				lt.includeList=join lt.includeList objs
			)
			else
			(
				lt.includeList=#()
			)
		)
	)
)
 
CreateDialog unnamedRollout 368 194
)

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'

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
tryharder's picture

looks promising ... i´ll try

looks promising ... i´ll try it now

thanks anyway

Clavery's picture

anybody gettin any use out of

anybody gettin any use out of this?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.