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:
authorSergey Sharybin <sergey.vfx@gmail.com>2019-09-13 12:48:22 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-09-13 12:59:34 +0300
commit592a3d7b4771c8d329d586e8bfa776b25666921b (patch)
tree3973860f49d85bc6f6b682fbf770bd5e03665ff0
parent49c36d34307ae510426455f834973b53f7d1db35 (diff)
Tracking: Perform tracking and solving from a locked interface
Solves stability issues with possibly doing destructive changes to the tracking setup. Locking interface is the simplest and most reliable way to avoid crashes. It is still possible to run non-destructive changes such as clip view navigation. More operations can be marked as safe if needed. Fixes T67012: Software closes when a processing marker is deleted
-rw-r--r--source/blender/editors/space_clip/tracking_ops_solve.c6
-rw-r--r--source/blender/editors/space_clip/tracking_ops_track.c12
2 files changed, 17 insertions, 1 deletions
diff --git a/source/blender/editors/space_clip/tracking_ops_solve.c b/source/blender/editors/space_clip/tracking_ops_solve.c
index 96b00ec5463..1d2fc239a89 100644
--- a/source/blender/editors/space_clip/tracking_ops_solve.c
+++ b/source/blender/editors/space_clip/tracking_ops_solve.c
@@ -50,6 +50,7 @@
/********************** solve camera operator *********************/
typedef struct {
+ struct wmWindowManager *wm;
Scene *scene;
MovieClip *clip;
MovieClipUser user;
@@ -78,6 +79,7 @@ static bool solve_camera_initjob(
/* Could fail if footage uses images with different sizes. */
BKE_movieclip_get_size(clip, &sc->user, &width, &height);
+ scj->wm = CTX_wm_manager(C);
scj->clip = clip;
scj->scene = scene;
scj->reports = op->reports;
@@ -88,6 +90,8 @@ static bool solve_camera_initjob(
tracking->stats = MEM_callocN(sizeof(MovieTrackingStats), "solve camera stats");
+ WM_set_locked_interface(scj->wm, true);
+
return true;
}
@@ -114,6 +118,8 @@ static void solve_camera_freejob(void *scv)
MovieClip *clip = scj->clip;
int solved;
+ WM_set_locked_interface(scj->wm, false);
+
if (!scj->context) {
/* job weren't fully initialized due to some error */
MEM_freeN(scj);
diff --git a/source/blender/editors/space_clip/tracking_ops_track.c b/source/blender/editors/space_clip/tracking_ops_track.c
index 4d3281c6cf9..adbb3e30850 100644
--- a/source/blender/editors/space_clip/tracking_ops_track.c
+++ b/source/blender/editors/space_clip/tracking_ops_track.c
@@ -59,6 +59,7 @@ typedef struct TrackMarkersJob {
float delay; /* Delay in milliseconds to allow
* tracking at fixed FPS */
+ struct wmWindowManager *wm;
struct Main *main;
struct Scene *scene;
struct bScreen *screen;
@@ -202,7 +203,15 @@ static bool track_markers_initjob(bContext *C, TrackMarkersJob *tmj, bool backwa
tmj->main = CTX_data_main(C);
tmj->screen = CTX_wm_screen(C);
- return track_markers_check_direction(backwards, tmj->sfra, tmj->efra);
+ tmj->wm = CTX_wm_manager(C);
+
+ if (!track_markers_check_direction(backwards, tmj->sfra, tmj->efra)) {
+ return false;
+ }
+
+ WM_set_locked_interface(tmj->wm, true);
+
+ return true;
}
static void track_markers_startjob(void *tmv, short *stop, short *do_update, float *progress)
@@ -281,6 +290,7 @@ static void track_markers_freejob(void *tmv)
{
TrackMarkersJob *tmj = (TrackMarkersJob *)tmv;
tmj->clip->tracking_context = NULL;
+ WM_set_locked_interface(tmj->wm, false);
BKE_autotrack_context_free(tmj->context);
MEM_freeN(tmj);
}