Scene Material VrayMtl Diffuse On Off

Hey Guys,

I want to be able to turn off and turn on Diffuse map in the scene I am working on.

meditMaterials[7].texmap_diffuse_on = off

I want to be able to do this to the entire scene.

Thanks

Comments

Comment viewing options

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

...

And this?

try(destroyDialog ::bgaRoll)catch()
rollout bgaRoll "Diffuse On/Off"
(
	colorPicker diff_clr "Diffuse Color: " pos:[5,3] fieldwidth:46 height:12 color:[170,170,170]
	button diff_on "Diffuse On" pos:[5,20] width:120 height:18
	button diff_off "Diffuse Off" pos:[5,43] width:120 height:18
 
	mapped fn collectMtl mtls clr:diff_clr.color state:on = 
	(
		if isKindOf mtls VRayMtl do 
		(
			mtls.texmap_diffuse_on = state
			if not state then
			(
				if distance (mtls.translucency_color as point3) (clr as point3) != 0 then
				(
					mtls.translucency_color = clr
					swap mtls.diffuse mtls.translucency_color
				) else (swap mtls.diffuse mtls.translucency_color)
			)
			else
			(
				if distance (mtls.diffuse as point3) (clr as point3) != 0 then
				(
					mtls.translucency_color = clr
				)
				else (swap mtls.diffuse mtls.translucency_color)
			)
		)
	) 
 
	on diff_on pressed do collectMtl (getClassInstances VRayMtl) 
	on diff_off pressed do collectMtl (getClassInstances VRayMtl) state:off
)
createDialog bgaRoll 130 65 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)

barigazy

aarb's picture

turn of real world scale box in diffuse map

Hi, I'm no programmer! Can you show me how to modify the script so that I can use it to turn off all (or selected objects materials - even better) real world scale in diffuse map?

ie. meditMaterials[1].texmap_diffuse.coords.realWorldScale = off

Thanks

xathletic01x's picture

This works! Cheers

This works! Cheers

barigazy's picture

...

Like this

try(destroyDialog ::bgaRoll)catch()
rollout bgaRoll "Diffuse On/Off"
(
	mapped fn collectMtl mtls state:on = if isKindOf mtls VRayMtl do mtls.texmap_diffuse_on = state
	button diff_on "Diffuse On" pos:[5,5] width:120 height:18
	button diff_off "Diffuse Off" pos:[5,28] width:120 height:18
	on diff_on pressed do collectMtl (getClassInstances VRayMtl)
	on diff_off pressed do collectMtl (getClassInstances VRayMtl) state:off
)
createDialog bgaRoll 130 50 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)

barigazy

xathletic01x's picture

humm.

This works but i want it to only change colors 170 to texmap_diffuse_on its turning off.

try(destroyDialog ::bgaRoll)catch()
rollout bgaRoll "Diffuse On/Off"
(
mapped fn collectMtl mtls state:on = if isKindOf mtls VRayMtl do
(
mtls.texmap_diffuse_on = state
mtls.diffuse = color 170 170 170
)

button diff_on "Diffuse On" pos:[5,5] width:120 height:18
button diff_off "Diffuse Off" pos:[5,28] width:120 height:18
on diff_on pressed do collectMtl (getClassInstances VRayMtl)
on diff_off pressed do collectMtl (getClassInstances VRayMtl) state:off
)
createDialog bgaRoll 130 50 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)

barigazy's picture

...

I did'nt test this

try(destroyDialog ::bgaRoll)catch()
rollout bgaRoll "Diffuse On/Off"
(
	mapped fn collectMtl mtls clr state:on = 
	(
		if isKindOf mtls VRayMtl do 
		(
			mtls.texmap_diffuse_on = state
			if not state then
			(
				if distance (mtls.translucency_color as point3) (clr as point3) != 0 then
				(
					mtls.translucency_color = clr
					swap mtls.diffuse mtls.translucency_color
				) else (swap mtls.diffuse mtls.translucency_color)
			)
			else
			(
				if distance (mtls.diffuse as point3) (clr as point3) != 0 then
				(
					mtls.translucency_color = clr
				)
				else (swap mtls.diffuse mtls.translucency_color)
			)
		)
	)
	colorPicker diff_clr "Diffuse Color: " pos:[5,3] fieldwidth:46 height:12 color:[170,170,170]
	button diff_on "Diffuse On" pos:[5,20] width:120 height:18
	button diff_off "Diffuse Off" pos:[5,43] width:120 height:18
	on diff_on pressed do collectMtl (getClassInstances VRayMtl)
	on diff_off pressed do collectMtl (getClassInstances VRayMtl) state:off
)
createDialog bgaRoll 130 65 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)

barigazy

xathletic01x's picture

error

--Argument count error: collectMtl wanted 2, got 1

Hats off to you. Thank you for your help!

xathletic01x's picture

is it possible to add to this

is it possible to add to this script

for only material texture map its turning on and off can we change the diffuse color to 170 170 170?

Thanks

xathletic01x's picture

This is perfect! thank you.

This is perfect! thank you.

I have an paid freelance opportunity for script if you are interested. email me at [email protected]

Thanks.

barigazy's picture

...

I not work as freelance scripter. Sorry
But U can ask any question here.

barigazy

Comment viewing options

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