Clip Editor: Fix camera error curve drawing
It didn't work correctly when there in no continuously solved camera segment (aka there is a single isolated frame with solved camera). Basically, don't start drawing curve segment until it's known there is enough points for at least one segment. On user level it seemed to be fine, but it was assert failure in debug builds.
This commit is contained in:
parent
236794d07a
commit
a260d1cd69
Notes:
blender-bot
2023-02-14 02:30:11 +01:00
Referenced by issue #76277, Enabling Viewer Border in Compositor Crashes Blender
|
@ -220,31 +220,46 @@ static void draw_frame_curves(SpaceClip *sc, uint pos)
|
|||
MovieClip *clip = ED_space_clip_get_clip(sc);
|
||||
MovieTracking *tracking = &clip->tracking;
|
||||
MovieTrackingReconstruction *reconstruction = BKE_tracking_get_active_reconstruction(tracking);
|
||||
int i, lines = 0, prevfra = 0;
|
||||
|
||||
int previous_frame;
|
||||
float previous_error;
|
||||
bool have_previous_point = false;
|
||||
|
||||
/* Indicates whether immBegin() was called. */
|
||||
bool is_lines_segment_open = false;
|
||||
|
||||
immUniformColor3f(0.0f, 0.0f, 1.0f);
|
||||
|
||||
for (i = 0; i < reconstruction->camnr; i++) {
|
||||
for (int i = 0; i < reconstruction->camnr; i++) {
|
||||
MovieReconstructedCamera *camera = &reconstruction->cameras[i];
|
||||
int framenr;
|
||||
|
||||
if (lines && camera->framenr != prevfra + 1) {
|
||||
immEnd();
|
||||
lines = 0;
|
||||
const int current_frame = BKE_movieclip_remap_clip_to_scene_frame(clip, camera->framenr);
|
||||
const float current_error = camera->error;
|
||||
|
||||
if (have_previous_point && current_frame != previous_frame + 1) {
|
||||
if (is_lines_segment_open) {
|
||||
immEnd();
|
||||
is_lines_segment_open = false;
|
||||
}
|
||||
have_previous_point = false;
|
||||
}
|
||||
|
||||
if (!lines) {
|
||||
immBeginAtMost(GPU_PRIM_LINE_STRIP, reconstruction->camnr);
|
||||
lines = 1;
|
||||
if (have_previous_point) {
|
||||
if (!is_lines_segment_open) {
|
||||
immBeginAtMost(GPU_PRIM_LINE_STRIP, reconstruction->camnr);
|
||||
is_lines_segment_open = true;
|
||||
|
||||
immVertex2f(pos, previous_frame, previous_error);
|
||||
}
|
||||
immVertex2f(pos, current_frame, current_error);
|
||||
}
|
||||
|
||||
framenr = BKE_movieclip_remap_clip_to_scene_frame(clip, camera->framenr);
|
||||
immVertex2f(pos, framenr, camera->error);
|
||||
|
||||
prevfra = camera->framenr;
|
||||
previous_frame = current_frame;
|
||||
previous_error = current_error;
|
||||
have_previous_point = true;
|
||||
}
|
||||
|
||||
if (lines) {
|
||||
if (is_lines_segment_open) {
|
||||
immEnd();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue