/*
This example illustrates how to insert keys in an fcurve.
*/
// Create a cube
NewScene(null, false);
CreatePrim("Cube", "MeshSurface");
// Create an fcurve on the posx parameter of the cube
SaveKey("cube.kine.local.posx", 1, 0);
SaveKey("cube.kine.local.posx", 30, 5);
// Insert a key at frame 10
var fc = Application.Selection(0).posx.Source;
var bIsKeyInsertedAtFrame10 = fc.InsertKeyAtFrame(10);
Application.LogMessage("Key inserted at frame 10 = " + bIsKeyInsertedAtFrame10);
// Move to the frame 20
SetValue("PlayControl.Key", 20);
SetValue("PlayControl.Current", 20);
// Insert a key at the current frame
fc = Application.Selection(0).posx.Source;
var bIsKeyInsertedAtCurrentFrame = fc.InsertKeyAtFrame();
Application.LogMessage("Key inserted at current frame (frame 20) = " + bIsKeyInsertedAtCurrentFrame);
// Open the Animation Editor
SelectObj("cube", null, true);
OpenView("Animation Editor");
// Outputs:
//INFO : Key inserted at frame 10 = true
//INFO : Key inserted at current frame (frame 20) = true
|