diff options
author | Sebastian Koenig <sebastian_k@gmail.com> | 2019-09-05 13:01:24 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-09-05 13:06:09 +0300 |
commit | 83875e978d62c0fd55632b4ce14828ab17931049 (patch) | |
tree | 88a5f6f78095459293e7471c3630541d13271a51 /release/scripts/startup/bl_operators/clip.py | |
parent | 31c2929496c2e778a162020215fb6d643d82581c (diff) |
Tracking: Enable "Render Undistorted" only if there is actual distortion
Applies to "Setup Tracking Scene" operator which configures background
images for the viewport.
Solves unnecessary slowdown and higher memory usage when camera's model
does not have any effective distortion.
Differential Revision: https://developer.blender.org/D5520
Diffstat (limited to 'release/scripts/startup/bl_operators/clip.py')
-rw-r--r-- | release/scripts/startup/bl_operators/clip.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/release/scripts/startup/bl_operators/clip.py b/release/scripts/startup/bl_operators/clip.py index e857d8547a7..fcde95a48fe 100644 --- a/release/scripts/startup/bl_operators/clip.py +++ b/release/scripts/startup/bl_operators/clip.py @@ -39,6 +39,17 @@ def CLIP_spaces_walk(context, all_screens, tarea, tspace, callback, *args): def CLIP_set_viewport_background(context, clip, clip_user): + + def check_camera_has_distortion(tracking_camera): + if tracking_camera.distortion_model == 'POLYNOMIAL': + return not all(k == 0 for k in (tracking_camera.k1, + tracking_camera.k2, + tracking_camera.k3)) + elif tracking_camera.distortion_model == 'DIVISION': + return not all(k == 0 for k in (tracking_camera.division_k1, + tracking_camera.division_k2)) + return False + def set_background(cam, clip, user): bgpic = None @@ -53,7 +64,8 @@ def CLIP_set_viewport_background(context, clip, clip_user): bgpic.source = 'MOVIE_CLIP' bgpic.clip = clip bgpic.clip_user.proxy_render_size = user.proxy_render_size - bgpic.clip_user.use_render_undistorted = True + if check_camera_has_distortion(clip.tracking.camera): + bgpic.clip_user.use_render_undistorted = True bgpic.use_camera_clip = False cam.show_background_images = True |