Salutations Blender community!
I am trying to:
- Move the camera object with bpy.context.scene.camera.location = (x, y, z)
- Find the locations in Normalized Device Coordinates (ie. within the frame of the rendered image) of some of the vertices with bpy_extras.object_utils.world_to_camera_view
I’m suspecting that I am not calling a function needed to update the projection information of the camera after moving, because the projections are incorrect. Blender is reporting that some points that I know are in the frame are outside of the viewing area (negative z value in world_to_camera_view). I have verified this by calling my script with blender -P script.py, and then examining the world coordinates in the 3d view to make sure that they are in fact in the frame.
Right now, I am calling:
bpy.context.scene.update()
Before I project with world_to_camera_view. Is there another function I need to call to make sure that the camera projection information is updated?