KeyRecorder.rfs
The "SimulationPre" Part
# Initialize nodes and global variables object = scene.getObject("Sphere01") name = object.getName() scene.setGlobalVariableValue("objName", name) scene.setGlobalVariableValue("posList", []) scene.setGlobalVariableValue("timeList", [])
Â
The "FramesPost" Part
Â
# Get the global variables and store the position and time values in lists objName   = scene.getGlobalVariableValue("objName") posList   = scene.getGlobalVariableValue("posList") timeList  = scene.getGlobalVariableValue("timeList") currentTime = scene.getCurrentTime() recObject  = scene.getObject(objName) pos     = recObject.getParameter("Position") posList.append(pos) timeList.append(currentTime)
Â
The "SimulationPost" Part
Â
# Read out the position and times values, create the curves and add the keys index   = 0 posList  = scene.getGlobalVariableValue("posList") timeList = scene.getGlobalVariableValue("timeList") objName  = scene.getGlobalVariableValue("objName") object  = scene.getObject(objName) curvePosX = object.getParameterCurve("Position.X") curvePosY = object.getParameterCurve("Position.Y") curvePosZ = object.getParameterCurve("Position.Z") for posVector in posList: newKeyX = Key.new() newKeyY = Key.new() newKeyZ = Key.new() simTime = timeList[index]  index += 1 # Record X positions newKeyX.time = simTime newKeyX.value = posVector.getX() newKeyX.type = KEY_TYPE_BEZIER curvePosX.addKey(newKeyX) # Record Y positions newKeyY.time = simTime newKeyY.value = posVector.getY() newKeyY.type = KEY_TYPE_BEZIER curvePosY.addKey(newKeyY) # Record Z positions newKeyZ.time = simTime newKeyZ.value = posVector.getZ() newKeyZ.type = KEY_TYPE_BEZIER curvePosZ.addKey(newKeyZ)