Fix T51101: icon viewer addon not working correctly on high DPI displays.

This commit is contained in:
Brecht Van Lommel 2017-04-01 00:26:09 +02:00
parent ac0c5a2cc1
commit e0c236644b
Notes: blender-bot 2023-02-14 19:39:56 +01:00
Referenced by issue #51101, Icon Viewer broken in master
2 changed files with 3 additions and 12 deletions

View File

@ -44,13 +44,8 @@ HISTORY = []
def ui_scale():
if hasattr(bpy.context.user_preferences.view, "ui_scale"):
return bpy.context.user_preferences.view.ui_scale
ret = bpy.context.user_preferences.system.dpi / DPI
if bpy.context.user_preferences.system.virtual_pixel_mode == 'DOUBLE':
ret *= 2
return ret
prefs = bpy.context.user_preferences.system
return prefs.dpi * prefs.pixel_size / DPI
def prefs():

View File

@ -600,11 +600,7 @@ def force_update(context):
def dpifac():
prefs = bpy.context.user_preferences.system
if hasattr(prefs, 'pixel_size'): # python access to this was only added recently, assume non-retina display is used if using older blender
retinafac = bpy.context.user_preferences.system.pixel_size
else:
retinafac = 1
return bpy.context.user_preferences.system.dpi/(72/retinafac)
return prefs.dpi * prefs.pixel_size / 72
def node_mid_pt(node, axis):