SIGetPrimCamera

Categories

primitive

Description

Creates a camera primitive with an interest.

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

SIGetPrimCamera( PresetObj, [Name], [InterestName], [Parent], [3DObjCamera], [3DObjCameraInterest], [PrimObjCamera], [PrimObjCameraInterest] );

Parameters

Parameter Type Description
PresetObj String or a preset object (see SIGetPreset) Any preset for Camera Primitives
Name String Name of the camera.
InterestName String Name of the camera interest.
Parent String Parent object for the camera.
3DObjCamera Camera Returns the camera.
3DObjCameraInterest Null Returns the camera interest.
PrimObjCamera Primitive Returns the camera primitive.
PrimObjCameraInterest Null Returns the camera interest primitive.

Examples

JScript Example

/*
        This example demonstrates how to retrieve the output arguments through the returned
        ISIVTCollection, comparing using the Item vs. the Value property.
*/
NewScene( null, false );
// Create the Camera and Interest, and parent them to a newly created NULL object 
var rtn = SIGetPrim( "CameraRoot", "MyCamera_Root", ActiveSceneRoot, true );
// Get the output arguments via the ISIVTCollection.Item property
var oPrim = rtn.Item(0);                // equiv. to:  var oPrim = rtn.Value("Primitive")
var o3DObj = rtn.Item(1);               // equiv. to:  var o3DObj = rtn.Value("Value")
//      NB: This is a perfect example of why using the Value property is much 
//              safer than the Item property: you would expect the output arguments
//              to use the same order in the ISIVTCollection, but in this case, they
//              are opposite.
WhatAmI( o3DObj );                      //INFO : MyCamera_Root is a CameraRig
WhatAmI( oPrim );                       //INFO : MyCamera_Root.CameraRoot is a Primitive
SetValue( o3DObj + ".kine.global.posy", 2.0 );
SetValue( o3DObj + ".kine.global.posz", 20.0 );
// Get the output arguments via the ISIVTCollection.Value property
rtn = SIGetPrimCamera( "Camera", "MyCameraName", "MyCameraIntName" );
var o3DObjCamera = rtn.Value("3DObjCamera" );
var o3DObjCameraInterest = rtn.Value("3DObjCameraInterest" );
var oPrimObjCamera = rtn.Value( "PrimObjCamera" );
var oPrimObjCameraInterest = rtn.Value(" PrimObjCameraInterest" );
// For each object, find out its name and class, if possible
WhatAmI( o3DObjCamera );                //INFO : MyCameraName is a Camera
WhatAmI( o3DObjCameraInterest );        //INFO : MyCameraIntName is a Null
WhatAmI( oPrimObjCamera );              //INFO : MyCameraName.camera is a Primitive
WhatAmI( oPrimObjCameraInterest );      //INFO : input object is a undefined
// 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 " + typeof(in_obj) );
        }
}

See Also

GetPrimCamera