  | | | Testing for presence of property | Testing for presence of property 2004-03-20 - By Bernard Lebel
Back Hello,
Let say I want to check if a camera has any shader attached. If it has some, using the "shaders" property will work fine.
But if there are no shaders, an 2000-unspecified failure will be thrown and the script will abort. Is there any way I can check if the shaders property is present on the object?
Example of script that fails:
// -- ------ Start here -- ---- -----
// Get selected object var oSel = Selection(0);
// Create enumator and populate with shaders of selection var e = new Enumerator( oSel.shaders );
// -- ------ End here -- ---- -----
Another example:
// -- ------ Start here -- ---- -----
// Get selected object var oSel = Selection(0);
// Test if there are shaders attached to selection if( !oSel.shaders ) { logmessage( "No shader attached to selection." ); }
// -- ------ End here -- ---- -----
Thanks Bernard --- Unsubscribe? Mail Majordomo@(protected) with the following text in body: unsubscribe xsi
|
|
 |