v1.0
ファイルからアクションを読み込みします。 読み込まれたアクションは、指定されたモデルのアニメーション ソース リストに追加されます。
このコマンドで使用できるファイル形式は次のとおりです。
- 外部の Softimage ネイティブ バイナリ アクション(".eani")ファイル
- dotXSI アクション(".xsi")ファイル
- Softimage プリセット アクション(".Preset")ファイル
このコマンドは、インターネットからのほとんどのファイル タイプのダウンロード ファイルに対応しています。 ファイル名に URL を指定すると、コマンドが実行される前にそのファイルがローカルにダウンロードされます。 ただし、URL 引数は Soft3D のアニメーション ファイルではサポートされていません。
oReturn = ImportAction( Model, [FileName], [Name], [ActionStorage] ); |
アクションを ActionSource として戻します。
| パラメータ | タイプ | 説明 |
|---|---|---|
| Model | 文字列またはモデル | アクションの読み込み先モデル |
| FileName | 文字列 |
読み込みするファイルの完全パス デフォルト値: ユーザがファイルを指定します。 |
| Name | 文字列 |
新しいアクションの名前 デフォルト値: ファイル名 |
| ActionStorage | 整数(siAssetStorageType にリストされている値に基づく) |
読み込まれたアクションを内部に保存するか、外部に保存するか。
-1 を指定すると、コマンドは自動的にファイルの種類を検出して設定します。 デフォルト値:0(シーンに保存) |
/*
This example demonstrates how to export and import an action. It also
shows how to create an action source from a static source and then
how to access the static source from the imported action.
*/
NewScene( null, false );
var root = ActiveSceneRoot;
// Create a static action
var obj = root.AddGeometry( "Cone", "MeshSurface" );
var targets = new Array( obj.rotx.FullName, obj.roty.FullName, obj.rotz.FullName );
var statics = new Array( 22.5, 90, 45 );
var actives = new Array( true, true, true );
var src = root.AddActionSource( "StoredAnimStaticAction", targets, statics, actives );
// Export the action
var path = Application.InstallationPath( siProjectPath ) + "\\Actions";
var filepath = path + "\\TestImportAction.eani";
ExportAction( src, filepath );
// Import the action into a new scene but this time in a different model
NewScene( null, false );
var mdl = ActiveSceneRoot.AddModel();
mdl.Name = "TestActionModel";
var newsrc = ImportAction( mdl, filepath, "ImportedAction4Test", -1 );
if ( newsrc.SourceItems.Count > 0 ) {
LogMessage( "Imported action contains these items: " );
for ( var s=0; s<newsrc.SourceItems.Count; s++ ) {
var datasrc = newsrc.SourceItems(s).Source;
LogMessage( "\t" + datasrc );
}
} else {
LogMessage( "Imported action is a(n) " + ClassName(newsrc) );
}
// Expected results:
//INFO : Imported action contains these items:
//INFO : StaticSource
//INFO : StaticSource
//INFO : StaticSource |