## ImportRefModels

### Introduced

v3.5

### Description

Imports multiple models as referenced models from .emdl files. This allows you to import characters composed of multiple models, where the envelope is in a different model than the skeleton rig.
The models' file names are separated by commas. All referenced models are reconnected (for envelopes) to outside objects, if necessary. This is done once all models are loaded.
Note: This command is not accessible from the UI.

### Scripting Syntax

    oReturn = ImportRefModels( FileName, [Parent], [ExternalCnxMappingTemplate] );

### Return Value

Returns the imported models as an XSICollection.

### Parameters

Parameter | Type | Description
--- | --- | ---
FileName | String | File names of the model file to import, separated by commas.
Parent | String | Name of the object or model to use as the parent of the imported models. Default Value: "" (or "Scene_Root")
ExternalCnxMappingTemplate | String | This parameter contains a list of models separated by commas, which is used to resolve the objects that we try to reconnect at the end of the import of referenced models. Note: All imported models are automatically added at the begining of this parameter.

### Examples

#### VBScript Example

    NewScene,false
    ' Create 2 models, one envelope and one skeleton rig
    CreatePrim "Sphere", "MeshSurface"
    Create2DSkeleton -4.31164311296239E-02, 4.0721568627451, 0, -4.31164311296239E-02, 3.45098039215692E-02, 0, 0, 0, 0, 4
    AppendBone "eff", -8.62328622592479E-03, -4.00313725490196, 0
    SelectObj "sphere", , True
    ApplyFlexEnv "sphere;root,bone,bone1,eff", False
    CreateModel
    SetValue "Model.Name", "MyEnvelope"
    SelectObj "root", "BRANCH"
    CreateModel
    SetValue "Model.Name", "MyRig"
    ' Export each model
    emdlFileEnv = Application.InstallationPath( siUserPath ) & "/Data/MyEnvelope.emdl"
    emdlFileRig = Application.InstallationPath( siUserPath ) & "/Data/MyRig.emdl"
    ExportModel "MyEnvelope", emdlFileEnv
    ExportModel "MyRig", emdlFileRig
    ' Delete them since we want to import them as reference
    DeleteObj "B:myrig,B:myenvelope"
    ' Now import both models at the same time.
    set oModels = ImportRefModels (emdlFileEnv & "," & emdlFileRig , "", "Referenced_MyRig")

### See Also

ExportModel ImportModel