[Bf-extensions-cvs] [e0c2366] master: Fix T51101: icon viewer addon not working correctly on high DPI displays.

Brecht Van Lommel noreply at git.blender.org
Sat Apr 1 00:32:56 CEST 2017


Commit: e0c236644bc9d3fff711ee69555fa9a7ffa61706
Author: Brecht Van Lommel
Date:   Sat Apr 1 00:26:09 2017 +0200
Branches: master
https://developer.blender.org/rBAe0c236644bc9d3fff711ee69555fa9a7ffa61706

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

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

M	development_icon_get.py
M	node_wrangler.py

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

diff --git a/development_icon_get.py b/development_icon_get.py
index c467dfd..b00d759 100644
--- a/development_icon_get.py
+++ b/development_icon_get.py
@@ -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():
diff --git a/node_wrangler.py b/node_wrangler.py
index 465e316..7b866d1 100644
--- a/node_wrangler.py
+++ b/node_wrangler.py
@@ -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):



More information about the Bf-extensions-cvs mailing list