Get all materials in scene...

2013-11-09 Thread Ognjen Vukovic
Hi guys, What would be the best way in python to select all the materials in a scene, I have this .. matSelection = Application.SelectObj("Sources.Materials.*.*") Selection = Application.Selection But it just seems a bit hacky, and im sure there is a better method of doing this. Cheers, Ogi.

Re: Get all materials in scene...

2013-11-10 Thread Alan Fregtman
Something like this? xsi = Application matLibs = xsi.ActiveProject.ActiveScene.MaterialLibraries # As a Python list: allMaterials = [mat for lib in matLibs for mat in lib.Items] # As an XSICollection: allMaterials = XSIFactory.CreateObject('XSI.Collection')for lib in matLibs: allMaterials.AddI

Re: Get all materials in scene...

2013-11-10 Thread Ognjen Vukovic
Ahh awesome. I did find a alternative earlier today but im not really sure is there some sort of rule for when to use which one, is there a speed difference or is it just personal preference what i did earlier was sClassID = "{4C4F7500-51EF-11D0-854E-00A02417D029}" selection = si.FindObjects(