From a4d306ae930366656c84c68cfc881f7d43509446 Mon Sep 17 00:00:00 2001 From: Oxicid Date: Sat, 15 Apr 2023 15:34:31 +0200 Subject: [PATCH 1/4] replace deprecated bgl module --- object_collection_manager/qcd_move_widget.py | 34 +++++++------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/object_collection_manager/qcd_move_widget.py b/object_collection_manager/qcd_move_widget.py index 55da14531..c1af132c2 100644 --- a/object_collection_manager/qcd_move_widget.py +++ b/object_collection_manager/qcd_move_widget.py @@ -5,7 +5,6 @@ import time from math import cos, sin, pi, floor import bpy -import bgl import blf import gpu from gpu_extras.batch import batch_for_shader @@ -91,15 +90,13 @@ def draw_rounded_rect(area, shader, color, tl=5, tr=5, bl=5, br=5, outline=False bl = round(bl * scale_factor()) br = round(br * scale_factor()) - bgl.glEnable(bgl.GL_BLEND) + gpu.state.blend_set('ALPHA') if outline: thickness = round(2 * scale_factor()) thickness = max(thickness, 2) - bgl.glLineWidth(thickness) - bgl.glEnable(bgl.GL_LINE_SMOOTH) - bgl.glHint(bgl.GL_LINE_SMOOTH_HINT, bgl.GL_NICEST) + gpu.state.line_width_set(thickness) draw_type = 'TRI_FAN' if not outline else 'LINE_STRIP' @@ -296,9 +293,8 @@ def draw_rounded_rect(area, shader, color, tl=5, tr=5, bl=5, br=5, outline=False batch = batch_for_shader(shader, 'LINE_STRIP', {"pos": vertices}) batch.draw(shader) - bgl.glDisable(bgl.GL_LINE_SMOOTH) - bgl.glDisable(bgl.GL_BLEND) + gpu.state.blend_set('NONE') def mouse_in_area(mouse_pos, area, buf = 0): x = mouse_pos[0] @@ -844,11 +840,11 @@ def draw_callback_px(self, context): shader.uniform_float("color", icon_color[:] + (1,)) batch = batch_for_shader(shader, 'TRI_FAN', {"pos": vertices}) - bgl.glEnable(bgl.GL_BLEND) + gpu.state.blend_set('ALPHA') batch.draw(shader) - bgl.glDisable(bgl.GL_BLEND) + gpu.state.blend_set('NONE') # SELECTED OBJECTS elif not set(selected_objects).isdisjoint(collection_objects): @@ -859,15 +855,12 @@ def draw_callback_px(self, context): shader.uniform_float("color", icon_color[:] + (alpha,)) batch = batch_for_shader(shader, 'LINE_STRIP', {"pos": vertices}) - bgl.glLineWidth(2 * scale_factor()) - bgl.glEnable(bgl.GL_BLEND) - bgl.glEnable(bgl.GL_LINE_SMOOTH) - bgl.glHint(bgl.GL_LINE_SMOOTH_HINT, bgl.GL_NICEST) + gpu.state.line_width_set(2 * scale_factor()) + gpu.state.blend_set('ALPHA') batch.draw(shader) - bgl.glDisable(bgl.GL_LINE_SMOOTH) - bgl.glDisable(bgl.GL_BLEND) + gpu.state.blend_set('NONE') # OBJECTS elif collection_objects: @@ -878,11 +871,11 @@ def draw_callback_px(self, context): shader.uniform_float("color", icon_color[:] + (alpha,)) batch = batch_for_shader(shader, 'TRIS', {"pos": vertices}, indices=indices) - bgl.glEnable(bgl.GL_BLEND) + gpu.state.blend_set('ALPHA') batch.draw(shader) - bgl.glDisable(bgl.GL_BLEND) + gpu.state.blend_set('NONE') # X ICON @@ -894,14 +887,11 @@ def draw_callback_px(self, context): shader.uniform_float("color", X_icon_color[:] + (1,)) batch = batch_for_shader(shader, 'TRIS', {"pos": vertices}, indices=indices) - bgl.glEnable(bgl.GL_BLEND) - bgl.glEnable(bgl.GL_POLYGON_SMOOTH) - bgl.glHint(bgl.GL_POLYGON_SMOOTH_HINT, bgl.GL_NICEST) + gpu.state.blend_set('ALPHA') batch.draw(shader) - bgl.glDisable(bgl.GL_POLYGON_SMOOTH) - bgl.glDisable(bgl.GL_BLEND) + gpu.state.blend_set('NONE') if in_tooltip_area: if self.draw_tooltip: -- 2.30.2 From 623f0921fece5cb7568f2196e0059daaaa71ba86 Mon Sep 17 00:00:00 2001 From: Oxicid Date: Sat, 15 Apr 2023 15:37:11 +0200 Subject: [PATCH 2/4] Explicitly convert to integers --- object_collection_manager/internals.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/object_collection_manager/internals.py b/object_collection_manager/internals.py index c616645fa..3e120e8ba 100644 --- a/object_collection_manager/internals.py +++ b/object_collection_manager/internals.py @@ -764,7 +764,7 @@ class CMSendReport(Operator): if length > max_len: max_len = length - return wm.invoke_popup(self, width=(30 + (max_len*5.5))) + return wm.invoke_popup(self, width=int(30 + (max_len*5.5))) def execute(self, context): self.report({'INFO'}, self.message) -- 2.30.2 From 8eb3a698ea7d0af21e46655f397f125e17d280cd Mon Sep 17 00:00:00 2001 From: Oxicid Date: Sat, 15 Apr 2023 15:38:09 +0200 Subject: [PATCH 3/4] Update 'object_collection_manager/__init__.py' --- object_collection_manager/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/object_collection_manager/__init__.py b/object_collection_manager/__init__.py index 7467fcbd0..f9e09879d 100644 --- a/object_collection_manager/__init__.py +++ b/object_collection_manager/__init__.py @@ -6,8 +6,8 @@ bl_info = { "name": "Collection Manager", "description": "Manage collections and their objects", "author": "Ryan Inch", - "version": (2, 24, 4), - "blender": (2, 80, 0), + "version": (2, 24, 5), + "blender": (3, 4, 0), "location": "View3D - Object Mode (Shortcut - M)", "warning": '', # used for warning icon and text in addons panel "doc_url": "{BLENDER_MANUAL_URL}/addons/interface/collection_manager.html", -- 2.30.2 From 797df1de4d438f8b07f44edad88c93730c2c407c Mon Sep 17 00:00:00 2001 From: Oxicid Date: Sun, 16 Apr 2023 11:09:07 +0200 Subject: [PATCH 4/4] Update 'object_collection_manager/__init__.py' --- object_collection_manager/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/object_collection_manager/__init__.py b/object_collection_manager/__init__.py index f9e09879d..9293b9c19 100644 --- a/object_collection_manager/__init__.py +++ b/object_collection_manager/__init__.py @@ -7,7 +7,7 @@ bl_info = { "description": "Manage collections and their objects", "author": "Ryan Inch", "version": (2, 24, 5), - "blender": (3, 4, 0), + "blender": (2, 93, 0), "location": "View3D - Object Mode (Shortcut - M)", "warning": '', # used for warning icon and text in addons panel "doc_url": "{BLENDER_MANUAL_URL}/addons/interface/collection_manager.html", -- 2.30.2