/*
This example demonstrates how to retrieve the output arguments through
the returned ISIVTCollection, by using their name with the Value property.
*/
NewScene( null, false );
// Get the output arguments via the ISIVTCollection
var rtn = SIGetPrimSpotLight( "Spot.Preset", "MySpotName", "MySpotInterestName" );
// With the ISIVTCollection, you can either get the items by index number using the Item
// property, or by output argument name by using the Value property, which is much clearer
// and faster to use
var o3DObjSpot = rtn.Value("3DObjSpot");
var o3DObjSpotInterest = rtn.Value("3DObjSpotInterest");
var oPrimObjSpot = rtn.Value("PrimObjSpot");
var oPrimObjSpotInterest = rtn.Value("PrimObjSpotInterest");
// For each object, find out its name and class, if possible
WhatAmI( o3DObjSpot ); //INFO : MySpotName is a Light
WhatAmI( o3DObjSpotInterest ); //INFO : MySpotInterestName is a Null
WhatAmI( oPrimObjSpot ); //INFO : MySpotName.light is a Primitive
WhatAmI( oPrimObjSpotInterest ); //INFO : MySpotInterestName.SpotInterest is a Primitive
// Convenience function
function WhatAmI( in_obj )
{
// To prevent crashes, use the try...catch statement, because using ClassName
// on a simple data type (string, number, etc.) will throw an error
try {
LogMessage( in_obj + " is a " + ClassName(in_obj) );
} catch (e) {
LogMessage( "input object is a " + typeof(in_obj) );
}
}
|