Tracking: Give more reasonable error message directly in the interface
Before this the message could be too generic which was simply saying that console is to be checked. This isn't very useful in cases when we know that reconstruction is failed because of lack of good keyframes or failure of initial reconstruction if there is no enough parallax on the selected keyframes.
This commit is contained in:
@@ -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 **** */
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user