ImportAction
 
 
 

ImportAction

Introduced

v1.0

Description

Imports an action from a file. The imported action is added to the animation source list of the specified model.

The file formats accepted by this command are:

- External Softimage Native Binary Action (".eani") files.

- dotXSI Action (".xsi") files.

- Softimage Preset Action(".Preset") files.

This command supports downloading most file types off the internet. If the filename specified is a URL then the file will be downloaded locally before the command is executed. However URL arguments are not supported for Soft3D animation files.

Scripting Syntax

oReturn = ImportAction( Model, [FileName], [Name], [ActionStorage] );

Return Value

Returns the action as an ActionSource.

Parameters

Parameter Type Description
Model String or Model Model into which the action is imported.
FileName String Full path to the file to import.

Default Value: User is prompted to select a file

Name String Name of the new action.

Default Value: The file name

ActionStorage Integer based on the values listed in siAssetStorageType Whether the imported action will be saved internally or externally.

If you specify -1 it will automatically detect what kind of file it is and set it.

Default Value: 0 (saved in the scene)

Examples

JScript Example

/*
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

See Also

ExportAction LoadActionPreset ImportMixer