/*
This example demonstrates how to partially offload an animation source.
*/
NewScene( null, false );
// Create an animation source of a sphere.
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);
var oAction = GetValue("Sources.Animation.Model.simplemove");
// Now offload the fcurve in the section of frames 10 to 20
oAction.PartialOffload( 10,20, false );
LogMessage(oAction.status.Value);
LogMessage(oAction.OffloadedRanges.Value);
// Note that this partial offload as not been added to the OffloadedRanges parameter of the source.
// reloading the action will dispose the temporary offloaded ranges
oAction.Reload();
oAction.PartialOffload( 12,22, true );
LogMessage(oAction.status.Value);
LogMessage(oAction.OffloadedRanges.Value);
// Expected result:
//INFO : 1
//INFO :
//INFO : 1
//INFO : 12,22 |