AnimationSourceItem.Source
 
 
 

AnimationSourceItem.Source

Description

Sets or returns an animation source. You can get an FCurve, ShapeKey or a StaticSource) but you can only set an fcurve or a static animation source. If the new source is null or not a valid source then an invalid argument error is raised.

Note: If the AnimationSourceItem is a compound (siAnimCompoundAnimItem or siShapeCompoundAnimItem) this property will fail. You can test for whether this is a compound or not by testing the AnimationSourceItem with the base property SIObject.Type.

C# Syntax

// get accessor
AnimationSource rtn = AnimationSourceItem.Source;
// set accessor
AnimationSourceItem.Source = AnimationSource;

Examples

VBScript Example

'
' This example illustrates how to create a simple actionsource from some position animation. 
' The AnimationSourceItem.Source property is used to get the fcurve source and modify the keys.
'
NewScene , false
set oRoot = Application.ActiveProject.ActiveScene.Root
' These commands were cut and pasted from scripting history
' and modified to work in a script. They create a simple 
' actionsource from some animation on the null's position
set oNull = GetPrim( "Null" )
strPosParams = oNull & ".kine.local.posx," & oNull & ".kine.local.posy," & oNull & ".kine.local.posz"
Translate oNull, -8.153, 7.015, -0.702, siRelative, siView, siObj, siXYZ
SaveKey strPosParams, 1.000
Translate oNull, 8.350, -8.935, 0.894, siRelative, siView, siObj, siXYZ
SaveKey strPosParams, 50.000
Translate oNull, 9.413, 8.935, -0.894, siRelative, siView, siObj, siXYZ
SaveKey strPosParams, 100.000
StoreAction oRoot, strPosParams, 2, "StoredFcvAction", True, 1, 100
' Get the actionsource from the model
set oActionSource = oRoot.Sources("StoredFcvAction")
' Find animation source item with posx
for each oSourceItem in oActionSource.SourceItems
        if InStr(1,CStr(oSourceItem.Target),"posx",vbTextCompare)<>0 then
                exit for
        end if
next
' Change the fcurve keys on the posx source
set oFCurve = oSourceItem.Source
oFCurve.SetKeys Array(1, -8, 50, 8, 100, 9 )
' Apply actionsource with modified posx fcurve
AddClip oRoot, oActionSource
' Now find the clip and test the source items
set oClip = oRoot.Mixer.Clips(0)
for each oAnimSrcItem in oClip.Source.SourceItems
        LogMessage oAnimSrcItem.FullName & " is active: " & oAnimSrcItem.Active
next
' Output of above script:
'INFO : muting null.kine.local.posx
'INFO : AnimationSourceItem is active: False
'INFO : AnimationSourceItem is active: True
'INFO : AnimationSourceItem is active: True