SCript to change material "show in viewport"
Hi all and happy new year!
Somthing tells me this 'could' be easy...
I am trying to make a script that will automatically change every material that is in the current scene so they do NOT 'show standard map in viewport'. Does anyone have an idea on the code for this?
Comments
Some texture maps can have
Some texture maps can have nested texture maps in them. But it would be tedious to go through all of them turning them off.
A workaround is to force the material to on, then off.
Thanks alot. The code below
Thanks alot. The code below is working except for one problem. If there is no diffusemap in the slot, the script halts. Would you know how to add a check to see if a diffuse map exists before proceeding?
(
for object in selection do
if (classOf object.material == Vraymtl) then
(
object.material.showInViewport = off
showTextureMap object.material object.material.diffusemap off
)
else if (classOf object.material == Multimaterial) then
(
for b = 1 to b = object.material.numsubs do
(
if (classOf object.material.materialList[b] == Vraymtl) then
(
object.material.showInViewport = off
)
)
)
updateToolbarButtons()
)
here's a script. source :
here's a script.
source : http://www.polycount.com/forum/showthread.php?t=76143
for object in selection do
if (classOf object.material == Standard) then
(
object.material.showInViewport = off
)
else if (classOf object.material == Multimaterial) then
(
for b = 1 to b = object.material.numsubs do
(
if (classOf object.material.materialList[b] == Standard) then
(
object.material.showInViewport = off
)
)
)