object_collection_manager: replace deprecated bgl module #104547
@ -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": (2, 93, 0),
|
||||
Imaginer marked this conversation as resolved
Outdated
|
||||
"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",
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
Germano Cavalcante
commented
`line_width_set` should no longer be used.
|
||||
|
||||
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:
|
||||
|
Loading…
Reference in New Issue
Block a user
I like to keep this to the minimum version of Blender the add-on will work with, which from my tests just now on Linux seems to be 2.93. So unless this is different on other platforms could you please set it to 2.93?
I looked more closely, everything is involved.
About the minimum version, I just do not know which version introduced new methods for gpu module, and decided to set it to 3.4 for sure. To be sure I checked with 2.93, everything works
Ah, okay. Makes sense. Thanks for changing it and the additional checking.