PartialOffloadAction

Introduced

v4.0

Description

Partially offloads one or many fcurve action sources for a given range of frames. The action source needs to have external storage in order to be able to execute this command.

Before offloading an action source, if the action is dirty it is exported. Once offloaded or partially offloaded, an action source never exports the data again. When an action source is partially offloaded, the Status parameter of the source becomes siActionStatusPartiallyLoaded (see siAssetStatus).

Note: This applies only to the FCurve action sources.

Scripting Syntax

PartialOffloadAction( [InputObjs], StartFrame, EndFrame, [Remember] );

Parameters

Parameter Type Description
InputObjs String List of action sources to process.

Default Value: Current selection

StartFrame Integer The frame to start offloading the fcurve keys. If smaller than the AnimStart parameter on the action, the AnimStart value is used instead.
EndFrame Integer The frame to end offloading the fcurve keys. If greater than the AnimEnd parameter on the action, the AnimEnd value is used instead.
Remember Boolean If true, the range of frames is appended to the parameter OffloadedRanges of the action, so when the scene is reloaded the partial offload will be processed. Otherwise, it is only temporarily offloaded.

Default Value: False

Examples

JScript Example

/*

	This example shows how to partially offload an animation source.

*/

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

// 

// 	SETUP

// Create an animation source of a sphere.

NewScene( null, false );

CreatePrim( "Cone", "MeshSurface", null, null );

Translate( null, -7.85065649868519, 0.715575131336405, -7.15575131336405E-02, 

	siRelative, siView, siObj, siXYZ, null, null, null, null, null, null, null, null, null );

SaveKey( "cone.kine.local.posx,cone.kine.local.posy,cone.kine.local.posz", 1, null, null );

SetValue( "PlayControl.Key", 10, null );

SetValue( "PlayControl.Current", 10, null);

Translate(null, 4.19500728937374, 7.06630442194682, -0.706630442194682, 

	siRelative, siView, siObj, siXYZ, null, null, null, null, null, null, null, null, null );

SaveKey( "cone.kine.local.posx,cone.kine.local.posy,cone.kine.local.posz", 10, null, null );

SetValue( "PlayControl.Key", 20, null );

SetValue( "PlayControl.Current", 20, null );

Translate( null, 4.25493596493627, -7.84151081422792, 0.784151081422792, 

	siRelative, siView, siObj, siXYZ, null, null, null, null, null, null, null, null, null );

SaveKey( "cone.kine.local.posx,cone.kine.local.posy,cone.kine.local.posz", 20, null, null );

SetValue( "PlayControl.Key", 30, null );

SetValue( "PlayControl.Current", 30, null );

Translate( null, 4.1350786138113, 7.57317013997673, -0.757317013997673, 

	siRelative, siView, siObj, siXYZ, null, null, null, null, null, null, null, null, null );

SaveKey( "cone.kine.local.posx,cone.kine.local.posy,cone.kine.local.posz", 30, null, null );

SetValue( "PlayControl.Key", 40, null );

SetValue( "PlayControl.Current", 40, null );

Translate( null, 2.21736099581185, -7.48372324855972, 0.748372324855972, 

	siRelative, siView, siObj, siXYZ, null, null, null, null, null, null, null, null, null );

SaveKey( "cone.kine.local.posx,cone.kine.local.posy,cone.kine.local.posz", 40, null, null );

CreateModel( null, null, null );

SelectObj( "Model.Cone", null, null );

StoreAction( "", "Model.Cone.kine.local.sclx,Model.Cone.kine.local.scly,"

	+ "Model.Cone.kine.local.sclz,Model.Cone.kine.local.rotx,Model.Cone.kine.local.roty,"

	+ "Model.Cone.kine.local.rotz,Model.Cone.kine.local.posx,Model.Cone.kine.local.posy,"

	+ "Model.Cone.kine.local.posz,Model.Cone.kine.global.sclx,Model.Cone.kine.global.scly,"

	+ "Model.Cone.kine.global.sclz,Model.Cone.kine.global.rotx,Model.Cone.kine.global.roty,"

	+ "Model.Cone.kine.global.rotz,Model.Cone.kine.global.posx,Model.Cone.kine.global.posy,"

	+ "Model.Cone.kine.global.posz", 2, "simplemove", true, 1, 40, false, false );

// Add a clip of the source in the mixer

SelectObj( "Model", null, null );

AddTrack( "Model", "Model", 0, null, null );

AddClip( "Model", "Sources.Animation.Model.simplemove", null, "Model.Mixer.Mixer_Anim_Track", 

	1, null, null, null, null );

SetValue( "PlayControl.Key", 20, null );

SetValue( "PlayControl.Current", 20, null );

// We need to set the external storage to external if we want to be able to offload the source

SetValue( "Sources.Animation.Model.simplemove.storage", 3, null );

var oAction = GetValue( "Sources.Animation.Model.simplemove" );

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

// 

// 	OFFLOAD

// Note that this partial offload has not been added to the OffloadedRanges parameter 

// of the source.

PartialOffloadAction( "Sources.Animation.Model.simplemove", 10, 20, false );

Application.LogMessage ( FindActionStatus(oAction.status.Value) );

Application.LogMessage ( oAction.OffloadedRanges.Value );

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

// 

// 	RELOAD

// Reloading the action will dispose the temporary offloaded ranges

oAction.Reload();

PartialOffloadAction( "Sources.Animation.Model.simplemove", 12, 22, true );

Application.LogMessage ( FindActionStatus(oAction.status.Value) );

Application.LogMessage ( oAction.OffloadedRanges.Value );

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

// 

// 	OUTPUT

//INFO : The action source contains section that are offloaded.

//INFO : 

//INFO : The action source contains section that are offloaded.

//INFO : 12,22

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

// 

// 	HELPER

function FindActionStatus( in_Val ) 

{

	var results = "";

	switch ( in_Val ) {

		case siActionStatusOffloaded :

			results = "The action source is offloaded on disk.";

			break;

		case siActionStatusPartiallyLoaded :

			results = "The action source contains section that are offloaded.";

			break;

		case siActionStatusLoaded :

			results = "The action source is loaded.";

			break;

		default :

			results = "Unrecognized action status.";

	}

	return results;

}

See Also

OffloadAction ActionSource.Offload ActionSource.PartialOffload