SICreateLayerFromSelection

導入

v5.0

詳細

新規レイヤを作成して選択オブジェクトをそのレイヤに追加しますが、現在のレイヤにはしません。

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

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

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

スクリプト構文

SICreateLayerFromSelection( [PresetObj], [Name], [InputObjs], [Value] );

パラメータ

パラメータ タイプ 説明
PresetObj 文字列またはプリセット オブジェクト(SIGetPreset から取得されたオブジェクトなど) 使用するレイヤのプリセット

デフォルト値: "Default_New_Layer"

指定可能な値:

説明:

Default_New_Layer デフォルトの新しいレイヤ
Name 文字列 新しいレイヤの名前
InputObjs 文字列 レイヤに移動するオブジェクトのリスト

デフォルト値: 選択されたオブジェクト

Value レイヤ 新しいレイヤを戻します。

1. VBScript の例

'

' This example shows how to use the current selection

' to create a new layer and set that layer to current

'

NewScene , false

CreatePrim "Cylinder", "MeshSurface"

CreatePrim "Sphere", "MeshSurface"

ToggleSelection "cylinder", , True

' Now create the layer from the selection and make it current

SICreateLayerFromSelection , "LayerA", , oLayer

SetCurrentLayer oLayer

2. JScript の例

/*

	This example demonstrates how to create a new layer

	and set it to be the current layer

*/

// Setup

NewScene( null, false );

CreatePrim("Cylinder", "MeshSurface", null, null);

CreatePrim("Sphere", "MeshSurface", null, null);

ToggleSelection("cylinder", null, true);

// Get initial settings

checkCurrLayer();

// Make a new layer (it is *not* automatically set as current)

var oLayer = SICreateLayerFromSelection( null, "LayerA" )(0);

checkCurrLayer();

// Now explicitly set the new layer as current and check again

SetCurrentLayer( oLayer );

checkCurrLayer();

function checkCurrLayer()

{

	// What is the current layer?

	var oCurrLayer = GetCurrentLayer()(0);

	Application.LogMessage( "Current layer is....." + oCurrLayer );

}

// Expected result:

//INFO : Current layer is.....Layers.Layer_Default

//INFO : Current layer is.....Layers.Layer_Default

//INFO : Current layer is.....Layers.LayerA

3. Python の例

#

# This example demonstrates how to 

# create a layer from a group

#

app = Application

app.NewScene( "", 0 )

# Create two nulls 

app.GetPrim( "Null" )

app.GetPrim( "Null" )

# Add them to a new group

oGroup = app.CreateGroup( "NullsGroup", "null*" )

# Move the group to a new layer

ivtInfo = app.SICreateLayerFromSelection( "", "LayerNulls" )

oLayer = ivtInfo.Value( "Value" )

app.SetCurrentLayer( oLayer )

関連項目

SICreateLayer SICreateLayer2 SICreateLayerFromSelection2 CreateLayer