AnimationSourceItem.1.vbs Example
Applies To
AnimationSourceItem object
Description
This example illustrates how to access the fcurves inside a model's actionsource
Code
NewScene , false set oRoot = Application.ActiveProject.ActiveScene.Root ' These commands were cut and pasted from scripting history and modified to work in a script. ' The commands 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") LogMessage oActionSource.Name for each oSourceItem in oActionSource.SourceItems LogMessage vbTab & "target: " & oSourceItem.Target set oSource = oSourceItem.Source if TypeName(oSource) = "FCurve" then strKeys="" for each oKey in oSource.Keys if strKeys<>""then strKeys = strKeys & "," end if strKeys = strKeys & oKey.Time & "," & oKey.Value next LogMessage vbTab & "source: " & "fcurve keys(" & strKeys & ")" else LogMessage vbTab & "source ignored" end if next ' Output of above script: 'INFO : StoredFcvAction 'INFO : target: null.kine.local.posx 'INFO : source: fcurve keys(1,-8.153,50,0.196999999999999,100,9.61) 'INFO : target: null.kine.local.posy 'INFO : source: fcurve keys(1,7.015,50,-1.92,100,7.015) 'INFO : target: null.kine.local.posz 'INFO : source: fcurve keys(1,-0.702,50,0.192,100,-0.702)
Related Examples
Keywords
AnimationSourceItem SetAsFCurve SetAsStatic Active Source Target
Autodesk Softimage 2011