## PlotToActions

### Introduced

v7.5

### Description

Creates and returns new actions by plotting values from consecutive frames of an animation. Actions are created under models containing animated parameters matching the specified list.

### Scripting Syntax

    oReturn = PlotToActions( [InputObj], [Name], [StartFrame], [EndFrame], [StepFrame], [FCurve Kind], [DefaultSegKind], [Fit FCurve], [Fit Tolerance], [ProcessContRots] );

### Return Value

Returns the created actions (a XSICollection object).

### Parameters

Parameter | Type | Description
--- | --- | ---
InputObj | String | List of parameters to plot into actions. Default Value: Marked values in current selection
Name | String | Name for the actions Default Value: "Action"
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: | Description:
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: | Description:
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

### Examples

#### JScript Example

    //

    // This example sets up one model with a sphere and another with a cone,

    // marks the local posz parameter of each primitive, plots various parameters

    // to an action source for each model, and then prints out the new sources.

    //

    // Set up the scene.

    NewScene( null, false );

    var oSphere = CreatePrim( "Sphere", "NurbsSurface", "MySphere" );

    var oCone = CreatePrim( "Cone", "NurbsSurface", "MyCone" );

    CreateModel( oSphere, "SphereModel" );

    CreateModel( oCone, "ConeModel" );

    // Create a path for the sphere and cone, just to make things more interesting.

    var oPath = CreatePrim( "Spiral", "NurbsCurve" );

    ApplyPath( oSphere, oPath, 1, 50, 2, true, true );

    ApplyPath( oCone, oPath, 50, 100, 2, true, true );

    // Mark the local position parameter in Z for the sphere and cone.

    SelectObj( oSphere + "," + oCone, null, true );

    SetMarking( "kine.local.posz" );

    // Plot the values of the marked parameter for the sphere and cone between frames 20 and 60.

    // Notice that the default input is the marked parameters, so

    // we do not have to specify anything for the 1st argument

    PlotToActions( null, null, 20, 60 );

    // Plot the local X position of the sphere and cone every frame between frames 20 and 60

    // and store the result in raw data fcurves.

    PlotToActions( oSphere + ".kine.local.posx," + oCone + ".kine.local.posx",

    			"ActionPosX", 20, 60, 1, 30 );

    // Plot the local Y position of the sphere only 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.

    PlotToActions( 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

    var oRoot = Application.ActiveSceneRoot;

    var oModelsFound = oRoot.Models;

    var iModelsCount = oModelsFound.Count;

    if( iModelsCount > 0 )

    {

    	for( var i = 0; i < iModelsCount; i++ )

    	{

    		var oModel = oModelsFound.Item( i );

    		var oSourcesFound = oModel.Sources;

    		var iSourcesCount = oSourcesFound.Count;

    		if( iSourcesCount > 0 )

    		{

    			Application.LogMessage( "Found the following sources in " + oModel + ":" );

    			for( var j = 0; j < iSourcesCount; j++ )

    			{

    				Application.LogMessage( "\t" + oSourcesFound.Item( j ).Name );

    			}

    		}

    		else

    		{

    			Application.LogMessage( "No sources found in " + oModel + "." );

    		}

    	}

    }

    else

    {

    	Application.LogMessage( "No models found in the scene." );

    }

    //---------------------------------------------------------

    // OUTPUT OF ABOVE SCRIPT IS:

    // INFO : Found the following sources in SphereModel:

    // INFO : 	Action

    // INFO : 	ActionPosX

    // INFO : 	ActionPosY

    // INFO : Found the following sources in ConeModel:

    // INFO : 	Action

    // INFO : 	ActionPosX

    //---------------------------------------------------------

### See Also

PlotAndApplyActions PlotConstrainedTransformsToActions PlotKeyableToActions StoreAction