AddBridgeTransition

Introduced

1.5

Description

Creates a bridge transition between two periodic animation clips. Both clips have to overlap. The "From" clip has to start before the "To" clip. The "To" clip has to start before the "From" clip ends. The periods of both clips are assumed to be the duration of the clips (i.e. time Clip out - Clip in).

Scripting Syntax

    AddBridgeTransition( [From], [To], [Name] )

Parameters

Parameter | Type | Description
From | String | The source clip from which to transition. Default Value: Current selection, if empty: pick session
To | String | The target clip to which to transition. Default Value: Current selection, if empty: pick session
Name | String | Name of the transition. Currently not used.

Return Value

Returns the Transition.

Examples

VBScript Example

    ' This example builds a couple of Actions, one which has
    ' the sphere moving slowly on a three-sided path, the other
    ' which has the sphere moving quickly on a four-sided path.
    ' It then uses a bridge transition to perform a correct
    ' transition between these two looped motions (which have
    ' different periods).
    slowPeriod = 30 ' period of the slow looping Action
    fastPeriod = 12 ' period of the fast looping Action
    preFade = 60 ' approx time to cycle before starting transition
    crossFade = 100 ' approx desired duration of transition
    posParams = "/kine.local.posx,kine.local.posy,kine.local.posz"

    ' Create an object for our example.
    set oObj = CreatePrim( "Sphere", "MeshSurface" )

    ' Make an Action with it moving slowly in a wide (three-sided) loop.
    BuildLoop oObj, slowPeriod, 15, false
    set oSlowSource = StoreAction( , oObj & posParams, 2, "Slow", True, _
                  0, slowPeriod - 1 )

    ' Make an Action with it moving quickly in a tight (four-sided) loop.
    BuildLoop oObj, fastPeriod, 3, true
    set oFastSource = StoreAction( , oObj & posParams, 2, "Fast", True, _
                  0, fastPeriod - 1 )

    ' Instantiate the Actions on the mixer -- cycled,
    ' overlapped and ready for the Bridge Transition.
    set oSlowClip = AddClip( "Scene_Root", oSlowSource, , , 1 )
    set oFastClip = AddClip( "Scene_Root", oFastSource, , , _
                  round( preFade / slowPeriod ) * slowPeriod + 1 )
    overlapSlowCycles = round( ( crossFade + preFade - slowPeriod ) / slowPeriod )
    SetValue oSlowClip & ".actionclip.timectrl.extrapaft_type", 2
    SetValue oSlowClip & ".actionclip.timectrl.extrapaft_nbcycles", overlapSlowCycles
    SetValue oFastClip & ".actionclip.timectrl.extrapaft_type", 2
    SetValue oFastClip & ".actionclip.timectrl.extrapaft_nbcycles", _
                  round( overlapSlowCycles * slowPeriod / fastPeriod ) + 1

    ' Apply the Bridge Transition, which will match the
    ' frequency of the periodic motions.  Compare it to
    ' a regular transition, where the motions tend to
    ' cancel each other out if they are at different frequencies.
    AddBridgeTransition oSlowClip, oFastClip

    ' Set a suitable timeline start/end for playback of this example.
    SetValue "PlayControl.In", 1
    SetValue "PlayControl.Out", GetValue( oFastClip & ".actionclip.timectrl.resout" )

    '==================================================
    ' Helper method to create the looping paths (three- or four-sided).
    '==================================================
    sub BuildLoop( in_oObj, in_period, in_size, in_bFourSided )
       SetPositionKey in_oObj, 0, -0.5 * in_size, -0.5 * in_size, 0

       if in_bFourSided then
           SetPositionKey in_oObj, in_period / 4, 0.5 * in_size, -0.5 * in_size, 0
           SetPositionKey in_oObj, in_period / 2, 0.5 * in_size, 0.5 * in_size, 0
           SetPositionKey in_oObj, 3 * in_period / 4, -0.5 * in_size, 0.5 * in_size, 0
       else
           SetPositionKey in_oObj, in_period / 3, 0.5 * in_size, -0.5 * in_size, 0
           SetPositionKey in_oObj, 2 * in_period / 3, 0, 0.5 * in_size, 0
       end if

       SetPositionKey in_oObj, in_period, -0.5 * in_size, -0.5 * in_size, 0
    end sub

    '==================================================
    ' 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

AddTransition

Autodesk Softimage v7.5