PDA

View Full Version : Accessing Scene Materials


Equinoxx
08-21-2003, 06:14 PM
i'll be damned if I can find it in the maxscript help

I'm trying to write a pretty simple tool
to switch between 80% opacity and 100% opacity of a certain material in the scene, but i can't seem to find how i access that material via script other then using meditmaterial.
I'm sure there has got to be another way that makes you less dependant on the material editor right ??

this is the script


rollout MatOpac "OpacitySwitcher" width:140
(
button btn80 "Set to 080% Opacity" width:125
button btn100 "Set to 100% Opacity" width:125
on btn80 pressed do
(
insert proper access to "metal" (the name of the material) here
)
)
createDialog MatOpac

Any help with this is appreciated.

And i need to check if we can have some vbcode for code, cause this ofcourse sucks hehe it would've been nice to keep it in nice coding layout.

cheers all.

magicm
08-21-2003, 09:48 PM
hey equi ;)

try this:

------------------------------------------
rollout MatOpac "OpacitySwitcher" width:140
(
button btn80 "Set to 080% Opacity" width:125
button btn100 "Set to 100% Opacity" width:125
on btn80 pressed do scenematerials["metal"].opacity = 80
on btn100 pressed do scenematerials["metal"].opacity = 100
)
createDialog MatOpac
------------------------------------------

cheers!
Martijn

magicm
08-21-2003, 09:57 PM
or, without using 'scenematerials' :

------------------------------------------
for obj in objects where obj.material != undefined do
(
if obj.material.name == "metal" then (
obj.material.opacity = 80
exit
)
)
------------------------------------------


Martijn

Equinoxx
08-22-2003, 12:26 AM
thx buddy :thumbsup:

CGTalk Moderation
01-15-2006, 11:00 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.