import pfpy def pfNodeName(): return 'Animate camera' def main(): # fetch the first camera # Note: if no camera is available, an error will occur. In # this case, create one using Camera.new(0, 'myCamera') and # make sure parameters such as pixel aspect, film back # and frame rectangle are all set c= pfpy.getCameraRef(0) # set focal to variable and known c.setFocalType('variable') c.setFocalStatus('known') # fetch the in and out points inp= c.getInPoint() outp= c.getOutPoint() # display camera info print (c.getName(), "in: ", inp, "out: ", outp) print ("pixel aspect: ", c.getPixelAspect()) print ("sensor size: ", c.getFilmBackWidth('mm'), c.getFilmBackHeight('mm')) print ("focal status: ", c.getFocalType(), c.getFocalStatus()) print ("frame: ", c.getFrameRectangle()) # remove all previous keyframes c.removeKeys() f= inp while (f <= outp) : # specify camera position c.setFocalLength(f, 5+f*0.05, 'mm') c.setTranslation(f, 5.0-f*0.05, 6.0, -4.0+f*0.02) c.setLookAt(f, 0.0, 2.0, 0.0, 0.0) f += 1