Is it possible to record the camera movements that I do using the mouse and keyboard? let’s say, If I get the position of the camera and target once every 1/3 seconds, and then use the points to create a curve for the camera path animation?
#records camera movements into camera_path and camera_target curves
#to be used to Set up path animation in Animation Settings
#camera path color is set to red
import scriptcontext
import rhinoscriptsyntax as rs
import time
strView=rs.CurrentView()
view = rs.CurrentView()
point_camera =[]
point_target = []
print "Recording camera movements. Long press ESC to stop."
while True:
time.sleep(0.1)
CameraTarget = rs.ViewCameraTarget(view)
point_camera.append(CameraTarget[0])
point_target.append(CameraTarget[1])
#check for esc press
if scriptcontext.escape_test(False):
print "ESC pressed "
break #get out of the loop
camera_path = rs.AddCurve(point_camera)
camera_target = rs.AddCurve(point_target)
rs.ObjectName(camera_path, name="camera_path")
rs.ObjectColor(camera_path, color=(255,0,0))
rs.ObjectName(camera_target, name="camera_target")