CreateRefModel

Introduced

6.0

Description

Creates a referenced model in the scene. You can use this command to create a new instance of an existing model on disk or specify the name of a model file that does not yet exist. It also allows you to specify whether to activate the new model, what resolution to use, and under which model or object to parent it.

Scripting Syntax

CreateRefModel( [FileName], [ModelName], [ResolutionName], [Parent], [Activate], [CreateFile], [ExternalCnxMappingTemplate] )

Parameters

Parameter

Type

Description

FileName

String

If a filename is specified, it is loaded and used for the first resolution.

ModelName

String

The model name.

Default Value: The name of the file (specified in Filename)

ResolutionName

String

The name of the first resolution.

Default Value: res1

Parent

String

Object or model to use as the parent of the imported model

Default Value: Scene Root

Activate

Boolean

True to import the model for the first resolution. If false, the model stays offloaded.

Default Value: True

CreateFile

Boolean

If the file specified does not exist yet, this argument tells XSI to automatically create a dummy model file (directories are also created). This is useful in a multiple-artist production pipeline to prepare the layout of a shot for a top-down approach before all the files exist.

Default Value: False

ExternalCnxMappingTemplate

String

This parameter contains a list of model separated by a comma, that is used to resolved the objects that we try to reconnect at the end of the import of referenced models.

The model is reconnected at the end of the import. If this parameter is null we will try to reconnect it to the original model name when the model was first exported.

Return Value

The new referenced Model

Examples

1. JScript Example

/*
   This example shows how to create a referenced model based on an asset that doesn't exist 
   yet. This will create the file on disk, and create an offloaded referenced model.
*/
NewScene( null, false );
var sPath = XSIUtils.BuildPath( Application.InstallationPath(siUserPath), "Data", "alain.emdl" );
CreateRefModel( sPath, "alaind", "low", null, false, true) ;

2. JScript Example

/*
   This example shows how to create a referenced model based on a model that already exists.
   It also demonstrates how to activate it and specify a parent model.
*/
NewScene( null, false );
CreateModel( null, "mymodel" );
var sPath = XSIUtils.BuildPath( Application.InstallationPath(siFactoryPath), 
   "Data", "XSI_SAMPLES", "Models", "Man.emdl" );
CreateRefModel( sPath, "man", "low", "mymodel", true, false );

See Also

CommitToReference

ConvertToRefModel

ImportModel

ExportModel



SOFTIMAGE|XSI v6.01     

Return to Softimage XSI Index