Select Vraylight and off

Hi,

I have a problem in one script and I'm need a help please.

I am selecting a series of lights, some VRayLight and others do not. To turn off some lights use $lights.enabled = off, but some lights use the command $lights.on = off as an example are the photometrics and Vraylights ... When I use $lights.on = off gives the following error "- Unknown property:" on "in $ VRaySun: @ Sun_Cam_portaria [149.746979, -227.845520,0.000000]" How do we work? There is a class for vraylights?

thanks

Kim

Comments

Comment viewing options

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

Just create rollout with two

Just create rollout with two buttons ("On" and "Off")
and then you can toggle lights on-off.
Cheers!

barigazy

kimarotta's picture

Very very good. worked very

Very very good.

worked very well
perfect and clean

Just put the basic script I'm doing.

Thanks...

kimarotta.com.br
3d Artist  

barigazy's picture

And this is the shorter

And this is the shorter version
Tested and works fine.
Also work on the Daylight System
Now supports and FinalRender Lights

 
fn TurnTheLights state: =
(
	if selection.count != 0 do
	(
		local lightTypes1 = #("Light", "mr Area Omni", "mr Area Spot", "VRayIES", "VRayAmbientLight", "VRaySun", "fRParticleLight")
		local lightTypes2 = #("Skylight", "Photometric Light", "mr Sky Portal", "VRayLight", "RectLight", "fRDome", "CylinderLight", "fRParticleLight")
		for lgh in selection where isKindof lgh Light do
		(
			if finditem lightTypes1 (getClassName lgh) != 0 then (lgh.enabled = state)
			else if finditem lightTypes2 (getClassName lgh) != 0 do (lgh.on = state)
		)
	)
)
--Now you can set state on or off
TurnTheLights state:off --turnoff lights
--TurnTheLights state:on --turnon lights

barigazy

kimarotta's picture

good

Hey Man very thanks...

I will test and send feedback..

kimarotta.com.br
3d Artist  

barigazy's picture

I added twice

I added twice "VRayAmbientLight".
I corrected the previous code.Copy again and try.

barigazy

barigazy's picture

TurnTheLights (ON or OFF)

You decide which state you need (on or off)
Supports all: VrayLights, mrLights, Standard and Photometric
Use this function.

fn TurnTheLights state:off =
if selection.count != 0 do
(
	for lgh in selection where isKindof lgh Light do
	(
		case getClassName lgh of (
			("Light"): lgh.enabled = state
			("Skylight"): lgh.on = state
			("Photometric Light"): lgh.on = state
			("mr Sky Portal"): lgh.on = state
			("mr Area Omni"): lgh.enabled = state
			("mr Area Spot"): lgh.enabled = state
			("VRayLight"): lgh.on = state
			("VRayIES"): lgh.enabled = state
			("VRayAmbientLight"): lgh.enabled = state
			("VRaySun"): lgh.enabled = state
		)
	)
)
TurnTheLights state:off

barigazy

Comment viewing options

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