ReconnectModel
 
 
 

ReconnectModel

Introduced

v3.5

Description

Reconnects all operators in a model that have connections outside the model and are not yet connected.

Usually, exporting a model strips away all objects that have connections outside the model. But there are some operators that are exported anyway (for example, enveloping operators). When importing a model the connections to objects outside the model are not established due to a lack of information concerning the targets. But when importing referenced models the connections are established automatically.

As of v6.5, the command takes an extra, optional parameter, ConnectDuplicateObjects, specifying whether or not duplicate objects are allowed. The previous behaviour was to always allow them, but now this command only duplicates objects when this parameter is passed in with a value of True.

Scripting Syntax

ReconnectModel( Model, ExternalCnxMappingTemplate, [DeleteUnconnectedObjects], [AllowDuplicateObjects] );

Parameters

Parameter Type Description
Model String Name of the model to reconnect.
ExternalCnxMappingTemplate String This parameter contains a list of models separated by a comma, used to resolved the objects that we try to reconnect.
DeleteUnconnectedObjects Boolean True to delete operators that were unable to be connected due to missing targets.

Default Value: True

AllowDuplicateObjects Boolean True to allow duplicate objects to be connected.

Default Value: False

Examples

VBScript Example

'
' This example demonstrates exporting a model, importing it back without the envelope 
' being connected and then using the ReconnectModel command to reconnect the envelope
'
NewScene , false
' Create a sphere in a model
CreatePrim "Sphere", "MeshSurface"
CreateModel
' Create a chain 
Create2DSkeleton -1.17507494684892E-02, 4.06772293980565, 0, -3.52522484054694E-02, 2.35128493630388E-02, 0, 0, 0, 0, 4
AppendBone "eff", -1.17507494684892E-02, -3.99718439171653, 0
' Envelope the sphere on the chain.
SelectObj "Model.sphere"
ApplyFlexEnv "Model.sphere;root,bone,bone1,eff", False
' Export the model and delete it.
SelectObj "Model"
ExportModel "Model", Application.InstallationPath( siFactoryPath ) & "/Data/XSI_SAMPLES/Models/mymodel.emdl"
SelectObj "Model", "BRANCH"
DeleteObj "B:Model"
' Import the model back, the envelope will not be reconnected
ImportModel Application.InstallationPath( siFactoryPath ) + "/Data/XSI_SAMPLES/Models/mymodel.emdl"
SelectObj "eff", , True
Translate , 1.83679023666235, 4.14069033985075, -0.414069033985075, siRelative, siView, siObj, siXYZ
' Reconnect the envelope in the model on the chain on the scene root.
ReconnectModel "eff", "Scene_Root"

See Also

ImportModel