Camera tracking integration

===========================

- Fixed some silly things ni DNA design. Now all
  reconstruction data is stored in Tracking->Reconstruction.
  Please, re-solve your cameras -- reconstruction data
  wouldn't be read from files saved in blender below this
  commit.
- RNA accessors for reconstruction data.
- Store average reconstruction error in new reconstruction
  structure and show it in clip editor header after
  reconstruction.
- Highlight failed to reconstruct frames with red in cache line.
- Added "group" "Failed Tracks" in Select Grouped operator,
  Meant to be used for selecting tracks bundles from which
  failed to to be solved.
- Hotkey to delete marker: Shift-X.
- Jump to next/prev failed frame operator. Hotkeys are
  Ctrl-Shift-Left/Right Arrow.
This commit is contained in:
Sergey Sharybin 2011-08-02 18:25:18 +00:00
parent 1694e5978a
commit cf6c261cc8
11 changed files with 238 additions and 76 deletions

View File

@ -113,6 +113,12 @@ class CLIP_HT_header(bpy.types.Header):
layout.template_ID(sc, "clip")
layout.template_running_jobs()
if clip:
r = clip.tracking.reconstruction
if r.is_reconstructed:
layout.label(text="Average solve error: %.4f" % (r.average_error))
class CLIP_PT_tools(bpy.types.Panel):
bl_space_type = 'CLIP_EDITOR'
@ -577,6 +583,9 @@ class CLIP_MT_select_grouped(bpy.types.Menu):
op = layout.operator("clip.select_grouped", text="Select Disabled")
op.group = 'DISABLED'
op = layout.operator("clip.select_grouped", text="Select Failed")
op.group = 'FAILED'
op = layout.operator("clip.select_grouped", text="Select by Color")
op.group = 'COLOR'

View File

@ -71,7 +71,7 @@ void BKE_tracking_sync(struct MovieTrackingContext *context);
void BKE_tracking_sync_user(struct MovieClipUser *user, struct MovieTrackingContext *context);
int BKE_tracking_next(struct MovieTrackingContext *context);
float BKE_tracking_solve_reconstruction(struct MovieClip *clip);
float BKE_tracking_solve_reconstruction(struct MovieTracking *tracking, int width, int height);
void BKE_track_unique_name(struct MovieTracking *tracking, struct MovieTrackingTrack *track);
struct MovieTrackingTrack *BKE_find_track_by_name(struct MovieTracking *tracking, const char *name);

View File

@ -448,8 +448,8 @@ void BKE_tracking_free(MovieTracking *tracking)
BLI_freelistN(&tracking->tracks);
if(tracking->camera.reconstructed)
MEM_freeN(tracking->camera.reconstructed);
if(tracking->reconstruction.cameras)
MEM_freeN(tracking->reconstruction.cameras);
if(tracking->stabilization.scaleibuf)
IMB_freeImBuf(tracking->stabilization.scaleibuf);
@ -871,17 +871,13 @@ int BKE_tracking_next(MovieTrackingContext *context)
}
#if WITH_LIBMV
static struct libmv_Tracks *create_libmv_tracks(MovieClip *clip)
static struct libmv_Tracks *create_libmv_tracks(MovieTracking *tracking, int width, int height)
{
int width, height;
int tracknr= 0;
MovieTrackingTrack *track;
struct libmv_Tracks *tracks= libmv_tracksNew();;
/* XXX: could fail if footage uses images with different sizes */
BKE_movieclip_acquire_size(clip, NULL, &width, &height);
track= clip->tracking.tracks.first;
track= tracking->tracks.first;
while(track) {
int a= 0;
@ -899,13 +895,12 @@ static struct libmv_Tracks *create_libmv_tracks(MovieClip *clip)
return tracks;
}
static int retrive_libmv_reconstruct(MovieClip *clip, struct libmv_Reconstruction *reconstruction)
static int retrive_libmv_reconstruct(MovieTracking *tracking, struct libmv_Reconstruction *libmv_reconstruction)
{
int tracknr= 0;
int sfra= INT_MAX, efra= INT_MIN, a, origin_set= 0;
MovieTracking *tracking= &clip->tracking;
MovieTrackingTrack *track;
MovieTrackingCamera *camera;
MovieTrackingReconstruction *reconstruction= &tracking->reconstruction;
MovieReconstructedCamera *reconstructed;
float origin[3]= {0.0f, 0.f, 0.0f};
int ok= 1;
@ -914,7 +909,7 @@ static int retrive_libmv_reconstruct(MovieClip *clip, struct libmv_Reconstructio
while(track) {
double pos[3];
if(libmv_reporojectionPointForTrack(reconstruction, tracknr, pos)) {
if(libmv_reporojectionPointForTrack(libmv_reconstruction, tracknr, pos)) {
track->bundle_pos[0]= pos[0];
track->bundle_pos[1]= pos[1];
track->bundle_pos[2]= pos[2];
@ -936,19 +931,17 @@ static int retrive_libmv_reconstruct(MovieClip *clip, struct libmv_Reconstructio
tracknr++;
}
camera= &tracking->camera;
if(reconstruction->cameras)
MEM_freeN(reconstruction->cameras);
if(camera->reconstructed)
MEM_freeN(camera->reconstructed);
camera->reconnr= 0;
camera->reconstructed= NULL;
reconstruction->camnr= 0;
reconstruction->cameras= NULL;
reconstructed= MEM_callocN((efra-sfra+1)*sizeof(MovieReconstructedCamera), "temp reconstructed camera");
for(a= sfra; a<=efra; a++) {
double matd[4][4];
if(libmv_reporojectionCameraForImage(reconstruction, a, matd)) {
if(libmv_reporojectionCameraForImage(libmv_reconstruction, a, matd)) {
int i, j;
float mat[4][4];
@ -964,18 +957,18 @@ static int retrive_libmv_reconstruct(MovieClip *clip, struct libmv_Reconstructio
if(origin_set)
sub_v3_v3(mat[3], origin);
copy_m4_m4(reconstructed[camera->reconnr].mat, mat);
reconstructed[camera->reconnr].framenr= a;
camera->reconnr++;
copy_m4_m4(reconstructed[reconstruction->camnr].mat, mat);
reconstructed[reconstruction->camnr].framenr= a;
reconstruction->camnr++;
} else {
ok= 0;
printf("No camera for frame %d\n", a);
}
}
if(camera->reconnr) {
camera->reconstructed= MEM_callocN(camera->reconnr*sizeof(MovieReconstructedCamera), "reconstructed camera");
memcpy(camera->reconstructed, reconstructed, camera->reconnr*sizeof(MovieReconstructedCamera));
if(reconstruction->camnr) {
reconstruction->cameras= MEM_callocN(reconstruction->camnr*sizeof(MovieReconstructedCamera), "reconstructed camera");
memcpy(reconstruction->cameras, reconstructed, reconstruction->camnr*sizeof(MovieReconstructedCamera));
}
if(origin_set) {
@ -995,25 +988,28 @@ static int retrive_libmv_reconstruct(MovieClip *clip, struct libmv_Reconstructio
#endif
float BKE_tracking_solve_reconstruction(MovieClip *clip)
float BKE_tracking_solve_reconstruction(MovieTracking *tracking, int width, int height)
{
#if WITH_LIBMV
{
MovieTrackingCamera *camera= &clip->tracking.camera;
MovieTracking *tracking= &clip->tracking;
struct libmv_Tracks *tracks= create_libmv_tracks(clip);
MovieTrackingCamera *camera= &tracking->camera;
struct libmv_Tracks *tracks= create_libmv_tracks(tracking, width, height);
struct libmv_Reconstruction *reconstruction = libmv_solveReconstruction(tracks,
tracking->settings.keyframe1, tracking->settings.keyframe2,
camera->focal, camera->principal[0], camera->principal[1],
camera->k1, camera->k2, camera->k3);
float error= libmv_reprojectionError(reconstruction);
if(!retrive_libmv_reconstruct(clip, reconstruction))
tracking->reconstruction.error= error;
if(!retrive_libmv_reconstruct(tracking, reconstruction))
error= -1.f;
libmv_destroyReconstruction(reconstruction);
libmv_tracksDestroy(tracks);
tracking->reconstruction.flag|= TRACKING_RECONSTRUCTED;
return error;
}
#endif
@ -1040,22 +1036,22 @@ MovieTrackingTrack *BKE_find_track_by_name(MovieTracking *tracking, const char *
MovieReconstructedCamera *BKE_tracking_get_reconstructed_camera(MovieTracking *tracking, int framenr)
{
MovieTrackingCamera *camera= &tracking->camera;
MovieTrackingReconstruction *reconstruction= &tracking->reconstruction;
int a= 0, d= 1;
if(!camera->reconnr)
if(!reconstruction->camnr)
return NULL;
if(camera->last_camera<camera->reconnr)
a= camera->last_camera;
if(reconstruction->last_camera<reconstruction->camnr)
a= reconstruction->last_camera;
if(camera->reconstructed[a].framenr>=framenr)
if(reconstruction->cameras[a].framenr>=framenr)
d= -1;
while(a>=0 && a<camera->reconnr) {
if(camera->reconstructed[a].framenr==framenr) {
camera->last_camera= a;
return &camera->reconstructed[a];
while(a>=0 && a<reconstruction->camnr) {
if(reconstruction->cameras[a].framenr==framenr) {
reconstruction->last_camera= a;
return &reconstruction->cameras[a];
break;
}

View File

@ -5706,7 +5706,7 @@ static void direct_link_movieclip(FileData *fd, MovieClip *clip)
if(fd->movieclipmap) clip->cache= newmclipadr(fd, clip->cache);
else clip->cache= NULL;
tracking->camera.reconstructed= newdataadr(fd, tracking->camera.reconstructed);
tracking->reconstruction.cameras= newdataadr(fd, tracking->reconstruction.cameras);
link_list(fd, &tracking->tracks);

View File

@ -2434,8 +2434,8 @@ static void write_movieclips(WriteData *wd, ListBase *idbase)
MovieTrackingTrack *track;
writestruct(wd, ID_MC, "MovieClip", 1, clip);
if(tracking->camera.reconnr)
writestruct(wd, DATA, "MovieReconstructedCamera", tracking->camera.reconnr, tracking->camera.reconstructed);
if(tracking->reconstruction.camnr)
writestruct(wd, DATA, "MovieReconstructedCamera", tracking->reconstruction.camnr, tracking->reconstruction.cameras);
track= tracking->tracks.first;
while(track) {

View File

@ -71,7 +71,7 @@
static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Scene *scene)
{
float x;
int *points, totseg, sel_type;
int *points, totseg, sel_type, i, a;
float sfra= SFRA, efra= EFRA;
void *sel;
float framelen= ar->winx/(efra-sfra+1);
@ -87,8 +87,6 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
/* cached segments -- could be usefu lto debug caching strategies */
BKE_movieclip_get_cache_segments(clip, &totseg, &points);
if(totseg) {
int a;
glColor4ub(128, 128, 255, 128);
for(a= 0; a<totseg; a++) {
@ -103,10 +101,9 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
/* track */
if(sel_type==MCLIP_SEL_TRACK) {
int i, a= 0;
MovieTrackingTrack *track= (MovieTrackingTrack *)sel;
for(i= sfra; i <= efra; i++) {
for(i= sfra, a= 0; i <= efra; i++) {
int framenr;
MovieTrackingMarker *marker;
@ -134,6 +131,33 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
}
}
/* failed frames */
if(clip->tracking.reconstruction.flag&TRACKING_RECONSTRUCTED) {
int n= clip->tracking.reconstruction.camnr;
MovieReconstructedCamera *cameras= clip->tracking.reconstruction.cameras;
glColor4ub(255, 0, 0, 96);
for(i= sfra, a= 0; i <= efra; i++) {
int ok= 0;
while(a<n) {
if(cameras[a].framenr==i) {
ok= 1;
break;
}
else if(cameras[a].framenr>i) {
break;
}
a++;
}
if(!ok)
glRecti((i-sfra)*framelen, 0, (i-sfra+1)*framelen, 8);
}
}
glDisable(GL_BLEND);
/* current frame */

View File

@ -354,6 +354,7 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "CLIP_OT_delete_track", XKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "CLIP_OT_delete_marker", DELKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "CLIP_OT_delete_marker", XKEY, KM_PRESS, KM_SHIFT, 0);
kmi= WM_keymap_add_item(keymap, "WM_OT_context_toggle", LKEY, KM_PRESS, 0, 0);
RNA_string_set(kmi->ptr, "data_path", "space_data.lock_selection");
@ -376,9 +377,17 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
kmi= WM_keymap_add_item(keymap, "CLIP_OT_lock_tracks", LKEY, KM_PRESS, KM_ALT, 0);
RNA_enum_set(kmi->ptr, "action", 1);
WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
kmi= WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "position", 0);
kmi= WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "end", 1);
RNA_enum_set(kmi->ptr, "position", 1);
kmi= WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "position", 2);
kmi= WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "position", 3);
WM_keymap_add_item(keymap, "CLIP_OT_join_tracks", JKEY, KM_PRESS, KM_CTRL, 0);

View File

@ -1122,6 +1122,9 @@ static int select_groped_exec(bContext *C, wmOperator *op)
ok= equals_v3v3(track->color, sel->color);
}
}
else if(group==6) { /* failed */
ok= (track->flag&TRACK_HAS_BUNDLE) == 0;
}
if(ok) {
track->flag|= SELECT;
@ -1146,6 +1149,7 @@ void CLIP_OT_select_grouped(wmOperatorType *ot)
{3, "LOCKED", 0, "Locked tracks", "Select all locked tracks"},
{4, "DISABLED", 0, "Disabled tracks", "Select all disabled tracks"},
{5, "COLOR", 0, "Tracks with same color", "Select all tracks with same color as actiev track"},
{6, "FAILED", 0, "Failed Tracks", "Select all tracks which failed to be reconstructed"},
{0, NULL, 0, NULL, NULL}
};
@ -1436,7 +1440,7 @@ void CLIP_OT_track_markers(wmOperatorType *ot)
/********************** solve camera operator *********************/
static int check_solve_tarck_count(MovieTracking *tracking)
static int check_solve_track_count(MovieTracking *tracking)
{
int tot= 0;
int frame1= tracking->settings.keyframe1, frame2= tracking->settings.keyframe2;
@ -1459,14 +1463,19 @@ static int solve_camera_exec(bContext *C, wmOperator *op)
SpaceClip *sc= CTX_wm_space_clip(C);
MovieClip *clip= ED_space_clip(sc);
Scene *scene= CTX_data_scene(C);
MovieTracking *tracking= &clip->tracking;
int width, height;
float error;
if(!check_solve_tarck_count(&clip->tracking)) {
if(!check_solve_track_count(tracking)) {
BKE_report(op->reports, RPT_ERROR, "At least 10 tracks on both of keyframes are needed for reconstruction");
return OPERATOR_CANCELLED;
}
error = BKE_tracking_solve_reconstruction(clip);
/* could fail if footage uses images with different sizes */
BKE_movieclip_acquire_size(clip, NULL, &width, &height);
error= BKE_tracking_solve_reconstruction(tracking, width, height);
if(error<0)
BKE_report(op->reports, RPT_WARNING, "Some data failed to reconstruct, see console for details");
@ -1479,7 +1488,6 @@ static int solve_camera_exec(bContext *C, wmOperator *op)
scene->camera= scene_find_camera(scene);
if(scene->camera) {
MovieTracking *tracking= &clip->tracking;
float focal= tracking->camera.focal;
/* set blender camera focal length so result would look fine there */
@ -1535,11 +1543,13 @@ static int clear_reconstruction_exec(bContext *C, wmOperator *UNUSED(op))
track= track->next;
}
if(tracking->camera.reconstructed)
MEM_freeN(tracking->camera.reconstructed);
if(tracking->reconstruction.cameras)
MEM_freeN(tracking->reconstruction.cameras);
tracking->camera.reconstructed= NULL;
tracking->camera.reconnr= 0;
tracking->reconstruction.cameras= NULL;
tracking->reconstruction.camnr= 0;
tracking->reconstruction.flag&= ~TRACKING_RECONSTRUCTED;
DAG_id_tag_update(&clip->id, 0);
@ -2199,16 +2209,47 @@ static int frame_jump_exec(bContext *C, wmOperator *op)
SpaceClip *sc= CTX_wm_space_clip(C);
MovieClip *clip= ED_space_clip(sc);
MovieTrackingTrack *track;
int end= RNA_boolean_get(op->ptr, "end");
int sel_type, delta= end ? 1 : -1;
int pos= RNA_enum_get(op->ptr, "position");
int sel_type, delta;
BKE_movieclip_last_selection(clip, &sel_type, (void**)&track);
if(pos<=1) { /* jump to path */
BKE_movieclip_last_selection(clip, &sel_type, (void**)&track);
if(sel_type!=MCLIP_SEL_TRACK)
return OPERATOR_CANCELLED;
if(sel_type!=MCLIP_SEL_TRACK)
return OPERATOR_CANCELLED;
while(BKE_tracking_has_marker(track, sc->user.framenr+delta)) {
sc->user.framenr+= delta;
delta= pos == 1 ? 1 : -1;
while(sc->user.framenr+delta >= SFRA && sc->user.framenr+delta <= EFRA) {
MovieTrackingMarker *marker= BKE_tracking_exact_marker(track, sc->user.framenr+delta);
if(!marker || marker->flag&MARKER_DISABLED)
break;
sc->user.framenr+= delta;
}
}
else { /* to to failed frame */
if(clip->tracking.reconstruction.flag&TRACKING_RECONSTRUCTED) {
int a= sc->user.framenr;
MovieTracking *tracking= &clip->tracking;
delta= pos == 3 ? 1 : -1;
a+= delta;
while(a+delta >= SFRA && a+delta <= EFRA) {
MovieReconstructedCamera *cam= BKE_tracking_get_reconstructed_camera(tracking, a);
if(!cam) {
sc->user.framenr= a;
break;
}
a+= delta;
}
}
}
if(CFRA!=sc->user.framenr) {
@ -2225,6 +2266,14 @@ static int frame_jump_exec(bContext *C, wmOperator *op)
void CLIP_OT_frame_jump(wmOperatorType *ot)
{
static EnumPropertyItem position_items[] = {
{0, "PATHSTART", 0, "Path Start", "Jump to start of current path"},
{1, "PATHEND", 0, "Path End", "Jump to end of current path"},
{2, "FAILEDPREV", 0, "Previons Failed", "Jump to previous failed frame"},
{2, "FAILNEXT", 0, "Next Failed", "Jump to next failed frame"},
{0, NULL, 0, NULL, NULL}
};
/* identifiers */
ot->name= "Jump to Frame";
ot->description= "Jump to special frame";
@ -2238,7 +2287,7 @@ void CLIP_OT_frame_jump(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "end", 0, "Last Frame", "Jump to the last frame of current track.");
RNA_def_enum(ot->srna, "position", position_items, 0, "Position", "Position to jumo to");
}
/********************** join tracks operator *********************/

View File

@ -1524,18 +1524,18 @@ static void draw_viewport_reconstruction(Scene *scene, Base *base, View3D *v3d,
}
if((flag & DRAW_PICKING)==0) {
if(v3d->flag2&V3D_SHOW_CAMERAPATH && clip->tracking.camera.reconnr) {
if(v3d->flag2&V3D_SHOW_CAMERAPATH && clip->tracking.reconstruction.camnr) {
int a= 0;
MovieTrackingCamera *camera= &clip->tracking.camera;
MovieReconstructedCamera *cur= camera->reconstructed;
MovieTrackingReconstruction *reconstruction= &tracking->reconstruction;
MovieReconstructedCamera *camera= tracking->reconstruction.cameras;
glDisable(GL_LIGHTING);
UI_ThemeColor(TH_CAMERA_PATH);
glLineWidth(2.0f);
glBegin(GL_LINE_STRIP);
for(a= 0; a<camera->reconnr; a++, cur++) {
glVertex3f(cur->mat[3][0], cur->mat[3][1], cur->mat[3][2]);
for(a= 0; a<reconstruction->camnr; a++, camera++) {
glVertex3f(camera->mat[3][0], camera->mat[3][1], camera->mat[3][2]);
}
glEnd();

View File

@ -63,9 +63,6 @@ typedef struct MovieTrackingCamera {
short pad;
float principal[2]; /* principal point */
float k1, k2, k3; /* radial distortion */
int last_camera; /* most recently used camera */
int reconnr; /* number of reconstructed cameras */
struct MovieReconstructedCamera *reconstructed; /* reconstructed cameras */
} MovieTrackingCamera;
typedef struct MovieTrackingMarker {
@ -124,10 +121,21 @@ typedef struct MovieTrackingStabilization {
struct ImBuf *scaleibuf; /* currently scaled ibuf */
} MovieTrackingStabilization;
typedef struct MovieTrackingReconstruction {
int flag;
float error; /* average error of reconstruction */
int last_camera; /* most recently used camera */
int camnr; /* number of reconstructed cameras */
struct MovieReconstructedCamera *cameras; /* reconstructed cameras */
} MovieTrackingReconstruction;
typedef struct MovieTracking {
MovieTrackingSettings settings; /* different tracking-related settings */
MovieTrackingCamera camera; /* camera intrinsics */
ListBase tracks; /* all tracks */
MovieTrackingReconstruction reconstruction; /* reconstruction data */
MovieTrackingStabilization stabilization; /* stabilization data */
} MovieTracking;
@ -164,4 +172,7 @@ enum {
#define TRACKING_2D_STABILIZATION (1<<0)
#define TRACKING_AUTOSCALE (1<<1)
/* MovieTrackingReconstruction->flag */
#define TRACKING_RECONSTRUCTED (1<<0)
#endif

View File

@ -200,6 +200,8 @@ static void rna_tracking_flushUpdate(Main *bmain, Scene *scene, PointerRNA *ptr)
#else
static int rna_matrix_dimsize_4x4[]= {4, 4};
static void rna_def_trackingSettings(BlenderRNA *brna)
{
StructRNA *srna;
@ -327,13 +329,20 @@ static void rna_def_trackingMarker(BlenderRNA *brna)
srna= RNA_def_struct(brna, "MovieTrackingMarker", NULL);
RNA_def_struct_ui_text(srna, "Movie tracking marker data", "Match-moving marker data for tracking");
/* Position */
/* oosition */
prop= RNA_def_property(srna, "pos", PROP_FLOAT, PROP_TRANSLATION);
RNA_def_property_array(prop, 2);
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 5);
RNA_def_property_float_sdna(prop, NULL, "pos");
RNA_def_property_ui_text(prop, "Position", "Marker position at frame in unified coordinates");
RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
/* frame */
prop= RNA_def_property(srna, "frame", PROP_INT, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* can't be safty edited for now, need to re-sort markers array after change */
RNA_def_property_int_sdna(prop, NULL, "framenr");
RNA_def_property_ui_text(prop, "Frame", "Frame number marker is keyframed on");
RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
}
static void rna_def_trackingTrack(BlenderRNA *brna)
@ -503,6 +512,56 @@ static void rna_def_trackingStabilization(BlenderRNA *brna)
RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
}
static void rna_def_reconstructedCamera(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
srna= RNA_def_struct(brna, "MovieReconstructedCamera", NULL);
RNA_def_struct_ui_text(srna, "Movie tracking reconstructed camera data", "Match-moving reconstructed camera data from tracker");
/* frame */
prop= RNA_def_property(srna, "frame", PROP_INT, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_int_sdna(prop, NULL, "framenr");
RNA_def_property_ui_text(prop, "Frame", "Frame number marker is keyframed on");
/* matrix */
prop= RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
RNA_def_property_float_sdna(prop, NULL, "mat");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
RNA_def_property_ui_text(prop, "Matrix", "Worldspace transformation matrix");
}
static void rna_def_trackingReconstruction(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
rna_def_reconstructedCamera(brna);
srna= RNA_def_struct(brna, "MovieTrackingReconstruction", NULL);
RNA_def_struct_ui_text(srna, "Movie tracking reconstruction data", "Match-moving reconstruction data from tracker");
/* is_reconstructed */
prop= RNA_def_property(srna, "is_reconstructed", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_RECONSTRUCTED);
RNA_def_property_ui_text(prop, "Reconstructed", "Is tracking data contsains valid reconstruction information");
/* average_error */
prop= RNA_def_property(srna, "average_error", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "error");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Average Error", "Average error of resonctruction");
/* cameras */
prop= RNA_def_property(srna, "cameras", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "MovieReconstructedCamera");
RNA_def_property_collection_sdna(prop, NULL, "cameras", "camnr");
RNA_def_property_ui_text(prop, "Cameras", "Collection of solved cameras");
}
static void rna_def_tracking(BlenderRNA *brna)
{
@ -513,6 +572,7 @@ static void rna_def_tracking(BlenderRNA *brna)
rna_def_trackingCamera(brna);
rna_def_trackingTrack(brna);
rna_def_trackingStabilization(brna);
rna_def_trackingReconstruction(brna);
srna= RNA_def_struct(brna, "MovieTracking", NULL);
RNA_def_struct_ui_text(srna, "Movie tracking data", "Match-moving data for tracking");
@ -537,9 +597,13 @@ static void rna_def_tracking(BlenderRNA *brna)
RNA_def_property_pointer_funcs(prop, "rna_tracking_active_track_get", NULL, NULL, NULL);
RNA_def_property_ui_text(prop, "Active Track", "Active track in this tracking data object");
/* stabilization*/
/* stabilization */
prop= RNA_def_property(srna, "stabilization", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "MovieTrackingStabilization");
/* reconstruction */
prop= RNA_def_property(srna, "reconstruction", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "MovieTrackingReconstruction");
}
void RNA_def_tracking(BlenderRNA *brna)