ScriptSpot home

Forum topic · Scripts Wanted

Scene Material VrayMtl Diffuse On Off

By Ash Mohammed · 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)
Branko Živković

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)

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

Branko Živković

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)

Reply to Branko Živković
Ash Mohammed

This is perfect! thank you.

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

Thanks.

Reply to Ash Mohammed
Branko Živković

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

Reply to Branko Živković
Ash Mohammed

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

Reply to Branko Živković
Ash Mohammed

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)

Reply to Ash Mohammed
Branko Živković

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)

Reply to Branko Živković
Ash Mohammed

error

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

Hats off to you. Thank you for your help!