Fix #37097: Setting scene frame does not update active camera

The issue was caused by uncertainty of current camera when
there're no markers to the left of current frame.

Now in this case camera from the top-left marker will be used.
This commit is contained in:
2013-10-17 14:10:03 +00:00
parent abee8a8717
commit eb1b4c3b55

View File

@@ -874,18 +874,35 @@ Object *BKE_scene_camera_switch_find(Scene *scene)
TimeMarker *m;
int cfra = scene->r.cfra;
int frame = -(MAXFRAME + 1);
int min_frame = MAXFRAME + 1;
Object *camera = NULL;
Object *first_camera;
for (m = scene->markers.first; m; m = m->next) {
if (m->camera && (m->camera->restrictflag & OB_RESTRICT_RENDER) == 0 && (m->frame <= cfra) && (m->frame > frame)) {
camera = m->camera;
frame = m->frame;
if (m->camera && (m->camera->restrictflag & OB_RESTRICT_RENDER) == 0) {
if ((m->frame <= cfra) && (m->frame > frame)) {
camera = m->camera;
frame = m->frame;
if (frame == cfra)
break;
if (frame == cfra)
break;
}
if (m->frame < min_frame) {
first_camera = m->camera;
min_frame = m->frame;
}
}
}
if (camera == NULL) {
/* If there's no marker to the left of current frame,
* use camera from left-most marker to solve all sort
* of Schrodinger uncertainties.
*/
return first_camera;
}
return camera;
}
#endif