Notifications
Clear all
[Closed] diffuse map on/off toggle
Jan 05, 2005 12:38 pm
is there a script that will toggle on/off the map in the diffuse channel for either the scene/selected objects? i want to disable the map for a render and then turn it on again. all the ones i see on scriptspot are for viewport only.
thanks
Pete
P.s post duplicated on Discreet forum
2 Replies
Jan 05, 2005 12:38 pm
-- This script only works on standard materials but that can easily be fixed by adding more
-- checks in the ValidateMaterial function. You will have to make a special case for
-- multi-sub objects
fn ValidateMaterial mat =
(
if (classof mat == standardMaterial) then
return true
-- add extra checks here
)
-- If you supply a value to the forceState variable it will force al the materials on or off.
fn ToggleDiffuseMapEnable forceState:undefined =
(
if selection.count > 0 then
objs = selection as array -- If we have a selection use it
else
objs = objects as array -- otherwise use all the objects in the scene
-- we must keep track of our materials otherwise we'll keep toggling it on and off if multiple
-- objects use the same material
local matsChecked = #()
-- loop through all the objects, ignoring those without materials
for obj in objs where obj.material != undefined do
(
-- Check if the material is valid
if (not ValidateMaterial obj.material) then
continue
-- check if the material we're looking at is in our list of checked materials
-- if it is skip it
if (findItem matsChecked obj.material > 0) then
continue
-- toggle the diffuseMapEnable variable in the material
if (forceState == undefined) then
obj.material.diffuseMapEnable = not obj.material.diffuseMapEnable
else
obj.material.diffuseMapEnable = forceState
-- add the material to the list of checked materials
append matsChecked obj.material
)
)
-- Toggle All Diffuse Maps
ToggleDiffuseMapEnable()
-- Enable all maps
--ToggleDiffuseMapEnable forceState:true
-- Disable all maps
--ToggleDiffuseMapEnable forceState:false
Sorry if its not properly indented, this WYSIWYG editor doesn’t like me very much when it comes to indenting
Jan 05, 2005 12:38 pm
thanks for the reply wahooney – i’ll give your code a try
many thanks for your help
Pete