Added track weight to presets
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 19 Feb 2014 12:42:32 +0000 (18:42 +0600)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 19 Feb 2014 12:43:36 +0000 (18:43 +0600)
Useful for cases when you need to create bunch of witness tracks.

release/scripts/presets/tracking_settings/blurry_footage.py
release/scripts/presets/tracking_settings/default.py
release/scripts/presets/tracking_settings/fast_motion.py
release/scripts/presets/tracking_settings/planar.py
release/scripts/startup/bl_operators/presets.py
release/scripts/startup/bl_ui/space_clip.py
source/blender/blenkernel/intern/tracking.c
source/blender/blenloader/intern/versioning_260.c
source/blender/makesdna/DNA_tracking_types.h
source/blender/makesrna/intern/rna_tracking.c

index de6f085f53d9ed7f27a3887f9f4803614cc99db2..253a8f395ba8c44527425a50c342a3e0ff1f5a95 100644 (file)
@@ -15,3 +15,4 @@ settings.use_default_red_channel = True
 settings.use_default_green_channel = True
 settings.use_default_blue_channel = True
 settings.default_correlation_min = 0.6
+settings.default_weight = 1.0
index 3c61ea7cd7fc7a8411b87a799dc66f654671c5db..c25b1140249475e69cf0167e55a31d83def726db 100644 (file)
@@ -15,3 +15,4 @@ settings.use_default_red_channel = True
 settings.use_default_green_channel = True
 settings.use_default_blue_channel = True
 settings.default_correlation_min = 0.75
+settings.default_weight = 1.0
index 6051f235b0c95c6c4804248fc8e62bd3717edd89..4294b7327d14eca4d5b2b684e75c5d0662957b67 100644 (file)
@@ -15,3 +15,4 @@ settings.use_default_red_channel = True
 settings.use_default_green_channel = True
 settings.use_default_blue_channel = True
 settings.default_correlation_min = 0.6
+settings.default_weight = 1.0
index 49a6404600287b6ecac8b922cefe21697207986d..a099b3a800d55cfb5d4c1243ac7b6710a43999da 100644 (file)
@@ -15,3 +15,4 @@ settings.use_default_red_channel = True
 settings.use_default_green_channel = True
 settings.use_default_blue_channel = True
 settings.default_correlation_min = 0.75
+settings.default_weight = 1.0
index f1da0ff615d1267977387c154f32c3104aa4105a..8b0ed7d9942c1da9917dd95ee4d73ce672587be4 100644 (file)
@@ -476,6 +476,7 @@ class AddPresetTrackingSettings(AddPresetBase, Operator):
         "settings.use_default_red_channel",
         "settings.use_default_green_channel",
         "settings.use_default_blue_channel"
+        "settings.default_weight"
     ]
 
     preset_subdir = "tracking_settings"
index 55113e406a39026a7aa47bad51677716609b4c80..00c2f7ae9e5322cc608b4b991280aff31d5da190 100644 (file)
@@ -335,6 +335,9 @@ class CLIP_PT_tracking_settings(CLIP_PT_tracking_panel, Panel):
             sub.prop(settings, "default_frames_limit")
             sub.prop(settings, "default_margin")
 
+            col = box.column()
+            col.prop(settings, "default_weight")
+
 
 class CLIP_PT_tools_tracking(CLIP_PT_tracking_panel, Panel):
     bl_space_type = 'CLIP_EDITOR'
index de20f4a8ac6496ed81f821a62ce3a7928d476cc2..e72b3697efaf1654ffb5e271c0e245f621adb3bf 100644 (file)
@@ -200,6 +200,7 @@ void BKE_tracking_settings_init(MovieTracking *tracking)
        tracking->settings.default_pattern_size = 15;
        tracking->settings.default_search_size = 61;
        tracking->settings.default_algorithm_flag |= TRACK_ALGORITHM_FLAG_USE_BRUTE;
+       tracking->settings.default_weight = 1.0f;
        tracking->settings.dist = 1;
        tracking->settings.object_distance = 1;
 
@@ -418,7 +419,7 @@ MovieTrackingTrack *BKE_tracking_track_add(MovieTracking *tracking, ListBase *tr
        track->frames_limit = settings->default_frames_limit;
        track->flag = settings->default_flag;
        track->algorithm_flag = settings->default_algorithm_flag;
-       track->weight = 1.0f;
+       track->weight = settings->default_weight;
 
        memset(&marker, 0, sizeof(marker));
        marker.pos[0] = x;
index af6355d7009cafd8c29ade5861fa6275f678cbcd..2880fec698bd2188fe242b26d81d4dab0daaf7ad 100644 (file)
@@ -2719,4 +2719,11 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *main)
                        }
                }
        }
+
+       if (!DNA_struct_elem_find(fd->filesdna, "MovieTrackingSettings", "float", "default_weight")) {
+               MovieClip *clip;
+               for (clip = main->movieclip.first; clip; clip = clip->id.next) {
+                       clip->tracking.settings.default_weight = 1.0f;
+               }
+       }
 }
index 78faf5d8547ff5183452d8625d4828f459d2e98e..a5079cb6c6f1b0c2826a4a57a6883a4c36054f27 100644 (file)
@@ -210,6 +210,7 @@ typedef struct MovieTrackingSettings {
        short default_margin;               /* margin from frame boundaries */
        short default_pattern_match;        /* re-adjust every N frames */
        short default_flag;                 /* default flags like color channels used by default */
+       float default_weight;               /* default weight of the track */
 
        short motion_flag;      /* flags describes motion type */
 
@@ -222,7 +223,7 @@ typedef struct MovieTrackingSettings {
                                             * were moved to per-tracking object settings
                                             */
 
-       int reconstruction_flag, pad;
+       int reconstruction_flag;
 
        /* which camera intrinsics to refine. uses on the REFINE_* flags */
        short refine_camera_intrinsics, pad2;
index 8cb82643b873eaf2e5af36fec1b40a42e8348b6c..289556b58623ebaf4183c47ff6a1243ee21eba7b 100644 (file)
@@ -930,6 +930,10 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Use Blue Channel", "Use blue channel from footage for tracking");
        RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
 
+       prop = RNA_def_property(srna, "default_weight", PROP_FLOAT, PROP_FACTOR);
+       RNA_def_property_range(prop, 0.0f, 1.0f);
+       RNA_def_property_ui_text(prop, "Weight", "Influence of newly created track on a final solution");
+
        /* ** object tracking ** */
 
        /* object distance */