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
This commit is contained in:
parent
31c2929496
commit
83875e978d
Notes:
blender-bot
2023-02-14 10:32:59 +01:00
Referenced by issue #69536, Setting dimension of objects parented in scaled object is broken
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue