View Full Version : Script to show textures in viewport?
Gibbz 12-01-2005, 05:49 AM Hey guys, i tryed messing around trying to create a test script to actiave the "view map in viewport" button in the material editor, but it doesnt seem to work. So does anyone have a script that goes through and enables all of these on all the materials in the scene?
Cheers
|
|
This should work.
--------------------------Code Start---------------------------
for pckdObj in 1 to selection.count do
(
x = $selection
showTextureMap x[pckdObj].material on
)-- end for loop
--------------------------Code End-----------------------------
Marc
Wahooney
12-01-2005, 06:35 AM
The code below cycles through all the subAnims of the scene materials, finds the material super classes and turns their show in viewport on or off.
As far as I can see it doesn't work on Shellac materials but it should work on everything else (hopefully), it does step through Multi/Submaterials as well.
fn ShowMaterials obj bOn =
(
if obj.numSubs > 0 then
for i = 1 to obj.numsubs do ShowMaterials obj[i] bOn
if superclassof obj == Material then try (showTexturemap obj bOn) catch()
)
-- for mat in sceneMaterials do ShowMaterials mat off -- switches textures off
for mat in sceneMaterials do ShowMaterials mat on -- switches textures on
Hope this helps.
Gibbz
12-01-2005, 09:21 AM
cool guys, ill give this a try tommorow :)
heres yet another way to do it, though mine was, until a few seconds ago, set to shut off the mat in viewport of selected objects.. ;) i use vray, which has a different diffusemat name..
replace the showMatInViewport function with anything you'd like to do to all materials that are on the selected objects..
/shrug :)
fn showMatInViewport mat =
(
if (mat != undefined) do
(
--this works for all materials
mat.showinviewport = true
--but there could also be the show in viewport of just the bitmaps..
--so if it was a standard material
if classof mat == Standardmaterial then
(
-- then we use the .diffusemap object of the material
if (mat.diffusemap != undefined) then showTextureMap mat mat.diffusemap on
)
--if it wasn't a standard material, check if its a vraymaterial
else if classof mat == Vraymtl then
(
--and then we try and shut off the .texmap_diffuse map
if (mat.texmap_diffuse != undefined) then showTextureMap mat mat.texmap_diffuse on
)
)
)--end function
-- teh script
sel = selection as array
for n = 1 to sel.count do
(
if classof sel[n].material == Multimaterial then
(
for i in 1 to sel[n].material.numsubs do
(
showMatInViewport sel[n].material.materiallist[i]
)
)
else
(
showMatInViewport sel[n].material
)
)
reForm
03-01-2006, 11:42 PM
Is there any way to determine if a material has showTextureMap on or off? I am trying to build a toggle for switching materials on and off at the click of a switch, and for the switch to show the status of 'showtexturemap' (if thats possible)
Any suggestions?
reForm
03-05-2006, 03:10 PM
I can't believe there is no way to see if a material has the 'view material in viewport' toggle set.
MrSparkle
03-05-2006, 07:25 PM
you could try:
print $.material.showInViewport
reForm
03-05-2006, 09:59 PM
ah, sorry, I should have been more clear... it was the material maps that I couldn't work out how to check for their viewport visibility.
the showinviewport variable only works on the top level of a material as far as I can tell.
abyjoe
03-08-2006, 07:25 PM
can you get to show the final blend map result in the viewport...??? right now i dont know how to show my blend result in the viewport, it only shows one of the three maps i.e Diffuse0, diffuse1 or the alpha
reForm
03-08-2006, 11:13 PM
I think it is a limitation of max that you can only view one of the three maps at a time with a blend map....
CGTalk Moderation
03-08-2006, 11:13 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.