Page 1 of 1

list materials

Posted: Sat Apr 27, 2019 1:12 pm
by nigec
how do I get the list of materials in a scene (python)
I can't see it in the docs or examples

Re: list materials

Posted: Sat Apr 27, 2019 3:48 pm
by Dade
Something along the line of:

Code: Select all

materialNames = scene.ToProperties().GetAllUniqueNames("scene.materials.")
(just out of my memory so syntax/names may be not totally correct)

Re: list materials

Posted: Sat Apr 27, 2019 5:11 pm
by nigec
there's no GetAllUniqueNames
materialNames = self.scene.ToProperties().GetAllNames("scene.materials.")
gets everything material related

Re: list materials

Posted: Sat Apr 27, 2019 5:15 pm
by B.Y.O.B.

Re: list materials

Posted: Sat Apr 27, 2019 5:19 pm
by nigec
yes mate that's the one :
materialNames = self.scene.ToProperties().GetAllUniqueSubNames("scene.materials")