ScriptSpot

Forum topic · Scripts Wanted

Scene Material VrayMtl Diffuse On Off

By xathletic01x · 2014-06-25

Description

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 (11)

barigazy · 2014-06-26

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)

xathletic01x · 2014-06-30

This works! Cheers

turn of real world scale box in diffuse map

aarb · 2015-01-13

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

barigazy · 2014-06-26

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)

xathletic01x · 2014-06-26

This is perfect! thank you.

I have an paid freelance opportunity for script if you are interested. email me at ash@studiorendering.com

Thanks.

barigazy · 2014-06-26

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

Thank you

xathletic01x · 2014-06-26

All your help in many blogs are very helpful. Thank you.

xathletic01x · 2014-06-26

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

humm.

xathletic01x · 2014-06-26

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 · 2014-06-26

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)

error

xathletic01x · 2014-06-26

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

Hats off to you. Thank you for your help!