PlotToAction

Description

Creates and returns a new action by plotting values from consecutive frames of an animation into the action.

If you don't enter a start and end frame, or enter 0 for both, plotting is performed from the first frame to the last frame in the timeline.

Note: There are two ways to specify where (under which model) you want to store the plotted action:

(1) Leave the first parameter ('Model') blank. The command will use the model owner of the object specified in the second parameter ('InputObj') as the model under which to store the action.

(2) If you want to store the action under a different model than what you are plotting, specify a 3D Object in the first parameter ('Model') that is owned by the model where you want to store the action.

Scripting Syntax

PlotToAction( [Model], [InputObj], [Name], [StartFrame], [EndFrame], [StepFrame], [FCurve Kind], [DefaultSegKind], [Fit FCurve], [Fit Tolerance], [ProcessContRots] )

Parameters

Parameter

Type

Description

Model

String

Object owned by the model on which to put the new action.

Default Value: If nothing is specified for this parameter, the action is stored

under the model owner of the InputObj.

 

InputObj

String

List of parameters to plot into the action.

Default Value: Marked values in current selection

Name

String

Name for the action

Default Value: "PlottedAction"

StartFrame

Double

First frame to plot

Default Value: 0

EndFrame

Double

Last frame to plot

Default Value: 0

StepFrame

Double

Step between frames

Default Value: 1

FCurve Kind

Integer

What kind of fcurve do we want to plot to?

Default Value: 20

Possible Values:

10: BOOLEAN (value true or false)

15: INTEGER (staircase-like fcurve with integer values)

20: STANDARD (fcurve with spline/linear/constant interpolation)

30: RAWDATA (linear fcurve: less storage than a standard fcurve but with linear interpolation only)

DefaultSegKind

Integer

What kind of interpolation do we want for the resulting fcurves?

Note: Only relevant when FCurveKind is 20 (Standard).

Default Value: 3

Possible Values:

1: CONSTANT

2: LINEAR

3: CUBIC

Fit FCurve

Boolean

Do we want to fit an fcurve through the plotted values?

Default Value: False

Fit Tolerance

Double

What tolerance do we want for the fit?

Default Value: 0.01

ProcessContRots

Boolean

Do we want to process rotation curves to ensure their continuity?

Default Value: True

Return Value

Returns the action (an ActionSource object).

Examples

VBScript Example

'
' This example sets up a sphere, marks the local posz parameter, plots various
' parameters to an action source, and then prints out the new sources.
'
' Set up the scene 
set oRoot = ActiveSceneRoot
set oSphere = CreatePrim( "Sphere", "NurbsSurface", "MySphere" )

' Create a path for the sphere, just to make things more interesting.
set oPath = CreatePrim( "Spiral", "NurbsCurve" )
ApplyPath oSphere, oPath, 1, 100, 2, True, True

' Mark the local position parameter in Z
SelectObj oSphere
SetMarking "kine.local.posz"

' Plot the values of the marked parameter for the sphere between frames 20 and 60. 
' Notice how the default input is the marked parameter, so
' we do not have to specify anything for the 2nd argument
PlotToAction oRoot, , , 20, 60

' Plot the local X position of the sphere every frame between frames 20 and 60 
' and store the result in raw data fcurves.
PlotToAction oRoot, oSphere.posx, "ActionPosX", 20, 60, 1, 30

' Plot the local Y position of the sphere every frame between frames 20 and 60
' and store the result in a standard fcurve with constant interpolation after 
' applying a fit with a tolerance of 0.1 to the plotted values.
PlotToAction oRoot, oSphere.posy, "ActionPosY", 20, 60, 1, 30, _
          1, True, 0.1, True

' Once they are created, they are stored with the scene waiting to be applied
set oSourcesFound = ActiveSceneRoot.Sources
if oSourcesFound.Count > 0 then
   LogMessage "Found the following sources in " & ActiveSceneRoot & ":"
   for each a in oSourcesFound
       LogMessage vbTab & a.Name 
   next
else
   LogMessage "No sources found in the scene."
end if


' Output of the above script:
'INFO : "Found the following sources in Scene_Root:"
'INFO : " Action"
'INFO : " ActionPosX"
'INFO : " ActionPosY"

See Also

PlotAndApplyAction

StoreAction



SOFTIMAGE|XSI v6.01     

Return to Softimage XSI Index