Scripting - catching an error for a none existent item

Date : Thu, 24 May 2007 13:42:55 +0100
To : <XSI(at)Softimage.COM>
From : "Adam Seeley" <adam.seeley(at)clearpost.co.uk>
Subject : Scripting - catching an error for a none existent item
Hi,

Another basic scripty question (in VB).

I'm looping through the Partitions in a Pass and printing out the Material names.
This is fine if there is a Material, but falls over if none exists.
How do I check to see if it exists at all before I hit an error?

E.g. 
		for each oPartition in oPartitionList 

			logmessage oPartition.name
			if oPartition.Material <> false then logmessage "MATERIAL : " & oPartition.Material.Name	
					
		next

Will give

'INFO : Background_Objects_Partition
'INFO : MATERIAL : Scene_Material
'INFO : Background_Lights_Partition
'ERROR : Object variable not set - [line 27]


Thanks again,

Adam.


No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.467 / Virus Database: 269.7.6 - Release Date: 20/05/2007 00:00
 

---
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.