RE: Py: Testing if shader is assigned
http://xsisupport.com/tag/materials/ From: ognj...@gmail.com Date: Tue, 15 Apr 2014 13:47:46 +0200 Subject: Py: Testing if shader is assigned To: softimage@listproc.autodesk.com Hi guys, heres a quick one. I have all my materials in a selection, is there a way to iterate the selection and test if the material is assigned to anything and drop it if its not? Thanks in advance.
RE: Py: Testing if shader is assigned
import win32com xsi = Application matColl = win32com.client.Dispatch( XSI.Collection ) matColl.AddItems (xsi.Selection) for eachMat in matColl: if eachMat.UsedBy.Count == 0: print eachMat.UsedBy.Count matColl.RemoveItems (eachMat) xsi.SelectObj (matColl) matColl.RemoveAll() From: garethb...@outlook.com To: softimage@listproc.autodesk.com Subject: RE: Py: Testing if shader is assigned Date: Tue, 15 Apr 2014 11:52:56 + http://xsisupport.com/tag/materials/ From: ognj...@gmail.com Date: Tue, 15 Apr 2014 13:47:46 +0200 Subject: Py: Testing if shader is assigned To: softimage@listproc.autodesk.com Hi guys, heres a quick one. I have all my materials in a selection, is there a way to iterate the selection and test if the material is assigned to anything and drop it if its not? Thanks in advance.
Re: Py: Testing if shader is assigned
Thanks for the link and the example, it was just what i was looking for. Im going to bookmark http://xsisupport.com/tag/materials/ for future reference. Cheers, Ogi. On Tue, Apr 15, 2014 at 1:57 PM, gareth bell garethb...@outlook.com wrote: import win32com xsi = Application matColl = win32com.client.Dispatch( XSI.Collection ) matColl.AddItems (xsi.Selection) for eachMat in matColl: if eachMat.UsedBy.Count == 0: print eachMat.UsedBy.Count matColl.RemoveItems (eachMat) xsi.SelectObj (matColl) matColl.RemoveAll() -- From: garethb...@outlook.com To: softimage@listproc.autodesk.com Subject: RE: Py: Testing if shader is assigned Date: Tue, 15 Apr 2014 11:52:56 + http://xsisupport.com/tag/materials/ -- From: ognj...@gmail.com Date: Tue, 15 Apr 2014 13:47:46 +0200 Subject: Py: Testing if shader is assigned To: softimage@listproc.autodesk.com Hi guys, heres a quick one. I have all my materials in a selection, is there a way to iterate the selection and test if the material is assigned to anything and drop it if its not? Thanks in advance.