ApplyOp

導入

v1.0

詳細

1 つ以上のオブジェクトにオペレータを適用し、このオペレータによって作成されたすべてのオブジェクトを戻します。また、新しく適用されたオペレータのプロパティ ページを開きます。 これは、任意のオペレータ(ヘア、デフォーム、ジェネレータ、トポロジ、カスタムなど)を適用できる汎用コマンドです。

また、適用しているオペレータに固有のコマンドを使用することもできます。 たとえば、ApplyGenOp コマンドを使用して、Birail や Loft などのジェネレータ オペレータを適用できます。ApplyHairCombOp を使用して適用できる HairCombOp などのように、オペレータには固有のコマンドを持つものがあります。

このコマンドは、グループ レベルの ConnectionSet のみをサポートしています。 ポート レベルの ConnectionSet を指定する場合は、代わりに ApplyOperator コマンドを使用します。

Tip:これらのタイプ固有のコマンドは、適用しているオペレータ タイプ専用の機能を持つ場合がしばしばあります。 たとえば、ApplyGenOp コマンドには、イミディエイト モードまたはパーシスタント モードを適用するオプションのほか、新しいジオメトリの作成後に入力(オリジナル)オブジェクトを処理するためのオプションがあります。一方 ApplyOp コマンドはこれらのオプションを持ちません。

注: このコマンドは、出力引数を使用します。C# および一部のスクリプト言語(JScript、PerlScript、Python など)は、リファレンスによって渡される引数をサポートしていません。通常、出力引数は XSIApplication.ExecuteCommand メソッド(C#)または ISIVTCollection (スクリプト言語)を介して取得できますが、このコマンドはすでに値を返しています。

この場合の唯一の回避策は、出力引数と戻り値の両方を 1 つの配列で戻す VBScript のカスタム コマンドを作成することです。詳細については、「関数がすでに値を戻している場合の処理について」を参照してください。

スクリプト構文

oReturn = ApplyOp( PresetObj, [ConnectionSet], [ConnectType], [ImmediateMode], [OutputObjs], [ConstructionMode] );

戻り値

作成されたオペレータのリストを含む XSICollection を戻します。

パラメータ

パラメータ タイプ 説明
PresetObj 文字列またはプリセット オブジェクト(SIGetPreset から取得されたオブジェクトなど) オペレータ プリセット。
ConnectionSet ConnectionSet オペレータに接続されるオブジェクトを指定します。

注: これは入/出力パラメータのため、このパラメータに渡した任意の文字列(変数または値)は、自動的に ConnectionSet オブジェクトに変換されます。

デフォルト値:現在選択されているオブジェクトをメイン グループとして使用

警告: 接続セットが無効だと、エラーが発生します。 スクリプトの中断を防ぐため、このオペレータに必要な接続セットを確認してください。

ConnectType siBranchFlag 接続タイプ(ノードまたはブランチ)を指定します。

デフォルト値: siUnspecified

ImmediateMode siOperationMode オペレータを即座にフリーズするかどうかを指定します。

デフォルト値: siPersistentOperation

OutputObjs XSICollection オペレータによって作成されたプリミティブを戻します。 たとえば、Loft はプリミティブ サーフェイスを作成します。
ConstructionMode siConstructionMode オペレータを適用するコンストラクション モードを指定します。

デフォルト値:現在のコンストラクション モードを使用

1. VBScript の例

'

' This example illustrates how to create

' loft operators

'

'

' Use Loft to create a surface from 2 curves

'

set curve1 = CreatePrim( "Arc", "NurbsCurve" )

translate curve1, , , 2

set curve2 = CreatePrim( "Arc", "NurbsCurve" )

set oplist = ApplyOp( "Loft", curve1 & "," & curve2,,,createdobjects )

set loftop = oplist(0)

' change the subdivision level in U

setvalue loftop & ".subdivu", 19

'

' Loft onto an existing surface

'

set surface = createdobjects(0)

surface.name = "Surface_created_by_lofting_2_curves"

set curve1 = CreatePrim( "Arc", "NurbsCurve" )

translate curve1, , , 2

set curve2 = CreatePrim( "Arc", "NurbsCurve" )

set surface = CreatePrim( "Grid", "NurbsSurface", "Loft_into_existing_surface" )

' Freeze the surface so that the object can be used to contain a

' new lofted surface

FreezeObj surface

set oplist = ApplyOp( "Loft", curve1 & "," & curve2 & ";" & surface )

set surface = oplist(0)

surface.name = "Surface_created_by_lofting_2_curves"

2. JScript の例

/* 

	Example showing how to retrieve the newly created operator

	when ApplyOp is called on a single object

*/

// Create primitive

oCube = activesceneroot.addgeometry( "Cube", "MeshSurface" );

// Call command to apply a Taper deformer and 

// retrieve the newly created operator

oColl = ApplyOp( "Taper", oCube, 3, 0, null, 0 ) ;

// Because there is only 1 input object (oCube)

// we know there is only one operator created

var oOp = oColl(0);

// Modify the Amplitude Parameter

oOp.ampl = 0.25 ;

3. JScript の例

// Create empty collection to store objects that

// we want to apply the operator to

oInputCollection = XSIFactory.CreateObject( "XSI.Collection" );

// Create primitive

oInputCollection.add( activesceneroot.addgeometry( "Cube", "MeshSurface" ) );

oInputCollection.add( activesceneroot.addgeometry( "Sphere", "MeshSurface" ) );

// Call command to apply a Taper deformer and populate collection with its return value

oOps = ApplyOp( "Taper", oInputCollection, 3, 0, null, 0 ) ;

// Validate result

for( var i=0; i < oOps.count; i++ )

{

// Get operator

oOp = oOps(i);

logmessage( oOp.fullname );

}

//Expected results:

//INFO : cube.polymsh.taperop

//INFO : sphere.polymsh.taperop

関連項目

ApplyOperator ApplyGenOp ApplyTopoOp ApplyHairOp Operator