[Bf-blender-cvs] [83875e978d6] master: Tracking: Enable "Render Undistorted" only if there is actual distortion

Sebastian Koenig noreply at git.blender.org
Thu Sep 5 12:06:14 CEST 2019


Commit: 83875e978d62c0fd55632b4ce14828ab17931049
Author: Sebastian Koenig
Date:   Thu Sep 5 12:01:24 2019 +0200
Branches: master
https://developer.blender.org/rB83875e978d62c0fd55632b4ce14828ab17931049

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

===================================================================

M	release/scripts/startup/bl_operators/clip.py

===================================================================

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



More information about the Bf-blender-cvs mailing list