Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/blender/blender_object.cpp
| Show First 20 Lines • Show All 428 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| if (scene->need_motion() == Scene::MOTION_NONE) | if (scene->need_motion() == Scene::MOTION_NONE) | ||||
| return; | return; | ||||
| /* get camera object here to deal with camera switch */ | /* get camera object here to deal with camera switch */ | ||||
| BL::Object b_cam = b_scene.camera(); | BL::Object b_cam = b_scene.camera(); | ||||
| if (b_override) | if (b_override) | ||||
| b_cam = b_override; | b_cam = b_override; | ||||
| if (!b_cam) { | |||||
| return; | |||||
| } | |||||
brecht: Skipping the entire function seems wrong to me, we just exclude just the ones involving the… | |||||
| Camera prevcam = *(scene->camera); | Camera prevcam = *(scene->camera); | ||||
| int frame_center = b_scene.frame_current(); | int frame_center = b_scene.frame_current(); | ||||
| float subframe_center = b_scene.frame_subframe(); | float subframe_center = b_scene.frame_subframe(); | ||||
| float frame_center_delta = 0.0f; | float frame_center_delta = 0.0f; | ||||
| if (scene->need_motion() != Scene::MOTION_PASS && | if (scene->need_motion() != Scene::MOTION_PASS && | ||||
| scene->camera->motion_position != Camera::MOTION_POSITION_CENTER) { | scene->camera->motion_position != Camera::MOTION_POSITION_CENTER) { | ||||
| float shuttertime = scene->camera->shuttertime; | float shuttertime = scene->camera->shuttertime; | ||||
| if (scene->camera->motion_position == Camera::MOTION_POSITION_END) { | if (scene->camera->motion_position == Camera::MOTION_POSITION_END) { | ||||
| frame_center_delta = -shuttertime * 0.5f; | frame_center_delta = -shuttertime * 0.5f; | ||||
| } | } | ||||
| else { | else { | ||||
| assert(scene->camera->motion_position == Camera::MOTION_POSITION_START); | assert(scene->camera->motion_position == Camera::MOTION_POSITION_START); | ||||
| frame_center_delta = shuttertime * 0.5f; | frame_center_delta = shuttertime * 0.5f; | ||||
| } | } | ||||
| float time = frame_center + subframe_center + frame_center_delta; | float time = frame_center + subframe_center + frame_center_delta; | ||||
| int frame = (int)floorf(time); | int frame = (int)floorf(time); | ||||
| float subframe = time - frame; | float subframe = time - frame; | ||||
| python_thread_state_restore(python_thread_state); | python_thread_state_restore(python_thread_state); | ||||
| b_engine.frame_set(frame, subframe); | b_engine.frame_set(frame, subframe); | ||||
| python_thread_state_save(python_thread_state); | python_thread_state_save(python_thread_state); | ||||
| sync_camera_motion(b_render, b_cam, width, height, 0.0f); | sync_camera_motion(b_render, b_cam, width, height, 0.0f); | ||||
brechtUnsubmitted Not Done Inline ActionsThis one line. brecht: This one line. | |||||
| sync_objects(b_depsgraph, b_v3d, 0.0f); | sync_objects(b_depsgraph, b_v3d, 0.0f); | ||||
| } | } | ||||
| /* Insert motion times from camera. Motion times from other objects | /* Insert motion times from camera. Motion times from other objects | ||||
| * have already been added in a sync_objects call. */ | * have already been added in a sync_objects call. */ | ||||
| uint camera_motion_steps = object_motion_steps(b_cam, b_cam); | uint camera_motion_steps = object_motion_steps(b_cam, b_cam); | ||||
| for (size_t step = 0; step < camera_motion_steps; step++) { | for (size_t step = 0; step < camera_motion_steps; step++) { | ||||
| motion_times.insert(scene->camera->motion_time(step)); | motion_times.insert(scene->camera->motion_time(step)); | ||||
| } | } | ||||
brechtUnsubmitted Not Done Inline ActionsThese 3 lines. brecht: These 3 lines. | |||||
| /* note iteration over motion_times set happens in sorted order */ | /* note iteration over motion_times set happens in sorted order */ | ||||
| foreach (float relative_time, motion_times) { | foreach (float relative_time, motion_times) { | ||||
| /* center time is already handled. */ | /* center time is already handled. */ | ||||
| if (relative_time == 0.0f) { | if (relative_time == 0.0f) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| Show All 36 Lines | |||||
Skipping the entire function seems wrong to me, we just exclude just the ones involving the camera.