I have the default Python 2.3 in Panther and I’m trying to get the Blenderman script to work. However, I get an error with the Blender.Scene.getCurrentCamera() function because it is returning NoType instead of the current camera.
I read the 2.3 Blender Python docs and it says that getCurrentCamera() is now a member of Render.RenderData. Buuuut, when I do
context = scene.getRenderingContext()
camera = context.getCurrentCamera()
it gives an AttributeError saying the getCurrentCamera() is not a function of RenderData despite the fact other functions in the 2.3 spec work properly.
I can get the camera in the scene by using
camera = Blender.Camera.Get()[0]
but that won’t be good enough for multiple cameras in a scene. How do I get the getCurrentCamera function to work in Mac OS 10.3.5 with Blender 2.34 & Python 2.3?
If you are using Blender 2.34, best to use the Bpy 2.34 docs. We make a great effort to maintain backward compatibilty, but sometimes things do change. ( I admit I am looking at the current CVS docs )
import Blender
scene = Blender.Scene.getCurrent()
cam = scene.getCurrentCamera() # get cam object
camObj = cam.getData() # get cam obData
print camObj.getClipStart(), camObj.getClipEnd()
Thanks, I downloaded the new docs and I found that the getCurrentCamera() is indeed under the scene module. I got it working by making a new scene. Not sure how the default camera became inactive.