vray light select render element based on layer

would it be possible to have a script that does vray light select render elements based on layer?

let's say I have 5 layers in my scene, each one of them has few lights inside, I would like to have a script that select all the lights for each layer and create 5 vray light render elements

thank youu

Comments

Comment viewing options

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

We should use light colors to

We should use light colors to design and layout because they look attractive and on it we can show text clearly. Instead using other web use my assignment help it will show you design of layouts so that you can also make it.

fed_86's picture

not sure what happen but I

not sure what happen but I tried again on a new scene and now it is working!!

if you can have a look.. otherwise is good as it is..

again thank you!!

fed_86's picture

seems not working properly

hi Pixamoon,

Thank you for your help.

however for some reason it seems not working.. this is what I've got from maxscript listener after running the "code" you posted

-- [stack level: 0]
-- In i loop; filename: ; position: 419; line: 13
-- member of: anonymous codeblock
-- Parameters:
-- i: 3
-- Locals:
-- objs: #(ReferenceTarget:LayerManager, $, $Target:Direct001.Target @ [2612.644043,-2367.108398,582.146667], ReferenceTarget:NodeSelection, Controller:Look_At, $Target_Directional_Light:Direct001 @ [-2766.946045,-6001.703613,10671.556641], ReferenceTarget:ParamBlock2, ReferenceTarget:VRayLightSelect, ReferenceTarget:ParamBlock2, ReferenceTarget:VRayLightSelect, ReferenceTarget:ParamBlock2, ReferenceTarget:VRayLightSelect, ReferenceTarget:LightRefMgr, ReferenceTarget:ParamBlock2, DefaultVRaySky:VRaySky, ReferenceTarget:ParamBlock2, Properties:Properties, TrackviewNode:DefaultVRaySky ( VRaySky ), Map #2138382625:Color Correction, ReferenceTarget:ParamBlock2, ...)
-- iLayer:
-- i: 3
-- lsRE: undefined
-- lgts: #($Target_Directional_Light:Direct001 @ [-2766.946045,-6001.703613,10671.556641], VRayLight, $VRayLight:sky_dome_light @ [618.866211,-3582.042725,0.000000])
-- layer: ReferenceTarget:BaseLayer
-- Externals:
-- re:
-- owner:
-- ------------------------------------------------------
-- [stack level: 1]
-- called from anonymous codeblock; filename: ; position: 463; line: 16
-- Locals:
-- re:
-- Externals:
-- ------------------------------------------------------
-- [stack level: 2]
-- called from top-level

pixamoon's picture

'

Hi,

This should work:

(
	local re = maxOps.GetCurRenderElementMgr()
 
	for i = 0 to LayerManager.count - 1 do (
 
		local iLayer = LayerManager.getLayer i
		local layer = ILayerManager.getLayerObject iLayer.name
		local objs = refs.dependents layer
 
		local lgts = for o in objs where superclassof o == Light collect o
 
		if lgts.count > 0 do (
			local lsRE = VrayLightSelect elementname:("LightSelect_" + iLayer.name) lights:lgts
			re.AddRenderElement lsRE
		)
	)
)

Best,
Pixamoon

Comment viewing options

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