ScriptSpot

Forum topic · General Scripting

autoexposure toggle button

By kino_unico · 2021-04-15

Description

hi, this is a very basic question, but I'm trying to make a button that alters the autoexposure state of vray.
I have the code to turn it on and pressing it again turns it off, but I would like the same button to work as a toggle.
So with the button on the autoexposure mode would be true and with the button off the autoexposure mode would be false.
Would it be possible to improve the code so that the button is somehow checked when the exposure state is true and the button is unchecked when the auto exposure is false?


if (renderers.current.camera_autoExposure == true) then (renderers.current.camera_autoExposure = false) else (renderers.current.camera_autoExposure = true)

what would the complete code

Comments (2)

.

miauu · 2021-05-03

Try this:


macroscript miauuVrayCameraAutoExposure
category:"miauu"
tooltip:"VrayCameraAutoExposure"
buttonText:"VrayCameraAutoExposure"
(
	on isChecked do
	(
		if hasProperty renderers.current #camera_autoExposure do renderers.current.camera_autoExposure
	)
	
	on execute do
	(
		if hasProperty renderers.current #camera_autoExposure do
		(
			renderers.current.camera_autoExposure = not renderers.current.camera_autoExposure
		)	
	)
)

thanks, but this script does

kino_unico · 2021-05-03

thanks, this script works perfect