Blender V2.61 - r43446

rna_tracking.c

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * Contributor(s): Blender Foundation,
00019  *                 Sergey Sharybin
00020  *
00021  * ***** END GPL LICENSE BLOCK *****
00022  */
00023 
00029 #include <stdlib.h>
00030 #include <limits.h>
00031 
00032 #include "MEM_guardedalloc.h"
00033 
00034 #include "BLI_math.h"
00035 #include "BKE_movieclip.h"
00036 #include "BKE_tracking.h"
00037 
00038 #include "RNA_define.h"
00039 
00040 #include "rna_internal.h"
00041 
00042 #include "DNA_movieclip_types.h"
00043 #include "DNA_object_types.h"   /* SELECT */
00044 #include "DNA_scene_types.h"
00045 
00046 #include "WM_types.h"
00047 
00048 #ifdef RNA_RUNTIME
00049 
00050 #include "BKE_depsgraph.h"
00051 #include "BKE_node.h"
00052 
00053 #include "IMB_imbuf.h"
00054 
00055 #include "WM_api.h"
00056 
00057 static void rna_tracking_defaultSettings_levelsUpdate(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
00058 {
00059     MovieClip *clip= (MovieClip*)ptr->id.data;
00060     MovieTracking *tracking= &clip->tracking;
00061     MovieTrackingSettings *settings= &tracking->settings;
00062 
00063     if(settings->default_tracker==TRACKER_KLT) {
00064         int max_pyramid_level_factor= 1 << (settings->default_pyramid_levels - 1);
00065         float search_ratio= 2.3f * max_pyramid_level_factor;
00066 
00067         settings->default_search_size= settings->default_pattern_size*search_ratio;
00068     }
00069 }
00070 
00071 static void rna_tracking_defaultSettings_patternUpdate(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
00072 {
00073     MovieClip *clip= (MovieClip*)ptr->id.data;
00074     MovieTracking *tracking= &clip->tracking;
00075     MovieTrackingSettings *settings= &tracking->settings;
00076 
00077     if(settings->default_search_size<settings->default_pattern_size)
00078         settings->default_search_size= settings->default_pattern_size;
00079 }
00080 
00081 static void rna_tracking_defaultSettings_searchUpdate(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
00082 {
00083     MovieClip *clip= (MovieClip*)ptr->id.data;
00084     MovieTracking *tracking= &clip->tracking;
00085     MovieTrackingSettings *settings= &tracking->settings;
00086 
00087     if(settings->default_pattern_size>settings->default_search_size)
00088         settings->default_pattern_size= settings->default_search_size;
00089 }
00090 
00091 static void rna_trackingTracks_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
00092 {
00093     MovieClip *clip= (MovieClip*)ptr->id.data;
00094 
00095     rna_iterator_listbase_begin(iter, &clip->tracking.tracks, NULL);
00096 }
00097 
00098 static void rna_trackingObjects_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
00099 {
00100     MovieClip *clip= (MovieClip*)ptr->id.data;
00101 
00102     rna_iterator_listbase_begin(iter, &clip->tracking.objects, NULL);
00103 }
00104 
00105 static int rna_tracking_active_object_index_get(PointerRNA *ptr)
00106 {
00107     MovieClip *clip= (MovieClip*)ptr->id.data;
00108 
00109     return clip->tracking.objectnr;
00110 }
00111 
00112 static void rna_tracking_active_object_index_set(PointerRNA *ptr, int value)
00113 {
00114     MovieClip *clip= (MovieClip*)ptr->id.data;
00115 
00116     clip->tracking.objectnr= value;
00117 }
00118 
00119 static void rna_tracking_active_object_index_range(PointerRNA *ptr, int *min, int *max)
00120 {
00121     MovieClip *clip= (MovieClip*)ptr->id.data;
00122 
00123     *min= 0;
00124     *max= clip->tracking.tot_object-1;
00125     *max= MAX2(0, *max);
00126 }
00127 
00128 static PointerRNA rna_tracking_active_track_get(PointerRNA *ptr)
00129 {
00130     MovieClip *clip= (MovieClip*)ptr->id.data;
00131     MovieTrackingTrack *act_track= BKE_tracking_active_track(&clip->tracking);
00132 
00133     return rna_pointer_inherit_refine(ptr, &RNA_MovieTrackingTrack, act_track);
00134 }
00135 
00136 static void rna_tracking_active_track_set(PointerRNA *ptr, PointerRNA value)
00137 {
00138     MovieClip *clip= (MovieClip*)ptr->id.data;
00139     MovieTrackingTrack *track= (MovieTrackingTrack *)value.data;
00140     ListBase *tracksbase= BKE_tracking_get_tracks(&clip->tracking);
00141     int index= BLI_findindex(tracksbase, track);
00142 
00143     if(index>=0)
00144         clip->tracking.act_track= track;
00145     else
00146         clip->tracking.act_track= NULL;
00147 }
00148 
00149 void rna_trackingTrack_name_set(PointerRNA *ptr, const char *value)
00150 {
00151     MovieClip *clip= (MovieClip *)ptr->id.data;
00152     MovieTracking *tracking= &clip->tracking;
00153     MovieTrackingTrack *track= (MovieTrackingTrack *)ptr->data;
00154     ListBase *tracksbase= &tracking->tracks;
00155 
00156     BLI_strncpy(track->name, value, sizeof(track->name));
00157 
00158     /* TODO: it's a bit difficult to find list track came from knowing just
00159              movie clip ID and MovieTracking structure, so keep this naive
00160              search for a while */
00161     if(BLI_findindex(tracksbase, track) < 0) {
00162         MovieTrackingObject *object= tracking->objects.first;
00163 
00164         while(object) {
00165             if(BLI_findindex(&object->tracks, track)) {
00166                 tracksbase= &object->tracks;
00167                 break;
00168             }
00169 
00170             object= object->next;
00171         }
00172     }
00173 
00174     BKE_track_unique_name(tracksbase, track);
00175 }
00176 
00177 static int rna_trackingTrack_select_get(PointerRNA *ptr)
00178 {
00179     MovieTrackingTrack *track= (MovieTrackingTrack *)ptr->data;
00180 
00181     return TRACK_SELECTED(track);
00182 }
00183 
00184 static void rna_trackingTrack_select_set(PointerRNA *ptr, int value)
00185 {
00186     MovieTrackingTrack *track= (MovieTrackingTrack *)ptr->data;
00187 
00188     if(value) {
00189         track->flag|= SELECT;
00190         track->pat_flag|= SELECT;
00191         track->search_flag|= SELECT;
00192     }
00193     else {
00194         track->flag&= ~SELECT;
00195         track->pat_flag&= ~SELECT;
00196         track->search_flag&= ~SELECT;
00197     }
00198 }
00199 
00200 static void rna_tracking_trackerPattern_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
00201 {
00202     MovieTrackingTrack *track= (MovieTrackingTrack *)ptr->data;
00203 
00204     BKE_tracking_clamp_track(track, CLAMP_PAT_DIM);
00205 }
00206 
00207 static void rna_tracking_trackerSearch_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
00208 {
00209     MovieTrackingTrack *track= (MovieTrackingTrack *)ptr->data;
00210 
00211     BKE_tracking_clamp_track(track, CLAMP_SEARCH_DIM);
00212 }
00213 
00214 static void rna_tracking_trackerAlgorithm_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
00215 {
00216     MovieTrackingTrack *track= (MovieTrackingTrack *)ptr->data;
00217 
00218         if(track->tracker==TRACKER_KLT)
00219           BKE_tracking_clamp_track(track, CLAMP_PYRAMID_LEVELS);
00220         else
00221           BKE_tracking_clamp_track(track, CLAMP_SEARCH_DIM);
00222 }
00223 
00224 static void rna_tracking_trackerPyramid_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
00225 {
00226     MovieTrackingTrack *track= (MovieTrackingTrack *)ptr->data;
00227 
00228     BKE_tracking_clamp_track(track, CLAMP_PYRAMID_LEVELS);
00229 }
00230 
00231 static float rna_trackingCamera_focal_mm_get(PointerRNA *ptr)
00232 {
00233     MovieClip *clip= (MovieClip*)ptr->id.data;
00234     MovieTrackingCamera *camera= &clip->tracking.camera;
00235     float val= camera->focal;
00236 
00237     if(clip->lastsize[0])
00238         val= val*camera->sensor_width/(float)clip->lastsize[0];
00239 
00240     return val;
00241 }
00242 
00243 static void rna_trackingCamera_focal_mm_set(PointerRNA *ptr, float value)
00244 {
00245     MovieClip *clip= (MovieClip*)ptr->id.data;
00246     MovieTrackingCamera *camera= &clip->tracking.camera;
00247 
00248     if(clip->lastsize[0])
00249         value= clip->lastsize[0]*value/camera->sensor_width;
00250 
00251     if(value>=0.0001)
00252         camera->focal= value;
00253 }
00254 
00255 static int rna_track_2d_stabilization(CollectionPropertyIterator *UNUSED(iter), void *data)
00256 {
00257     MovieTrackingTrack *track= (MovieTrackingTrack*)data;
00258 
00259     if((track->flag&TRACK_USE_2D_STAB)==0)
00260         return 1;
00261 
00262     return 0;
00263 }
00264 
00265 static void rna_tracking_stabTracks_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
00266 {
00267     MovieClip *clip= (MovieClip*)ptr->id.data;
00268     rna_iterator_listbase_begin(iter, &clip->tracking.tracks, rna_track_2d_stabilization);
00269 }
00270 
00271 static int rna_tracking_stabTracks_active_index_get(PointerRNA *ptr)
00272 {
00273     MovieClip *clip= (MovieClip*)ptr->id.data;
00274     return clip->tracking.stabilization.act_track;
00275 }
00276 
00277 static void rna_tracking_stabTracks_active_index_set(PointerRNA *ptr, int value)
00278 {
00279     MovieClip *clip= (MovieClip*)ptr->id.data;
00280     clip->tracking.stabilization.act_track= value;
00281 }
00282 
00283 static void rna_tracking_stabTracks_active_index_range(PointerRNA *ptr, int *min, int *max)
00284 {
00285     MovieClip *clip= (MovieClip*)ptr->id.data;
00286 
00287     *min= 0;
00288     *max= clip->tracking.stabilization.tot_track-1;
00289     *max= MAX2(0, *max);
00290 }
00291 
00292 static void rna_tracking_flushUpdate(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
00293 {
00294     MovieClip *clip= (MovieClip*)ptr->id.data;
00295     MovieTrackingStabilization *stab= &clip->tracking.stabilization;
00296 
00297     stab->ok= 0;
00298 
00299     nodeUpdateID(scene->nodetree, &clip->id);
00300 
00301     WM_main_add_notifier(NC_SCENE|ND_NODES, NULL);
00302     DAG_id_tag_update(&clip->id, 0);
00303 }
00304 
00305 static void rna_trackingObject_tracks_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
00306 {
00307     MovieTrackingObject *object= (MovieTrackingObject* )ptr->data;
00308 
00309     if(object->flag&TRACKING_OBJECT_CAMERA) {
00310         MovieClip *clip= (MovieClip*)ptr->id.data;
00311 
00312         rna_iterator_listbase_begin(iter, &clip->tracking.tracks, NULL);
00313     }
00314     else {
00315         rna_iterator_listbase_begin(iter, &object->tracks, NULL);
00316     }
00317 }
00318 
00319 static PointerRNA rna_tracking_active_object_get(PointerRNA *ptr)
00320 {
00321     MovieClip *clip= (MovieClip*)ptr->id.data;
00322     MovieTrackingObject *object= BLI_findlink(&clip->tracking.objects, clip->tracking.objectnr);
00323 
00324     return rna_pointer_inherit_refine(ptr, &RNA_MovieTrackingObject, object);
00325 }
00326 
00327 static void rna_tracking_active_object_set(PointerRNA *ptr, PointerRNA value)
00328 {
00329     MovieClip *clip= (MovieClip*)ptr->id.data;
00330     MovieTrackingObject *object= (MovieTrackingObject *)value.data;
00331     int index= BLI_findindex(&clip->tracking.objects, object);
00332 
00333     if(index>=0) clip->tracking.objectnr= index;
00334     else clip->tracking.objectnr= 0;
00335 }
00336 
00337 void rna_trackingObject_name_set(PointerRNA *ptr, const char *value)
00338 {
00339     MovieClip *clip= (MovieClip *)ptr->id.data;
00340     MovieTrackingObject *object= (MovieTrackingObject *)ptr->data;
00341 
00342     BLI_strncpy(object->name, value, sizeof(object->name));
00343 
00344     BKE_tracking_object_unique_name(&clip->tracking, object);
00345 }
00346 
00347 static void rna_trackingObject_flushUpdate(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
00348 {
00349     MovieClip *clip= (MovieClip*)ptr->id.data;
00350 
00351     WM_main_add_notifier(NC_OBJECT|ND_TRANSFORM, NULL);
00352     DAG_id_tag_update(&clip->id, 0);
00353 }
00354 
00355 static void rna_trackingMarker_frame_set(PointerRNA *ptr, int value)
00356 {
00357     MovieClip *clip = (MovieClip *) ptr->id.data;
00358     MovieTracking *tracking = &clip->tracking;
00359     MovieTrackingTrack *track;
00360     MovieTrackingMarker *marker = (MovieTrackingMarker *) ptr->data;
00361 
00362     track = tracking->tracks.first;
00363     while (track) {
00364         if (marker >= track->markers && marker < track->markers+track->markersnr) {
00365             break;
00366         }
00367 
00368         track = track->next;
00369     }
00370 
00371     if (track) {
00372         MovieTrackingMarker new_marker = *marker;
00373         new_marker.framenr = value;
00374 
00375         BKE_tracking_delete_marker(track, marker->framenr);
00376         BKE_tracking_insert_marker(track, &new_marker);
00377     }
00378 }
00379 
00380 /* API */
00381 
00382 static void add_tracks_to_base(MovieClip *clip, MovieTracking *tracking, ListBase *tracksbase, int frame, int number)
00383 {
00384     int a, width, height;
00385     MovieClipUser user= {0};
00386 
00387     user.framenr= 1;
00388 
00389     BKE_movieclip_get_size(clip, &user, &width, &height);
00390 
00391     for(a= 0; a<number; a++)
00392         BKE_tracking_add_track(tracking, tracksbase, 0, 0, frame, width, height);
00393 }
00394 
00395 static void rna_trackingTracks_add(ID *id, MovieTracking *tracking, int frame, int number)
00396 {
00397     MovieClip *clip= (MovieClip *) id;
00398 
00399     add_tracks_to_base(clip, tracking, &tracking->tracks, frame, number);
00400 
00401     WM_main_add_notifier(NC_MOVIECLIP|NA_EDITED, clip);
00402 }
00403 
00404 static void rna_trackingObject_tracks_add(ID *id, MovieTrackingObject *object, int frame, int number)
00405 {
00406     MovieClip *clip= (MovieClip *) id;
00407     ListBase *tracksbase= &object->tracks;
00408 
00409     if(object->flag&TRACKING_OBJECT_CAMERA)
00410         tracksbase= &clip->tracking.tracks;
00411 
00412     add_tracks_to_base(clip, &clip->tracking, tracksbase, frame, number);
00413 
00414     WM_main_add_notifier(NC_MOVIECLIP|NA_EDITED, NULL);
00415 }
00416 
00417 static MovieTrackingObject *rna_trackingObject_new(MovieTracking *tracking, const char *name)
00418 {
00419     MovieTrackingObject *object= BKE_tracking_new_object(tracking, name);
00420 
00421     WM_main_add_notifier(NC_MOVIECLIP|NA_EDITED, NULL);
00422 
00423     return object;
00424 }
00425 
00426 void rna_trackingObject_remove(MovieTracking *tracking, MovieTrackingObject *object)
00427 {
00428     BKE_tracking_remove_object(tracking, object);
00429 
00430     WM_main_add_notifier(NC_MOVIECLIP|NA_EDITED, NULL);
00431 }
00432 
00433 static MovieTrackingMarker *rna_trackingMarkers_find_frame(MovieTrackingTrack *track, int framenr)
00434 {
00435     return BKE_tracking_exact_marker(track, framenr);
00436 }
00437 
00438 static MovieTrackingMarker* rna_trackingMarkers_insert_frame(MovieTrackingTrack *track, int framenr, float *co)
00439 {
00440     MovieTrackingMarker marker, *new_marker;
00441 
00442     memset(&marker, 0, sizeof(marker));
00443     marker.framenr = framenr;
00444     copy_v2_v2(marker.pos, co);
00445 
00446     new_marker = BKE_tracking_insert_marker(track, &marker);
00447 
00448     WM_main_add_notifier(NC_MOVIECLIP|NA_EDITED, NULL);
00449 
00450     return new_marker;
00451 }
00452 
00453 void rna_trackingMarkers_delete_frame(MovieTrackingTrack *track, int framenr)
00454 {
00455     if(track->markersnr==1)
00456         return;
00457 
00458     BKE_tracking_delete_marker(track, framenr);
00459 
00460     WM_main_add_notifier(NC_MOVIECLIP|NA_EDITED, NULL);
00461 }
00462 
00463 #else
00464 
00465 static EnumPropertyItem tracker_items[] = {
00466     {TRACKER_KLT, "KLT", 0, "KLT", "Kanade–Lucas–Tomasi tracker which works with most of video clips, a bit slower than SAD"},
00467     {TRACKER_SAD, "SAD", 0, "SAD", "Sum of Absolute Differences tracker which can be used when KLT tracker fails"},
00468     {TRACKER_HYBRID, "Hybrid", 0, "Hybrid", "A hybrid tracker that uses SAD for rough tracking, KLT for refinement."},
00469     {0, NULL, 0, NULL, NULL}};
00470 
00471 static EnumPropertyItem pattern_match_items[] = {
00472     {TRACK_MATCH_KEYFRAME, "KEYFRAME", 0, "Keyframe", "Track pattern from keyframe to next frame"},
00473     {TRACK_MATCH_PREVFRAME, "PREV_FRAME", 0, "Previous frame", "Track pattern from current frame to next frame"},
00474     {0, NULL, 0, NULL, NULL}};
00475 
00476 static int rna_matrix_dimsize_4x4[]= {4, 4};
00477 
00478 static void rna_def_trackingSettings(BlenderRNA *brna)
00479 {
00480     StructRNA *srna;
00481     PropertyRNA *prop;
00482 
00483     static EnumPropertyItem speed_items[] = {
00484         {0, "FASTEST", 0, "Fastest", "Track as fast as it's possible"},
00485         {TRACKING_SPEED_DOUBLE, "DOUBLE", 0, "Double", "Track with double speed"},
00486         {TRACKING_SPEED_REALTIME, "REALTIME", 0, "Realtime", "Track with realtime speed"},
00487         {TRACKING_SPEED_HALF, "HALF", 0, "Half", "Track with half of realtime speed"},
00488         {TRACKING_SPEED_QUARTER, "QUARTER", 0, "Quarter", "Track with quarter of realtime speed"},
00489         {0, NULL, 0, NULL, NULL}};
00490 
00491     static EnumPropertyItem cleanup_items[] = {
00492         {TRACKING_CLEAN_SELECT, "SELECT", 0, "Select", "Select unclean tracks"},
00493         {TRACKING_CLEAN_DELETE_TRACK, "DELETE_TRACK", 0, "Delete Track", "Delete unclean tracks"},
00494         {TRACKING_CLEAN_DELETE_SEGMENT, "DELETE_SEGMENTS", 0, "Delete Segments", "Delete unclean segments of tracks"},
00495         {0, NULL, 0, NULL, NULL}
00496     };
00497 
00498     static EnumPropertyItem refine_items[] = {
00499         {0, "NONE", 0, "Nothing", "Do not refine camera intrinsics"},
00500         {REFINE_FOCAL_LENGTH, "FOCAL_LENGTH", 0, "Focal Length", "Refine focal length"},
00501         {REFINE_FOCAL_LENGTH|REFINE_RADIAL_DISTORTION_K1, "FOCAL_LENGTH_RADIAL_K1", 0, "Focal length, K1", "Refine focal length and radial distortion K1"},
00502         {REFINE_FOCAL_LENGTH|
00503          REFINE_RADIAL_DISTORTION_K1|
00504          REFINE_RADIAL_DISTORTION_K2, "FOCAL_LENGTH_RADIAL_K1_K2", 0, "Focal length, K1, K2", "Refine focal length and radial distortion K1 and K2"},
00505         {REFINE_FOCAL_LENGTH|
00506          REFINE_PRINCIPAL_POINT|
00507          REFINE_RADIAL_DISTORTION_K1|
00508          REFINE_RADIAL_DISTORTION_K2,
00509          "FOCAL_LENGTH_PRINCIPAL_POINT_RADIAL_K1_K2", 0, "Focal Length, Optical Center, K1, K2", "Refine focal length, optical center and radial distortion K1 and K2"},
00510         {REFINE_FOCAL_LENGTH|
00511          REFINE_PRINCIPAL_POINT, "FOCAL_LENGTH_PRINCIPAL_POINT", 0, "Focal Length, Optical Center", "Refine focal length and optical center"},
00512         {0, NULL, 0, NULL, NULL}
00513     };
00514 
00515     srna= RNA_def_struct(brna, "MovieTrackingSettings", NULL);
00516     RNA_def_struct_ui_text(srna, "Movie tracking settings", "Match moving settings");
00517 
00518     /* speed */
00519     prop= RNA_def_property(srna, "speed", PROP_ENUM, PROP_NONE);
00520     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00521     RNA_def_property_enum_items(prop, speed_items);
00522     RNA_def_property_ui_text(prop, "Speed", "Limit speed of tracking to make visual feedback easier (this does not affect the tracking quality)");
00523 
00524     /* keyframe_a */
00525     prop= RNA_def_property(srna, "keyframe_a", PROP_INT, PROP_NONE);
00526     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00527     RNA_def_property_int_sdna(prop, NULL, "keyframe1");
00528     RNA_def_property_ui_text(prop, "Keyframe A", "First keyframe used for reconstruction initialization");
00529 
00530     /* keyframe_b */
00531     prop= RNA_def_property(srna, "keyframe_b", PROP_INT, PROP_NONE);
00532     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00533     RNA_def_property_int_sdna(prop, NULL, "keyframe2");
00534     RNA_def_property_ui_text(prop, "Keyframe B", "Second keyframe used for reconstruction initialization");
00535 
00536     /* intrinsics refinement during bundle adjustment */
00537     prop= RNA_def_property(srna, "refine_intrinsics", PROP_ENUM, PROP_NONE);
00538     RNA_def_property_enum_sdna(prop, NULL, "refine_camera_intrinsics");
00539     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00540     RNA_def_property_enum_items(prop, refine_items);
00541     RNA_def_property_ui_text(prop, "Refine", "Refine intrinsics during camera solving");
00542 
00543     /* tool settings */
00544 
00545     /* distance */
00546     prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
00547     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00548     RNA_def_property_float_sdna(prop, NULL, "dist");
00549     RNA_def_property_ui_text(prop, "Distance", "Distance between two bundles used for scene scaling");
00550 
00551     /* frames count */
00552     prop= RNA_def_property(srna, "clean_frames", PROP_INT, PROP_NONE);
00553     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00554     RNA_def_property_int_sdna(prop, NULL, "clean_frames");
00555     RNA_def_property_range(prop, 0, INT_MAX);
00556     RNA_def_property_ui_text(prop, "Tracked Frames", "Effect on tracks which are tracked less than the specified amount of frames");
00557 
00558     /* reprojection error */
00559     prop= RNA_def_property(srna, "clean_error", PROP_FLOAT, PROP_NONE);
00560     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00561     RNA_def_property_float_sdna(prop, NULL, "clean_error");
00562     RNA_def_property_range(prop, 0, FLT_MAX);
00563     RNA_def_property_ui_text(prop, "Reprojection Error", "Effect on tracks which have a larger reprojection error");
00564 
00565     /* cleanup action */
00566     prop= RNA_def_property(srna, "clean_action", PROP_ENUM, PROP_NONE);
00567     RNA_def_property_enum_sdna(prop, NULL, "clean_action");
00568     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00569     RNA_def_property_enum_items(prop, cleanup_items);
00570     RNA_def_property_ui_text(prop, "Action", "Cleanup action to execute");
00571 
00572     /* ** default tracker settings ** */
00573     prop= RNA_def_property(srna, "show_default_expanded", PROP_BOOLEAN, PROP_NONE);
00574     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00575     RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_SETTINGS_SHOW_DEFAULT_EXPANDED);
00576     RNA_def_property_ui_text(prop, "Show Expanded", "Show the expanded in the user interface");
00577     RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
00578 
00579     /* limit frames */
00580     prop= RNA_def_property(srna, "default_frames_limit", PROP_INT, PROP_NONE);
00581     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00582     RNA_def_property_int_sdna(prop, NULL, "default_frames_limit");
00583     RNA_def_property_range(prop, 0, SHRT_MAX);
00584     RNA_def_property_ui_text(prop, "Frames Limit", "Every tracking cycle, this number of frames are tracked");
00585 
00586     /* pattern match */
00587     prop= RNA_def_property(srna, "default_pattern_match", PROP_ENUM, PROP_NONE);
00588     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00589     RNA_def_property_enum_sdna(prop, NULL, "default_pattern_match");
00590     RNA_def_property_enum_items(prop, pattern_match_items);
00591     RNA_def_property_ui_text(prop, "Pattern Match", "Track pattern from given frame when tracking marker to next frame");
00592 
00593     /* margin */
00594     prop= RNA_def_property(srna, "default_margin", PROP_INT, PROP_NONE);
00595     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00596     RNA_def_property_int_sdna(prop, NULL, "default_margin");
00597     RNA_def_property_range(prop, 0, 300);
00598     RNA_def_property_ui_text(prop, "Margin", "Default distance from image boudary at which marker stops tracking");
00599 
00600     /* tracking algorithm */
00601     prop= RNA_def_property(srna, "default_tracker", PROP_ENUM, PROP_NONE);
00602     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00603     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00604     RNA_def_property_enum_items(prop, tracker_items);
00605     RNA_def_property_update(prop, 0, "rna_tracking_defaultSettings_levelsUpdate");
00606     RNA_def_property_ui_text(prop, "Tracker", "Default tracking algorithm to use");
00607 
00608     /* pyramid level for pyramid klt tracking */
00609     prop= RNA_def_property(srna, "default_pyramid_levels", PROP_INT, PROP_NONE);
00610     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00611     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00612     RNA_def_property_int_sdna(prop, NULL, "default_pyramid_levels");
00613     RNA_def_property_range(prop, 1, 16);
00614     RNA_def_property_update(prop, 0, "rna_tracking_defaultSettings_levelsUpdate");
00615     RNA_def_property_ui_text(prop, "Pyramid levels", "Default number of pyramid levels (increase on blurry footage)");
00616 
00617     /* minmal correlation - only used for SAD tracker */
00618     prop= RNA_def_property(srna, "default_correlation_min", PROP_FLOAT, PROP_NONE);
00619     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00620     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00621     RNA_def_property_float_sdna(prop, NULL, "default_minimum_correlation");
00622     RNA_def_property_range(prop, -1.0f, 1.0f);
00623     RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
00624     RNA_def_property_ui_text(prop, "Correlation", "Default minimal value of correlation between matched pattern and reference which is still treated as successful tracking");
00625 
00626     /* default pattern size */
00627     prop= RNA_def_property(srna, "default_pattern_size", PROP_INT, PROP_NONE);
00628     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00629     RNA_def_property_int_sdna(prop, NULL, "default_pattern_size");
00630     RNA_def_property_range(prop, 5, 1000);
00631     RNA_def_property_update(prop, 0, "rna_tracking_defaultSettings_patternUpdate");
00632     RNA_def_property_ui_text(prop, "Pattern Size", "Size of pattern area for newly created tracks");
00633 
00634     /* default search size */
00635     prop= RNA_def_property(srna, "default_search_size", PROP_INT, PROP_NONE);
00636     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00637     RNA_def_property_int_sdna(prop, NULL, "default_search_size");
00638     RNA_def_property_range(prop, 5, 1000);
00639     RNA_def_property_update(prop, 0, "rna_tracking_defaultSettings_searchUpdate");
00640     RNA_def_property_ui_text(prop, "Search Size", "Size of search area for newly created tracks");
00641 
00642     /* object distance */
00643     prop= RNA_def_property(srna, "object_distance", PROP_FLOAT, PROP_NONE);
00644     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00645     RNA_def_property_float_sdna(prop, NULL, "object_distance");
00646     RNA_def_property_ui_text(prop, "Distance", "Distance between two bundles used for object scaling");
00647     RNA_def_property_range(prop, 0.001, 10000);
00648     RNA_def_property_ui_range(prop, 0.001, 10000.0, 1, 3);
00649 }
00650 
00651 static void rna_def_trackingCamera(BlenderRNA *brna)
00652 {
00653     StructRNA *srna;
00654     PropertyRNA *prop;
00655 
00656     static EnumPropertyItem camera_units_items[] = {
00657         {CAMERA_UNITS_PX, "PIXELS", 0, "px", "Use pixels for units of focal length"},
00658         {CAMERA_UNITS_MM, "MILLIMETERS", 0, "mm", "Use millimeters for units of focal length"},
00659         {0, NULL, 0, NULL, NULL}};
00660 
00661     srna= RNA_def_struct(brna, "MovieTrackingCamera", NULL);
00662     RNA_def_struct_ui_text(srna, "Movie tracking camera data", "Match-moving camera data for tracking");
00663 
00664     /* Sensor */
00665     prop= RNA_def_property(srna, "sensor_width", PROP_FLOAT, PROP_NONE);
00666     RNA_def_property_float_sdna(prop, NULL, "sensor_width");
00667     RNA_def_property_range(prop, 0.0f, 500.0f);
00668     RNA_def_property_ui_text(prop, "Sensor", "Width of CCD sensor in millimeters");
00669     RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
00670 
00671     /* Focal Length */
00672     prop= RNA_def_property(srna, "focal_length", PROP_FLOAT, PROP_NONE);
00673     RNA_def_property_float_sdna(prop, NULL, "focal");
00674     RNA_def_property_range(prop, 0.0001f, 5000.0f);
00675     RNA_def_property_float_funcs(prop, "rna_trackingCamera_focal_mm_get", "rna_trackingCamera_focal_mm_set", NULL);
00676     RNA_def_property_ui_text(prop, "Focal Length", "Camera's focal length");
00677     RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
00678 
00679     /* Focal Length in pixels */
00680     prop= RNA_def_property(srna, "focal_length_pixels", PROP_FLOAT, PROP_NONE);
00681     RNA_def_property_float_sdna(prop, NULL, "focal");
00682     RNA_def_property_range(prop, 0.0f, 5000.0f);
00683     RNA_def_property_ui_text(prop, "Focal Length", "Camera's focal length");
00684     RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
00685 
00686     /* Units */
00687     prop= RNA_def_property(srna, "units", PROP_ENUM, PROP_NONE);
00688     RNA_def_property_enum_sdna(prop, NULL, "units");
00689     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00690     RNA_def_property_enum_items(prop, camera_units_items);
00691     RNA_def_property_ui_text(prop, "Units", "Units used for camera focal length");
00692 
00693     /* Principal Point */
00694     prop= RNA_def_property(srna, "principal", PROP_FLOAT, PROP_NONE);
00695     RNA_def_property_array(prop, 2);
00696     RNA_def_property_float_sdna(prop, NULL, "principal");
00697     RNA_def_property_ui_text(prop, "Principal Point", "Optical center of lens");
00698     RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
00699 
00700     /* Radial distortion parameters */
00701     prop= RNA_def_property(srna, "k1", PROP_FLOAT, PROP_NONE);
00702     RNA_def_property_float_sdna(prop, NULL, "k1");
00703     RNA_def_property_ui_range(prop, -10, 10, .1, 3);
00704     RNA_def_property_ui_text(prop, "K1", "First coefficient of third order polynomial radial distortion");
00705     RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_flushUpdate");
00706 
00707     prop= RNA_def_property(srna, "k2", PROP_FLOAT, PROP_NONE);
00708     RNA_def_property_float_sdna(prop, NULL, "k2");
00709     RNA_def_property_ui_range(prop, -10, 10, .1, 3);
00710     RNA_def_property_ui_text(prop, "K2", "Second coefficient of third order polynomial radial distortion");
00711     RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_flushUpdate");
00712 
00713     prop= RNA_def_property(srna, "k3", PROP_FLOAT, PROP_NONE);
00714     RNA_def_property_float_sdna(prop, NULL, "k3");
00715     RNA_def_property_ui_range(prop, -10, 10, .1, 3);
00716     RNA_def_property_ui_text(prop, "K3", "Third coefficient of third order polynomial radial distortion");
00717     RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_flushUpdate");
00718 
00719     /* pixel aspect */
00720     prop= RNA_def_property(srna, "pixel_aspect", PROP_FLOAT, PROP_XYZ);
00721     RNA_def_property_float_sdna(prop, NULL, "pixel_aspect");
00722     RNA_def_property_range(prop, 0.1f, 5000.0f);
00723     RNA_def_property_ui_range(prop, 0.1f, 5000.0f, 1, 2);
00724     RNA_def_property_ui_text(prop, "Pixel Aspect Ratio", "Pixel aspect ratio");
00725     RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
00726 }
00727 
00728 static void rna_def_trackingMarker(BlenderRNA *brna)
00729 {
00730     StructRNA *srna;
00731     PropertyRNA *prop;
00732 
00733     srna= RNA_def_struct(brna, "MovieTrackingMarker", NULL);
00734     RNA_def_struct_ui_text(srna, "Movie tracking marker data", "Match-moving marker data for tracking");
00735 
00736     /* position */
00737     prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
00738     RNA_def_property_array(prop, 2);
00739     RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 5);
00740     RNA_def_property_float_sdna(prop, NULL, "pos");
00741     RNA_def_property_ui_text(prop, "Position", "Marker position at frame in normalized coordinates");
00742     RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
00743 
00744     /* frame */
00745     prop= RNA_def_property(srna, "frame", PROP_INT, PROP_NONE);
00746     RNA_def_property_int_sdna(prop, NULL, "framenr");
00747     RNA_def_property_ui_text(prop, "Frame", "Frame number marker is keyframed on");
00748     RNA_def_property_int_funcs(prop, NULL, "rna_trackingMarker_frame_set", NULL);
00749     RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, 0);
00750 
00751     /* enable */
00752     prop= RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
00753     RNA_def_property_boolean_sdna(prop, NULL, "flag", MARKER_DISABLED);
00754     RNA_def_property_ui_text(prop, "Mode", "Is marker muted for current frame");
00755     RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
00756 }
00757 
00758 static void rna_def_trackingMarkers(BlenderRNA *brna, PropertyRNA *cprop)
00759 {
00760     StructRNA *srna;
00761     FunctionRNA *func;
00762     PropertyRNA *parm;
00763 
00764     RNA_def_property_srna(cprop, "MovieTrackingMarkers");
00765     srna= RNA_def_struct(brna, "MovieTrackingMarkers", NULL);
00766     RNA_def_struct_sdna(srna, "MovieTrackingTrack");
00767     RNA_def_struct_ui_text(srna, "Movie Tracking Markers", "Collection of markers for movie tracking track");
00768 
00769     func= RNA_def_function(srna, "find_frame", "rna_trackingMarkers_find_frame");
00770     RNA_def_function_ui_description(func, "Get marker for specified frame");
00771     parm= RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame",
00772              "Frame number to find marker for", MINFRAME, MAXFRAME);
00773     RNA_def_property_flag(parm, PROP_REQUIRED);
00774     parm= RNA_def_pointer(func, "marker", "MovieTrackingMarker", "", "Marker for specified frame");
00775     RNA_def_function_return(func, parm);
00776 
00777     func= RNA_def_function(srna, "insert_frame", "rna_trackingMarkers_insert_frame");
00778     RNA_def_function_ui_description(func, "Add a number of tracks to this movie clip");
00779     parm= RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame",
00780             "Frame number to insert marker to", MINFRAME, MAXFRAME);
00781     RNA_def_property_flag(parm, PROP_REQUIRED);
00782     RNA_def_float_vector(func, "co", 2, 0, -1.0, 1.0, "Coordinate",
00783             "Place new marker at the given frame using specified in normalized space coordinates", -1.0, 1.0);
00784     RNA_def_property_flag(parm, PROP_REQUIRED);
00785     parm= RNA_def_pointer(func, "marker", "MovieTrackingMarker", "", "Newly created marker");
00786     RNA_def_function_return(func, parm);
00787 
00788     func= RNA_def_function(srna, "delete_frame", "rna_trackingMarkers_delete_frame");
00789     RNA_def_function_ui_description(func, "Delete marker at specified frame");
00790     parm= RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame",
00791             "Frame number to delete marker from", MINFRAME, MAXFRAME);
00792     RNA_def_property_flag(parm, PROP_REQUIRED);
00793 }
00794 
00795 static void rna_def_trackingTrack(BlenderRNA *brna)
00796 {
00797     StructRNA *srna;
00798     PropertyRNA *prop;
00799 
00800     rna_def_trackingMarker(brna);
00801 
00802     srna= RNA_def_struct(brna, "MovieTrackingTrack", NULL);
00803     RNA_def_struct_ui_text(srna, "Movie tracking track data", "Match-moving track data for tracking");
00804     RNA_def_struct_ui_icon(srna, ICON_ANIM_DATA);
00805 
00806     /* name */
00807     prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
00808     RNA_def_property_ui_text(prop, "Name", "Unique name of track");
00809     RNA_def_property_string_funcs(prop, NULL, NULL, "rna_trackingTrack_name_set");
00810     RNA_def_property_string_maxlength(prop, MAX_ID_NAME-2);
00811     RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
00812     RNA_def_struct_name_property(srna, prop);
00813 
00814     /* Pattern */
00815     prop= RNA_def_property(srna, "pattern_min", PROP_FLOAT, PROP_TRANSLATION);
00816     RNA_def_property_array(prop, 2);
00817     RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 5);
00818     RNA_def_property_float_sdna(prop, NULL, "pat_min");
00819     RNA_def_property_ui_text(prop, "Pattern Min", "Left-bottom corner of pattern area in normalized coordinates relative to marker position");
00820     RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerPattern_update");
00821 
00822     prop= RNA_def_property(srna, "pattern_max", PROP_FLOAT, PROP_TRANSLATION);
00823     RNA_def_property_array(prop, 2);
00824     RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 5);
00825     RNA_def_property_float_sdna(prop, NULL, "pat_max");
00826     RNA_def_property_ui_text(prop, "Pattern Max", "Right-bottom corner of pattern area in normalized coordinates relative to marker position");
00827     RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerPattern_update");
00828 
00829     /* Search */
00830     prop= RNA_def_property(srna, "search_min", PROP_FLOAT, PROP_TRANSLATION);
00831     RNA_def_property_array(prop, 2);
00832     RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 5);
00833     RNA_def_property_float_sdna(prop, NULL, "search_min");
00834     RNA_def_property_ui_text(prop, "Search Min", "Left-bottom corner of search area in normalized coordinates relative to marker position");
00835     RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerSearch_update");
00836 
00837     prop= RNA_def_property(srna, "search_max", PROP_FLOAT, PROP_TRANSLATION);
00838     RNA_def_property_array(prop, 2);
00839     RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 5);
00840     RNA_def_property_float_sdna(prop, NULL, "search_max");
00841     RNA_def_property_ui_text(prop, "Search Max", "Right-bottom corner of search area in normalized coordinates relative to marker position");
00842     RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerSearch_update");
00843 
00844     /* limit frames */
00845     prop= RNA_def_property(srna, "frames_limit", PROP_INT, PROP_NONE);
00846     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00847     RNA_def_property_int_sdna(prop, NULL, "frames_limit");
00848     RNA_def_property_range(prop, 0, SHRT_MAX);
00849     RNA_def_property_ui_text(prop, "Frames Limit", "Every tracking cycle, this number of frames are tracked");
00850 
00851     /* pattern match */
00852     prop= RNA_def_property(srna, "pattern_match", PROP_ENUM, PROP_NONE);
00853     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00854     RNA_def_property_enum_sdna(prop, NULL, "pattern_match");
00855     RNA_def_property_enum_items(prop, pattern_match_items);
00856     RNA_def_property_ui_text(prop, "Pattern Match", "Track pattern from given frame when tracking marker to next frame");
00857 
00858     /* margin */
00859     prop= RNA_def_property(srna, "margin", PROP_INT, PROP_NONE);
00860     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00861     RNA_def_property_int_sdna(prop, NULL, "margin");
00862     RNA_def_property_range(prop, 0, 300);
00863     RNA_def_property_ui_text(prop, "Margin", "Distance from image boudary at which marker stops tracking");
00864 
00865     /* tracking algorithm */
00866     prop= RNA_def_property(srna, "tracker", PROP_ENUM, PROP_NONE);
00867     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00868     RNA_def_property_enum_items(prop, tracker_items);
00869     RNA_def_property_ui_text(prop, "Tracker", "Tracking algorithm to use");
00870     RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerAlgorithm_update");
00871 
00872     /* pyramid level for pyramid klt tracking */
00873     prop= RNA_def_property(srna, "pyramid_levels", PROP_INT, PROP_NONE);
00874     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00875     RNA_def_property_int_sdna(prop, NULL, "pyramid_levels");
00876     RNA_def_property_range(prop, 1, 16);
00877     RNA_def_property_ui_text(prop, "Pyramid levels", "Number of pyramid levels (increase on blurry footage)");
00878     RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerPyramid_update");
00879 
00880     /* minmal correlation - only used for SAD tracker */
00881     prop= RNA_def_property(srna, "correlation_min", PROP_FLOAT, PROP_NONE);
00882     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00883     RNA_def_property_float_sdna(prop, NULL, "minimum_correlation");
00884     RNA_def_property_range(prop, -1.0f, 1.0f);
00885     RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
00886     RNA_def_property_ui_text(prop, "Correlation", "Minimal value of correlation between matched pattern and reference which is still treated as successful tracking");
00887 
00888     /* markers */
00889     prop= RNA_def_property(srna, "markers", PROP_COLLECTION, PROP_NONE);
00890     RNA_def_property_struct_type(prop, "MovieTrackingMarker");
00891     RNA_def_property_collection_sdna(prop, NULL, "markers", "markersnr");
00892     RNA_def_property_ui_text(prop, "Markers", "Collection of markers in track");
00893     rna_def_trackingMarkers(brna, prop);
00894 
00895     /* ** channels ** */
00896 
00897     /* use_red_channel */
00898     prop= RNA_def_property(srna, "use_red_channel", PROP_BOOLEAN, PROP_NONE);
00899     RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", TRACK_DISABLE_RED);
00900     RNA_def_property_ui_text(prop, "Use Red Channel", "Use red channel from footage for tracking");
00901     RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
00902 
00903     /* use_green_channel */
00904     prop= RNA_def_property(srna, "use_green_channel", PROP_BOOLEAN, PROP_NONE);
00905     RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", TRACK_DISABLE_GREEN);
00906     RNA_def_property_ui_text(prop, "Use Green Channel", "Use green channel from footage for tracking");
00907     RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
00908 
00909     /* use_blue_channel */
00910     prop= RNA_def_property(srna, "use_blue_channel", PROP_BOOLEAN, PROP_NONE);
00911     RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", TRACK_DISABLE_BLUE);
00912     RNA_def_property_ui_text(prop, "Use Blue Channel", "Use blue channel from footage for tracking");
00913     RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
00914 
00915     /* preview_grayscale */
00916     prop= RNA_def_property(srna, "use_grayscale_preview", PROP_BOOLEAN, PROP_NONE);
00917     RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_PREVIEW_GRAYSCALE);
00918     RNA_def_property_ui_text(prop, "Grayscale", "Display what the tracking algorithm sees in the preview");
00919     RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
00920 
00921     /* has bundle */
00922     prop= RNA_def_property(srna, "has_bundle", PROP_BOOLEAN, PROP_NONE);
00923     RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_HAS_BUNDLE);
00924     RNA_def_property_clear_flag(prop, PROP_EDITABLE);
00925     RNA_def_property_ui_text(prop, "Has Bundle", "True if track has a valid bundle");
00926 
00927     /* bundle position */
00928     prop= RNA_def_property(srna, "bundle", PROP_FLOAT, PROP_TRANSLATION);
00929     RNA_def_property_array(prop, 3);
00930     RNA_def_property_float_sdna(prop, NULL, "bundle_pos");
00931     RNA_def_property_clear_flag(prop, PROP_EDITABLE);
00932     RNA_def_property_ui_text(prop, "Bundle", "Position of bundle reconstructed from this track");
00933 
00934     /* hide */
00935     prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
00936     RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_HIDDEN);
00937     RNA_def_property_ui_text(prop, "Hide", "Track is hidden");
00938     RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
00939 
00940     /* select */
00941     prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
00942     RNA_def_property_boolean_funcs(prop, "rna_trackingTrack_select_get", "rna_trackingTrack_select_set");
00943     RNA_def_property_ui_text(prop, "Select", "Track is selected");
00944     RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
00945 
00946     /* select_anchor */
00947     prop= RNA_def_property(srna, "select_anchor", PROP_BOOLEAN, PROP_NONE);
00948     RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
00949     RNA_def_property_ui_text(prop, "Select Anchor", "Track's anchor point is selected");
00950     RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
00951 
00952     /* select_pattern */
00953     prop= RNA_def_property(srna, "select_pattern", PROP_BOOLEAN, PROP_NONE);
00954     RNA_def_property_boolean_sdna(prop, NULL, "pat_flag", SELECT);
00955     RNA_def_property_ui_text(prop, "Select Pattern", "Track's pattern area is selected");
00956     RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
00957 
00958     /* select_search */
00959     prop= RNA_def_property(srna, "select_search", PROP_BOOLEAN, PROP_NONE);
00960     RNA_def_property_boolean_sdna(prop, NULL, "search_flag", SELECT);
00961     RNA_def_property_ui_text(prop, "Select Search", "Track's search area is selected");
00962     RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
00963 
00964     /* locked */
00965     prop= RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
00966     RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_LOCKED);
00967     RNA_def_property_ui_text(prop, "Lock", "Track is locked and all changes to it are disabled");
00968     RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
00969 
00970     /* custom color */
00971     prop= RNA_def_property(srna, "use_custom_color", PROP_BOOLEAN, PROP_NONE);
00972     RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_CUSTOMCOLOR);
00973     RNA_def_property_ui_text(prop, "Custom Color", "Use custom color instead of theme-defined");
00974     RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
00975 
00976     /* color */
00977     prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
00978     RNA_def_property_array(prop, 3);
00979     RNA_def_property_range(prop, 0.0f, 1.0f);
00980     RNA_def_property_ui_text(prop, "Color", "Color of the track in the Movie Track Editor and the 3D viewport after a solve");
00981     RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
00982 
00983     /* average error */
00984     prop= RNA_def_property(srna, "average_error", PROP_FLOAT, PROP_NONE);
00985     RNA_def_property_float_sdna(prop, NULL, "error");
00986     RNA_def_property_clear_flag(prop, PROP_EDITABLE);
00987     RNA_def_property_ui_text(prop, "Average Error", "Average error of re-projection");
00988 }
00989 
00990 static void rna_def_trackingStabilization(BlenderRNA *brna)
00991 {
00992     StructRNA *srna;
00993     PropertyRNA *prop;
00994 
00995     srna= RNA_def_struct(brna, "MovieTrackingStabilization", NULL);
00996     RNA_def_struct_ui_text(srna, "Movie tracking stabilization data", "Match-moving stabilization data for tracking");
00997 
00998     /* 2d stabilization */
00999     prop= RNA_def_property(srna, "use_2d_stabilization", PROP_BOOLEAN, PROP_NONE);
01000     RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_2D_STABILIZATION);
01001     RNA_def_property_ui_text(prop, "Use 2D stabilization", "Use 2D stabilization for footage");
01002     RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
01003 
01004     /* tracks */
01005     prop= RNA_def_property(srna, "tracks", PROP_COLLECTION, PROP_NONE);
01006     RNA_def_property_collection_funcs(prop, "rna_tracking_stabTracks_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0);
01007     RNA_def_property_struct_type(prop, "MovieTrackingTrack");
01008     RNA_def_property_ui_text(prop, "Tracks", "Collection of tracks used for stabilization");
01009     RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
01010 
01011     /* rotation track */
01012     prop= RNA_def_property(srna, "rotation_track", PROP_POINTER, PROP_NONE);
01013     RNA_def_property_pointer_sdna(prop, NULL, "rot_track");
01014     RNA_def_property_flag(prop, PROP_EDITABLE);
01015     RNA_def_property_ui_text(prop, "Rotation Track", "Track used to compensate rotation");
01016     RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_flushUpdate");
01017 
01018     /* active track index */
01019     prop= RNA_def_property(srna, "active_track_index", PROP_INT, PROP_NONE);
01020     RNA_def_property_int_sdna(prop, NULL, "act_track");
01021     RNA_def_property_int_funcs(prop, "rna_tracking_stabTracks_active_index_get", "rna_tracking_stabTracks_active_index_set", "rna_tracking_stabTracks_active_index_range");
01022     RNA_def_property_ui_text(prop, "Active Track Index", "Index of active track in stabilization tracks list");
01023 
01024     /* autoscale */
01025     prop= RNA_def_property(srna, "use_autoscale", PROP_BOOLEAN, PROP_NONE);
01026     RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_AUTOSCALE);
01027     RNA_def_property_ui_text(prop, "Autoscale", "Automatically scale footage to cover unfilled areas when stabilizating");
01028     RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
01029 
01030     /* max scale */
01031     prop= RNA_def_property(srna, "scale_max", PROP_FLOAT, PROP_FACTOR);
01032     RNA_def_property_float_sdna(prop, NULL, "maxscale");
01033     RNA_def_property_range(prop, 0.0f, 10.0f);
01034     RNA_def_property_ui_text(prop, "Maximal Scale", "Limit the amount of automatic scaling");
01035     RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
01036 
01037     /* influence_location */
01038     prop= RNA_def_property(srna, "influence_location", PROP_FLOAT, PROP_FACTOR);
01039     RNA_def_property_float_sdna(prop, NULL, "locinf");
01040     RNA_def_property_range(prop, 0.0f, 1.0f);
01041     RNA_def_property_ui_text(prop, "Location Influence", "Influence of stabilization algorithm on footage location");
01042     RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
01043 
01044     /* influence_scale */
01045     prop= RNA_def_property(srna, "influence_scale", PROP_FLOAT, PROP_FACTOR);
01046     RNA_def_property_float_sdna(prop, NULL, "scaleinf");
01047     RNA_def_property_range(prop, 0.0f, 1.0f);
01048     RNA_def_property_ui_text(prop, "Scale Influence", "Influence of stabilization algorithm on footage scale");
01049     RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
01050 
01051     /* use_stabilize_rotation */
01052     prop= RNA_def_property(srna, "use_stabilize_rotation", PROP_BOOLEAN, PROP_NONE);
01053     RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_STABILIZE_ROTATION);
01054     RNA_def_property_ui_text(prop, "Stabilize Rotation", "Stabilize horizon line on the shot");
01055     RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
01056 
01057     /* influence_rotation */
01058     prop= RNA_def_property(srna, "influence_rotation", PROP_FLOAT, PROP_FACTOR);
01059     RNA_def_property_float_sdna(prop, NULL, "rotinf");
01060     RNA_def_property_range(prop, 0.0f, 1.0f);
01061     RNA_def_property_ui_text(prop, "Rotation Influence", "Influence of stabilization algorithm on footage rotation");
01062     RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
01063 }
01064 
01065 static void rna_def_reconstructedCamera(BlenderRNA *brna)
01066 {
01067     StructRNA *srna;
01068     PropertyRNA *prop;
01069 
01070     srna= RNA_def_struct(brna, "MovieReconstructedCamera", NULL);
01071     RNA_def_struct_ui_text(srna, "Movie tracking reconstructed camera data", "Match-moving reconstructed camera data from tracker");
01072 
01073     /* frame */
01074     prop= RNA_def_property(srna, "frame", PROP_INT, PROP_NONE);
01075     RNA_def_property_clear_flag(prop, PROP_EDITABLE);
01076     RNA_def_property_int_sdna(prop, NULL, "framenr");
01077     RNA_def_property_ui_text(prop, "Frame", "Frame number marker is keyframed on");
01078 
01079     /* matrix */
01080     prop= RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
01081     RNA_def_property_float_sdna(prop, NULL, "mat");
01082     RNA_def_property_clear_flag(prop, PROP_EDITABLE);
01083     RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
01084     RNA_def_property_ui_text(prop, "Matrix", "Worldspace transformation matrix");
01085 
01086     /* average_error */
01087     prop= RNA_def_property(srna, "average_error", PROP_FLOAT, PROP_NONE);
01088     RNA_def_property_float_sdna(prop, NULL, "error");
01089     RNA_def_property_clear_flag(prop, PROP_EDITABLE);
01090     RNA_def_property_ui_text(prop, "Average Error", "Average error of resonctruction");
01091 }
01092 
01093 static void rna_def_trackingReconstruction(BlenderRNA *brna)
01094 {
01095     StructRNA *srna;
01096     PropertyRNA *prop;
01097 
01098     rna_def_reconstructedCamera(brna);
01099 
01100     srna= RNA_def_struct(brna, "MovieTrackingReconstruction", NULL);
01101     RNA_def_struct_ui_text(srna, "Movie tracking reconstruction data", "Match-moving reconstruction data from tracker");
01102 
01103     /* is_valid */
01104     prop= RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
01105     RNA_def_property_clear_flag(prop, PROP_EDITABLE);
01106     RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_RECONSTRUCTED);
01107     RNA_def_property_ui_text(prop, "Reconstructed", "Is tracking data contains valid reconstruction information");
01108 
01109     /* average_error */
01110     prop= RNA_def_property(srna, "average_error", PROP_FLOAT, PROP_NONE);
01111     RNA_def_property_float_sdna(prop, NULL, "error");
01112     RNA_def_property_clear_flag(prop, PROP_EDITABLE);
01113     RNA_def_property_ui_text(prop, "Average Error", "Average error of resonctruction");
01114 
01115     /* cameras */
01116     prop= RNA_def_property(srna, "cameras", PROP_COLLECTION, PROP_NONE);
01117     RNA_def_property_struct_type(prop, "MovieReconstructedCamera");
01118     RNA_def_property_collection_sdna(prop, NULL, "cameras", "camnr");
01119     RNA_def_property_ui_text(prop, "Cameras", "Collection of solved cameras");
01120 }
01121 
01122 static void rna_def_trackingTracks(BlenderRNA *brna)
01123 {
01124     StructRNA *srna;
01125     FunctionRNA *func;
01126     PropertyRNA *prop;
01127 
01128     srna= RNA_def_struct(brna, "MovieTrackingTracks", NULL);
01129     RNA_def_struct_sdna(srna, "MovieTracking");
01130     RNA_def_struct_ui_text(srna, "Movie Tracks", "Collection of movie tracking tracks");
01131 
01132     func= RNA_def_function(srna, "add", "rna_trackingTracks_add");
01133     RNA_def_function_flag(func, FUNC_USE_SELF_ID);
01134     RNA_def_function_ui_description(func, "Add a number of tracks to this movie clip");
01135     RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame", "Frame number to add tracks on", MINFRAME, MAXFRAME);
01136     RNA_def_int(func, "count", 1, 0, INT_MAX, "Number", "Number of tracks to add to the movie clip", 0, INT_MAX);
01137 
01138     /* active track */
01139     prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
01140     RNA_def_property_struct_type(prop, "MovieTrackingTrack");
01141     RNA_def_property_pointer_funcs(prop, "rna_tracking_active_track_get", "rna_tracking_active_track_set", NULL, NULL);
01142     RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_UNLINK);
01143     RNA_def_property_ui_text(prop, "Active Track", "Active track in this tracking data object");
01144 }
01145 
01146 static void rna_def_trackingObjectTracks(BlenderRNA *brna)
01147 {
01148     StructRNA *srna;
01149     FunctionRNA *func;
01150     PropertyRNA *prop;
01151 
01152     srna= RNA_def_struct(brna, "MovieTrackingObjectTracks", NULL);
01153     RNA_def_struct_sdna(srna, "MovieTrackingObject");
01154     RNA_def_struct_ui_text(srna, "Movie Tracks", "Collection of movie tracking tracks");
01155 
01156     func= RNA_def_function(srna, "add", "rna_trackingObject_tracks_add");
01157     RNA_def_function_flag(func, FUNC_USE_SELF_ID);
01158     RNA_def_function_ui_description(func, "Add a number of tracks to this movie clip");
01159     RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame", "Frame number to add tracks on", MINFRAME, MAXFRAME);
01160     RNA_def_int(func, "count", 1, 0, INT_MAX, "Number", "Number of tracks to add to the movie clip", 0, INT_MAX);
01161 
01162     /* active track */
01163     prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
01164     RNA_def_property_struct_type(prop, "MovieTrackingTrack");
01165     RNA_def_property_pointer_funcs(prop, "rna_tracking_active_track_get", "rna_tracking_active_track_set", NULL, NULL);
01166     RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_UNLINK);
01167     RNA_def_property_ui_text(prop, "Active Track", "Active track in this tracking data object");
01168 }
01169 
01170 static void rna_def_trackingObject(BlenderRNA *brna)
01171 {
01172     StructRNA *srna;
01173     PropertyRNA *prop;
01174 
01175     srna= RNA_def_struct(brna, "MovieTrackingObject", NULL);
01176     RNA_def_struct_ui_text(srna, "Movie tracking object data", "Match-moving object tracking and reconstruction data");
01177 
01178     /* name */
01179     prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
01180     RNA_def_property_ui_text(prop, "Name", "Unique name of object");
01181     RNA_def_property_string_funcs(prop, NULL, NULL, "rna_trackingObject_name_set");
01182     RNA_def_property_string_maxlength(prop, MAX_ID_NAME-2);
01183     RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
01184     RNA_def_struct_name_property(srna, prop);
01185 
01186     /* is_camera */
01187     prop= RNA_def_property(srna, "is_camera", PROP_BOOLEAN, PROP_NONE);
01188     RNA_def_property_clear_flag(prop, PROP_EDITABLE);
01189     RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_OBJECT_CAMERA);
01190     RNA_def_property_ui_text(prop, "Camera", "Object is used for camera tracking");
01191     RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
01192 
01193     /* tracks */
01194     prop= RNA_def_property(srna, "tracks", PROP_COLLECTION, PROP_NONE);
01195     RNA_def_property_collection_funcs(prop, "rna_trackingObject_tracks_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0);
01196     RNA_def_property_struct_type(prop, "MovieTrackingTrack");
01197     RNA_def_property_ui_text(prop, "Tracks", "Collection of tracks in this tracking data object");
01198     RNA_def_property_srna(prop, "MovieTrackingObjectTracks");
01199 
01200     /* reconstruction */
01201     prop= RNA_def_property(srna, "reconstruction", PROP_POINTER, PROP_NONE);
01202     RNA_def_property_struct_type(prop, "MovieTrackingReconstruction");
01203 
01204     /* scale */
01205     prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
01206     RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
01207     RNA_def_property_float_sdna(prop, NULL, "scale");
01208     RNA_def_property_range(prop, 0.0001f, 10000.0f);
01209     RNA_def_property_ui_range(prop, 0.0001f, 10000.0, 1, 4);
01210     RNA_def_property_ui_text(prop, "Scale", "Scale of object solution in camera space");
01211     RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_trackingObject_flushUpdate");
01212 }
01213 
01214 static void rna_def_trackingObjects(BlenderRNA *brna, PropertyRNA *cprop)
01215 {
01216     StructRNA *srna;
01217     PropertyRNA *prop;
01218 
01219     FunctionRNA *func;
01220     PropertyRNA *parm;
01221 
01222     RNA_def_property_srna(cprop, "MovieTrackingObjects");
01223     srna= RNA_def_struct(brna, "MovieTrackingObjects", NULL);
01224     RNA_def_struct_sdna(srna, "MovieTracking");
01225     RNA_def_struct_ui_text(srna, "Movie Objects", "Collection of movie trackingobjects");
01226 
01227     func= RNA_def_function(srna, "new", "rna_trackingObject_new");
01228     RNA_def_function_ui_description(func, "Add tracking object to this movie clip");
01229     RNA_def_string(func, "name", "", 0, "", "Name of new object");
01230     parm= RNA_def_pointer(func, "object", "MovieTrackingObject", "", "New motion tracking object");
01231     RNA_def_function_return(func, parm);
01232 
01233     func= RNA_def_function(srna, "remove", "rna_trackingObject_remove");
01234     RNA_def_function_ui_description(func, "Remove tracking object from this movie clip");
01235     parm= RNA_def_pointer(func, "object", "MovieTrackingObject", "", "Motion tracking object to be removed");
01236 
01237     /* active object */
01238     prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
01239     RNA_def_property_struct_type(prop, "MovieTrackingObject");
01240     RNA_def_property_pointer_funcs(prop, "rna_tracking_active_object_get", "rna_tracking_active_object_set", NULL, NULL);
01241     RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_UNLINK);
01242     RNA_def_property_ui_text(prop, "Active Object", "Active object in this tracking data object");
01243 }
01244 
01245 static void rna_def_tracking(BlenderRNA *brna)
01246 {
01247     StructRNA *srna;
01248     PropertyRNA *prop;
01249 
01250     rna_def_trackingSettings(brna);
01251     rna_def_trackingCamera(brna);
01252     rna_def_trackingTrack(brna);
01253     rna_def_trackingTracks(brna);
01254     rna_def_trackingObjectTracks(brna);
01255     rna_def_trackingStabilization(brna);
01256     rna_def_trackingReconstruction(brna);
01257     rna_def_trackingObject(brna);
01258 
01259     srna= RNA_def_struct(brna, "MovieTracking", NULL);
01260     RNA_def_struct_ui_text(srna, "Movie tracking data", "Match-moving data for tracking");
01261 
01262     /* settings */
01263     prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
01264     RNA_def_property_struct_type(prop, "MovieTrackingSettings");
01265 
01266     /* camera properties */
01267     prop= RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
01268     RNA_def_property_struct_type(prop, "MovieTrackingCamera");
01269 
01270     /* tracks */
01271     prop= RNA_def_property(srna, "tracks", PROP_COLLECTION, PROP_NONE);
01272     RNA_def_property_collection_funcs(prop, "rna_trackingTracks_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0);
01273     RNA_def_property_struct_type(prop, "MovieTrackingTrack");
01274     RNA_def_property_ui_text(prop, "Tracks", "Collection of tracks in this tracking data object");
01275     RNA_def_property_srna(prop, "MovieTrackingTracks");
01276 
01277     /* stabilization */
01278     prop= RNA_def_property(srna, "stabilization", PROP_POINTER, PROP_NONE);
01279     RNA_def_property_struct_type(prop, "MovieTrackingStabilization");
01280 
01281     /* reconstruction */
01282     prop= RNA_def_property(srna, "reconstruction", PROP_POINTER, PROP_NONE);
01283     RNA_def_property_struct_type(prop, "MovieTrackingReconstruction");
01284 
01285     /* objects */
01286     prop= RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
01287     RNA_def_property_collection_funcs(prop, "rna_trackingObjects_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0);
01288     RNA_def_property_struct_type(prop, "MovieTrackingObject");
01289     RNA_def_property_ui_text(prop, "Objects", "Collection of objects in this tracking data object");
01290     rna_def_trackingObjects(brna, prop);
01291 
01292     /* active object index */
01293     prop= RNA_def_property(srna, "active_object_index", PROP_INT, PROP_NONE);
01294     RNA_def_property_int_sdna(prop, NULL, "objectnr");
01295     RNA_def_property_int_funcs(prop, "rna_tracking_active_object_index_get", "rna_tracking_active_object_index_set", "rna_tracking_active_object_index_range");
01296     RNA_def_property_ui_text(prop, "Active Object Index", "Index of active object");
01297     RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
01298 }
01299 
01300 void RNA_def_tracking(BlenderRNA *brna)
01301 {
01302     rna_def_tracking(brna);
01303 }
01304 
01305 #endif