Archimesh: replace deprecated bgl module

Part of T80730
This commit is contained in:
Germano Cavalcante 2022-07-28 11:46:33 -03:00
parent 880284a41e
commit 547adaa4ed
Notes: blender-bot 2024-02-26 14:24:26 +01:00
Referenced by issue #80730, BGL deprecation
3 changed files with 14 additions and 15 deletions

View File

@ -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"

View File

@ -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

View File

@ -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 *