diff options
Diffstat (limited to 'intern/cycles/blender/blender_camera.cpp')
-rw-r--r-- | intern/cycles/blender/blender_camera.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/intern/cycles/blender/blender_camera.cpp b/intern/cycles/blender/blender_camera.cpp index 1cc601ce148..491b5632ed5 100644 --- a/intern/cycles/blender/blender_camera.cpp +++ b/intern/cycles/blender/blender_camera.cpp @@ -36,6 +36,7 @@ struct BlenderCamera { float lens; float shuttertime; + Camera::MotionPosition motion_position; float aperturesize; uint apertureblades; @@ -83,6 +84,7 @@ static void blender_camera_init(BlenderCamera *bcam, BL::RenderSettings b_render bcam->sensor_height = 18.0f; bcam->sensor_fit = BlenderCamera::AUTO; bcam->shuttertime = 1.0f; + bcam->motion_position = Camera::MOTION_POSITION_CENTER; bcam->border.right = 1.0f; bcam->border.top = 1.0f; bcam->pano_viewplane.right = 1.0f; @@ -409,6 +411,7 @@ static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int cam->shuttertime = bcam->shuttertime; cam->fov_pre = cam->fov; cam->fov_post = cam->fov; + cam->motion_position = bcam->motion_position; /* border */ cam->border = bcam->border; @@ -431,6 +434,22 @@ void BlenderSync::sync_camera(BL::RenderSettings b_render, BL::Object b_override bcam.pixelaspect.y = b_render.pixel_aspect_y(); bcam.shuttertime = b_render.motion_blur_shutter(); + PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles"); + switch(RNA_enum_get(&cscene, "motion_blur_position")) { + case 0: + bcam.motion_position = Camera::MOTION_POSITION_START; + break; + case 1: + bcam.motion_position = Camera::MOTION_POSITION_CENTER; + break; + case 2: + bcam.motion_position = Camera::MOTION_POSITION_END; + break; + default: + bcam.motion_position = Camera::MOTION_POSITION_CENTER; + break; + } + /* border */ if(b_render.use_border()) { bcam.border.left = b_render.border_min_x(); @@ -487,6 +506,11 @@ void BlenderSync::sync_camera_motion(BL::RenderSettings b_render, BlenderCamera bcam; float aspectratio, sensor_size; blender_camera_init(&bcam, b_render); + + /* TODO(sergey): Consider making it a part of blender_camera_init(). */ + bcam.pixelaspect.x = b_render.pixel_aspect_x(); + bcam.pixelaspect.y = b_render.pixel_aspect_y(); + blender_camera_from_object(&bcam, b_engine, b_ob); blender_camera_viewplane(&bcam, width, height, |