Hello
I'm new in max scripting and I'm trying to get a list all the material properties of the selected object.
This is my first attempt...
for prop in (getPropNames $.material) do
(
getProperty $.material prop
)
...but no property were listed.
So, I tried to force the parameter name:
for prop in (getPropNames $.material) do
(
getProperty $.material "Diffuse"
)
And again, no property are listed.
I did some test to check if I wrote the values correctly:
getProperty $.material "Diffuse"
And if I put the getProperty out of the loop, it works perfectly for this specific parameter.
I checked also the loop using a print function...
for prop in (getPropNames $.material) do
(
print prop
)
...and it seems to work well, listing all the property names.
So... where I'm wrong?
I don't understand is why the getProperty row works only out of the "for prop" loop.
Someone can help me, please?
Comments (3)
Comment policy
Wow, now it works perfectly!
Thanks barigazy! :)
try this
for prop in (getPropNames $.material) do
(
format "% = %\n" (prop as string) (getProperty $.material prop)
)
or
for prop in (getPropNames $.material) do
(
print (getProperty $.material prop)
)
-- if you want to collect and then print
propList = for prop in (getPropNames $.material) collect (getProperty $.material prop)
for p in propList do print p