  | | | Testing for presence of property | Testing for presence of property 2004-03-20 - By Bernard Lebel
Back Ok I see. My colleagues are wondering what I'm doing with that baseball glove.
Bernard
-- -- Original Message -- -- From: "kim aldis" <kim@(protected)> To: <XSI@(protected)> Sent: Saturday, March 20, 2004 3:03 PM Subject: RE: [Script] Testing for presence of property
> The 'try' is part of the code, by the way, not me saying 'try this' ;) > > > -- --Original Message-- -- > > From: owner-xsi@(protected) > > [mailto:owner-xsi@(protected)] On Behalf Of kim aldis > > Sent: 20 March 2004 12:44 > > To: XSI@(protected) > > Subject: RE: [Script] Testing for presence of property > > > > Try { > > // Get selected object > > var oSel = Selection(0); > > > > // Create enumator and populate with shaders of selection var > > e = new Enumerator( oSel.shaders ); > > > > } catch(ee) { > > logmessage( "oops" ); > > } > > > > > > > > > -- --Original Message-- -- > > > From: owner-xsi@(protected) > > > [mailto:owner-xsi@(protected)] On Behalf Of Bernard Lebel > > > Sent: 20 March 2004 12:30 > > > To: XSI@(protected) > > > Subject: [Script] Testing for presence of property > > > > > > 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 > > > > > > > > > > > > > > > > > --- > > Unsubscribe? Mail Majordomo@(protected) with the following > > text in body: > > unsubscribe xsi > > > > > > > > > > --- > Unsubscribe? Mail Majordomo@(protected) with the following text in body: > unsubscribe xsi > --- Unsubscribe? Mail Majordomo@(protected) with the following text in body: unsubscribe xsi
|
|
 |