v2.0
プリセットベースのスクリプト オペレータを、ランタイム用に設計されたスクリプト オペレータに変換します。 以下に、プリセットベースのスクリプト オペレータとランタイム用に設計されたスクリプト オペレータの違いを示します。
ランタイムに合わせて設計されたスクリプト オペレータはシーンの一部として保存されます。 プリセットベースのプラグイン オペレータ(コンパイル オペレータまたはスクリプト オペレータ)はリファレンスとして保存され、関連付けられたプリセット ファイル(ファイル拡張子は .preset)と spdl ファイル(ファイル拡張子は .spdl)があります。
ご使用のシステムにプラグイン オペレータをインストールしていない場合、プリセットベースのスクリプト オペレータへの参照を含むシーンはロードできません。 インストールするスクリプト オペレータを決定する場合は、「xsi -l」コマンド ライン オプションを使用するか、アドオン パッケージのダイアログにすでにインストールされているスクリプト オペレータのリストを表示できます。
注: Softimage でカスタム オペレータを実装する場合は、自己インストール カスタム オペレータ(SICO)をお勧めしますが、このコマンドでは SICO をランタイム オペレータに変換することができません。
oReturn = ConvertScriptedOp( [Source] ); |
ランタイム用に設計されたプリセットベースのスクリプト オペレータを含む Operator を戻します。
| パラメータ | タイプ | 説明 |
|---|---|---|
| Source | オペレータ |
プリセットベースのスクリプト オペレータ デフォルト値:現在選択されているプリセットベースのスクリプト オペレータ |
/*
This example demonstrates how to use the ConvertScriptedOp command to generate a
legacy runtime operator from a preset-based operator definition. Since the preferred
implementation for custom operators is now Self-Installing Custom Operator, this
example first creates a legacy runtime operator, and then writes it to a spdl file
and registers the new spdl file so that we have a preset-based legacy operator to use.
Once a preset-based legacy operator has been saved to disk and registered in Softimage, this
example creates a new scene and runs the ConvertScriptedOp command to create a new
runtime version of the preset-based operator.
*/
// ---------------------------------------------------
// SET UP A PRESET-BASED OPERATOR
//
// Create scene and apply operator
NewScene( null, false );
GetPrim( "null" );
// Create and apply the operator to the null's posx
var str = DemoSpdlFile_Update.toString();
var op = AddScriptedOp( "null.kine.local.posx", str, null, "DemoSpdlFile" );
// Create a preset from it
spdlpath = XSIUtils.BuildPath(
Application.InstallationPath(siUserPath),
"Application", "spdl"
);
var fso = XSIFactory.CreateActiveXObject( "Scripting.FileSystemObject" );
if ( !fso.FolderExists(spdlpath) ) { // Create the directory if it doesn't exist
fso.CreateFolder(spdlpath);
}
spdlpath = XSIUtils.BuildPath( spdlpath, "DemoSpdlFile.spdl" );
CreateDemoSpdlFileOnDisk( spdlpath );
XSIUtils.RegisterSPDL( spdlpath, true );
// ---------------------------------------------------
// RUN THE CONVERTSCRIPTEDOP COMMAND
//
// Now run the ConvertScriptedOp command in a new scene
NewScene( null, false );
var myNull = GetPrim( "null" );
var myPresetBasedOp = ApplyOp( "DemoSpdlFile", myNull )(0);
var myRuntimeDesignedOp = ConvertScriptedOp( myPresetBasedOp );
// ---------------------------------------------------
// HELPER FUNCTION
//
// Update function
function DemoSpdlFile_Update( ctx, out )
{
Application.LogMessage( "DemoSpdlFile::Update()" );
out.Value = 2;
}
// Create SPDL file
function CreateDemoSpdlFileOnDisk( in_path )
{
// Set up text to write to spdl file
var spdltext = "SPDL\nVersion = \"2.0.0.2\";\nReference = \"{CE89DBEF-EA05-4378-B507-4A6718"
+ "25641F}\";\nName = \"DemoSpdlFile\";\n\nPropertySet \"DemoSpdlFile_Params\"\n{\n"
+ "\tParameter \"DemoSpdlFile\"\n\t{\n\t\tName\t= \"DemoSpdlFile\";\n\t\tGuid\t= \""
+ "{CE89DBEF-EA05-4378-B507-4A671825641F}\";\n\t\tCaps\t= Persistable;\n\t\tType\t="
+ " VT_EMPTY;\n\t}\n\n}\n\n\nLayout \"Default\"\n{\n}\nPortSet \"DemoSpdlFile_Ports"
+ "\"\n{\n\tGroup \"Group_0\"\n\t{\n\t\tOrigin = Select;\n\t\tPickMessage = \"Group"
+ "_0\";\n\n\t\tOutput \"Outposx\"\n\t\t{\n\t\t\tMajor = {9E04FCEE-10F3-11D0-943A-0"
+ "0AA006D3165};\n\t\t\tMinor = {4125B131-86EF-11D1-B1AB-0800360BFF02};\n\t\t\tComp"
+ "onent = {06294283-B94B-11D2-B87F-00A0C92469BE};\n\t\t\tAttributes = 0x00009001;\n"
+ "\t\t}\n\t}\n}\n\nPlugin = Scripted\n{\n\tLanguage = \"JScript\";\n\n\tUpdate =\n"
+ "\tBeginScript\n\tDemoSpdlFile_Update(In_UpdateContext, Out);\n\n\tEndScript\n\n"
+ "\tHelpers =\n\tBeginScript\nfunction DemoSpdlFile_Update( ctx, out ) \n{ \n Ap"
+ "plication.LogMessage( \"DemoSpdlFile::Update()\" );\n out.Value = 2;\n}\n\tEnd"
+ "Script\n}";
// Create a spdl file on disk
var fso = new ActiveXObject( "Scripting.FileSystemObject" );
var ts = fso.CreateTextFile( in_path );
ts.Write( spdltext );
ts.Close();
} |