Notifications
Clear all

[Closed] Accessing Scene Materials

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.

3 Replies

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

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

thx buddy