macroScript LightTool category:"Keffer Tools" tooltip:"LightTool" buttontext:"Light" ( global SelObjArray=#(), SelObjTextArray=#(), Larray = #(), LTextArray = #(), Lightnumarray =#(), SLArray = #() rollout lighttools "Include Exclude" ( group "Settings" ( radiobuttons InEx "" labels:#("Include", "Exclude") default:1 columns:2 radiobuttons InExType "" labels:#("Illumination", "Shadow Casting", "Both") default:1 ) group "Selection" ( listbox scenelights "scene lights" items:#() height:5 --pickbutton SelLight "select light" width:100 height:18 button SelLight "get scene lights" width:100 height:18 MultiListBox objselection "Selected Objects" items:#() height:5 button BySel "Change Selection" width:100 height:24 button LightObjects "Get Light Objects" width:100 height:30 align:#cen ) ------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------- on lighttools open do ( if lights.count != 0 do ( LTextArray = #() for L = 1 to lights.count do ( append LTextArray lights[L].name )--end for L scenelights.items = LTextArray SLArray = lights as array for x = Ltextarray.count to 1 by -1 do ( if findstring (Ltextarray[x] as string) "Target" != undefined do ( deleteitem ltextarray x deleteitem SLarray x --append Lightnumarray x ) )--end for x scenelights.items = LTextArray )--end if lights.count ) -------------------------------------------------------------------------------- on SelLight pressed do ( if Ltextarray.count != lights.count do ( Larray = #() LTextArray = #() for L = 1 to lights.count do ( append LTextArray lights[L].name )-- end for L scenelights.items = LTextArray SLArray = lights as array for x = Ltextarray.count to 1 by -1 do ( if findstring (Ltextarray[x] as string) "Target" != undefined do ( deleteitem ltextarray x deleteitem SLarray x --append Lightnumarray x ) )--end for x scenelights.items = LTextArray )-- end if Ltextarray.count ) -------------------------------------------------------------------------------------- on scenelights selected S do ( select SLarray[s] --select lights[s] append Larray $ ) ------------------------------------------------------------------------------------ on BySel pressed do ( if $ != undefined do ( SelObjArray=#() SelObjTextArray=#() if selection.count == 1 then ( append selobjarray $ append selobjtextarray $.name objselection.items = selobjtextarray )--end if selection.count else ( numselected = $.count if numselected > 1 then ( selarray = $ as array for i = 1 to numselected do ( append selobjarray selarray[i] append selobjtextarray selarray[i].name )--end for i objselection.items = selobjtextarray )--end if numselected )--end else )--end if $ != select Larray $.inclExclType = InExType.state if InEx.state == 1 then ( $.includelist = selobjarray )--end if InEx.state else ( $.excludelist = selobjarray )--end else select selobjarray )--end on bysel --------------------------------------------------------------------------------------- on scenelights doubleclicked sel do --on LightObjects pressed do ( Larray = #() SelObjArray = #() SelObjTextArray =#() objselection.items = #() --SelLight.text = $.name append Larray $ if $.includelist != undefined then ( SelObjArray = $.includelist for i = 1 to selobjarray.count do ( append SelObjTextArray SelObjArray[i].name objselection.items = selobjtextarray )--end for i select selobjarray inex.state = 1 --inextype.state = $.inclexcltype )--end if $includelist else ( SelObjArray = $.excludelist for i = 1 to selobjarray.count do ( append SelObjTextArray SelObjArray[i].name objselection.items = selobjtextarray )--end for i select selobjarray inex.state = 2 --inextype.state = $.inclexcltype )--else if SelobjArray.count == 0 do ( objselection.items = #("NONE") select larray )--end if )--end on scenelights ----------------------------------------------------------------------------------- ------------------------------------------------------------------------------- on LightObjects pressed do ( if $ != undefined do ( if iskindof $ light do ( Larray = #() SelObjArray = #() SelObjTextArray =#() objselection.items = #() --print (findItem larray $.name) scenelights.selection = findItem ltextarray $.name append Larray $ if $.includelist != undefined then ( SelObjArray = $.includelist for i = 1 to selobjarray.count do ( append SelObjTextArray SelObjArray[i].name objselection.items = selobjtextarray ) select selobjarray inex.state = 1 --inextype.state = $.inclexcltype ) else ( SelObjArray = $.excludelist for i = 1 to selobjarray.count do ( append SelObjTextArray SelObjArray[i].name objselection.items = selobjtextarray ) select selobjarray inex.state = 2 --inextype.state = $.inclexcltype )-- end else if SelobjArray.count == 0 do ( objselection.items = #("NONE") select larray ) )--end if kind of )--end if !undefined )--end on lightobjects ------------------------------------------------------------------------------------------------ )----End of Rollout lighttools -------------------------------------------------------------- rollout help "help" ( group "overview" ( label h2 "this script allows users" align:#left label h3 "to visually include / exclude" align:#left label h4 "objects from lights" align:#left ) group "Instructions:" ( label h5 "1: either select a light from" align:#left label h6 "the list or in the viewport" align:#left label h7 "2: click the get light objects " align:#left label h8 "or double click in the list" align:#left label h9 "3: select the objects you want" align:#left label h10 "include / exclude " align:#left label h11 "4: click change selection" align:#left label h12 "5: if you add/remove lights " align:#left label h13 "click get scene lights" align:#left ) label lname "Written by: Brian Keffer" ) ---------------------------------------------------------------- LighttoolsMain = newRolloutFloater "Light Tools" 200 485 AddRollout lighttools LighttoolsMain AddRollout help LighttoolsMain rolledup: true )---end macro