## AddClip

### Introduced

v1.0

### Description

Creates a Clip and adds it to the Mixer of the specified Model. A clip is an instance of an ActionSource (action or shape animation) or an audio Source object.

### Scripting Syntax

    oReturn = AddClip( Model, Source, [Compound], [Track], [Time], [Name], [ConnectionMappingTemplate], [ValueMappingTemplate], [ShareParent], [IgnoreMissingConnections] );

### Return Value

Returns a Clip object.

### Parameters

Parameter | Type | Description
--- | --- | ---
Model | String | Model to add the clip to.
Source | String | Source for the clip. Typically, a "source" is an action.
Compound | String | Compound container (track owner) to add this clip to.
Track | String | Track to add this clip to.
Time | Double | Frame at which to add the clip. Default Value: Current frame
Name | String | Name for the new clip.
ConnectionMappingTemplate | String | The connection mapping template to use for the new clip. Default Value: The active connection mapping template.
ValueMappingTemplate | String | The value mapping template to use for the new clip. Default Value: The active value mapping template
ShareParent | Boolean | Share the source (when coming from another model). Default Value: True
IgnoreMissingConnections | Boolean | If true, ignores missing connections by skipping the connection resolution dialog. Default Value: False

### Examples

#### VBScript Example

    '
    ' This example creates a simple Action and instantiates it
    ' on two different objects using a connection mapping template.
    ' It shows very basic mixer scripting -- creating Actions, tracks
    ' and clips, as well as a simple mapping template.
    '
    ' Create objects for our example.
    set oSphere = CreatePrim( "Sphere", "MeshSurface" )
    set oCone = CreatePrim( "Cone", "MeshSurface" )
    posParams = "/kine.local.posx,kine.local.posy,kine.local.posz"
    ' Make an Action with it moving diagonally over 20 frames.
    SetPositionKey oSphere, 1, -5, -5, 0
    SetPositionKey oSphere, 20, 5, 5, 0
    set oSource = StoreAction( , oSphere & posParams, 2, "Diagonal", True, 1, 20 )
    ' Create a track and instantiate the Action onto it, starting at frame 10.
    set oTrack = AddTrack( "Scene_Root", , 0 )
    set oClip = AddClip( "Scene_Root", oSource, , oTrack, 10 )
    ' Make the clip play with three bounce cycles.
    SetValue oClip & ".actionclip.timectrl.extrapaft_type", 3
    SetValue oClip & ".actionclip.timectrl.extrapaft_nbbounces", 3
    ' Now create a connection mapping template so that the same
    ' Action source can be applied to the cone.
    CreateConnectionMap oCone, oSphere, oCnxMap
    ' Use the connection map to add another clip, so it will
    ' drive the cone instead.  We don't specify a track so it
    ' will create a new one for the clip.
    set oClip = AddClip( "Scene_Root", oSource, , , 1, "Slow", oCnxMap )
    ' Slow the cone's clip to play at one-quarter speed.
    SetValue oClip & ".actionclip.timectrl.scale", 1/4
    '==================================================
    ' Helper method to key an object somewhere at a given frame.
    '==================================================
    sub SetPositionKey( in_oObj, in_frame, in_posX, in_posY, in_posZ )
            Translate in_oObj, in_posX, in_posY, in_posZ, siAbsolute, siParent, siObj, siXYZ
            SaveKey in_oObj & posParams, in_frame
    end sub

### See Also

CreateConnectionMap CreateValueMap StoreAction Clip