Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-11-28 21:09:13 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-11-28 21:09:13 +0400
commit063dd4f60aa0fb0a93e1fb8e450ab83b98b8df83 (patch)
treede946c0d42157b01fcdea59517972d0475ae651d
parent173b956ea2df41b0f78f4ea670fca1aa115653e1 (diff)
parentc126bfba82dd434e2478d0ce4e5cf095f98b0c9a (diff)
svn merge ^/trunk/blender -r42197:42221
-rw-r--r--extern/libmv/CMakeLists.txt2
-rw-r--r--extern/libmv/libmv-capi.cpp44
-rw-r--r--extern/libmv/libmv-capi.h6
-rw-r--r--extern/libmv/libmv/simple_pipeline/callbacks.cc29
-rw-r--r--extern/libmv/libmv/simple_pipeline/callbacks.h33
-rw-r--r--extern/libmv/libmv/simple_pipeline/pipeline.cc46
-rw-r--r--extern/libmv/libmv/simple_pipeline/pipeline.h4
-rw-r--r--release/scripts/presets/tracking_settings/blurry_movie.py11
-rw-r--r--release/scripts/presets/tracking_settings/default.py11
-rw-r--r--release/scripts/presets/tracking_settings/fast_motion.py11
-rw-r--r--release/scripts/startup/bl_operators/presets.py24
-rw-r--r--release/scripts/startup/bl_ui/space_clip.py69
-rw-r--r--source/blender/blenkernel/BKE_depsgraph.h5
-rw-r--r--source/blender/blenkernel/BKE_scene.h1
-rw-r--r--source/blender/blenkernel/BKE_tracking.h13
-rw-r--r--source/blender/blenkernel/intern/BME_tools.c76
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c36
-rw-r--r--source/blender/blenkernel/intern/movieclip.c14
-rw-r--r--source/blender/blenkernel/intern/scene.c15
-rw-r--r--source/blender/blenkernel/intern/tracking.c313
-rw-r--r--source/blender/blenloader/intern/readfile.c15
-rw-r--r--source/blender/bmesh/editmesh_tools.c2
-rw-r--r--source/blender/editors/include/ED_render.h3
-rw-r--r--source/blender/editors/include/ED_view3d.h10
-rw-r--r--source/blender/editors/mesh/bmesh_select.c4
-rw-r--r--source/blender/editors/mesh/bmesh_tools.c2
-rw-r--r--source/blender/editors/render/render_update.c58
-rw-r--r--source/blender/editors/space_clip/clip_draw.c27
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c218
-rw-r--r--source/blender/editors/space_view3d/drawobject.c56
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c16
-rw-r--r--source/blender/makesdna/DNA_tracking_types.h54
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c78
-rw-r--r--source/blender/makesrna/intern/rna_scene_api.c1
-rw-r--r--source/blender/makesrna/intern/rna_tracking.c163
-rw-r--r--source/blender/render/intern/source/rendercore.c2
-rw-r--r--source/blender/windowmanager/CMakeLists.txt4
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c4
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c2
-rw-r--r--source/blenderplayer/CMakeLists.txt2
40 files changed, 1108 insertions, 376 deletions
diff --git a/extern/libmv/CMakeLists.txt b/extern/libmv/CMakeLists.txt
index cd1f572197c..6f0d5f3d126 100644
--- a/extern/libmv/CMakeLists.txt
+++ b/extern/libmv/CMakeLists.txt
@@ -39,6 +39,7 @@ set(SRC
libmv-capi.cpp
libmv/numeric/numeric.cc
libmv/numeric/poly.cc
+ libmv/simple_pipeline/callbacks.cc
libmv/simple_pipeline/reconstruction.cc
libmv/simple_pipeline/resect.cc
libmv/simple_pipeline/intersect.cc
@@ -83,6 +84,7 @@ set(SRC
libmv/numeric/poly.h
libmv/numeric/function_derivative.h
libmv/numeric/numeric.h
+ libmv/simple_pipeline/callbacks.h
libmv/simple_pipeline/resect.h
libmv/simple_pipeline/reconstruction.h
libmv/simple_pipeline/camera_intrinsics.h
diff --git a/extern/libmv/libmv-capi.cpp b/extern/libmv/libmv-capi.cpp
index 8c453944e9d..f08aea9fbd1 100644
--- a/extern/libmv/libmv-capi.cpp
+++ b/extern/libmv/libmv-capi.cpp
@@ -31,6 +31,8 @@
#include "libmv-capi.h"
#include "glog/logging.h"
+#include "libmv/logging/logging.h"
+
#include "Math/v3d_optimization.h"
#include "libmv/tracking/esm_region_tracker.h"
@@ -41,6 +43,7 @@
#include "libmv/tracking/sad.h"
+#include "libmv/simple_pipeline/callbacks.h"
#include "libmv/simple_pipeline/tracks.h"
#include "libmv/simple_pipeline/initialize_reconstruction.h"
#include "libmv/simple_pipeline/bundle.h"
@@ -339,6 +342,26 @@ void libmv_tracksDestroy(libmv_Tracks *libmv_tracks)
/* ************ Reconstruction solver ************ */
+class ReconstructUpdateCallback : public libmv::ProgressUpdateCallback {
+public:
+ ReconstructUpdateCallback(reconstruct_progress_update_cb progress_update_callback,
+ void *callback_customdata)
+ {
+ progress_update_callback_ = progress_update_callback;
+ callback_customdata_ = callback_customdata;
+ }
+
+ void invoke(double progress, const char *message)
+ {
+ if(progress_update_callback_) {
+ progress_update_callback_(callback_customdata_, progress, message);
+ }
+ }
+protected:
+ reconstruct_progress_update_cb progress_update_callback_;
+ void *callback_customdata_;
+};
+
int libmv_refineParametersAreValid(int parameters) {
return (parameters == (LIBMV_REFINE_FOCAL_LENGTH)) ||
(parameters == (LIBMV_REFINE_FOCAL_LENGTH |
@@ -356,7 +379,8 @@ int libmv_refineParametersAreValid(int parameters) {
libmv_Reconstruction *libmv_solveReconstruction(libmv_Tracks *tracks, int keyframe1, int keyframe2,
- int refine_intrinsics, double focal_length, double principal_x, double principal_y, double k1, double k2, double k3)
+ int refine_intrinsics, double focal_length, double principal_x, double principal_y, double k1, double k2, double k3,
+ reconstruct_progress_update_cb progress_update_callback, void *callback_customdata)
{
/* Invert the camera intrinsics. */
libmv::vector<libmv::Marker> markers = ((libmv::Tracks*)tracks)->AllMarkers();
@@ -364,6 +388,9 @@ libmv_Reconstruction *libmv_solveReconstruction(libmv_Tracks *tracks, int keyfra
libmv::EuclideanReconstruction *reconstruction = &libmv_reconstruction->reconstruction;
libmv::CameraIntrinsics *intrinsics = &libmv_reconstruction->intrinsics;
+ ReconstructUpdateCallback update_callback =
+ ReconstructUpdateCallback(progress_update_callback, callback_customdata);
+
intrinsics->SetFocalLength(focal_length, focal_length);
intrinsics->SetPrincipalPoint(principal_x, principal_y);
intrinsics->SetRadialDistortion(k1, k2, k3);
@@ -377,15 +404,16 @@ libmv_Reconstruction *libmv_solveReconstruction(libmv_Tracks *tracks, int keyfra
libmv::Tracks normalized_tracks(markers);
- // printf("frames to init from: %d, %d\n", keyframe1, keyframe2);
+ LG << "frames to init from: " << keyframe1 << " " << keyframe2;
libmv::vector<libmv::Marker> keyframe_markers =
normalized_tracks.MarkersForTracksInBothImages(keyframe1, keyframe2);
- // printf("number of markers for init: %d\n", keyframe_markers.size());
+ LG << "number of markers for init: " << keyframe_markers.size();
+
+ update_callback.invoke(0, "Initial reconstruction");
libmv::EuclideanReconstructTwoFrames(keyframe_markers, reconstruction);
libmv::EuclideanBundle(normalized_tracks, reconstruction);
-
- libmv::EuclideanCompleteReconstruction(normalized_tracks, reconstruction);
+ libmv::EuclideanCompleteReconstruction(normalized_tracks, reconstruction, &update_callback);
if (refine_intrinsics) {
/* only a few combinations are supported but trust the caller */
@@ -402,9 +430,13 @@ libmv_Reconstruction *libmv_solveReconstruction(libmv_Tracks *tracks, int keyfra
if (refine_intrinsics & LIBMV_REFINE_RADIAL_DISTORTION_K2) {
libmv_refine_flags |= libmv::BUNDLE_RADIAL_K2;
}
- libmv::EuclideanBundleCommonIntrinsics(*(libmv::Tracks *)tracks, libmv_refine_flags, reconstruction, intrinsics);
+
+ progress_update_callback(callback_customdata, 1.0, "Refining solution");
+ libmv::EuclideanBundleCommonIntrinsics(*(libmv::Tracks *)tracks, libmv_refine_flags,
+ reconstruction, intrinsics);
}
+ progress_update_callback(callback_customdata, 1.0, "Finishing solution");
libmv_reconstruction->tracks = *(libmv::Tracks *)tracks;
libmv_reconstruction->error = libmv::EuclideanReprojectionError(*(libmv::Tracks *)tracks, *reconstruction, *intrinsics);
diff --git a/extern/libmv/libmv-capi.h b/extern/libmv/libmv-capi.h
index 8252a11739b..536f8a5f14c 100644
--- a/extern/libmv/libmv-capi.h
+++ b/extern/libmv/libmv-capi.h
@@ -64,10 +64,14 @@ void libmv_tracksDestroy(struct libmv_Tracks *libmv_tracks);
#define LIBMV_REFINE_PRINCIPAL_POINT (1<<1)
#define LIBMV_REFINE_RADIAL_DISTORTION_K1 (1<<2)
#define LIBMV_REFINE_RADIAL_DISTORTION_K2 (1<<4)
+
+typedef void (*reconstruct_progress_update_cb) (void *customdata, double progress, const char *message);
+
int libmv_refineParametersAreValid(int parameters);
struct libmv_Reconstruction *libmv_solveReconstruction(struct libmv_Tracks *tracks, int keyframe1, int keyframe2,
- int refine_intrinsics, double focal_length, double principal_x, double principal_y, double k1, double k2, double k3);
+ int refine_intrinsics, double focal_length, double principal_x, double principal_y, double k1, double k2, double k3,
+ reconstruct_progress_update_cb progress_update_callback, void *callback_customdata);
int libmv_reporojectionPointForTrack(struct libmv_Reconstruction *libmv_reconstruction, int track, double pos[3]);
double libmv_reporojectionErrorForTrack(struct libmv_Reconstruction *libmv_reconstruction, int track);
double libmv_reporojectionErrorForImage(struct libmv_Reconstruction *libmv_reconstruction, int image);
diff --git a/extern/libmv/libmv/simple_pipeline/callbacks.cc b/extern/libmv/libmv/simple_pipeline/callbacks.cc
new file mode 100644
index 00000000000..7e4bca6efc7
--- /dev/null
+++ b/extern/libmv/libmv/simple_pipeline/callbacks.cc
@@ -0,0 +1,29 @@
+// Copyright (c) 2011 libmv authors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+
+#include "libmv/simple_pipeline/callbacks.h"
+
+namespace libmv {
+
+void ProgressUpdateCallback::invoke(double progress, const char* message)
+{
+}
+
+} // namespace libmv
diff --git a/extern/libmv/libmv/simple_pipeline/callbacks.h b/extern/libmv/libmv/simple_pipeline/callbacks.h
new file mode 100644
index 00000000000..675f73c1cab
--- /dev/null
+++ b/extern/libmv/libmv/simple_pipeline/callbacks.h
@@ -0,0 +1,33 @@
+// Copyright (c) 2011 libmv authors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+
+#ifndef LIBMV_SIMPLE_PIPELINE_CALLBACKS_H_
+#define LIBMV_SIMPLE_PIPELINE_CALLBACKS_H_
+
+namespace libmv {
+
+class ProgressUpdateCallback {
+ public:
+ virtual void invoke(double progress, const char *message);
+};
+
+} // namespace libmv
+
+#endif // LIBMV_SIMPLE_PIPELINE_MARKERS_H_
diff --git a/extern/libmv/libmv/simple_pipeline/pipeline.cc b/extern/libmv/libmv/simple_pipeline/pipeline.cc
index 9512a41c00f..382365e579f 100644
--- a/extern/libmv/libmv/simple_pipeline/pipeline.cc
+++ b/extern/libmv/libmv/simple_pipeline/pipeline.cc
@@ -21,6 +21,7 @@
#include <cstdio>
#include "libmv/logging/logging.h"
+#include "libmv/simple_pipeline/pipeline.h"
#include "libmv/simple_pipeline/bundle.h"
#include "libmv/simple_pipeline/intersect.h"
#include "libmv/simple_pipeline/resect.h"
@@ -117,14 +118,32 @@ struct ProjectivePipelineRoutines {
} // namespace
+static void CompleteReconstructionLogProress(ProgressUpdateCallback *update_callback,
+ double progress,
+ const char *step = NULL)
+{
+ if(update_callback) {
+ char message[256];
+
+ if(step)
+ snprintf(message, sizeof(message), "Completing solution %d%% | %s", (int)(progress*100), step);
+ else
+ snprintf(message, sizeof(message), "Completing solution %d%%", (int)(progress*100));
+
+ update_callback->invoke(progress, message);
+ }
+}
+
template<typename PipelineRoutines>
void InternalCompleteReconstruction(
const Tracks &tracks,
- typename PipelineRoutines::Reconstruction *reconstruction) {
+ typename PipelineRoutines::Reconstruction *reconstruction,
+ ProgressUpdateCallback *update_callback = NULL) {
int max_track = tracks.MaxTrack();
int max_image = tracks.MaxImage();
int num_resects = -1;
int num_intersects = -1;
+ int tot_resects = 0;
LG << "Max track: " << max_track;
LG << "Max image: " << max_image;
LG << "Number of markers: " << tracks.NumMarkers();
@@ -148,12 +167,17 @@ void InternalCompleteReconstruction(
LG << "Got " << reconstructed_markers.size()
<< " reconstructed markers for track " << track;
if (reconstructed_markers.size() >= 2) {
+ CompleteReconstructionLogProress(update_callback,
+ (double)tot_resects/(max_image));
PipelineRoutines::Intersect(reconstructed_markers, reconstruction);
num_intersects++;
LG << "Ran Intersect() for track " << track;
}
}
if (num_intersects) {
+ CompleteReconstructionLogProress(update_callback,
+ (double)tot_resects/(max_image),
+ "Bundling...");
PipelineRoutines::Bundle(tracks, reconstruction);
LG << "Ran Bundle() after intersections.";
}
@@ -178,8 +202,11 @@ void InternalCompleteReconstruction(
LG << "Got " << reconstructed_markers.size()
<< " reconstructed markers for image " << image;
if (reconstructed_markers.size() >= 5) {
+ CompleteReconstructionLogProress(update_callback,
+ (double)tot_resects/(max_image));
if (PipelineRoutines::Resect(reconstructed_markers, reconstruction, false)) {
num_resects++;
+ tot_resects++;
LG << "Ran Resect() for image " << image;
} else {
LG << "Failed Resect() for image " << image;
@@ -187,6 +214,9 @@ void InternalCompleteReconstruction(
}
}
if (num_resects) {
+ CompleteReconstructionLogProress(update_callback,
+ (double)tot_resects/(max_image),
+ "Bundling...");
PipelineRoutines::Bundle(tracks, reconstruction);
}
LG << "Did " << num_resects << " resects.";
@@ -208,6 +238,8 @@ void InternalCompleteReconstruction(
}
}
if (reconstructed_markers.size() >= 5) {
+ CompleteReconstructionLogProress(update_callback,
+ (double)tot_resects/(max_image));
if (PipelineRoutines::Resect(reconstructed_markers, reconstruction, true)) {
num_resects++;
LG << "Ran Resect() for image " << image;
@@ -217,6 +249,9 @@ void InternalCompleteReconstruction(
}
}
if (num_resects) {
+ CompleteReconstructionLogProress(update_callback,
+ (double)tot_resects/(max_image),
+ "Bundling...");
PipelineRoutines::Bundle(tracks, reconstruction);
}
}
@@ -244,7 +279,7 @@ double InternalReprojectionError(const Tracks &image_tracks,
PipelineRoutines::ProjectMarker(*point, *camera, intrinsics);
double ex = reprojected_marker.x - markers[i].x;
double ey = reprojected_marker.y - markers[i].y;
-
+#if 0
const int N = 100;
char line[N];
snprintf(line, N,
@@ -262,6 +297,7 @@ double InternalReprojectionError(const Tracks &image_tracks,
ex,
ey,
sqrt(ex*ex + ey*ey));
+#endif
total_error += sqrt(ex*ex + ey*ey);
}
LG << "Skipped " << num_skipped << " markers.";
@@ -289,9 +325,11 @@ double ProjectiveReprojectionError(
}
void EuclideanCompleteReconstruction(const Tracks &tracks,
- EuclideanReconstruction *reconstruction) {
+ EuclideanReconstruction *reconstruction,
+ ProgressUpdateCallback *update_callback) {
InternalCompleteReconstruction<EuclideanPipelineRoutines>(tracks,
- reconstruction);
+ reconstruction,
+ update_callback);
}
void ProjectiveCompleteReconstruction(const Tracks &tracks,
diff --git a/extern/libmv/libmv/simple_pipeline/pipeline.h b/extern/libmv/libmv/simple_pipeline/pipeline.h
index b7dfcb7993a..e940b57bc0d 100644
--- a/extern/libmv/libmv/simple_pipeline/pipeline.h
+++ b/extern/libmv/libmv/simple_pipeline/pipeline.h
@@ -21,6 +21,7 @@
#ifndef LIBMV_SIMPLE_PIPELINE_PIPELINE_H_
#define LIBMV_SIMPLE_PIPELINE_PIPELINE_H_
+#include "libmv/simple_pipeline/callbacks.h"
#include "libmv/simple_pipeline/tracks.h"
#include "libmv/simple_pipeline/reconstruction.h"
@@ -46,7 +47,8 @@ namespace libmv {
\sa EuclideanResect, EuclideanIntersect, EuclideanBundle
*/
void EuclideanCompleteReconstruction(const Tracks &tracks,
- EuclideanReconstruction *reconstruction);
+ EuclideanReconstruction *reconstruction,
+ ProgressUpdateCallback *update_callback = NULL);
/*!
Estimate camera matrices and homogeneous 3D coordinates for all frames and
diff --git a/release/scripts/presets/tracking_settings/blurry_movie.py b/release/scripts/presets/tracking_settings/blurry_movie.py
new file mode 100644
index 00000000000..8a503bec9bd
--- /dev/null
+++ b/release/scripts/presets/tracking_settings/blurry_movie.py
@@ -0,0 +1,11 @@
+import bpy
+settings = bpy.context.edit_movieclip.tracking.settings
+
+settings.default_tracker = 'KLT'
+settings.default_pyramid_levels = 4
+settings.default_correlation_min = 0.75
+settings.default_pattern_size = 11
+settings.default_search_size = 202
+settings.default_frames_limit = 25
+settings.default_pattern_match = 'KEYFRAME'
+settings.default_margin = 0
diff --git a/release/scripts/presets/tracking_settings/default.py b/release/scripts/presets/tracking_settings/default.py
new file mode 100644
index 00000000000..4b2d41bf292
--- /dev/null
+++ b/release/scripts/presets/tracking_settings/default.py
@@ -0,0 +1,11 @@
+import bpy
+settings = bpy.context.edit_movieclip.tracking.settings
+
+settings.default_tracker = 'KLT'
+settings.default_pyramid_levels = 2
+settings.default_correlation_min = 0.75
+settings.default_pattern_size = 11
+settings.default_search_size = 51
+settings.default_frames_limit = 0
+settings.default_pattern_match = 'KEYFRAME'
+settings.default_margin = 0
diff --git a/release/scripts/presets/tracking_settings/fast_motion.py b/release/scripts/presets/tracking_settings/fast_motion.py
new file mode 100644
index 00000000000..a3d382e6700
--- /dev/null
+++ b/release/scripts/presets/tracking_settings/fast_motion.py
@@ -0,0 +1,11 @@
+import bpy
+settings = bpy.context.edit_movieclip.tracking.settings
+
+settings.default_tracker = 'KLT'
+settings.default_pyramid_levels = 2
+settings.default_correlation_min = 0.75
+settings.default_pattern_size = 11
+settings.default_search_size = 121
+settings.default_frames_limit = 0
+settings.default_pattern_match = 'KEYFRAME'
+settings.default_margin = 0
diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py
index 100b21fc303..a5c8c280616 100644
--- a/release/scripts/startup/bl_operators/presets.py
+++ b/release/scripts/startup/bl_operators/presets.py
@@ -360,6 +360,30 @@ class AddPresetTrackingTrackColor(AddPresetBase, Operator):
preset_subdir = "tracking_track_color"
+class AddPresetTrackingSettings(AddPresetBase, Operator):
+ '''Add a motion tracking settings preset'''
+ bl_idname = "clip.tracking_settings_preset_add"
+ bl_label = "Add Tracking Settings Preset"
+ preset_menu = "CLIP_MT_tracking_settings_presets"
+
+ preset_defines = [
+ "settings = bpy.context.edit_movieclip.tracking.settings"
+ ]
+
+ preset_values = [
+ "settings.default_tracker",
+ "settings.default_pyramid_levels",
+ "settings.default_correlation_min",
+ "settings.default_pattern_size",
+ "settings.default_search_size",
+ "settings.default_frames_limit",
+ "settings.default_pattern_match",
+ "settings.default_margin"
+ ]
+
+ preset_subdir = "tracking_settings"
+
+
class AddPresetKeyconfig(AddPresetBase, Operator):
'''Add a Keyconfig Preset'''
bl_idname = "wm.keyconfig_preset_add"
diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py
index b04d81b6b2a..d5171d119f7 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -92,6 +92,9 @@ class CLIP_PT_tools_marker(Panel):
return clip and sc.mode == 'TRACKING'
def draw(self, context):
+ sc = context.space_data
+ clip = sc.clip
+ settings = clip.tracking.settings
layout = self.layout
col = layout.column(align=True)
@@ -99,6 +102,45 @@ class CLIP_PT_tools_marker(Panel):
col.operator("clip.detect_features")
col.operator("clip.delete_track")
+ box = layout.box()
+ row = box.row(align=True)
+ row.prop(settings, "show_default_expanded", text="", emboss=False)
+ row.label(text="Tracking Settings")
+
+ if settings.show_default_expanded:
+ col = box.column()
+ row = col.row(align=True)
+ label = bpy.types.CLIP_MT_tracking_settings_presets.bl_label
+ row.menu('CLIP_MT_tracking_settings_presets', text=label)
+ row.operator("clip.tracking_settings_preset_add",
+ text="", icon='ZOOMIN')
+ props = row.operator("clip.track_color_preset_add",
+ text="", icon='ZOOMOUT')
+ props.remove_active = True
+
+ col.separator()
+
+ col2 = col.column(align=True)
+ col2.prop(settings, "default_pattern_size")
+ col2.prop(settings, "default_search_size")
+
+ col.label(text="Tracker:")
+ col.prop(settings, "default_tracker", text="")
+
+ if settings.default_tracker == 'KLT':
+ col.prop(settings, "default_pyramid_levels")
+ else:
+ col.prop(settings, "default_correlation_min")
+
+ col.separator()
+
+ col2 = col.column(align=True)
+ col2.prop(settings, "default_frames_limit")
+ col2.prop(settings, "default_margin")
+
+ col.label(text="Match:")
+ col.prop(settings, "default_pattern_match", text="")
+
class CLIP_PT_tools_tracking(Panel):
bl_space_type = 'CLIP_EDITOR'
@@ -447,18 +489,23 @@ class CLIP_PT_track_settings(Panel):
clip = context.space_data.clip
settings = clip.tracking.settings
+ col = layout.column()
+
active = clip.tracking.tracks.active
if active:
- layout.prop(active, "tracker")
+ col.prop(active, "tracker")
+
if active.tracker == 'KLT':
- layout.prop(active, "pyramid_levels")
+ col.prop(active, "pyramid_levels")
elif active.tracker == 'SAD':
- layout.prop(active, "correlation_min")
+ col.prop(active, "correlation_min")
- layout.prop(settings, "frames_adjust")
- layout.prop(settings, "speed")
- layout.prop(settings, "frames_limit")
- layout.prop(settings, "margin")
+ col.separator()
+ col.prop(active, "frames_limit")
+ col.prop(active, "margin")
+ col.prop(active, "pattern_match", text="Match")
+
+ col.prop(settings, "speed")
class CLIP_PT_stabilization(Panel):
@@ -866,6 +913,14 @@ class CLIP_MT_track_color_presets(Menu):
draw = bpy.types.Menu.draw_preset
+class CLIP_MT_tracking_settings_presets(Menu):
+ """Predefined tracking settings"""
+ bl_label = "Tracking Presets"
+ preset_subdir = "tracking_settings"
+ preset_operator = "script.execute_preset"
+ draw = bpy.types.Menu.draw_preset
+
+
class CLIP_MT_track_color_specials(Menu):
bl_label = "Track Color Specials"
diff --git a/source/blender/blenkernel/BKE_depsgraph.h b/source/blender/blenkernel/BKE_depsgraph.h
index e0b8e40d731..5d475903feb 100644
--- a/source/blender/blenkernel/BKE_depsgraph.h
+++ b/source/blender/blenkernel/BKE_depsgraph.h
@@ -121,7 +121,7 @@ void DAG_id_tag_update(struct ID *id, short flag);
/* flush all tagged updates */
void DAG_ids_flush_tagged(struct Main *bmain);
/* check and clear ID recalc flags */
-void DAG_ids_check_recalc(struct Main *bmain);
+void DAG_ids_check_recalc(struct Main *bmain, struct Scene *scene, int time);
void DAG_ids_clear_recalc(struct Main *bmain);
/* test if any of this id type is tagged for update */
void DAG_id_type_tag(struct Main *bmain, short idtype);
@@ -131,7 +131,8 @@ int DAG_id_type_tagged(struct Main *bmain, short idtype);
void DAG_pose_sort(struct Object *ob);
/* callback for editors module to do updates */
-void DAG_editors_update_cb(void (*func)(struct Main *bmain, struct ID *id));
+void DAG_editors_update_cb(void (*id_func)(struct Main *bmain, struct ID *id),
+ void (*scene_func)(struct Main *bmain, struct Scene *scene, int updated));
/* debugging */
void DAG_print_dependencies(struct Main *bmain, struct Scene *scene, struct Object *ob);
diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h
index 7cb31505430..2df5e7ac2c6 100644
--- a/source/blender/blenkernel/BKE_scene.h
+++ b/source/blender/blenkernel/BKE_scene.h
@@ -90,7 +90,6 @@ float BKE_curframe(struct Scene *scene);
float BKE_frame_to_ctime(struct Scene *scene, const float frame);
void scene_update_tagged(struct Main *bmain, struct Scene *sce);
-void scene_clear_tagged(struct Main *bmain, struct Scene *sce);
void scene_update_for_newframe(struct Main *bmain, struct Scene *sce, unsigned int lay);
diff --git a/source/blender/blenkernel/BKE_tracking.h b/source/blender/blenkernel/BKE_tracking.h
index 1c25547b146..e55d40ebfe5 100644
--- a/source/blender/blenkernel/BKE_tracking.h
+++ b/source/blender/blenkernel/BKE_tracking.h
@@ -34,6 +34,7 @@
struct bGPDlayer;
struct ImBuf;
+struct MovieReconstructContext;
struct MovieTrackingTrack;
struct MovieTrackingMarker;
struct MovieTracking;
@@ -44,6 +45,7 @@ struct Camera;
struct Object;
struct Scene;
+void BKE_tracking_init_settings(struct MovieTracking *tracking);
void BKE_tracking_clamp_track(struct MovieTrackingTrack *track, int event);
void BKE_tracking_track_flag(struct MovieTrackingTrack *track, int area, int flag, int clear);
@@ -90,9 +92,14 @@ void BKE_tracking_sync_user(struct MovieClipUser *user, struct MovieTrackingCont
int BKE_tracking_next(struct MovieTrackingContext *context);
/* Camera solving */
-int BKE_tracking_can_solve(struct MovieTracking *tracking, char *error_msg, int error_size);
-
-float BKE_tracking_solve_reconstruction(struct MovieTracking *tracking, int width, int height);
+int BKE_tracking_can_reconstruct(struct MovieTracking *tracking, char *error_msg, int error_size);
+
+struct MovieReconstructContext* BKE_tracking_reconstruction_context_new(struct MovieTracking *tracking,
+ int keyframe1, int keyframe2, int width, int height);
+void BKE_tracking_reconstruction_context_free(struct MovieReconstructContext *context);
+void BKE_tracking_solve_reconstruction(struct MovieReconstructContext *context,
+ short *stop, short *do_update, float *progress, char *stats_message, int message_size);
+int BKE_tracking_finish_reconstruction(struct MovieReconstructContext *context, struct MovieTracking *tracking);
struct MovieReconstructedCamera *BKE_tracking_get_reconstructed_camera(struct MovieTracking *tracking, int framenr);
void BKE_tracking_get_interpolated_camera(struct MovieTracking *tracking, int framenr, float mat[4][4]);
diff --git a/source/blender/blenkernel/intern/BME_tools.c b/source/blender/blenkernel/intern/BME_tools.c
index 203a07e0cfc..32e608623d5 100644
--- a/source/blender/blenkernel/intern/BME_tools.c
+++ b/source/blender/blenkernel/intern/BME_tools.c
@@ -69,9 +69,11 @@ void BME_free_transdata(BME_TransData_Head *td) {
MEM_freeN(td);
}
-BME_TransData *BME_assign_transdata(BME_TransData_Head *td, BME_Mesh *bm, BME_Vert *v,
- float *co, float *org, float *vec, float *loc,
- float factor, float weight, float maxfactor, float *max) {
+BME_TransData *BME_assign_transdata(
+ BME_TransData_Head *td, BME_Mesh *bm, BME_Vert *v,
+ float *co, float *org, float *vec, float *loc,
+ float factor, float weight, float maxfactor, float *max)
+{
BME_TransData *vtd;
int is_new = 0;
@@ -86,13 +88,23 @@ BME_TransData *BME_assign_transdata(BME_TransData_Head *td, BME_Mesh *bm, BME_Ve
vtd->bm = bm;
vtd->v = v;
- if (co != NULL) VECCOPY(vtd->co,co);
- if (org == NULL && is_new) { VECCOPY(vtd->org,v->co); } /* default */
- else if (org != NULL) VECCOPY(vtd->org,org);
+
+ if (co != NULL) {
+ copy_v3_v3(vtd->co, co);
+ }
+
+ if (org == NULL && is_new) {
+ copy_v3_v3(vtd->org, v->co); /* default */
+ }
+ else if (org != NULL) {
+ copy_v3_v3(vtd->org,org);
+ }
+
if (vec != NULL) {
- VECCOPY(vtd->vec,vec);
+ copy_v3_v3(vtd->vec,vec);
normalize_v3(vtd->vec);
}
+
vtd->loc = loc;
vtd->factor = factor;
@@ -325,7 +337,8 @@ static int BME_bevel_is_split_vert(BME_Loop *l) {
* the bevel operation as a whole based on the relationship between v1 and v2
* (won't necessarily be a vec from v1->co to v2->co, though it probably will be);
* the return value is -1 for failure, 0 if we used vert co's, and 1 if we used transform origins */
-static int BME_bevel_get_vec(float *vec, BME_Vert *v1, BME_Vert *v2, BME_TransData_Head *td) {
+static int BME_bevel_get_vec(float *vec, BME_Vert *v1, BME_Vert *v2, BME_TransData_Head *td)
+{
BME_TransData *vtd1, *vtd2;
vtd1 = BME_get_transdata(td,v1);
@@ -339,14 +352,14 @@ static int BME_bevel_get_vec(float *vec, BME_Vert *v1, BME_Vert *v2, BME_TransDa
* if they belong to different origins, then we will use the origins to determine
* the vector */
if (compare_v3v3(vtd1->org,vtd2->org,0.000001f)) {
- VECSUB(vec,v2->co,v1->co);
+ sub_v3_v3v3(vec, v2->co, v1->co);
if (len_v3(vec) < 0.000001f) {
zero_v3(vec);
}
return 0;
}
else {
- VECSUB(vec,vtd2->org,vtd1->org);
+ sub_v3_v3v3(vec,vtd2->org,vtd1->org);
if (len_v3(vec) < 0.000001f) {
zero_v3(vec);
}
@@ -363,7 +376,8 @@ static int BME_bevel_get_vec(float *vec, BME_Vert *v1, BME_Vert *v2, BME_TransDa
* vec2 is the direction of projection (pointing away from vec1)
* up_vec is used for orientation (expected to be normalized)
* returns the length of the projected vector that lies along vec1 */
-static float BME_bevel_project_vec(float *vec1, float *vec2, float *up_vec, int is_forward, BME_TransData_Head *UNUSED(td)) {
+static float BME_bevel_project_vec(float *vec1, float *vec2, float *up_vec, int is_forward, BME_TransData_Head *UNUSED(td))
+{
float factor, vec3[3], tmp[3],c1,c2;
cross_v3_v3v3(tmp,vec1,vec2);
@@ -378,7 +392,7 @@ static float BME_bevel_project_vec(float *vec1, float *vec2, float *up_vec, int
normalize_v3(vec3);
c1 = dot_v3v3(vec3,vec1);
c2 = dot_v3v3(vec1,vec1);
- if (fabs(c1) < 0.000001f || fabs(c2) < 0.000001f) {
+ if (fabsf(c1) < 0.000001f || fabsf(c2) < 0.000001f) {
factor = 0.0f;
}
else {
@@ -526,8 +540,8 @@ static BME_Vert *BME_bevel_split_edge(BME_Mesh *bm, BME_Vert *v, BME_Vert *v1, B
if (is_edge || dis > maxfactor*value) {
dis = maxfactor*value;
}
- VECADDFAC(sv->co,v->co,vec1,dis);
- VECSUB(vec1,sv->co,vtd1->org);
+ madd_v3_v3v3fl(sv->co, v->co, vec1, dis);
+ sub_v3_v3v3(vec1, sv->co, vtd1->org);
dis = len_v3(vec1);
normalize_v3(vec1);
BME_assign_transdata(td, bm, sv, vtd1->org, vtd1->org, vec1, sv->co, dis, scale, maxfactor, vtd->max);
@@ -547,11 +561,11 @@ static float BME_bevel_set_max(BME_Vert *v1, BME_Vert *v2, float value, BME_Tran
fac1 = 0;
}
else {
- VECCOPY(vec2,vtd1->vec);
- mul_v3_fl(vec2,vtd1->factor);
+ copy_v3_v3(vec2, vtd1->vec);
+ mul_v3_fl(vec2, vtd1->factor);
if (dot_v3v3(vec1, vec1)) {
- project_v3_v3v3(vec2,vec2,vec1);
- fac1 = len_v3(vec2)/value;
+ project_v3_v3v3(vec2, vec2,vec1);
+ fac1 = len_v3(vec2) / value;
}
else {
fac1 = 0;
@@ -562,11 +576,11 @@ static float BME_bevel_set_max(BME_Vert *v1, BME_Vert *v2, float value, BME_Tran
fac2 = 0;
}
else {
- VECCOPY(vec3,vtd2->vec);
- mul_v3_fl(vec3,vtd2->factor);
+ copy_v3_v3(vec3, vtd2->vec);
+ mul_v3_fl(vec3, vtd2->factor);
if (dot_v3v3(vec1, vec1)) {
- project_v3_v3v3(vec2,vec3,vec1);
- fac2 = len_v3(vec2)/value;
+ project_v3_v3v3(vec2, vec3, vec1);
+ fac2 = len_v3(vec2) / value;
}
else {
fac2 = 0;
@@ -574,7 +588,7 @@ static float BME_bevel_set_max(BME_Vert *v1, BME_Vert *v2, float value, BME_Tran
}
if (fac1 || fac2) {
- max = len_v3(vec1)/(fac1 + fac2);
+ max = len_v3(vec1) / (fac1 + fac2);
if (vtd1->max && (*vtd1->max < 0 || max < *vtd1->max)) {
*vtd1->max = max;
}
@@ -763,8 +777,8 @@ static BME_Poly *BME_bevel_poly(BME_Mesh *bm, BME_Poly *f, float value, int opti
for (i=0,ol=f->loopbase,l=ol->next; l->next!=ol; l=l->next) {
BME_bevel_get_vec(vec1,l->next->v,ol->v,td);
BME_bevel_get_vec(vec2,l->v,ol->v,td);
- cross_v3_v3v3(vec3,vec2,vec1);
- VECADD(up_vec,up_vec,vec3);
+ cross_v3_v3v3(vec3, vec2, vec1);
+ add_v3_v3(up_vec, vec3);
i++;
}
mul_v3_fl(up_vec,1.0f/i);
@@ -793,7 +807,7 @@ static BME_Poly *BME_bevel_poly(BME_Mesh *bm, BME_Poly *f, float value, int opti
fac1 = 0;
}
else {
- VECCOPY(vec2,vtd1->vec);
+ copy_v3_v3(vec2,vtd1->vec);
mul_v3_fl(vec2,vtd1->factor);
if (dot_v3v3(vec1, vec1)) {
project_v3_v3v3(vec2,vec2,vec1);
@@ -807,7 +821,7 @@ static BME_Poly *BME_bevel_poly(BME_Mesh *bm, BME_Poly *f, float value, int opti
fac2 = 0;
}
else {
- VECCOPY(vec3,vtd2->vec);
+ copy_v3_v3(vec3,vtd2->vec);
mul_v3_fl(vec3,vtd2->factor);
if (dot_v3v3(vec1, vec1)) {
project_v3_v3v3(vec2,vec3,vec1);
@@ -833,7 +847,8 @@ static BME_Poly *BME_bevel_poly(BME_Mesh *bm, BME_Poly *f, float value, int opti
return l->f;
}
-static void BME_bevel_add_vweight(BME_TransData_Head *td, BME_Mesh *bm, BME_Vert *v, float weight, float factor, int options) {
+static void BME_bevel_add_vweight(BME_TransData_Head *td, BME_Mesh *bm, BME_Vert *v, float weight, float factor, int options)
+{
BME_TransData *vtd;
if (v->tflag1 & BME_BEVEL_NONMAN) return;
@@ -1105,6 +1120,7 @@ static BME_Mesh *BME_bevel_initialize(BME_Mesh *bm, int options, int UNUSED(defg
}
return bm;
+
}
/* tags all elements as originals */
@@ -1124,8 +1140,8 @@ static BME_Mesh *BME_bevel_reinitialize(BME_Mesh *bm) {
for (f=bm->polys.first; f; f=f->next) {
f->tflag1 |= BME_BEVEL_ORIG;
}
-
return bm;
+
}
/**
@@ -1318,7 +1334,7 @@ BME_Mesh *BME_bevel(BME_Mesh *bm, float value, int res, int options, int defgrp_
else {
d = value;
}
- VECADDFAC(v->co,vtd->org,vtd->vec,vtd->factor*d);
+ madd_v3_v3v3fl(v->co,vtd->org,vtd->vec,vtd->factor*d);
}
v->tflag1 = 0;
}
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index b1e39b1d768..4eaf49dc679 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -1636,17 +1636,25 @@ void graph_print_adj_list(void)
/* mechanism to allow editors to be informed of depsgraph updates,
to do their own updates based on changes... */
-static void (*EditorsUpdateCb)(Main *bmain, ID *id)= NULL;
+static void (*EditorsUpdateIDCb)(Main *bmain, ID *id)= NULL;
+static void (*EditorsUpdateSceneCb)(Main *bmain, Scene *scene, int updated)= NULL;
-void DAG_editors_update_cb(void (*func)(Main *bmain, ID *id))
+void DAG_editors_update_cb(void (*id_func)(Main *bmain, ID *id), void (*scene_func)(Main *bmain, Scene *scene, int updated))
{
- EditorsUpdateCb= func;
+ EditorsUpdateIDCb= id_func;
+ EditorsUpdateSceneCb= scene_func;
}
-static void dag_editors_update(Main *bmain, ID *id)
+static void dag_editors_id_update(Main *bmain, ID *id)
{
- if(EditorsUpdateCb)
- EditorsUpdateCb(bmain, id);
+ if(EditorsUpdateIDCb)
+ EditorsUpdateIDCb(bmain, id);
+}
+
+static void dag_editors_scene_update(Main *bmain, Scene *scene, int updated)
+{
+ if(EditorsUpdateSceneCb)
+ EditorsUpdateSceneCb(bmain, scene, updated);
}
/* groups with objects in this scene need to be put in the right order as well */
@@ -2460,7 +2468,7 @@ static void dag_id_flush_update(Scene *sce, ID *id)
/* no point in trying in this cases */
if(id && id->us <= 1) {
- dag_editors_update(bmain, id);
+ dag_editors_id_update(bmain, id);
id= NULL;
}
}
@@ -2572,7 +2580,7 @@ static void dag_id_flush_update(Scene *sce, ID *id)
}
/* update editors */
- dag_editors_update(bmain, id);
+ dag_editors_id_update(bmain, id);
}
}
@@ -2612,10 +2620,10 @@ void DAG_ids_flush_tagged(Main *bmain)
DAG_scene_flush_update(bmain, sce, lay, 0);
}
-void DAG_ids_check_recalc(Main *bmain)
+void DAG_ids_check_recalc(Main *bmain, Scene *scene, int time)
{
ListBase *lbarray[MAX_LIBARRAY];
- int a;
+ int a, updated = 0;
/* loop over all ID types */
a = set_listbasepointers(bmain, lbarray);
@@ -2627,13 +2635,13 @@ void DAG_ids_check_recalc(Main *bmain)
/* we tag based on first ID type character to avoid
looping over all ID's in case there are no tags */
if(id && bmain->id_tag_update[id->name[0]]) {
- /* do editors update */
- dag_editors_update(bmain, NULL);
- return;
+ updated= 1;
+ break;
}
}
-}
+ dag_editors_scene_update(bmain, scene, (updated || time));
+}
void DAG_ids_clear_recalc(Main *bmain)
{
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index 382e1d70387..75d8ec584e8 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -369,19 +369,7 @@ static MovieClip *movieclip_alloc(const char *name)
clip->aspx= clip->aspy= 1.0f;
- clip->tracking.camera.sensor_width= 35.0f;
- clip->tracking.camera.pixel_aspect= 1.0f;
- clip->tracking.camera.units= CAMERA_UNITS_MM;
-
- clip->tracking.settings.frames_limit= 0;
- clip->tracking.settings.keyframe1= 1;
- clip->tracking.settings.keyframe2= 30;
- clip->tracking.settings.dist= 1;
-
- clip->tracking.stabilization.scaleinf= 1.0f;
- clip->tracking.stabilization.locinf= 1.0f;
- clip->tracking.stabilization.rotinf= 1.0f;
- clip->tracking.stabilization.maxscale= 2.0f;
+ BKE_tracking_init_settings(&clip->tracking);
clip->proxy.build_size_flag= IMB_PROXY_25;
clip->proxy.build_tc_flag= IMB_TC_RECORD_RUN|IMB_TC_FREE_RUN|IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN;
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index b7aa02b2f7b..c284ed02868 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -1028,15 +1028,11 @@ void scene_update_tagged(Main *bmain, Scene *scene)
if (scene->physics_settings.quick_cache_step)
BKE_ptcache_quick_cache_all(bmain, scene);
- /* notify editors about recalc */
- DAG_ids_check_recalc(bmain);
-
- /* keep this last */
+ /* notify editors and python about recalc */
BLI_exec_cb(bmain, &scene->id, BLI_CB_EVT_SCENE_UPDATE_POST);
-}
+ DAG_ids_check_recalc(bmain, scene, FALSE);
-void scene_clear_tagged(Main *bmain, Scene *UNUSED(scene))
-{
+ /* clear recalc flags */
DAG_ids_clear_recalc(bmain);
}
@@ -1081,10 +1077,13 @@ void scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay)
/* object_handle_update() on all objects, groups and sets */
scene_update_tagged_recursive(bmain, sce, sce);
- /* keep this last */
+ /* notify editors and python about recalc */
BLI_exec_cb(bmain, &sce->id, BLI_CB_EVT_SCENE_UPDATE_POST);
BLI_exec_cb(bmain, &sce->id, BLI_CB_EVT_FRAME_CHANGE_POST);
+ DAG_ids_check_recalc(bmain, sce, TRUE);
+
+ /* clear recalc flags */
DAG_ids_clear_recalc(bmain);
}
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index 45e708a8233..cb94e3f3ec1 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -70,14 +70,37 @@ typedef struct MovieDistortion {
/*********************** common functions *************************/
+void BKE_tracking_init_settings(MovieTracking *tracking)
+{
+ tracking->camera.sensor_width= 35.0f;
+ tracking->camera.pixel_aspect= 1.0f;
+ tracking->camera.units= CAMERA_UNITS_MM;
+
+ tracking->settings.default_tracker= TRACKER_KLT;
+ tracking->settings.default_pyramid_levels= 2;
+ tracking->settings.default_minimum_correlation= 0.75;
+ tracking->settings.default_pattern_size= 11;
+ tracking->settings.default_search_size= 51;
+ tracking->settings.default_pyramid_levels= 2;
+ tracking->settings.keyframe1= 1;
+ tracking->settings.keyframe2= 30;
+ tracking->settings.dist= 1;
+
+ tracking->stabilization.scaleinf= 1.0f;
+ tracking->stabilization.locinf= 1.0f;
+ tracking->stabilization.rotinf= 1.0f;
+ tracking->stabilization.maxscale= 2.0f;
+}
+
void BKE_tracking_clamp_track(MovieTrackingTrack *track, int event)
{
int a;
float pat_min[2];
float pat_max[2];
float max_pyramid_level_factor = 1.0;
+
if (track->tracker == TRACKER_KLT) {
- max_pyramid_level_factor = 1 << (track->pyramid_levels - 1);
+ max_pyramid_level_factor= 1 << (track->pyramid_levels - 1);
}
/* sort */
@@ -146,7 +169,7 @@ void BKE_tracking_clamp_track(MovieTrackingTrack *track, int event)
float dim[2];
sub_v2_v2v2(dim, track->pat_max, track->pat_min);
{
- float search_ratio = 2.3f * max_pyramid_level_factor;
+ float search_ratio= 2.3f * max_pyramid_level_factor;
/* resize the search area to something sensible based
* on the number of pyramid levels */
@@ -190,25 +213,27 @@ MovieTrackingTrack *BKE_tracking_add_track(MovieTracking *tracking, float x, flo
{
MovieTrackingTrack *track;
MovieTrackingMarker marker;
+ MovieTrackingSettings *settings= &tracking->settings;
- /* pick reasonable defaults */
- float pat[2]= {5.5f, 5.5f}, search[2]= {25.5f, 25.5f}; /* TODO: move to default setting? */
+ float half_pattern= (float)settings->default_pattern_size/2.0f;
+ float half_search= (float)settings->default_search_size/2.0f;
+ float pat[2], search[2];
- pat[0] /= (float)width;
- pat[1] /= (float)height;
+ pat[0]= half_pattern/(float)width;
+ pat[1]= half_pattern/(float)height;
- search[0] /= (float)width;
- search[1] /= (float)height;
+ search[0]= half_search/(float)width;
+ search[1]= half_search/(float)height;
track= MEM_callocN(sizeof(MovieTrackingTrack), "add_marker_exec track");
strcpy(track->name, "Track");
- /* default to KLT tracker */
- track->tracker = TRACKER_KLT;
- track->pyramid_levels = 2;
-
- /* set SAD defaults even though it's not selected by default */
- track->minimum_correlation= 0.75f;
+ track->tracker= settings->default_tracker;
+ track->pyramid_levels= settings->default_pyramid_levels;
+ track->minimum_correlation= settings->default_minimum_correlation;
+ track->margin= settings->default_margin;
+ track->pattern_match= settings->default_pattern_match;
+ track->frames_limit= settings->default_frames_limit;
memset(&marker, 0, sizeof(marker));
marker.pos[0]= x;
@@ -223,6 +248,8 @@ MovieTrackingTrack *BKE_tracking_add_track(MovieTracking *tracking, float x, flo
BKE_tracking_insert_marker(track, &marker);
+ BKE_tracking_clamp_track(track, CLAMP_PYRAMID_LEVELS);
+
BLI_addtail(&tracking->tracks, track);
BKE_track_unique_name(tracking, track);
@@ -1050,7 +1077,7 @@ static ImBuf *get_adjust_ibuf(MovieTrackingContext *context, MovieTrackingTrack
{
ImBuf *ibuf= NULL;
- if(context->settings.adjframes == 0) {
+ if(track->pattern_match == TRACK_MATCH_KEYFRAME) {
ibuf= get_keyframed_ibuf(context, track, marker, marker_keyed);
} else {
ibuf= get_frame_ibuf(context, curfra);
@@ -1133,8 +1160,10 @@ int BKE_tracking_next(MovieTrackingContext *context)
int onbound= 0, coords_correct= 0;
int nextfra;
- if(!context->settings.adjframes) need_readjust= context->first_time;
- else need_readjust= context->frames%context->settings.adjframes == 0;
+ if(track->pattern_match==TRACK_MATCH_KEYFRAME)
+ need_readjust= context->first_time;
+ else
+ need_readjust= 1;
if(context->backwards) nextfra= curfra-1;
else nextfra= curfra+1;
@@ -1142,8 +1171,8 @@ int BKE_tracking_next(MovieTrackingContext *context)
/* margin from frame boundaries */
sub_v2_v2v2(margin, track->pat_max, track->pat_min);
- margin[0]= MAX2(margin[0], (float)context->settings.margin / ibuf_new->x);
- margin[1]= MAX2(margin[1], (float)context->settings.margin / ibuf_new->y);
+ margin[0]= MAX2(margin[0], (float)track->margin / ibuf_new->x);
+ margin[1]= MAX2(margin[1], (float)track->margin / ibuf_new->y);
/* do not track markers which are too close to boundary */
if(marker->pos[0]<margin[0] || marker->pos[0]>1.0f-margin[0] ||
@@ -1250,7 +1279,7 @@ int BKE_tracking_next(MovieTrackingContext *context)
#pragma omp critical
{
/* check if there's no keyframe/tracked markers before tracking marker.
- if so -- create disabled marker before currently tracking "segment" */
+ if so -- create disabled marker before currently tracking "segment" */
put_disabled_marker(track, marker, 1, 0);
}
}
@@ -1302,6 +1331,36 @@ int BKE_tracking_next(MovieTrackingContext *context)
return ok;
}
+/*********************** camera solving *************************/
+
+typedef struct MovieReconstructContext {
+#ifdef WITH_LIBMV
+ struct libmv_Tracks *tracks;
+ int keyframe1, keyframe2;
+ short refine_flags;
+
+ struct libmv_Reconstruction *reconstruction;
+#endif
+
+ float focal_length;
+ float principal_point[2];
+ float k1, k2, k3;
+
+ float reprojection_error;
+
+ TracksMap *tracks_map;
+
+ int sfra, efra;
+} MovieReconstructContext;
+
+typedef struct ReconstructProgressData {
+ short *stop;
+ short *do_update;
+ float *progress;
+ char *stats_message;
+ int message_size;
+} ReconstructProgressData;
+
#if WITH_LIBMV
static struct libmv_Tracks *create_libmv_tracks(MovieTracking *tracking, int width, int height)
{
@@ -1328,8 +1387,9 @@ static struct libmv_Tracks *create_libmv_tracks(MovieTracking *tracking, int wid
return tracks;
}
-static void retrieve_libmv_reconstruct_intrinscis(MovieTracking *tracking, struct libmv_Reconstruction *libmv_reconstruction)
+static void retrieve_libmv_reconstruct_intrinscis(MovieReconstructContext *context, MovieTracking *tracking)
{
+ struct libmv_Reconstruction *libmv_reconstruction= context->reconstruction;
struct libmv_CameraIntrinsics *libmv_intrinsics = libmv_ReconstructionExtractIntrinsics(libmv_reconstruction);
float aspy= 1.0f/tracking->camera.pixel_aspect;
@@ -1349,14 +1409,14 @@ static void retrieve_libmv_reconstruct_intrinscis(MovieTracking *tracking, struc
tracking->camera.k2= k2;
}
-static int retrieve_libmv_reconstruct_tracks(MovieTracking *tracking, struct libmv_Reconstruction *libmv_reconstruction)
+static int retrieve_libmv_reconstruct_tracks(MovieReconstructContext *context, MovieTracking *tracking)
{
- int tracknr= 0;
- int sfra= INT_MAX, efra= INT_MIN, a, origin_set= 0;
- MovieTrackingTrack *track;
+ struct libmv_Reconstruction *libmv_reconstruction= context->reconstruction;
MovieTrackingReconstruction *reconstruction= &tracking->reconstruction;
MovieReconstructedCamera *reconstructed;
- int ok= 1;
+ MovieTrackingTrack *track;
+ int ok= 1, tracknr= 0, a, origin_set= 0;
+ int sfra= context->sfra, efra= context->efra;
float imat[4][4];
unit_m4(imat);
@@ -1379,30 +1439,6 @@ static int retrieve_libmv_reconstruct_tracks(MovieTracking *tracking, struct lib
printf("No bundle for track #%d '%s'\n", tracknr, track->name);
}
- if(track->markersnr) {
- int first= 0, last= track->markersnr;
- MovieTrackingMarker *first_marker= &track->markers[0];
- MovieTrackingMarker *last_marker= &track->markers[track->markersnr-1];
-
- /* find first not-disabled marker */
- while(first<track->markersnr-1 && first_marker->flag&MARKER_DISABLED) {
- first++;
- first_marker++;
- }
-
- /* find last not-disabled marker */
- while(last>=0 && last_marker->flag&MARKER_DISABLED) {
- last--;
- last_marker--;
- }
-
- if(first<track->markersnr-1)
- sfra= MIN2(sfra, first_marker->framenr);
-
- if(last>=0)
- efra= MAX2(efra, last_marker->framenr);
- }
-
track= track->next;
tracknr++;
}
@@ -1465,12 +1501,14 @@ static int retrieve_libmv_reconstruct_tracks(MovieTracking *tracking, struct lib
return ok;
}
-static int retrieve_libmv_reconstruct(MovieTracking *tracking, struct libmv_Reconstruction *libmv_reconstruction)
+static int retrieve_libmv_reconstruct(MovieReconstructContext *context, MovieTracking *tracking)
{
+ tracks_map_merge(context->tracks_map, tracking);
+
/* take the intrinscis back from libmv */
- retrieve_libmv_reconstruct_intrinscis(tracking, libmv_reconstruction);
+ retrieve_libmv_reconstruct_intrinscis(context, tracking);
- return retrieve_libmv_reconstruct_tracks(tracking, libmv_reconstruction);
+ return retrieve_libmv_reconstruct_tracks(context, tracking);
}
static int get_refine_intrinsics_flags(MovieTracking *tracking)
@@ -1512,7 +1550,7 @@ static int count_tracks_on_both_keyframes(MovieTracking *tracking)
}
#endif
-int BKE_tracking_can_solve(MovieTracking *tracking, char *error_msg, int error_size)
+int BKE_tracking_can_reconstruct(MovieTracking *tracking, char *error_msg, int error_size)
{
#if WITH_LIBMV
if(count_tracks_on_both_keyframes(tracking)<8) {
@@ -1523,46 +1561,163 @@ int BKE_tracking_can_solve(MovieTracking *tracking, char *error_msg, int error_s
return 1;
#else
BLI_strncpy(error_msg, "Blender is compiled without motion tracking library", error_size);
- (void)tracking;
+ (void) tracking;
return 0;
#endif
}
-float BKE_tracking_solve_reconstruction(MovieTracking *tracking, int width, int height)
+MovieReconstructContext* BKE_tracking_reconstruction_context_new(MovieTracking *tracking,
+ int keyframe1, int keyframe2, int width, int height)
{
-#if WITH_LIBMV
- {
- MovieTrackingCamera *camera= &tracking->camera;
- float aspy= 1.0f/tracking->camera.pixel_aspect;
- struct libmv_Tracks *tracks= create_libmv_tracks(tracking, width, height*aspy);
- struct libmv_Reconstruction *reconstruction = libmv_solveReconstruction(tracks,
- tracking->settings.keyframe1, tracking->settings.keyframe2,
- get_refine_intrinsics_flags(tracking),
- camera->focal,
- camera->principal[0], camera->principal[1]*aspy,
- camera->k1, camera->k2, camera->k3);
- float error= libmv_reprojectionError(reconstruction);
+ MovieReconstructContext *context= MEM_callocN(sizeof(MovieReconstructContext), "MovieReconstructContext data");
+ MovieTrackingCamera *camera= &tracking->camera;
+ float aspy= 1.0f/tracking->camera.pixel_aspect;
+ int num_tracks= BLI_countlist(&tracking->tracks);
+ int sfra= INT_MAX, efra= INT_MIN;
+ MovieTrackingTrack *track;
+
+ context->tracks_map= tracks_map_new(num_tracks, 0);
+ track= tracking->tracks.first;
+ while(track) {
+ int first= 0, last= track->markersnr;
+ MovieTrackingMarker *first_marker= &track->markers[0];
+ MovieTrackingMarker *last_marker= &track->markers[track->markersnr-1];
+
+ /* find first not-disabled marker */
+ while(first<track->markersnr-1 && first_marker->flag&MARKER_DISABLED) {
+ first++;
+ first_marker++;
+ }
+
+ /* find last not-disabled marker */
+ while(last>=0 && last_marker->flag&MARKER_DISABLED) {
+ last--;
+ last_marker--;
+ }
+
+ if(first<track->markersnr-1)
+ sfra= MIN2(sfra, first_marker->framenr);
+
+ if(last>=0)
+ efra= MAX2(efra, last_marker->framenr);
+
+ tracks_map_insert(context->tracks_map, track, NULL);
- tracking->reconstruction.error= error;
+ track= track->next;
+ }
+
+ context->sfra= sfra;
+ context->efra= efra;
+
+#ifdef WITH_LIBMV
+ context->tracks= create_libmv_tracks(tracking, width, height*aspy);
+ context->keyframe1= keyframe1;
+ context->keyframe2= keyframe2;
+ context->refine_flags= get_refine_intrinsics_flags(tracking);
+#else
+ (void) width;
+ (void) height;
+ (void) keyframe1;
+ (void) keyframe2;
+#endif
+
+ context->focal_length= camera->focal;
+ context->principal_point[0]= camera->principal[0];
+ context->principal_point[1]= camera->principal[1]*aspy;
+
+ context->k1= camera->k1;
+ context->k2= camera->k2;
+ context->k2= camera->k2;
+
+ return context;
+}
- if(!retrieve_libmv_reconstruct(tracking, reconstruction))
- error= -1.0f;
+void BKE_tracking_reconstruction_context_free(MovieReconstructContext *context)
+{
+#ifdef WITH_LIBMV
+ if(context->reconstruction)
+ libmv_destroyReconstruction(context->reconstruction);
+
+ libmv_tracksDestroy(context->tracks);
+#endif
+
+ tracks_map_free(context->tracks_map, NULL);
- libmv_destroyReconstruction(reconstruction);
- libmv_tracksDestroy(tracks);
+ MEM_freeN(context);
+}
- tracking->reconstruction.flag|= TRACKING_RECONSTRUCTED;
+static void solve_reconstruction_update_cb(void *customdata, double progress, const char *message)
+{
+ ReconstructProgressData *progressdata= customdata;
- return error;
+ if(progressdata->progress) {
+ *progressdata->progress= progress;
+ *progressdata->do_update= 1;
}
+
+ BLI_snprintf(progressdata->stats_message, progressdata->message_size,
+ "Solving camera | %s", message);
+}
+
+#if 0
+static int solve_reconstruction_testbreak_cb(void *customdata)
+{
+ ReconstructProgressData *progressdata= customdata;
+
+ if(progressdata->stop && *progressdata->stop)
+ return 1;
+
+ return G.afbreek;
+}
+#endif
+
+void BKE_tracking_solve_reconstruction(MovieReconstructContext *context, short *stop,
+ short *do_update, float *progress, char *stats_message, int message_size)
+{
+#ifdef WITH_LIBMV
+ float error;
+
+ ReconstructProgressData progressdata;
+
+ progressdata.stop= stop;
+ progressdata.do_update= do_update;
+ progressdata.progress= progress;
+ progressdata.stats_message= stats_message;
+ progressdata.message_size= message_size;
+
+ context->reconstruction = libmv_solveReconstruction(context->tracks,
+ context->keyframe1, context->keyframe2,
+ context->refine_flags,
+ context->focal_length,
+ context->principal_point[0], context->principal_point[1],
+ context->k1, context->k2, context->k3,
+ solve_reconstruction_update_cb, &progressdata);
+
+ error= libmv_reprojectionError(context->reconstruction);
+
+ context->reprojection_error= error;
#else
- (void)tracking;
- (void)width;
- (void)height;
+ (void) context;
+ (void) stop;
+ (void) do_update;
+ (void) progress;
+ (void) stats_message;
+ (void) message_size;
+#endif
+}
- return -1.0f;
+int BKE_tracking_finish_reconstruction(MovieReconstructContext *context, MovieTracking *tracking)
+{
+ tracking->reconstruction.error= context->reprojection_error;
+ tracking->reconstruction.flag|= TRACKING_RECONSTRUCTED;
+
+#ifdef WITH_LIBMV
+ if(!retrieve_libmv_reconstruct(context, tracking))
+ return 0;
#endif
+
+ return 1;
}
void BKE_track_unique_name(MovieTracking *tracking, MovieTrackingTrack *track)
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 569e3368225..57cd3ab8537 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -6048,6 +6048,7 @@ static void direct_link_movieclip(FileData *fd, MovieClip *clip)
clip->anim= NULL;
clip->tracking_context= NULL;
+ clip->tracking.stats= NULL;
clip->tracking.stabilization.ok= 0;
clip->tracking.stabilization.scaleibuf= NULL;
@@ -12688,11 +12689,25 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* put compatibility code here until next subversion bump */
{
Scene *sce;
+ MovieClip *clip;
+
for(sce = main->scene.first; sce; sce = sce->id.next) {
if (sce->r.im_format.depth == 0) {
do_versions_image_settings_2_60(sce);
}
}
+
+ for (clip= main->movieclip.first; clip; clip= clip->id.next) {
+ MovieTrackingSettings *settings= &clip->tracking.settings;
+
+ if(settings->default_pyramid_levels==0) {
+ settings->default_tracker= TRACKER_KLT;
+ settings->default_pyramid_levels= 2;
+ settings->default_minimum_correlation= 0.75;
+ settings->default_pattern_size= 11;
+ settings->default_search_size= 51;
+ }
+ }
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
diff --git a/source/blender/bmesh/editmesh_tools.c b/source/blender/bmesh/editmesh_tools.c
index d05bf3e5177..4bbc0e267d5 100644
--- a/source/blender/bmesh/editmesh_tools.c
+++ b/source/blender/bmesh/editmesh_tools.c
@@ -528,7 +528,7 @@ void xsortvert_flag(int flag)
for (i=0,eve=em->verts.first; eve; i++,eve=eve->next)
if(eve->f & flag)
sortblock[i].v1 = eve;
- mesh_foreachScreenVert(xsortvert_flag__doSetX, sortblock, 0);
+ mesh_foreachScreenVert(xsortvert_flag__doSetX, sortblock, V3D_CLIP_TEST_OFF);
qsort(sortblock, amount, sizeof(xvertsort), vergxco);
/* make temporal listbase */
diff --git a/source/blender/editors/include/ED_render.h b/source/blender/editors/include/ED_render.h
index 7461f5e9e9f..73776f7234b 100644
--- a/source/blender/editors/include/ED_render.h
+++ b/source/blender/editors/include/ED_render.h
@@ -36,6 +36,7 @@ struct Main;
struct MTex;
struct Render;
struct RenderInfo;
+struct Scene;
/* render_ops.c */
@@ -45,7 +46,7 @@ void ED_operatortypes_render(void);
void ED_render_id_flush_update(struct Main *bmain, struct ID *id);
void ED_render_engine_changed(struct Main *bmain);
-void ED_render_engine_update_tagged(struct bContext *C, struct Main *bmain);
+void ED_render_scene_update(struct Main *bmain, struct Scene *scene, int updated);
/* render_preview.c */
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 1df8f723140..eab770e2dad 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -78,6 +78,12 @@ typedef struct ViewDepths {
char damaged;
} ViewDepths;
+/* enum for passing to foreach functions to test RV3D_CLIPPING */
+typedef enum eV3DClipTest {
+ V3D_CLIP_TEST_OFF = 0, /* clipping is off */
+ V3D_CLIP_TEST_RV3D_CLIPPING = 1, /* clip single points */
+ V3D_CLIP_TEST_REGION = 2 /* use for edges to check if both verts are in the view, but not RV3D_CLIPPING */
+} eV3DClipTest;
float *give_cursor(struct Scene *scene, struct View3D *v3d);
@@ -218,8 +224,8 @@ void ED_view3d_project_float_v3(struct ARegion *a, float *vec, float *adr, float
void ED_view3d_calc_camera_border_size(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct RegionView3D *rv3d, float size_r[2]);
/* drawobject.c iterators */
-void mesh_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct BMVert *eve, int x, int y, int index), void *userData, int clipVerts);
-void mesh_foreachScreenEdge(struct ViewContext *vc, void (*func)(void *userData, struct BMEdge *eed, int x0, int y0, int x1, int y1, int index), void *userData, int clipVerts);
+void mesh_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct BMVert *eve, int x, int y, int index), void *userData, eV3DClipTest clipVerts);
+void mesh_foreachScreenEdge(struct ViewContext *vc, void (*func)(void *userData, struct BMEdge *eed, int x0, int y0, int x1, int y1, int index), void *userData, eV3DClipTest clipVerts);
void mesh_foreachScreenFace(struct ViewContext *vc, void (*func)(void *userData, struct BMFace *efa, int x, int y, int index), void *userData);
void nurbs_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct Nurb *nu, struct BPoint *bp, struct BezTriple *bezt, int beztindex, int x, int y), void *userData);
void lattice_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct BPoint *bp, int x, int y), void *userData);
diff --git a/source/blender/editors/mesh/bmesh_select.c b/source/blender/editors/mesh/bmesh_select.c
index ad6715f9668..02f2531554e 100644
--- a/source/blender/editors/mesh/bmesh_select.c
+++ b/source/blender/editors/mesh/bmesh_select.c
@@ -423,11 +423,11 @@ BMVert *EDBM_findnearestvert(ViewContext *vc, int *dist, short sel, short strict
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
- mesh_foreachScreenVert(vc, findnearestvert__doClosest, &data, 1);
+ mesh_foreachScreenVert(vc, findnearestvert__doClosest, &data, V3D_CLIP_TEST_RV3D_CLIPPING);
if (data.dist>3) {
data.pass = 1;
- mesh_foreachScreenVert(vc, findnearestvert__doClosest, &data, 1);
+ mesh_foreachScreenVert(vc, findnearestvert__doClosest, &data, V3D_CLIP_TEST_RV3D_CLIPPING);
}
*dist = data.dist;
diff --git a/source/blender/editors/mesh/bmesh_tools.c b/source/blender/editors/mesh/bmesh_tools.c
index 090e01d701d..b9e3d44b77a 100644
--- a/source/blender/editors/mesh/bmesh_tools.c
+++ b/source/blender/editors/mesh/bmesh_tools.c
@@ -4054,7 +4054,7 @@ static void xsortvert_flag(bContext *UNUSED(C), int UNUSED(flag))
}
ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d);
- mesh_foreachScreenVert(&vc, xsortvert_flag__doSetX, sortblock, 0);
+ mesh_foreachScreenVert(&vc, xsortvert_flag__doSetX, sortblock, V3D_CLIP_TEST_OFF);
qsort(sortblock, amount, sizeof(xvertsort), vergxco);
diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c
index f353a090305..d921308aad5 100644
--- a/source/blender/editors/render/render_update.c
+++ b/source/blender/editors/render/render_update.c
@@ -41,6 +41,7 @@
#include "DNA_view3d_types.h"
#include "DNA_world_types.h"
+#include "BLI_threads.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
@@ -65,13 +66,25 @@
/***************************** Render Engines ********************************/
-void ED_render_engine_update_tagged(bContext *C, Main *bmain)
+void ED_render_scene_update(Main *bmain, Scene *scene, int updated)
{
/* viewport rendering update on data changes, happens after depsgraph
* updates if there was any change. context is set to the 3d view */
- bScreen *sc, *prev_sc= CTX_wm_screen(C);
- ScrArea *sa, *prev_sa= CTX_wm_area(C);
- ARegion *ar, *prev_ar= CTX_wm_region(C);
+ bContext *C;
+ bScreen *sc;
+ ScrArea *sa;
+ ARegion *ar;
+
+ /* don't do this render engine update if we're updating the scene from
+ other threads doing e.g. rendering or baking jobs */
+ if(!BLI_thread_is_main())
+ return;
+
+ C= CTX_create();
+ CTX_data_main_set(C, bmain);
+ CTX_data_scene_set(C, scene);
+
+ CTX_wm_manager_set(C, bmain->wm.first);
for(sc=bmain->screen.first; sc; sc=sc->id.next) {
for(sa=sc->areabase.first; sa; sa=sa->next) {
@@ -88,7 +101,7 @@ void ED_render_engine_update_tagged(bContext *C, Main *bmain)
rv3d= ar->regiondata;
engine= rv3d->render_engine;
- if(engine && (engine->flag & RE_ENGINE_DO_UPDATE)) {
+ if(engine && (updated || (engine->flag & RE_ENGINE_DO_UPDATE))) {
CTX_wm_screen_set(C, sc);
CTX_wm_area_set(C, sa);
CTX_wm_region_set(C, ar);
@@ -100,9 +113,7 @@ void ED_render_engine_update_tagged(bContext *C, Main *bmain)
}
}
- CTX_wm_screen_set(C, prev_sc);
- CTX_wm_area_set(C, prev_sa);
- CTX_wm_region_set(C, prev_ar);
+ CTX_free(C);
}
void ED_render_engine_changed(Main *bmain)
@@ -134,32 +145,6 @@ void ED_render_engine_changed(Main *bmain)
}
}
-static void tag_render_engines(Main *bmain)
-{
- /* tag running render engines for update later on */
- bScreen *sc;
- ScrArea *sa;
- ARegion *ar;
-
- for(sc=bmain->screen.first; sc; sc=sc->id.next) {
- for(sa=sc->areabase.first; sa; sa=sa->next) {
- if(sa->spacetype != SPACE_VIEW3D)
- continue;
-
- for(ar=sa->regionbase.first; ar; ar=ar->next) {
- RegionView3D *rv3d;
-
- if(ar->regiontype != RGN_TYPE_WINDOW)
- continue;
-
- rv3d= ar->regiondata;
- if(rv3d->render_engine)
- rv3d->render_engine->flag |= RE_ENGINE_DO_UPDATE;
- }
- }
- }
-}
-
/***************************** Updates ***********************************
* ED_render_id_flush_update gets called from DAG_id_tag_update, to do *
* editor level updates when the ID changes. when these ID blocks are in *
@@ -357,11 +342,6 @@ static void scene_changed(Main *bmain, Scene *UNUSED(scene))
void ED_render_id_flush_update(Main *bmain, ID *id)
{
- if(!id) {
- tag_render_engines(bmain);
- return;
- }
-
switch(GS(id->name)) {
case ID_MA:
material_changed(bmain, (Material*)id);
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index 630038d4c6b..a53da4ce006 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -191,27 +191,38 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
static void draw_movieclip_notes(SpaceClip *sc, ARegion *ar)
{
+ MovieClip *clip= ED_space_clip(sc);
+ MovieTracking *tracking= &clip->tracking;
char str[256]= {0};
+ int block= 0;
- if(sc->flag&SC_LOCK_SELECTION)
- strcpy(str, "Locked");
+ if(tracking->stats) {
+ BLI_strncpy(str, tracking->stats->message, sizeof(str));
+ block= 1;
+ } else {
+ if(sc->flag&SC_LOCK_SELECTION)
+ strcpy(str, "Locked");
+ }
if(str[0]) {
uiStyle *style= UI_GetStyle();
- int fontsize, fontwidth;
int fontid= style->widget.uifont_id;
+ int fontwidth;
+
+ BLF_size(fontid, 11.0f, 72);
- BLF_size(fontid, 11.0f, U.dpi);
- fontsize= BLF_height(fontid, str);
- fontwidth= BLF_width(fontid, str);
+ if(block)
+ fontwidth= ar->winx;
+ else
+ fontwidth= BLF_width(fontid, str);
glEnable(GL_BLEND);
glColor4f(0.0f, 0.0f, 0.0f, 0.6f);
- glRecti(0, ar->winy-fontsize-9, fontwidth+12, ar->winy);
+ glRecti(0, ar->winy-17, fontwidth+12, ar->winy);
glColor3f(1.0f, 1.0f, 1.0f);
- BLF_position(fontid, 6.0f, ar->winy-fontsize-5.0f, 0.0f);
+ BLF_position(fontid, 6.0f, ar->winy-13.0f, 0.0f);
BLF_draw(fontid, str, strlen(str));
glDisable(GL_BLEND);
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index 6eb5e511bc4..89c58ab5d81 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -684,7 +684,7 @@ static int track_mouse_area(SpaceClip *sc, float co[2], MovieTrackingTrack *trac
epsy= MIN4(track->pat_min[1]-track->search_min[1], track->search_max[1]-track->pat_max[1],
fabsf(track->pat_min[1]), fabsf(track->pat_max[1])) / 2;
- epsx= MAX2(epsy, 2.0f / width);
+ epsx= MAX2(epsx, 2.0f / width);
epsy= MAX2(epsy, 2.0f / height);
if(sc->flag&SC_SHOW_MARKER_SEARCH)
@@ -1221,10 +1221,11 @@ static int track_count_markers(SpaceClip *sc, MovieClip *clip)
return tot;
}
-static void track_init_markers(SpaceClip *sc, MovieClip *clip)
+static void track_init_markers(SpaceClip *sc, MovieClip *clip, int *frames_limit_r)
{
MovieTrackingTrack *track;
int framenr= sc->user.framenr, hidden= 0;
+ int frames_limit= 0;
if((sc->flag&SC_SHOW_MARKER_PATTERN)==0) hidden|= TRACK_AREA_PAT;
if((sc->flag&SC_SHOW_MARKER_SEARCH)==0) hidden|= TRACK_AREA_SEARCH;
@@ -1235,12 +1236,22 @@ static void track_init_markers(SpaceClip *sc, MovieClip *clip)
BKE_tracking_track_flag(track, hidden, SELECT, 1);
if(TRACK_SELECTED(track)) {
- if((track->flag&TRACK_HIDDEN)==0 && (track->flag&TRACK_LOCKED)==0)
+ if((track->flag&TRACK_HIDDEN)==0 && (track->flag&TRACK_LOCKED)==0) {
BKE_tracking_ensure_marker(track, framenr);
+
+ if(track->frames_limit) {
+ if(frames_limit==0)
+ frames_limit= track->frames_limit;
+ else
+ frames_limit= MIN2(frames_limit, track->frames_limit);
+ }
+ }
}
track= track->next;
}
+
+ *frames_limit_r= frames_limit;
}
static int track_markers_check_direction(int backwards, int curfra, int efra)
@@ -1261,6 +1272,9 @@ static int track_markers_initjob(bContext *C, TrackMarkersJob *tmj, int backward
MovieClip *clip= ED_space_clip(sc);
Scene *scene= CTX_data_scene(C);
MovieTrackingSettings *settings= &clip->tracking.settings;
+ int frames_limit;
+
+ track_init_markers(sc, clip, &frames_limit);
tmj->sfra= sc->user.framenr;
tmj->clip= clip;
@@ -1270,9 +1284,9 @@ static int track_markers_initjob(bContext *C, TrackMarkersJob *tmj, int backward
else tmj->efra= EFRA;
/* limit frames to be tracked by user setting */
- if(settings->frames_limit) {
- if(backwards) tmj->efra= MAX2(tmj->efra, tmj->sfra-settings->frames_limit);
- else tmj->efra= MIN2(tmj->efra, tmj->sfra+settings->frames_limit);
+ if(frames_limit) {
+ if(backwards) tmj->efra= MAX2(tmj->efra, tmj->sfra-frames_limit);
+ else tmj->efra= MIN2(tmj->efra, tmj->sfra+frames_limit);
}
if(settings->speed!=TRACKING_SPEED_FASTEST) {
@@ -1283,8 +1297,6 @@ static int track_markers_initjob(bContext *C, TrackMarkersJob *tmj, int backward
else if(settings->speed==TRACKING_SPEED_DOUBLE) tmj->delay/= 2;
}
- track_init_markers(sc, clip);
-
tmj->context= BKE_tracking_context_new(clip, &sc->user, backwards, 1);
clip->tracking_context= tmj->context;
@@ -1376,25 +1388,25 @@ static int track_markers_exec(bContext *C, wmOperator *op)
int sfra= framenr, efra;
int backwards= RNA_boolean_get(op->ptr, "backwards");
int sequence= RNA_boolean_get(op->ptr, "sequence");
- MovieTrackingSettings *settings= &clip->tracking.settings;
+ int frames_limit;
if(track_count_markers(sc, clip)==0)
return OPERATOR_CANCELLED;
+ track_init_markers(sc, clip, &frames_limit);
+
if(backwards) efra= SFRA;
else efra= EFRA;
/* limit frames to be tracked by user setting */
- if(settings->frames_limit) {
- if(backwards) efra= MAX2(efra, sfra-settings->frames_limit);
- else efra= MIN2(efra, sfra+settings->frames_limit);
+ if(frames_limit) {
+ if(backwards) efra= MAX2(efra, sfra-frames_limit);
+ else efra= MIN2(efra, sfra+frames_limit);
}
if(!track_markers_check_direction(backwards, framenr, efra))
return OPERATOR_CANCELLED;
- track_init_markers(sc, clip);
-
/* do not disable tracks due to threshold when tracking frame-by-frame */
context= BKE_tracking_context_new(clip, &sc->user, backwards, sequence);
@@ -1473,7 +1485,7 @@ static int track_markers_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
static int track_markers_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
- /* no running blender, remove handler and pass through */
+ /* no running tracking, remove handler and pass through */
if(0==WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C)))
return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
@@ -1510,61 +1522,201 @@ void CLIP_OT_track_markers(wmOperatorType *ot)
/********************** solve camera operator *********************/
-static int solve_camera_exec(bContext *C, wmOperator *op)
+typedef struct {
+ Scene *scene;
+ MovieClip *clip;
+ MovieClipUser user;
+
+ ReportList *reports;
+
+ char stats_message[256];
+
+ struct MovieReconstructContext *context;
+} SolveCameraJob;
+
+static int solve_camera_initjob(bContext *C, SolveCameraJob *scj, wmOperator *op, char *error_msg, int max_error)
{
SpaceClip *sc= CTX_wm_space_clip(C);
MovieClip *clip= ED_space_clip(sc);
Scene *scene= CTX_data_scene(C);
MovieTracking *tracking= &clip->tracking;
+ MovieTrackingSettings *settings= &clip->tracking.settings;
int width, height;
- float error;
- char error_msg[255];
-
- if(!BKE_tracking_can_solve(tracking, error_msg, sizeof(error_msg))) {
- BKE_report(op->reports, RPT_ERROR, error_msg);
- return OPERATOR_CANCELLED;
- }
+ if(!BKE_tracking_can_reconstruct(tracking, error_msg, max_error))
+ return 0;
/* could fail if footage uses images with different sizes */
BKE_movieclip_get_size(clip, &sc->user, &width, &height);
- error= BKE_tracking_solve_reconstruction(tracking, width, height);
+ scj->clip= clip;
+ scj->scene= scene;
+ scj->reports= op->reports;
+ scj->user= sc->user;
+
+ scj->context= BKE_tracking_reconstruction_context_new(tracking,
+ settings->keyframe1, settings->keyframe2, width, height);
+
+ tracking->stats= MEM_callocN(sizeof(MovieTrackingStats), "solve camera stats");
+
+ return 1;
+}
+
+static void solve_camera_updatejob(void *scv)
+{
+ SolveCameraJob *scj= (SolveCameraJob *)scv;
+ MovieTracking *tracking= &scj->clip->tracking;
+
+ BLI_strncpy(tracking->stats->message, scj->stats_message, sizeof(tracking->stats->message));
+}
+
+static void solve_camera_startjob(void *scv, short *stop, short *do_update, float *progress)
+{
+ SolveCameraJob *scj= (SolveCameraJob *)scv;
+
+ BKE_tracking_solve_reconstruction(scj->context, stop, do_update, progress,
+ scj->stats_message, sizeof(scj->stats_message));
+}
+
+static void solve_camera_freejob(void *scv)
+{
+ SolveCameraJob *scj= (SolveCameraJob *)scv;
+ MovieTracking *tracking= &scj->clip->tracking;
+ Scene *scene= scj->scene;
+ MovieClip *clip= scj->clip;
+ int solved;
+
+ if(!scj->context) {
+ /* job weren't fully initialized due to some error */
+ MEM_freeN(scj);
+ return;
+ }
+
+ solved= BKE_tracking_finish_reconstruction(scj->context, tracking);
- if(error<0)
- BKE_report(op->reports, RPT_WARNING, "Some data failed to reconstruct, see console for details");
+ if(!solved)
+ BKE_report(scj->reports, RPT_WARNING, "Some data failed to reconstruct, see console for details");
else
- BKE_reportf(op->reports, RPT_INFO, "Average reprojection error %.3f", error);
+ BKE_reportf(scj->reports, RPT_INFO, "Average reprojection error %.3f", tracking->reconstruction.error);
+ /* set currently solved clip as active for scene */
if(scene->clip)
id_us_min(&clip->id);
scene->clip= clip;
id_us_plus(&clip->id);
+ /* set blender camera focal length so result would look fine there */
if(!scene->camera)
scene->camera= scene_find_camera(scene);
if(scene->camera) {
- /* set blender camera focal length so result would look fine there */
Camera *camera= (Camera*)scene->camera->data;
+ int width, height;
+
+ BKE_movieclip_get_size(clip, &scj->user, &width, &height);
BKE_tracking_camera_to_blender(tracking, scene, camera, width, height);
- WM_event_add_notifier(C, NC_OBJECT, camera);
+ WM_main_add_notifier(NC_OBJECT, camera);
}
+ MEM_freeN(tracking->stats);
+ tracking->stats= NULL;
+
DAG_id_tag_update(&clip->id, 0);
- WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip);
- WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+ WM_main_add_notifier(NC_MOVIECLIP|NA_EVALUATED, clip);
+ WM_main_add_notifier(NC_OBJECT|ND_TRANSFORM, NULL);
/* update active clip displayed in scene buttons */
- WM_event_add_notifier(C, NC_SCENE, scene);
+ WM_main_add_notifier(NC_SCENE, scene);
+
+ BKE_tracking_reconstruction_context_free(scj->context);
+ MEM_freeN(scj);
+}
+
+static int solve_camera_exec(bContext *C, wmOperator *op)
+{
+ SolveCameraJob *scj;
+ char error_msg[256]= "\0";
+
+ scj= MEM_callocN(sizeof(SolveCameraJob), "SolveCameraJob data");
+ if(!solve_camera_initjob(C, scj, op, error_msg, sizeof(error_msg))) {
+ if(error_msg[0])
+ BKE_report(op->reports, RPT_ERROR, error_msg);
+
+ solve_camera_freejob(scj);
+
+ return OPERATOR_CANCELLED;
+ }
+
+ solve_camera_startjob(scj, NULL, NULL, NULL);
+
+ solve_camera_freejob(scj);
return OPERATOR_FINISHED;
}
+static int solve_camera_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+{
+ SolveCameraJob *scj;
+ ScrArea *sa= CTX_wm_area(C);
+ SpaceClip *sc= CTX_wm_space_clip(C);
+ MovieClip *clip= ED_space_clip(sc);
+ MovieTracking *tracking= &clip->tracking;
+ wmJob *steve;
+ char error_msg[256]= "\0";
+
+ scj= MEM_callocN(sizeof(SolveCameraJob), "SolveCameraJob data");
+ if(!solve_camera_initjob(C, scj, op, error_msg, sizeof(error_msg))) {
+ if(error_msg[0])
+ BKE_report(op->reports, RPT_ERROR, error_msg);
+
+ solve_camera_freejob(scj);
+
+ return OPERATOR_CANCELLED;
+ }
+
+ BLI_strncpy(tracking->stats->message, "Solving camera | Preparing solve", sizeof(tracking->stats->message));
+
+ /* hide reconstruction statistics from previous solve */
+ clip->tracking.reconstruction.flag&= ~TRACKING_RECONSTRUCTED;
+ WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip);
+
+ /* setup job */
+ steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Solve Camera", WM_JOB_PROGRESS);
+ WM_jobs_customdata(steve, scj, solve_camera_freejob);
+ WM_jobs_timer(steve, 0.1, NC_MOVIECLIP|NA_EVALUATED, 0);
+ WM_jobs_callbacks(steve, solve_camera_startjob, NULL, solve_camera_updatejob, NULL);
+
+ G.afbreek= 0;
+
+ WM_jobs_start(CTX_wm_manager(C), steve);
+ WM_cursor_wait(0);
+
+ /* add modal handler for ESC */
+ WM_event_add_modal_handler(C, op);
+
+ return OPERATOR_RUNNING_MODAL;
+}
+
+static int solve_camera_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
+{
+ /* no running solver, remove handler and pass through */
+ if(0==WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C)))
+ return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
+
+ /* running tracking */
+ switch (event->type) {
+ case ESCKEY:
+ return OPERATOR_RUNNING_MODAL;
+ break;
+ }
+
+ return OPERATOR_PASS_THROUGH;
+}
+
void CLIP_OT_solve_camera(wmOperatorType *ot)
{
/* identifiers */
@@ -1574,6 +1726,8 @@ void CLIP_OT_solve_camera(wmOperatorType *ot)
/* api callbacks */
ot->exec= solve_camera_exec;
+ ot->invoke= solve_camera_invoke;
+ ot->modal= solve_camera_modal;
ot->poll= ED_space_clip_poll;
/* flags */
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 1ed4edd5fcb..e0b8a3241ea 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -152,7 +152,7 @@ static int check_ob_drawface_dot(Scene *sce, View3D *vd, char dt)
/* ************* only use while object drawing **************
* or after running ED_view3d_init_mats_rv3d
* */
-static void view3d_project_short_clip(ARegion *ar, const float vec[3], short *adr, int local)
+static void view3d_project_short_clip(ARegion *ar, const float vec[3], short adr[2], int local)
{
RegionView3D *rv3d= ar->regiondata;
float fx, fy, vec4[4];
@@ -187,7 +187,7 @@ static void view3d_project_short_clip(ARegion *ar, const float vec[3], short *ad
}
/* only use while object drawing */
-static void view3d_project_short_noclip(ARegion *ar, const float vec[3], short *adr)
+static void view3d_project_short_noclip(ARegion *ar, const float vec[3], short adr[2])
{
RegionView3D *rv3d= ar->regiondata;
float fx, fy, vec4[4];
@@ -215,7 +215,7 @@ static void view3d_project_short_noclip(ARegion *ar, const float vec[3], short *
}
/* same as view3d_project_short_clip but use persmat instead of persmatob for projection */
-static void view3d_project_short_clip_persmat(ARegion *ar, float *vec, short *adr, int local)
+static void view3d_project_short_clip_persmat(ARegion *ar, float *vec, short adr[2], int local)
{
RegionView3D *rv3d= ar->regiondata;
float fx, fy, vec4[4];
@@ -1903,13 +1903,14 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob)
* use the object matrix in the useual way */
static void mesh_foreachScreenVert__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
{
- struct { void (*func)(void *userData, BMVert *eve, int x, int y, int index); void *userData; ViewContext vc; int clipVerts; float pmat[4][4], vmat[4][4]; } *data = userData;
+ struct { void (*func)(void *userData, BMVert *eve, int x, int y, int index);
+ void *userData; ViewContext vc; eV3DClipTest clipVerts; float pmat[4][4], vmat[4][4]; } *data = userData;
BMVert *eve = EDBM_get_vert_for_index(data->vc.em, index);
if (!BM_TestHFlag(eve, BM_HIDDEN)) {
short s[2]= {IS_CLIPPED, 0};
- if (data->clipVerts) {
+ if (data->clipVerts != V3D_CLIP_TEST_OFF) {
view3d_project_short_clip(data->vc.ar, co, s, 1);
} else {
float co2[2];
@@ -1922,9 +1923,10 @@ static void mesh_foreachScreenVert__mapFunc(void *userData, int index, float *co
}
}
-void mesh_foreachScreenVert(ViewContext *vc, void (*func)(void *userData, BMVert *eve, int x, int y, int index), void *userData, int clipVerts)
+void mesh_foreachScreenVert(ViewContext *vc, void (*func)(void *userData, BMVert *eve, int x, int y, int index), void *userData, eV3DClipTest clipVerts)
{
- struct { void (*func)(void *userData, BMVert *eve, int x, int y, int index); void *userData; ViewContext vc; int clipVerts; float pmat[4][4], vmat[4][4]; } data;
+ struct { void (*func)(void *userData, BMVert *eve, int x, int y, int index);
+ void *userData; ViewContext vc; eV3DClipTest clipVerts; float pmat[4][4], vmat[4][4]; } data;
DerivedMesh *dm = editbmesh_get_derived_cage(vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH);
data.vc= *vc;
@@ -1933,7 +1935,7 @@ void mesh_foreachScreenVert(ViewContext *vc, void (*func)(void *userData, BMVert
data.clipVerts = clipVerts;
EDBM_init_index_arrays(vc->em, 1, 0, 0);
- if(clipVerts)
+ if(clipVerts != V3D_CLIP_TEST_OFF)
ED_view3d_local_clipping(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups */
dm->foreachMappedVert(dm, mesh_foreachScreenVert__mapFunc, &data);
@@ -1968,18 +1970,28 @@ static void drawSelectedVertices(DerivedMesh *dm, Mesh *me)
dm->foreachMappedVert(dm, drawSelectedVertices__mapFunc, me->mvert);
glEnd();
}
+static int is_co_in_region(ARegion *ar, const short co[2])
+{
+ return ( (co[0] != IS_CLIPPED) && /* may be the only initialized value, check first */
+ (co[0] >= 0) &&
+ (co[0] < ar->winx) &&
+ (co[1] >= 0) &&
+ (co[1] < ar->winy));
+}
static void mesh_foreachScreenEdge__mapFunc(void *userData, int index, float *v0co, float *v1co)
{
- struct { void (*func)(void *userData, BMEdge *eed, int x0, int y0, int x1, int y1, int index); void *userData; ViewContext vc; int clipVerts; float pmat[4][4], vmat[4][4]; } *data = userData;
+ struct { void (*func)(void *userData, BMEdge *eed, int x0, int y0, int x1, int y1, int index);
+ void *userData; ViewContext vc; eV3DClipTest clipVerts; float pmat[4][4], vmat[4][4]; } *data = userData;
BMEdge *eed = EDBM_get_edge_for_index(data->vc.em, index);
if (!BM_TestHFlag(eed, BM_HIDDEN)) {
short s[2][2];
- if (data->clipVerts==1) {
+ if (data->clipVerts == V3D_CLIP_TEST_RV3D_CLIPPING) {
view3d_project_short_clip(data->vc.ar, v0co, s[0], 1);
view3d_project_short_clip(data->vc.ar, v1co, s[1], 1);
- } else {
+ }
+ else {
float v1_co[3], v2_co[3];
mul_v3_m4v3(v1_co, data->vc.obedit->obmat, v0co);
@@ -1988,10 +2000,12 @@ static void mesh_foreachScreenEdge__mapFunc(void *userData, int index, float *v0
project_short_noclip(data->vc.ar, v1_co, s[0]);
project_short_noclip(data->vc.ar, v2_co, s[1]);
- if (data->clipVerts==2) {
- if (!(s[0][0]>=0 && s[0][1]>= 0 && s[0][0]<data->vc.ar->winx && s[0][1]<data->vc.ar->winy))
- if (!(s[1][0]>=0 && s[1][1]>= 0 && s[1][0]<data->vc.ar->winx && s[1][1]<data->vc.ar->winy))
- return;
+ if (data->clipVerts == V3D_CLIP_TEST_REGION) {
+ if ( !is_co_in_region(data->vc.ar, s[0]) &&
+ !is_co_in_region(data->vc.ar, s[1]))
+ {
+ return;
+ }
}
}
@@ -1999,9 +2013,10 @@ static void mesh_foreachScreenEdge__mapFunc(void *userData, int index, float *v0
}
}
-void mesh_foreachScreenEdge(ViewContext *vc, void (*func)(void *userData, BMEdge *eed, int x0, int y0, int x1, int y1, int index), void *userData, int clipVerts)
+void mesh_foreachScreenEdge(ViewContext *vc, void (*func)(void *userData, BMEdge *eed, int x0, int y0, int x1, int y1, int index), void *userData, eV3DClipTest clipVerts)
{
- struct { void (*func)(void *userData, BMEdge *eed, int x0, int y0, int x1, int y1, int index); void *userData; ViewContext vc; int clipVerts; float pmat[4][4], vmat[4][4]; } data;
+ struct { void (*func)(void *userData, BMEdge *eed, int x0, int y0, int x1, int y1, int index);
+ void *userData; ViewContext vc; int clipVerts; float pmat[4][4], vmat[4][4]; } data;
DerivedMesh *dm = editbmesh_get_derived_cage(vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH);
data.vc= *vc;
@@ -2010,7 +2025,7 @@ void mesh_foreachScreenEdge(ViewContext *vc, void (*func)(void *userData, BMEdge
data.clipVerts = clipVerts;
EDBM_init_index_arrays(vc->em, 0, 1, 0);
- if(clipVerts)
+ if(clipVerts != V3D_CLIP_TEST_OFF)
ED_view3d_local_clipping(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups */
dm->foreachMappedEdge(dm, mesh_foreachScreenEdge__mapFunc, &data);
@@ -5876,9 +5891,8 @@ static void draw_bb_quadric(BoundBox *bb, char type)
}
else if(type==OB_BOUND_CONE) {
float radius = size[0] > size[1] ? size[0] : size[1];
- glTranslatef(cent[0], cent[2]-size[2], cent[1]);
- glScalef(radius, 2.0f * size[2], radius);
- glRotatef(-90., 1.0, 0.0, 0.0);
+ glTranslatef(cent[0], cent[1], cent[2]-size[2]);
+ glScalef(radius, radius, 2.0f * size[2]);
gluCylinder(qobj, 1.0, 0.0, 1.0, 8, 1);
}
glPopMatrix();
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 29c7f2cc7fd..a4c7749dc8e 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -528,17 +528,17 @@ static void do_lasso_select_mesh(ViewContext *vc, int mcords[][2], short moves,
EDBM_backbuf_checkAndSelectVerts(vc->em, select);
}
else {
- mesh_foreachScreenVert(vc, do_lasso_select_mesh__doSelectVert, &data, 1);
+ mesh_foreachScreenVert(vc, do_lasso_select_mesh__doSelectVert, &data, V3D_CLIP_TEST_RV3D_CLIPPING);
}
}
if(ts->selectmode & SCE_SELECT_EDGE) {
/* Does both bbsel and non-bbsel versions (need screen cos for both) */
data.pass = 0;
- mesh_foreachScreenEdge(vc, do_lasso_select_mesh__doSelectEdge, &data, 0);
+ mesh_foreachScreenEdge(vc, do_lasso_select_mesh__doSelectEdge, &data, V3D_CLIP_TEST_OFF);
if (data.done==0) {
data.pass = 1;
- mesh_foreachScreenEdge(vc, do_lasso_select_mesh__doSelectEdge, &data, 0);
+ mesh_foreachScreenEdge(vc, do_lasso_select_mesh__doSelectEdge, &data, V3D_CLIP_TEST_OFF);
}
}
@@ -1651,18 +1651,18 @@ static int do_mesh_box_select(ViewContext *vc, rcti *rect, int select, int exten
if (bbsel) {
EDBM_backbuf_checkAndSelectVerts(vc->em, select);
} else {
- mesh_foreachScreenVert(vc, do_mesh_box_select__doSelectVert, &data, 1);
+ mesh_foreachScreenVert(vc, do_mesh_box_select__doSelectVert, &data, V3D_CLIP_TEST_RV3D_CLIPPING);
}
}
if(ts->selectmode & SCE_SELECT_EDGE) {
/* Does both bbsel and non-bbsel versions (need screen cos for both) */
data.pass = 0;
- mesh_foreachScreenEdge(vc, do_mesh_box_select__doSelectEdge, &data, 0);
+ mesh_foreachScreenEdge(vc, do_mesh_box_select__doSelectEdge, &data, V3D_CLIP_TEST_OFF);
if (data.done==0) {
data.pass = 1;
- mesh_foreachScreenEdge(vc, do_mesh_box_select__doSelectEdge, &data, 0);
+ mesh_foreachScreenEdge(vc, do_mesh_box_select__doSelectEdge, &data, V3D_CLIP_TEST_OFF);
}
}
@@ -2177,7 +2177,7 @@ static void mesh_circle_select(ViewContext *vc, int select, const int mval[2], f
if(bbsel) {
EDBM_backbuf_checkAndSelectVerts(vc->em, select==LEFTMOUSE);
} else {
- mesh_foreachScreenVert(vc, mesh_circle_doSelectVert, &data, 1);
+ mesh_foreachScreenVert(vc, mesh_circle_doSelectVert, &data, V3D_CLIP_TEST_RV3D_CLIPPING);
}
}
@@ -2185,7 +2185,7 @@ static void mesh_circle_select(ViewContext *vc, int select, const int mval[2], f
if (bbsel) {
EDBM_backbuf_checkAndSelectEdges(vc->em, select==LEFTMOUSE);
} else {
- mesh_foreachScreenEdge(vc, mesh_circle_doSelectEdge, &data, 0);
+ mesh_foreachScreenEdge(vc, mesh_circle_doSelectEdge, &data, V3D_CLIP_TEST_OFF);
}
}
diff --git a/source/blender/makesdna/DNA_tracking_types.h b/source/blender/makesdna/DNA_tracking_types.h
index cbac3721ac3..c4e6fcc4dc8 100644
--- a/source/blender/makesdna/DNA_tracking_types.h
+++ b/source/blender/makesdna/DNA_tracking_types.h
@@ -100,33 +100,40 @@ typedef struct MovieTrackingTrack {
float color[3]; /* custom color for track */
/* tracking algorithm to use; can be KLT or SAD */
- short tracker;
- char pad4[2];
+ short frames_limit; /* number of frames to be tarcked during single tracking session (if TRACKING_FRAMES_LIMIT is set) */
+ short margin; /* margin from frame boundaries */
+ short pattern_match; /* re-adjust every N frames */
- /* ** SAD tracker settings ** */
- float minimum_correlation; /* minimal correlation which is still treated as successful tracking */
+ short tracker; /* tracking algorithm used for this track */
/* ** KLT tracker settings ** */
- int pyramid_levels; /* number of pyramid levels to use for KLT tracking */
- char pad5[4];
+ short pyramid_levels, pad2; /* number of pyramid levels to use for KLT tracking */
+
+ /* ** SAD tracker settings ** */
+ float minimum_correlation; /* minimal correlation which is still treated as successful tracking */
} MovieTrackingTrack;
typedef struct MovieTrackingSettings {
+ int flag;
+
+ /* ** default tracker settings */
+ short default_tracker; /* tracking algorithm used by default */
+ short default_pyramid_levels; /* number of pyramid levels to use for KLT tracking */
+ float default_minimum_correlation; /* minimal correlation which is still treated as successful tracking */
+ short default_pattern_size; /* size of pattern area for new tracks */
+ short default_search_size; /* size of search area for new tracks */
+ short default_frames_limit; /* number of frames to be tarcked during single tracking session (if TRACKING_FRAMES_LIMIT is set) */
+ short default_margin; /* margin from frame boundaries */
+ short default_pattern_match; /* re-adjust every N frames */
+
/* ** common tracker settings ** */
short speed; /* speed of tracking */
- short frames_limit; /* number of frames to be tarcked during single tracking session (if TRACKING_FRAMES_LIMIT is set) */
- short margin; /* margin from frame boundaries */
- char pad[2];
-
- int adjframes; /* re-adjust every N frames */
/* ** reconstruction settings ** */
int keyframe1, keyframe2; /* two keyframes for reconstrution initialization */
/* ** which camera intrinsics to refine. uses on the REFINE_* flags */
- short refine_camera_intrinsics;
-
- char pad2[6];
+ short refine_camera_intrinsics, pad2;
/* ** tool settings ** */
@@ -135,7 +142,7 @@ typedef struct MovieTrackingSettings {
/* cleanup */
int clean_frames, clean_action;
- float clean_error;
+ float clean_error, pad;
} MovieTrackingSettings;
typedef struct MovieTrackingStabilization {
@@ -165,15 +172,19 @@ typedef struct MovieTrackingReconstruction {
struct MovieReconstructedCamera *cameras; /* reconstructed cameras */
} MovieTrackingReconstruction;
+typedef struct MovieTrackingStats {
+ char message[256];
+} MovieTrackingStats;
+
typedef struct MovieTracking {
MovieTrackingSettings settings; /* different tracking-related settings */
- char pad2[4];
-
MovieTrackingCamera camera; /* camera intrinsics */
ListBase tracks; /* all tracks */
MovieTrackingReconstruction reconstruction; /* reconstruction data */
MovieTrackingStabilization stabilization; /* stabilization data */
MovieTrackingTrack *act_track; /* active track */
+
+ MovieTrackingStats *stats; /* statistics displaying in clip editor */
} MovieTracking;
/* MovieTrackingCamera->units */
@@ -197,10 +208,17 @@ enum {
#define TRACK_CUSTOMCOLOR (1<<7)
#define TRACK_USE_2D_STAB (1<<8)
-/* MovieTrackingSettings->tracker */
+/* MovieTrackingTrack->tracker */
#define TRACKER_KLT 0
#define TRACKER_SAD 1
+/* MovieTrackingTrack->adjframes */
+#define TRACK_MATCH_KEYFRAME 0
+#define TRACK_MATCH_PREVFRAME 1
+
+/* MovieTrackingSettings->flag */
+#define TRACKING_SETTINGS_SHOW_DEFAULT_EXPANDED (1<<0)
+
/* MovieTrackingSettings->speed */
#define TRACKING_SPEED_FASTEST 0
#define TRACKING_SPEED_REALTIME 1
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 0bbe253072a..42926f72c4f 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -746,7 +746,7 @@ static void rna_def_property_subdivision_common(StructRNA *srna, const char type
PropertyRNA *prop= RNA_def_property(srna, "subdivision_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, type);
RNA_def_property_enum_items(prop, prop_subdivision_type_items);
- RNA_def_property_ui_text(prop, "Subdivision Type", "Selects type of subdivision algorithm");
+ RNA_def_property_ui_text(prop, "Subdivision Type", "Select type of subdivision algorithm");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
@@ -787,7 +787,7 @@ static void rna_def_modifier_subsurf(BlenderRNA *brna)
static void rna_def_modifier_generic_map_info(StructRNA *srna)
{
static EnumPropertyItem prop_texture_coordinates_items[] = {
- {MOD_DISP_MAP_LOCAL, "LOCAL", 0, "Map", "Use the local coordinate system for the texture coordinates"},
+ {MOD_DISP_MAP_LOCAL, "LOCAL", 0, "Local", "Use the local coordinate system for the texture coordinates"},
{MOD_DISP_MAP_GLOBAL, "GLOBAL", 0, "Global", "Use the global coordinate system for the texture coordinates"},
{MOD_DISP_MAP_OBJECT, "OBJECT", 0, "Object", "Use the linked object's local coordinate system for the texture coordinates"},
{MOD_DISP_MAP_UV, "UV", 0, "UV", "Use UV coordinates for the texture coordinates"},
@@ -1013,13 +1013,13 @@ static void rna_def_modifier_build(BlenderRNA *brna)
prop= RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_TIME);
RNA_def_property_float_sdna(prop, NULL, "start");
RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
- RNA_def_property_ui_text(prop, "Start", "Specify the start frame of the effect");
+ RNA_def_property_ui_text(prop, "Start", "Start frame of the effect");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop= RNA_def_property(srna, "frame_duration", PROP_FLOAT, PROP_TIME);
RNA_def_property_float_sdna(prop, NULL, "length");
RNA_def_property_range(prop, 1, MAXFRAMEF);
- RNA_def_property_ui_text(prop, "Length", "Specify the total time the build effect requires");
+ RNA_def_property_ui_text(prop, "Length", "Total time the build effect requires");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop= RNA_def_property(srna, "use_random_order", PROP_BOOLEAN, PROP_NONE);
@@ -1029,7 +1029,7 @@ static void rna_def_modifier_build(BlenderRNA *brna)
prop= RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 1, MAXFRAMEF);
- RNA_def_property_ui_text(prop, "Seed", "Specify the seed for random if used");
+ RNA_def_property_ui_text(prop, "Seed", "Seed for random if used");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
@@ -1060,7 +1060,7 @@ static void rna_def_modifier_mirror(BlenderRNA *brna)
prop= RNA_def_property(srna, "use_clip", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_CLIPPING);
- RNA_def_property_ui_text(prop, "Clip", "Prevents vertices from going through the mirror during transform");
+ RNA_def_property_ui_text(prop, "Clip", "Prevent vertices from going through the mirror during transform");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop= RNA_def_property(srna, "use_mirror_vertex_groups", PROP_BOOLEAN, PROP_NONE);
@@ -1111,7 +1111,7 @@ static void rna_def_modifier_decimate(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "percent");
RNA_def_property_range(prop, 0, 1);
RNA_def_property_ui_range(prop, 0, 1, 1, 2);
- RNA_def_property_ui_text(prop, "Ratio", "Defines the ratio of triangles to reduce to");
+ RNA_def_property_ui_text(prop, "Ratio", "Ratio of triangles to reduce to");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop= RNA_def_property(srna, "face_count", PROP_INT, PROP_NONE);
@@ -1187,7 +1187,7 @@ static void rna_def_modifier_wave(BlenderRNA *brna)
prop= RNA_def_property(srna, "damping_time", PROP_FLOAT, PROP_TIME);
RNA_def_property_float_sdna(prop, NULL, "damp");
RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
- RNA_def_property_ui_text(prop, "Damping Time", "Number of frames in which the waves damps out after it dies");
+ RNA_def_property_ui_text(prop, "Damping Time", "Number of frames in which the wave damps out after it dies");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop= RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_DISTANCE);
@@ -1208,7 +1208,7 @@ static void rna_def_modifier_wave(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "starty");
RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
RNA_def_property_ui_range(prop, -100, 100, 100, 2);
- RNA_def_property_ui_text(prop, "Start Position Y", "Z coordinate of the start position");
+ RNA_def_property_ui_text(prop, "Start Position Y", "Y coordinate of the start position");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop= RNA_def_property(srna, "start_position_object", PROP_POINTER, PROP_NONE);
@@ -1601,7 +1601,7 @@ static void rna_def_modifier_uvproject(BlenderRNA *brna)
PropertyRNA *prop;
srna= RNA_def_struct(brna, "UVProjectModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "UV Project Modifier", "UV projection modifier to sets UVs from a projector");
+ RNA_def_struct_ui_text(srna, "UV Project Modifier", "UV projection modifier to set UVs from a projector");
RNA_def_struct_sdna(srna, "UVProjectModifierData");
RNA_def_struct_ui_icon(srna, ICON_MOD_UVPROJECT);
@@ -1729,7 +1729,7 @@ static void rna_def_modifier_cast(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "CastModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Cast Modifier", "Cast modifier to cast to other shapes");
+ RNA_def_struct_ui_text(srna, "Cast Modifier", "Modifier to cast to other shapes");
RNA_def_struct_sdna(srna, "CastModifierData");
RNA_def_struct_ui_icon(srna, ICON_MOD_CAST);
@@ -1786,7 +1786,7 @@ static void rna_def_modifier_cast(BlenderRNA *brna)
prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0, FLT_MAX);
RNA_def_property_ui_range(prop, 0, 100, 5, 2);
- RNA_def_property_ui_text(prop, "Size", "Size of projection shape (leave as 0 for auto.)");
+ RNA_def_property_ui_text(prop, "Size", "Size of projection shape (leave as 0 for auto)");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
@@ -1842,7 +1842,7 @@ static void rna_def_modifier_meshdeform(BlenderRNA *brna)
prop= RNA_def_property(srna, "use_dynamic_bind", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MDEF_DYNAMIC_BIND);
- RNA_def_property_ui_text(prop, "Dynamic", "Recompute binding dynamically on top of other deformers (slower and more memory consuming.)");
+ RNA_def_property_ui_text(prop, "Dynamic", "Recompute binding dynamically on top of other deformers (slower and more memory consuming)");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
#if 0
@@ -2178,15 +2178,15 @@ static void rna_def_modifier_shrinkwrap(BlenderRNA *brna)
PropertyRNA *prop;
static EnumPropertyItem shrink_type_items[] = {
- {MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACEPOINT", 0, "Nearest Surface Point", "Shrinks the mesh to the nearest target surface"},
- {MOD_SHRINKWRAP_PROJECT, "PROJECT", 0, "Project", "Shrinks the mesh to the nearest target surface along a given axis"},
- {MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", 0, "Nearest Vertex", "Shrinks the mesh to the nearest target vertex"},
+ {MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACEPOINT", 0, "Nearest Surface Point", "Shrink the mesh to the nearest target surface"},
+ {MOD_SHRINKWRAP_PROJECT, "PROJECT", 0, "Project", "Shrink the mesh to the nearest target surface along a given axis"},
+ {MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", 0, "Nearest Vertex", "Shrink the mesh to the nearest target vertex"},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem shrink_face_cull_items[] = {
- {0, "OFF", 0, "Off", ""},
- {MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE, "FRONT", 0, "Front", ""},
- {MOD_SHRINKWRAP_CULL_TARGET_BACKFACE, "BACK", 0, "Back", ""},
+ {0, "OFF", 0, "Off", "No culling"},
+ {MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE, "FRONT", 0, "Front", "No projection when in front of the face"},
+ {MOD_SHRINKWRAP_CULL_TARGET_BACKFACE, "BACK", 0, "Back", "No projection when behind the face"},
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "ShrinkwrapModifier", "Modifier");
@@ -2204,7 +2204,7 @@ static void rna_def_modifier_shrinkwrap(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "shrinkOpts");
RNA_def_property_enum_items(prop, shrink_face_cull_items);
RNA_def_property_enum_funcs(prop, "rna_ShrinkwrapModifier_face_cull_get", "rna_ShrinkwrapModifier_face_cull_set", NULL);
- RNA_def_property_ui_text(prop, "Face Cull", "Stop vertices from projecting to a the face on the target when facing towards/away");
+ RNA_def_property_ui_text(prop, "Face Cull", "Stop vertices from projecting to a face on the target when facing towards/away");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
@@ -2332,10 +2332,10 @@ static void rna_def_modifier_simpledeform(BlenderRNA *brna)
PropertyRNA *prop;
static EnumPropertyItem simple_deform_mode_items[] = {
- {MOD_SIMPLEDEFORM_MODE_TWIST, "TWIST", 0, "Twist", "Rotates around the Z axis of the modifier space"},
- {MOD_SIMPLEDEFORM_MODE_BEND, "BEND", 0, "Bend", "Bends the mesh over the Z axis of the modifier space"},
- {MOD_SIMPLEDEFORM_MODE_TAPER, "TAPER", 0, "Taper", "Linearly scales along Z axis of the modifier space"},
- {MOD_SIMPLEDEFORM_MODE_STRETCH, "STRETCH", 0, "Stretch", "Stretches the object along the Z axis of the modifier space"},
+ {MOD_SIMPLEDEFORM_MODE_TWIST, "TWIST", 0, "Twist", "Rotate around the Z axis of the modifier space"},
+ {MOD_SIMPLEDEFORM_MODE_BEND, "BEND", 0, "Bend", "Bend the mesh over the Z axis of the modifier space"},
+ {MOD_SIMPLEDEFORM_MODE_TAPER, "TAPER", 0, "Taper", "Linearly scale along Z axis of the modifier space"},
+ {MOD_SIMPLEDEFORM_MODE_STRETCH, "STRETCH", 0, "Stretch", "Stretch the object along the Z axis of the modifier space"},
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "SimpleDeformModifier", "Modifier");
@@ -2362,7 +2362,7 @@ static void rna_def_modifier_simpledeform(BlenderRNA *brna)
prop= RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "originOpts", MOD_SIMPLEDEFORM_ORIGIN_LOCAL);
- RNA_def_property_ui_text(prop, "Relative", "Sets the origin of deform space to be relative to the object");
+ RNA_def_property_ui_text(prop, "Relative", "Set the origin of deform space to be relative to the object");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop= RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
@@ -2678,7 +2678,7 @@ static void rna_def_modifier_weightvgedit(BlenderRNA *brna)
prop= RNA_def_property(srna, "use_remove", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "edit_flags", MOD_WVG_EDIT_REMFVG);
RNA_def_property_ui_text(prop, "Group Remove", "Remove vertices with weight below threshold "
- "from vgroup");
+ "from vgroup");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop= RNA_def_property(srna, "default_weight", PROP_FLOAT, PROP_NONE);
@@ -2716,7 +2716,7 @@ static void rna_def_modifier_weightvgedit(BlenderRNA *brna)
static void rna_def_modifier_weightvgmix(BlenderRNA *brna)
{
static EnumPropertyItem weightvg_mix_modes_items[] = {
- {MOD_WVG_MIX_SET, "SET", 0, "Replace", "Replace VGroup A's weights by VGroup b's ones"},
+ {MOD_WVG_MIX_SET, "SET", 0, "Replace", "Replace VGroup A's weights by VGroup B's ones"},
{MOD_WVG_MIX_ADD, "ADD", 0, "Add", "Add VGroup B's weights to VGroup A's ones"},
{MOD_WVG_MIX_SUB, "SUB", 0, "Subtract", "Subtract VGroup B's weights from VGroup A's ones"},
{MOD_WVG_MIX_MUL, "MUL", 0, "Multiply", "Multiply VGroup A's weights by VGroup B's ones"},
@@ -2758,20 +2758,20 @@ static void rna_def_modifier_weightvgmix(BlenderRNA *brna)
RNA_def_property_range(prop, 0.0, 1.0f);
RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 0);
RNA_def_property_ui_text(prop, "Default Weight A", "Default weight a vertex will have if "
- "it is not in the first vgroup");
+ "it is not in the first A vgroup");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop= RNA_def_property(srna, "default_weight_b", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 1.0f);
RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 0);
RNA_def_property_ui_text(prop, "Default Weight B", "Default weight a vertex will have if "
- "it is not in the second vgroup");
+ "it is not in the second B vgroup");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop= RNA_def_property(srna, "mix_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, weightvg_mix_modes_items);
- RNA_def_property_ui_text(prop, "Mix Mode", "How weights from vgroup 2 affect weights "
- "of vgroup 1");
+ RNA_def_property_ui_text(prop, "Mix Mode", "How weights from vgroup B affect weights "
+ "of vgroup A");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop= RNA_def_property(srna, "mix_set", PROP_ENUM, PROP_NONE);
@@ -2829,6 +2829,7 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna)
prop= RNA_def_property(srna, "proximity_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, weightvg_proximity_modes_items);
+ RNA_def_property_enum_default(prop, MOD_WVG_PROXIMITY_GEOMETRY);
RNA_def_property_ui_text(prop, "Proximity Mode", "Which distances to target object to use");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -2836,6 +2837,7 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "proximity_flags");
RNA_def_property_enum_items(prop, proximity_geometry_items);
RNA_def_property_flag(prop, PROP_ENUM_FLAG); /* important to run before default set */
+ RNA_def_property_enum_default(prop, MOD_WVG_PROXIMITY_GEOM_FACES);
RNA_def_property_ui_text(prop, "Proximity Geometry",
"Use the shortest computed distance to target object's geometry "
"as weight");
@@ -2850,13 +2852,13 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna)
prop= RNA_def_property(srna, "min_dist", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_range(prop, 0.0, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0, 1000.0, 10, 0);
- RNA_def_property_ui_text(prop, "Lowest Dist", "Distance mapping to weight 0.0 (or weight 1.0 if above Highest Dist)");
+ RNA_def_property_ui_text(prop, "Lowest Dist", "Distance mapping to weight 0.0");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop= RNA_def_property(srna, "max_dist", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_range(prop, 0.0, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0, 1000.0, 10, 0);
- RNA_def_property_ui_text(prop, "Highest Dist", "Distance mapping to weight 1.0 (or weight 0.0 if below Lowest Dist)");
+ RNA_def_property_ui_text(prop, "Highest Dist", "Distance mapping to weight 1.0");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop= RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
@@ -2875,8 +2877,8 @@ static void rna_def_modifier_ocean(BlenderRNA *brna)
PropertyRNA *prop;
static EnumPropertyItem geometry_items[]= {
- {MOD_OCEAN_GEOM_GENERATE, "GENERATE", 0, "Generate", "Generates ocean surface geometry at the specified resolution"},
- {MOD_OCEAN_GEOM_DISPLACE, "DISPLACE", 0, "Displace", "Displaces existing geometry according to simulation"},
+ {MOD_OCEAN_GEOM_GENERATE, "GENERATE", 0, "Generate", "Generate ocean surface geometry at the specified resolution"},
+ {MOD_OCEAN_GEOM_DISPLACE, "DISPLACE", 0, "Displace", "Displace existing geometry according to simulation"},
//{MOD_OCEAN_GEOM_SIM_ONLY, "SIM_ONLY", 0, "Sim Only", "Leaves geometry unchanged, but still runs simulation (to be used from texture)"},
{0, NULL, 0, NULL, NULL}};
@@ -2922,13 +2924,13 @@ static void rna_def_modifier_ocean(BlenderRNA *brna)
prop= RNA_def_property(srna, "use_normals", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_OCEAN_GENERATE_NORMALS);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Generate Normals", "Outputs normals for bump mapping - disabling can speed up performance if its not needed");
+ RNA_def_property_ui_text(prop, "Generate Normals", "Output normals for bump mapping - disabling can speed up performance if its not needed");
RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
prop= RNA_def_property(srna, "use_foam", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_OCEAN_GENERATE_FOAM);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Generate Foam", "Generates foam mask as a vertex color channel");
+ RNA_def_property_ui_text(prop, "Generate Foam", "Generate foam mask as a vertex color channel");
RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
prop= RNA_def_property(srna, "resolution", PROP_INT, PROP_UNSIGNED);
@@ -3038,7 +3040,7 @@ static void rna_def_modifier_ocean(BlenderRNA *brna)
prop= RNA_def_property(srna, "is_cached", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "cached", 1);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Ocean is Cached", "Whether the ocean is useing cached data or simulating");
+ RNA_def_property_ui_text(prop, "Ocean is Cached", "Whether the ocean is using cached data or simulating");
prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_DIRPATH);
RNA_def_property_string_sdna(prop, NULL, "cachepath");
diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c
index 9d0149726c3..14e518da4b5 100644
--- a/source/blender/makesrna/intern/rna_scene_api.c
+++ b/source/blender/makesrna/intern/rna_scene_api.c
@@ -69,7 +69,6 @@ static void rna_Scene_frame_set(Scene *scene, int frame, float subframe)
static void rna_Scene_update_tagged(Scene *scene)
{
scene_update_tagged(G.main, scene);
- scene_clear_tagged(G.main, scene);
}
static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, char *name)
diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c
index eb3512083aa..a3d043ab6ec 100644
--- a/source/blender/makesrna/intern/rna_tracking.c
+++ b/source/blender/makesrna/intern/rna_tracking.c
@@ -53,6 +53,40 @@
#include "WM_api.h"
+static void rna_tracking_defaultSettings_levelsUpdate(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
+{
+ MovieClip *clip= (MovieClip*)ptr->id.data;
+ MovieTracking *tracking= &clip->tracking;
+ MovieTrackingSettings *settings= &tracking->settings;
+
+ if(settings->default_tracker==TRACKER_KLT) {
+ int max_pyramid_level_factor= 1 << (settings->default_pyramid_levels - 1);
+ float search_ratio= 2.3f * max_pyramid_level_factor;
+
+ settings->default_search_size= settings->default_pattern_size*search_ratio;
+ }
+}
+
+static void rna_tracking_defaultSettings_patternUpdate(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
+{
+ MovieClip *clip= (MovieClip*)ptr->id.data;
+ MovieTracking *tracking= &clip->tracking;
+ MovieTrackingSettings *settings= &tracking->settings;
+
+ if(settings->default_search_size<settings->default_pattern_size)
+ settings->default_search_size= settings->default_pattern_size;
+}
+
+static void rna_tracking_defaultSettings_searchUpdate(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
+{
+ MovieClip *clip= (MovieClip*)ptr->id.data;
+ MovieTracking *tracking= &clip->tracking;
+ MovieTrackingSettings *settings= &tracking->settings;
+
+ if(settings->default_pattern_size>settings->default_search_size)
+ settings->default_pattern_size= settings->default_search_size;
+}
+
static void rna_tracking_tracks_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
MovieClip *clip= (MovieClip*)ptr->id.data;
@@ -232,6 +266,16 @@ static MovieTrackingMarker *rna_trackingTrack_marker_find_frame(MovieTrackingTra
#else
+static EnumPropertyItem tracker_items[] = {
+ {TRACKER_KLT, "KLT", 0, "KLT", "Kanade–Lucas–Tomasi tracker which works with most of video clips, a bit slower than SAD"},
+ {TRACKER_SAD, "SAD", 0, "SAD", "Sum of Absolute Differences tracker which can be used when MLT tracker fails"},
+ {0, NULL, 0, NULL, NULL}};
+
+static EnumPropertyItem pattern_match_items[] = {
+ {TRACK_MATCH_KEYFRAME, "KEYFRAME", 0, "Keyframe", "Track pattern from keyframe to next frame"},
+ {TRACK_MATCH_PREVFRAME, "PREV_FRAME", 0, "Previous frame", "Track pattern from current frame to next frame"},
+ {0, NULL, 0, NULL, NULL}};
+
static int rna_matrix_dimsize_4x4[]= {4, 4};
static void rna_def_trackingSettings(BlenderRNA *brna)
@@ -280,27 +324,6 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
RNA_def_property_enum_items(prop, speed_items);
RNA_def_property_ui_text(prop, "Speed", "Limit speed of tracking to make visual feedback easier (this does not affect the tracking quality)");
- /* limit frames */
- prop= RNA_def_property(srna, "frames_limit", PROP_INT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_sdna(prop, NULL, "frames_limit");
- RNA_def_property_range(prop, 0, SHRT_MAX);
- RNA_def_property_ui_text(prop, "Frames Limit", "Every tracking cycle, this amount of frames are tracked");
-
- /* adjust frames */
- prop= RNA_def_property(srna, "frames_adjust", PROP_INT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_sdna(prop, NULL, "adjframes");
- RNA_def_property_range(prop, 0, INT_MAX);
- RNA_def_property_ui_text(prop, "Adjust Frames", "Automatically re-adjust marker position using position on each N frames. 0 means only keyframed position is used");
-
- /* margin */
- prop= RNA_def_property(srna, "margin", PROP_INT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_sdna(prop, NULL, "margin");
- RNA_def_property_range(prop, 0, 300);
- RNA_def_property_ui_text(prop, "Margin", "Distance from image boudary at which marker stops tracking");
-
/* keyframe_a */
prop= RNA_def_property(srna, "keyframe_a", PROP_INT, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
@@ -348,6 +371,76 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_enum_items(prop, cleanup_items);
RNA_def_property_ui_text(prop, "Action", "Cleanup action to execute");
+
+ /* ** default tracker settings ** */
+ prop= RNA_def_property(srna, "show_default_expanded", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_SETTINGS_SHOW_DEFAULT_EXPANDED);
+ RNA_def_property_ui_text(prop, "Show Expanded", "Show the expanded in the user interface");
+ RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
+
+ /* limit frames */
+ prop= RNA_def_property(srna, "default_frames_limit", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "default_frames_limit");
+ RNA_def_property_range(prop, 0, SHRT_MAX);
+ RNA_def_property_ui_text(prop, "Frames Limit", "Every tracking cycle, this amount of frames are tracked");
+
+ /* pattern match */
+ prop= RNA_def_property(srna, "default_pattern_match", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_sdna(prop, NULL, "default_pattern_match");
+ RNA_def_property_enum_items(prop, pattern_match_items);
+ RNA_def_property_ui_text(prop, "Pattern Match", "Track pattern from given frame when tracking marker to next frame");
+
+ /* margin */
+ prop= RNA_def_property(srna, "default_margin", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "default_margin");
+ RNA_def_property_range(prop, 0, 300);
+ RNA_def_property_ui_text(prop, "Margin", "Default distance from image boudary at which marker stops tracking");
+
+ /* tracking algorithm */
+ prop= RNA_def_property(srna, "default_tracker", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, tracker_items);
+ RNA_def_property_update(prop, 0, "rna_tracking_defaultSettings_levelsUpdate");
+ RNA_def_property_ui_text(prop, "Tracker", "Default tracking algorithm to use");
+
+ /* pyramid level for pyramid klt tracking */
+ prop= RNA_def_property(srna, "default_pyramid_levels", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "default_pyramid_levels");
+ RNA_def_property_range(prop, 1, 16);
+ RNA_def_property_update(prop, 0, "rna_tracking_defaultSettings_levelsUpdate");
+ RNA_def_property_ui_text(prop, "Pyramid levels", "Default number of pyramid levels (increase on blurry footage)");
+
+ /* minmal correlation - only used for SAD tracker */
+ prop= RNA_def_property(srna, "default_correlation_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_float_sdna(prop, NULL, "default_minimum_correlation");
+ RNA_def_property_range(prop, -1.0f, 1.0f);
+ RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Correlation", "Default minimal value of correlation between matched pattern and reference which is still treated as successful tracking");
+
+ /* default pattern size */
+ prop= RNA_def_property(srna, "default_pattern_size", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "default_pattern_size");
+ RNA_def_property_range(prop, 5, 1000);
+ RNA_def_property_update(prop, 0, "rna_tracking_defaultSettings_patternUpdate");
+ RNA_def_property_ui_text(prop, "Pattern Size", "Size of pattern area for newly creating tracks");
+
+ /* default search size */
+ prop= RNA_def_property(srna, "default_search_size", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "default_search_size");
+ RNA_def_property_range(prop, 5, 1000);
+ RNA_def_property_update(prop, 0, "rna_tracking_defaultSettings_searchUpdate");
+ RNA_def_property_ui_text(prop, "Search Size", "Size of search area for newly creating tracks");
}
static void rna_def_trackingCamera(BlenderRNA *brna)
@@ -465,11 +558,6 @@ static void rna_def_trackingTrack(BlenderRNA *brna)
FunctionRNA *func;
PropertyRNA *parm;
- static EnumPropertyItem tracker_items[] = {
- {TRACKER_KLT, "KLT", 0, "KLT", "Kanade–Lucas–Tomasi tracker which works with most of video clips, a bit slower than SAD"},
- {TRACKER_SAD, "SAD", 0, "SAD", "Sum of Absolute Differences tracker which can be used when MLT tracker fails"},
- {0, NULL, 0, NULL, NULL}};
-
rna_def_trackingMarker(brna);
srna= RNA_def_struct(brna, "MovieTrackingTrack", NULL);
@@ -514,6 +602,27 @@ static void rna_def_trackingTrack(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Search Max", "Right-bottom corner of search area in normalized coordinates relative to marker position");
RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerSearch_update");
+ /* limit frames */
+ prop= RNA_def_property(srna, "frames_limit", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "frames_limit");
+ RNA_def_property_range(prop, 0, SHRT_MAX);
+ RNA_def_property_ui_text(prop, "Frames Limit", "Every tracking cycle, this amount of frames are tracked");
+
+ /* pattern match */
+ prop= RNA_def_property(srna, "pattern_match", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_sdna(prop, NULL, "pattern_match");
+ RNA_def_property_enum_items(prop, pattern_match_items);
+ RNA_def_property_ui_text(prop, "Pattern Match", "Track pattern from given frame when tracking marker to next frame");
+
+ /* margin */
+ prop= RNA_def_property(srna, "margin", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "margin");
+ RNA_def_property_range(prop, 0, 300);
+ RNA_def_property_ui_text(prop, "Margin", "Distance from image boudary at which marker stops tracking");
+
/* tracking algorithm */
prop= RNA_def_property(srna, "tracker", PROP_ENUM, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
@@ -535,7 +644,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "minimum_correlation");
RNA_def_property_range(prop, -1.0f, 1.0f);
RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Correlation", "Minimal value of correlation between mathed pattern and reference which is still treated as successful tracking");
+ RNA_def_property_ui_text(prop, "Correlation", "Minimal value of correlation between matched pattern and reference which is still treated as successful tracking");
/* markers */
prop= RNA_def_property(srna, "markers", PROP_COLLECTION, PROP_NONE);
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c
index 5559d2ff34c..96f9918891a 100644
--- a/source/blender/render/intern/source/rendercore.c
+++ b/source/blender/render/intern/source/rendercore.c
@@ -2371,7 +2371,7 @@ static void do_bake_shade(void *handle, int x, int y, float u, float v)
isec.skip = RE_SKIP_VLR_NEIGHBOUR;
if(bake_intersect_tree(R.raytree, &isec, shi->co, shi->vn, sign, co, &dist)) {
- if(!hit || len_v3v3(shi->co, co) < len_v3v3(shi->co, minco)) {
+ if(!hit || len_squared_v3v3(shi->co, co) < len_squared_v3v3(shi->co, minco)) {
minisec= isec;
mindist= dist;
copy_v3_v3(minco, co);
diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt
index 33bbcb74835..521074463e0 100644
--- a/source/blender/windowmanager/CMakeLists.txt
+++ b/source/blender/windowmanager/CMakeLists.txt
@@ -105,6 +105,10 @@ if(WITH_CODEC_FFMPEG)
add_definitions(-DWITH_FFMPEG)
endif()
+if(WITH_HEADLESS)
+ add_definitions(-DWITH_HEADLESS)
+endif()
+
if(WITH_PYTHON)
list(APPEND INC
../python
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index a7c3e973a39..5d48a3c7a7f 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -321,10 +321,6 @@ void wm_event_do_notifiers(bContext *C)
win->screen->scene->customdata_mask |= win->screen->scene->customdata_mask_modal;
scene_update_tagged(bmain, win->screen->scene);
-
- ED_render_engine_update_tagged(C, bmain);
-
- scene_clear_tagged(bmain, win->screen->scene);
}
}
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index ebe53722ce1..0cc0d79b292 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -133,7 +133,7 @@ void WM_init(bContext *C, int argc, const char **argv)
set_free_windowmanager_cb(wm_close_and_free); /* library.c */
set_blender_test_break_cb(wm_window_testbreak); /* blender.c */
- DAG_editors_update_cb(ED_render_id_flush_update); /* depsgraph.c */
+ DAG_editors_update_cb(ED_render_id_flush_update, ED_render_scene_update); /* depsgraph.c */
ED_spacetypes_init(); /* editors/space_api/spacetype.c */
diff --git a/source/blenderplayer/CMakeLists.txt b/source/blenderplayer/CMakeLists.txt
index 913b6523ae6..db75e5f7ad0 100644
--- a/source/blenderplayer/CMakeLists.txt
+++ b/source/blenderplayer/CMakeLists.txt
@@ -166,8 +166,6 @@ endif()
list(APPEND BLENDER_SORTED_LIBS extern_lzma)
endif()
- list(APPEND BLENDER_SORTED_LIBS extern_colamd)
-
if(WITH_LIBMV)
list(APPEND BLENDER_SORTED_LIBS extern_libmv)
endif()