View Full Version : diffuse map on/off toggle
LoneRobot 01-05-2005, 11:38 AM 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
|
|
Wahooney
01-05-2005, 01:17 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 :(
LoneRobot
01-05-2005, 01:47 PM
thanks for the reply wahooney - i'll give your code a try
many thanks for your help
Pete
CGTalk Moderation
01-20-2006, 08:00 AM
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-2013, Jelsoft Enterprises Ltd.