I’ve written the basics of it, but not on 2.0 yet…
If someone who has Vray 2.0 can type this into the Maxscript listener and paste the output here please I’ll finish making it, just need to know the correct property.
OK basic version to test… Haven’t got Vray 2 to test it with but syntax should hopefully be ok… should work in all max versions. LightSelect_Element_maker.zip (920 Bytes)
Made change so you can choose to add selected lights as one Light Select Render Element instead of having a Render Element per light. It’s got a basic incremental numbering system built in but it might cause duplicates if you run it on seperate sessions.
--Light Select Render Element Maker
--Written by Dave Wortley
--Version 0.2
--Untested
--
--Makes a Light Select Render Element per chosen Light.
try(DestroyDialog DW_LightSelect) catch()
AR_lightList = #()
AR_LightSelect = #()
P = 1
rollout DW_LightSelect "Light Select Render Element Maker" width:297 height:300
(
listbox lbx_allLights "All Lights" pos:[6,10] width:127 height:17
listbox lbx_selectLights "Selected Lights" pos:[162,8] width:127 height:17
button btn_add ">" pos:[138,31] width:20 height:44
button btn_Remove "<" pos:[138,80] width:20 height:44
button btn_make "RE per Light" pos:[134,258] width:157 height:17
button btn_all "All" pos:[138,128] width:20 height:44
button btn_makeMulti "Add selected as one RE" pos:[133,279] width:156 height:17
on DW_LightSelect open do
(
for o in objects where superclassof o == light do append AR_lightList o.name
lbx_allLights.items = AR_LightList
)
on btn_add pressed do
(
--add
if lbx_allLights.selected != undefined then
(
append AR_LightSelect lbx_allLights.selected
lbx_selectLights.items = AR_LightSelect
deleteItem AR_LightList lbx_allLights.selection
lbx_allLights.items = AR_LightList
)
)
on btn_Remove pressed do
(
--remove
if lbx_selectLights.selected != undefined then
(
append AR_LightList lbx_selectLights.selected
lbx_allLights.items = AR_LightList
deleteitem AR_LightSelect lbx_allLights.selection
lbx_selectLights.items = AR_LightSelect
)
)
on btn_make pressed do
(
--make elements
theManager = maxOps.GetRenderElementMgr #Production
--for o in selection where superclassof o == Light do
for o in AR_LightSelect do
(
theManager.AddRenderElement (VrayLightSelect elementname:("LightSelect_" + o + "_") lights:#((getnodebyname o)))
--print (getnodebyname o)
)
--Messagebox (AR_LightSelect.count as string + " Light Select Elements Created")
)
on btn_all pressed do
(
--add all
if lbx_allLights.items.count != 0 then
(
for i = 1 to lbx_allLights.items.count do
(
append AR_Lightselect lbx_allLights.items[i]
lbx_selectLights.items = AR_LightList
)
AR_LightList = #()
lbx_allLights.items = AR_LightList
)
)
on btn_makeMulti pressed do
(
--make elements
theManager = maxOps.GetRenderElementMgr #Production
AR_MultiLights = #()
for o in AR_LightSelect do append AR_MultiLights (getnodebynameo)
theManager.AddRenderElement (VrayLightSelect elementname:("LightSelect_" + (formattedprint P format: "02d") + "_") lights:AR_MultiLights)
--print ("LightSelect_" + (formattedprint P format: "02d") + "_")
P += 1
)
)
CreateDialog DW_LightSelect
Just goto Maxscript ->new script, copy and paste that into a new script, and then select-all (in the editor) and drag the text onto the toolbar and it’ll make you a button to use it with.
Once run it’ll automatically populate the left list with all the lights and then you just add the lights you want to have as light selects, pressing the first button will make a render element per light, or if you want to have say 5 lights in one pass then just add them to the list and then press the 2nd button, and it’ll make one RE with all the selected lights in one pass.
Will have a look at doing layers as well… I can probably just add a button for use selection instead… then you can just select the layer contents and do it that way…
Ok added options for using selection… should mean u can set it up according to layers pretty easily. You can select a whole layer and it will only process the lights, no need to only select lights.
--Light Select Render Element Maker
--Written by Dave Wortley
--Version 0.3
--
--Makes a Light Select Render Element per chosen Light.
--
--Version History
--Added ability to use selection
--Add all lights as combined
--Initial Version
try(DestroyDialog DW_LightSelect) catch()
AR_lightList = #()
AR_LightSelect = #()
P = 1
rollout DW_LightSelect "Light Select Render Element Maker" width:297 height:300
(
listbox lbx_allLights "All Lights" pos:[6,10] width:127 height:17
listbox lbx_selectLights "Selected Lights" pos:[162,8] width:127 height:17
button btn_add ">" pos:[138,31] width:20 height:44
button btn_Remove "<" pos:[138,80] width:20 height:44
button btn_make "RE per Light" pos:[134,258] width:157 height:17
button btn_all "All" pos:[138,128] width:20 height:44
button btn_makeMulti "Add selected as one RE" pos:[133,279] width:156 height:17
button btn_Selection "Sel" pos:[138,176] width:20 height:44
on DW_LightSelect open do
(
for o in objects where superclassof o == light do append AR_lightList o.name
lbx_allLights.items = AR_LightList
)
on btn_add pressed do
(
--add
if lbx_allLights.selected != undefined then
(
append AR_LightSelect lbx_allLights.selected
lbx_selectLights.items = AR_LightSelect
deleteItem AR_LightList lbx_allLights.selection
lbx_allLights.items = AR_LightList
)
)
on btn_Remove pressed do
(
--remove
if lbx_selectLights.selected != undefined then
(
append AR_LightList lbx_selectLights.selected
lbx_allLights.items = AR_LightList
deleteitem AR_LightSelect lbx_allLights.selection
lbx_selectLights.items = AR_LightSelect
)
)
on btn_make pressed do
(
--make elements
theManager = maxOps.GetRenderElementMgr #Production
--for o in selection where superclassof o == Light do
for o in AR_LightSelect do
(
theManager.AddRenderElement (VrayLightSelect elementname:("LightSelect_" + o + "_") lights:#((getnodebyname o)))
--print (getnodebyname o)
)
--Messagebox (AR_LightSelect.count as string + " Light Select Elements Created")
)
on btn_all pressed do
(
--add all
if lbx_allLights.items.count != 0 then
(
for i = 1 to lbx_allLights.items.count do
(
append AR_Lightselect lbx_allLights.items[i]
lbx_selectLights.items = AR_LightList
)
AR_LightList = #()
lbx_allLights.items = AR_LightList
)
)
on btn_makeMulti pressed do
(
--make elements
theManager = maxOps.GetRenderElementMgr #Production
AR_MultiLights = #()
for o in AR_LightSelect do append AR_MultiLights (getnodebynameo)
theManager.AddRenderElement (VrayLightSelect elementname:("LightSelect_" + (formattedprint P format: "02d") + "_") lights:AR_MultiLights)
--print ("LightSelect_" + (formattedprint P format: "02d") + "_")
P += 1
)
on btn_Selection pressed do
(
--add selected lights
AR_Lightselect = #()
AR_lightList = #()
for o in objects where superclassof o == light do append AR_lightList o.name
for o in selection where superclassof o == Light do
(
append AR_Lightselect o.name
deleteitem AR_LightList (finditem AR_LightList o.name)
)
lbx_selectLights.items = AR_Lightselect
lbx_allLights.items = AR_LightList
)
)
CreateDialog DW_LightSelect
I’ve now developed this into a full Light Select/Material Select/Objects Select creator with various options and automates things like assigning object IDs for multiple objects, unfortunetly I probably can’t upload it now as I’ve done so much on it at the Office, I will ask tho, but hopefully what I’ve posted above should allow people to make their own.