diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_tracking.h | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/tracking_solver.c | 23 | ||||
-rw-r--r-- | source/blender/editors/space_clip/tracking_ops_solve.c | 10 |
3 files changed, 36 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_tracking.h b/source/blender/blenkernel/BKE_tracking.h index 6b6eb24d5fa..bf417403d43 100644 --- a/source/blender/blenkernel/BKE_tracking.h +++ b/source/blender/blenkernel/BKE_tracking.h @@ -355,6 +355,12 @@ void BKE_tracking_reconstruction_solve(struct MovieReconstructContext *context, bool BKE_tracking_reconstruction_finish(struct MovieReconstructContext *context, struct MovieTracking *tracking); +void BKE_tracking_reconstruction_report_error_message(struct MovieReconstructContext *context, + const char *error_message); + +const char *BKE_tracking_reconstruction_error_message_get( + const struct MovieReconstructContext *context); + void BKE_tracking_reconstruction_scale(struct MovieTracking *tracking, float scale[3]); /* **** Feature detection **** */ diff --git a/source/blender/blenkernel/intern/tracking_solver.c b/source/blender/blenkernel/intern/tracking_solver.c index cfa41cb7d92..7e7a839b645 100644 --- a/source/blender/blenkernel/intern/tracking_solver.c +++ b/source/blender/blenkernel/intern/tracking_solver.c @@ -65,6 +65,9 @@ typedef struct MovieReconstructContext { TracksMap *tracks_map; int sfra, efra; + + /* Details about reconstruction error, reported by Libmv. */ + char error_message[1024]; } MovieReconstructContext; typedef struct ReconstructProgressData { @@ -426,9 +429,26 @@ MovieReconstructContext *BKE_tracking_reconstruction_context_new(MovieClip *clip context->keyframe2 = keyframe2; context->refine_flags = reconstruct_refine_intrinsics_get_flags(tracking, object); + context->error_message[0] = '\0'; + return context; } +void BKE_tracking_reconstruction_report_error_message(MovieReconstructContext *context, + const char *error_message) +{ + if (context->error_message[0]) { + /* Only keep initial error message, the rest are inducted ones. */ + return; + } + BLI_strncpy(context->error_message, error_message, sizeof(context->error_message)); +} + +const char *BKE_tracking_reconstruction_error_message_get(const MovieReconstructContext *context) +{ + return context->error_message; +} + /* Free memory used by a reconstruction process. */ void BKE_tracking_reconstruction_context_free(MovieReconstructContext *context) { @@ -534,7 +554,8 @@ bool BKE_tracking_reconstruction_finish(MovieReconstructContext *context, MovieT MovieTrackingObject *object; if (!libmv_reconstructionIsValid(context->reconstruction)) { - printf("Failed solve the motion: most likely there are no good keyframes\n"); + BKE_tracking_reconstruction_report_error_message( + context, "Failed to solve the motion: most likely there are no good keyframes"); return false; } diff --git a/source/blender/editors/space_clip/tracking_ops_solve.c b/source/blender/editors/space_clip/tracking_ops_solve.c index 4490655393e..ab8a74715fa 100644 --- a/source/blender/editors/space_clip/tracking_ops_solve.c +++ b/source/blender/editors/space_clip/tracking_ops_solve.c @@ -122,8 +122,14 @@ static void solve_camera_freejob(void *scv) solved = BKE_tracking_reconstruction_finish(scj->context, tracking); if (!solved) { - BKE_report( - scj->reports, RPT_WARNING, "Some data failed to reconstruct (see console for details)"); + const char *error_message = BKE_tracking_reconstruction_error_message_get(scj->context); + if (error_message[0]) { + BKE_report(scj->reports, RPT_ERROR, error_message); + } + else { + BKE_report( + scj->reports, RPT_WARNING, "Some data failed to reconstruct (see console for details)"); + } } else { BKE_reportf(scj->reports, |