SIGetPrimCamera

カテゴリ

primitive

詳細

注視点を持つカメラ プリミティブを作成します。

注: このコマンドは、出力引数を使用します。 C# および一部のスクリプト言語(JScript、PerlScript、Python など)は、リファレンスによって渡される引数をサポートしていません。このため、状況に応じた適切な回避策を実行する必要があります。

スクリプト言語の場合、このコマンドは出力引数を取得するために使用できる ISIVTCollection を戻します。

C# の場合は、XSIApplication.ExecuteCommand メソッドを使用してこのコマンドを呼び出すことができます。 ExecuteCommand は、出力引数を C# の System.Object (出力引数の配列を含む)にパック化します(詳細については、「C# からのコマンドの呼び出し」を参照)。

スクリプト構文

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

パラメータ

パラメータ タイプ 詳細
PresetObj 文字列 またはプリセット オブジェクト(「SIGetPreset」を参照) カメラ プリミティブの任意のプリセット
Name 文字列 カメラの名前
InterestName 文字列 カメラの注視点の名前
Parent 文字列 カメラの親オブジェクト
3DObjCamera Camera カメラを戻します。
3DObjCameraInterest Null カメラの注視点を戻します。
PrimObjCamera Primitive カメラ プリミティブを戻します。
PrimObjCameraInterest Null カメラの注視点のプリミティブを戻します。

JScript の例

/*
        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) );
        }
}

関連項目

GetPrimCamera