From 547adaa4edf8a96e94613bb9345624a00c7f8632 Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Thu, 28 Jul 2022 11:46:33 -0300 Subject: Archimesh: replace deprecated bgl module Part of T80730 --- archimesh/__init__.py | 4 ++-- archimesh/achm_gltools.py | 24 ++++++++++++------------ archimesh/achm_main_panel.py | 1 - 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/archimesh/__init__.py b/archimesh/__init__.py index 261397f1..d79e02f7 100644 --- a/archimesh/__init__.py +++ b/archimesh/__init__.py @@ -11,8 +11,8 @@ bl_info = { "name": "Archimesh", "author": "Antonio Vazquez (antonioya)", "location": "View3D > Add Mesh / Sidebar > Create Tab", - "version": (1, 2, 2), - "blender": (2, 80, 0), + "version": (1, 2, 3), + "blender": (3, 0, 0), "description": "Generate rooms, doors, windows, and other architecture objects", "doc_url": "{BLENDER_MANUAL_URL}/addons/add_mesh/archimesh.html", "category": "Add Mesh" diff --git a/archimesh/achm_gltools.py b/archimesh/achm_gltools.py index de11226d..00160989 100644 --- a/archimesh/achm_gltools.py +++ b/archimesh/achm_gltools.py @@ -16,7 +16,6 @@ from mathutils import Vector from bpy_extras import view3d_utils from .achm_room_maker import get_wall_points # GPU -import bgl import gpu from gpu_extras.batch import batch_for_shader @@ -39,7 +38,7 @@ def draw_main(context): measure = scene.archimesh_gl_measure dspname = scene.archimesh_gl_name - bgl.glEnable(bgl.GL_BLEND) + gpu.state.blend_set('ALPHA') # Display selected or all if scene.archimesh_gl_ghost is False: objlist = context.selected_objects @@ -81,8 +80,8 @@ def draw_main(context): # ----------------------- # restore opengl defaults # ----------------------- - bgl.glLineWidth(1) - bgl.glDisable(bgl.GL_BLEND) + gpu.state.line_width_set(1.0) + gpu.state.blend_set('NONE') # ------------------------------------------------------------- @@ -175,8 +174,8 @@ def draw_room_data(myobj, op, region, rv3d, rgba, rgbaw, fsize, wfsize, space, m screen_point_b2 = view3d_utils.location_3d_to_region_2d(region, rv3d, b2_s2) # colour + line setup - bgl.glEnable(bgl.GL_BLEND) - bgl.glLineWidth(1) + gpu.state.blend_set('ALPHA') + gpu.state.line_width_set(1.0) # -------------------------------- # Measures # -------------------------------- @@ -284,8 +283,8 @@ def draw_door_data(myobj, op, region, rv3d, rgba, fsize, space, measure): screen_point_ep3 = view3d_utils.location_3d_to_region_2d(region, rv3d, e_p3) # colour + line setup - bgl.glEnable(bgl.GL_BLEND) - bgl.glLineWidth(1) + gpu.state.blend_set('ALPHA') + gpu.state.line_width_set(1.0) # -------------------------------- # Measures @@ -368,8 +367,8 @@ def draw_window_rail_data(myobj, op, region, rv3d, rgba, fsize, space, measure): screen_point_tp3 = view3d_utils.location_3d_to_region_2d(region, rv3d, t_p3) # colour + line setup - bgl.glEnable(bgl.GL_BLEND) - bgl.glLineWidth(1) + gpu.state.blend_set('ALPHA') + gpu.state.line_width_set(1.0) # -------------------------------- # Measures @@ -473,9 +472,10 @@ def draw_window_panel_data(myobj, op, region, rv3d, rgba, fsize, space, measure) screen_point_gp3 = view3d_utils.location_3d_to_region_2d(region, rv3d, g_p3) screen_point_gp4 = view3d_utils.location_3d_to_region_2d(region, rv3d, g_p4) screen_point_gp5 = view3d_utils.location_3d_to_region_2d(region, rv3d, g_p5) + # colour + line setup - bgl.glEnable(bgl.GL_BLEND) - bgl.glLineWidth(1) + gpu.state.blend_set('ALPHA') + gpu.state.line_width_set(1.0) # -------------------------------- # Measures diff --git a/archimesh/achm_main_panel.py b/archimesh/achm_main_panel.py index 97c7d19d..fda383f4 100644 --- a/archimesh/achm_main_panel.py +++ b/archimesh/achm_main_panel.py @@ -8,7 +8,6 @@ # noinspection PyUnresolvedReferences import bpy # noinspection PyUnresolvedReferences -import bgl from bpy.types import Operator, Panel, SpaceView3D from math import sqrt, fabs, pi, asin from .achm_tools import * -- cgit v1.2.3