[Closed] Set self-illumination value
Hello!
I have a lot materials in scene, and i need to change in all of them their self-illumination value. For example i want for all materials self-illumination to be 30.
Please, can you help me?
this is pretty simple to do. This code should work:
for s in scenematerials where hasProperty s "selfIllumAmount" do s.selfIllumAmount = 30
If you need it to search inside of multi-sub matierals as well, use this code:
amount = 30
for s in scenematerials do
(
if hasProperty s "selfIllumAmount" then
s.selfIllumAmount = amount
else if classof s == multiMaterial then
for m in s where hasProperty m "selfIllumAmount" do
m.selfIllumAmount = amount
)
Edit: You are correct, guess I got a bit too Syntax hungry ;), I see how you’re doing it.
amount = 30
--Check Gravey's
)
Just added the open and close bracket you forgot Gravey for correct code execution cheers.
-Colin
Thank you very much!
Can you help a little bit more? I have blend materials with 2 materials in one blend material, and script don’t work with blend material…
actually in this case it was not needed which is why I didn’t put it in! Try it and see
Thanks anyways
To make this script works with Blend materials just use the two maps:
fn setSelfIllum mtl amount =
(
if hasProperty mtl "selfIllumAmount" then
(
mtl.selfIllumAmount = amount
true
)
false
)
fn setMtlSelfIllum mtl amount =
(
bSet = false
if not (setSelfIllum mtl selfIllumAmount) then
(
if classof mtl == blend then
(
setSelfIllum mtl.map1 selfIllumAmount
setSelfIllum mtl.map2 selfIllumAmount
bSet = true
)
-- Add specific material support here
)
else
(
bSet = true
)
bSet
)
selfIllumAmount = 30
for m in sceneMaterials do
(
if not (setMtlSelfIllum m selfIllumAmount) then
(
if classof m == multiMaterial then
(
for sub in m do
setMtlSelfIllum sub selfIllumAmount
)
)
)