RE_Light_Select - Automated?

Heya

Em just went through youtube vids and have to say that that RE_Light_Select got my attention, something similar to Vue 9 relighting engine…

But I kinda hit the wall so I was hoping that maybe some1 nice would script it or chaosgroup would add it later on…

Basically listing 100+ lights in render elements would take ages so I’ll appreciate to get some script to list all selected lights plox…

From other hand any plans for adding indirect illumination and so on ? And caustics…and shadows…and everything else we can stick in ;O

When I upgrade to Vray 2 at the end of the week I’ll write a script for this, should be fairly easy.

Blass you ! Thanx :slight_smile: let me know when u finish plz : )

I’ll do it as well if Dave doesn’t get to it. Once I get 2.0.

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.

Showproperties VrayLightSelect()

Showproperties VrayLightSelect()
-- No ““showProperties”” function for VRayLightSelect

Sorry

Showproperties (VrayLightSelect())

I’m just guessing the name, but should be correct I’d imagine…

Showproperties (VrayLightSelect())
.enabled : boolean
.filterOn : boolean
.atmosphereOn : boolean
.shadowOn : boolean
.elementName : string
.bitmap : bitmap
.vrayVFB : boolean
.color_mapping : boolean
.multiplier : float
.lights : node array
.lights_exclude_type : integer
false

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

Haaa wow love u ! How do I use it now :o ?

U so good in it any chance to get that thing for mate too ? :slight_smile: Select object > mate? ^^

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.

Thanks you it’s working !
Now we can think about the workflow and options it’s needed .

Can we supposed to use layers also ? I’m usual to group my lights in differents layer.

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…

Any more feedback welcome…

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.

Thank you very much Dave_Wortley ! You are an amazing help to me and every1 else !

Thanx again for your hard work I will try these script once I get a chance. Hope that office will be ok too :slight_smile:

Looking forward for more hehe :slight_smile:

Thanks you so much :slight_smile:
hope your office will be ok to share with us this script :wink: