diff --git a/development_icon_get.py b/development_icon_get.py index f4bb798962d23adddb25e0e67d896e2a78de2f9f..1f22a4d8c3e19712bff3fec8baf6b7ec5ad2d8a4 100644 --- a/development_icon_get.py +++ b/development_icon_get.py @@ -5,8 +5,8 @@ bl_info = { "name": "Icon Viewer", "description": "Click an icon to copy its name to the clipboard", "author": "roaoao", - "version": (1, 4, 0), - "blender": (2, 80, 0), + "version": (1, 4, 1), + "blender": (3, 4, 0), "location": "Text Editor > Dev Tab > Icon Viewer", "doc_url": "{BLENDER_MANUAL_URL}/addons/development/icon_viewer.html", "category": "Development", @@ -30,7 +30,7 @@ HISTORY = [] def ui_scale(): prefs = bpy.context.preferences.system - return prefs.dpi * prefs.pixel_size / DPI + return prefs.dpi / DPI def prefs(): diff --git a/node_wrangler.py b/node_wrangler.py index aa3b6bc25ab91c57a4db24b728fd135d3beecc57..5932388ff05fbd350c6e4a2a595650d4ccb4c92c 100644 --- a/node_wrangler.py +++ b/node_wrangler.py @@ -3,7 +3,7 @@ bl_info = { "name": "Node Wrangler", "author": "Bartek Skorupa, Greg Zaal, Sebastian Koenig, Christian Brinkmann, Florian Meyer", - "version": (3, 42), + "version": (3, 43), "blender": (3, 4, 0), "location": "Node Editor Toolbar or Shift-W", "description": "Various tools to enhance and speed up node-based workflow", @@ -264,9 +264,14 @@ def force_update(context): context.space_data.node_tree.update_tag() -def dpifac(): +def dpi_fac(): prefs = bpy.context.preferences.system - return prefs.dpi * prefs.pixel_size / 72 + return prefs.dpi / 72 + + +def prefs_line_width(): + prefs = bpy.context.preferences.system + return prefs.pixel_size def node_mid_pt(node, axis): @@ -342,8 +347,8 @@ def node_at_pos(nodes, context, event): for node in nodes: skipnode = False if node.type != 'FRAME': # no point trying to link to a frame node - dimx = node.dimensions.x/dpifac() - dimy = node.dimensions.y/dpifac() + dimx = node.dimensions.x / dpi_fac() + dimy = node.dimensions.y / dpi_fac() locx, locy = abs_node_location(node) if not skipnode: @@ -362,8 +367,8 @@ def node_at_pos(nodes, context, event): for node in nodes: if node.type != 'FRAME' and skipnode == False: locx, locy = abs_node_location(node) - dimx = node.dimensions.x/dpifac() - dimy = node.dimensions.y/dpifac() + dimx = node.dimensions.x / dpi_fac() + dimy = node.dimensions.y / dpi_fac() if (locx <= x <= locx + dimx) and \ (locy - dimy <= y <= locy): nodes_under_mouse.append(node) @@ -392,7 +397,7 @@ def store_mouse_cursor(context, event): def draw_line(x1, y1, x2, y2, size, colour=(1.0, 1.0, 1.0, 0.7)): shader = gpu.shader.from_builtin('POLYLINE_SMOOTH_COLOR') shader.uniform_float("viewportSize", gpu.state.viewport_get()[2:]) - shader.uniform_float("lineWidth", size * dpifac()) + shader.uniform_float("lineWidth", size * prefs_line_width()) vertices = ((x1, y1), (x2, y2)) vertex_colors = ((colour[0]+(1.0-colour[0])/4, @@ -406,7 +411,7 @@ def draw_line(x1, y1, x2, y2, size, colour=(1.0, 1.0, 1.0, 0.7)): def draw_circle_2d_filled(mx, my, radius, colour=(1.0, 1.0, 1.0, 0.7)): - radius = radius * dpifac() + radius = radius * prefs_line_width() sides = 12 vertices = [(radius * cos(i * 2 * pi / sides) + mx, radius * sin(i * 2 * pi / sides) + my) @@ -421,12 +426,12 @@ def draw_circle_2d_filled(mx, my, radius, colour=(1.0, 1.0, 1.0, 0.7)): def draw_rounded_node_border(node, radius=8, colour=(1.0, 1.0, 1.0, 0.7)): area_width = bpy.context.area.width sides = 16 - radius = radius*dpifac() + radius *= prefs_line_width() nlocx, nlocy = abs_node_location(node) - nlocx = (nlocx+1)*dpifac() - nlocy = (nlocy+1)*dpifac() + nlocx = (nlocx+1) * dpi_fac() + nlocy = (nlocy+1) * dpi_fac() ndimx = node.dimensions.x ndimy = node.dimensions.y