Collection Manager: Replace deprecated bgl module. Task: T69577 #104703

Merged
Showing only changes of commit 511585e5d9 - Show all commits

View File

@ -93,8 +93,8 @@ def draw_rounded_rect(area, shader, color, tl=5, tr=5, bl=5, br=5, outline=False
gpu.state.blend_set('ALPHA')
if outline:
thickness = round(1 * scale_factor())
thickness = max(thickness, 1)
thickness = round(2 * scale_factor())
thickness = max(thickness, 2)

The thickness value has changed. Intentional?

The thickness value has changed. Intentional?

It was intentional, because the gpu line shader gave different results to what I had with bgl, but on second thought I'm going to revert the outline thickness and draw order changes.

It was intentional, because the gpu line shader gave different results to what I had with bgl, but on second thought I'm going to revert the outline thickness and draw order changes.
shader.uniform_float("lineWidth", thickness)
draw_type = 'TRI_FAN' if not outline else 'LINE_STRIP'
@ -769,8 +769,8 @@ def draw_callback_px(self, context):
main_window = self.areas["Main Window"]
outline_color = addon_prefs.qcd_ogl_widget_menu_back_outline
background_color = addon_prefs.qcd_ogl_widget_menu_back_inner
draw_rounded_rect(main_window, shader, background_color)
draw_rounded_rect(main_window, line_shader, outline_color[:] + (1,), outline=True)
draw_rounded_rect(main_window, shader, background_color)
# draw window title
window_title = self.areas["Window Title"]
@ -850,8 +850,8 @@ def draw_callback_px(self, context):
# draw button
outline_color = addon_prefs.qcd_ogl_widget_tool_outline
draw_rounded_rect(button_area, shader, button_color, tl, tr, bl, br)
draw_rounded_rect(button_area, line_shader, outline_color[:] + (1,), tl, tr, bl, br, outline=True)
draw_rounded_rect(button_area, shader, button_color, tl, tr, bl, br)
# ACTIVE OBJECT
if active_object and active_object in selected_objects and active_object.name in collection_objects:
@ -977,8 +977,8 @@ def draw_tooltip(self, context, shader, line_shader, message):
outline_color = addon_prefs.qcd_ogl_widget_tooltip_outline
background_color = addon_prefs.qcd_ogl_widget_tooltip_inner
draw_rounded_rect(tooltip, shader, background_color)
draw_rounded_rect(tooltip, line_shader, outline_color[:] + (1,), outline=True)
draw_rounded_rect(tooltip, shader, background_color)
line_pos = padding + line_height
# draw text