Re: Finding all materials using a sprite shader through scripting.

Date : Thu, 26 Jul 2007 16:57:28 +0100
To : XSI(at)Softimage.COM
From : Julian Johnson <julian(at)exch.demon.co.uk>
Subject : Re: Finding all materials using a sprite shader through scripting.
Hi Dan,

Provided all your Sprite nodes begin with "Sprite..." then this might be a simple starting point....but I'm sure there's a more elegant way of selecting the nodes by Class/GUI ID instead of by Text strings...

Python:

from win32com.client import constants as c
spriteColl = XSIFactory.CreateObject('XSI.Collection')

scn = Application.ActiveProject.ActiveScene
matlibs = scn.MaterialLibraries
Application.LogMessage( "There are " + str(matlibs.Count) + " libraries under the scene." )
for currlib in matlibs :
Application.LogMessage( currlib.Name + " has " + str(matlibs.Count) + " defined materials." )


   for currmat in currlib.Items :
       Application.LogMessage( "  - " + currmat.Name )
       for x in currmat.FindShaders(c.siShaderFilter):
           if x.Name[:6] == 'Sprite':
               Application.LogMessage(str(x)+' is a sprite shader')
               spriteColl.AddItems(currmat.UsedBy)

Application.SelectObj(spriteColl)

Julian






Dan Yargici wrote:
Hi all,

I have a fairly large shot that has been a decent number of objects using the sprite shader in their materials. I'd like to find all the objects using any materials that contain the sprite shader.

Now, I'm not too bad with basic scripting, but as soon as the rendertree is involved I fall flat on my arse. Could anyone point me in the right direction?

If not, it's not the end of the world, it would probably take me about 10 minutes to do by hand. I was just curious...

Thanks.

DAN.


========================================

This e-mail (and any attachments) is confidential and may contain personal views which are not the views of Men-from-Mars unless specifically stated.

If you have received it in error, please delete it from your system. Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately.
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi



Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.