SIGetPrimSpotLight

Description

Creates a spot light primitive.

Note: This command uses output arguments. C# and some scripting languages (such as JScript, PerlScript and Python) don't support arguments passed by reference so you need to use the best workaround for your situation:

For scripting languages this command returns an ISIVTCollection which you can use to get the output arguments.

For C# you can use the XSIApplication.ExecuteCommand method to call this command. ExecuteCommand packs the output arguments into a C# System.Object containing an Array of the output arguments (see Calling Commands from C#).

Scripting Syntax

SIGetPrimSpotLight( PresetObj, [Name], [InterestName], [Parent], [3DObjSpot], [3DObjSpotInterest], [PrimObjSpot], [PrimObjSpotInterest] );

Parameters

Parameter Type Description
PresetObj String A spot light preset (see Light Primitives).

Possible Values:

Description:

Spot The spot preset
Name String Name of the light.
InterestName String Name of the interest.
Parent String Parent object for the light.
3DObjSpot Light Returns the spot light object.
3DObjSpotInterest Null Returns the spot interest.
PrimObjSpot Primitive Returns the spot light primitive.
PrimObjSpotInterest Primitive Returns the interest primitive.

Examples

JScript Example

/*

	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) );

	}

}

See Also

GetPrimLight SIGetPrimLight