Blender BGL module deprecation message spam + clarification #105997

Closed
opened 2023-03-22 15:15:39 +01:00 by Andrej · 2 comments
Contributor

Blender Version
Blender 3.5 Beta ( hash 5332537fc5)

Short description of error

Related to #80730

If some of your addons is using bgl module then you'll get up to 100 deprecation warning messages in the console like below.

  1. Is it really necessary to have that many messages? Users might miss some more important warnings or errors behind that wall of warning. Perhaps it should be 1 warning per addon or something like that?

  2. Is it possible to add some clarification to the warning message which addon is actually using the bgl module and producing the warnings?

Deprecation warning message:
image

Way to reproduce

Run any addon that uses bgl module or run the script below (got it from here):

import bpy
import gpu
from gpu_extras.batch import batch_for_shader
import bgl
 
vertices = [(0.0, 0.0, 0.0), (1.0, 0.0, 0.0),
    (0.0, 0.0, 0.0), (0.0, 1.0, 0.0),
    (0.0, 0.0, 0.0), (0.0, 0.0, 1.0)]
shader = gpu.shader.from_builtin('3D_SMOOTH_COLOR')
col = [(1.0, 0.0, 0.0, 1.0), (1.0, 0.0, 0.0, 1.0),
    (0.0, 1.0, 0.0, 1.0), (0.0, 1.0, 0.0, 1.0),
    (0.0, 0.0, 1.0, 1.0), (0.0, 0.0, 1.0, 1.0)]
batch = batch_for_shader(shader, 'LINES', {"pos": vertices, "color": col})
 
def draw():
    bgl.glLineWidth(5)
    shader.bind()
    batch.draw(shader)
    bgl.glLineWidth(1)
 
draw_handler = bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_VIEW')
 
for area in bpy.context.window.screen.areas:
    if area.type == 'VIEW_3D':
        area.tag_redraw()
**Blender Version** Blender 3.5 Beta ( hash 5332537fc560) **Short description of error** Related to #80730 If some of your addons is using `bgl` module then you'll get up to 100 deprecation warning messages in the console like below. 1) Is it really necessary to have that many messages? Users might miss some more important warnings or errors behind that wall of warning. Perhaps it should be 1 warning per addon or something like that? 2) Is it possible to add some clarification to the warning message which addon is actually using the `bgl` module and producing the warnings? Deprecation warning message: ![image](/attachments/538b25a1-e475-46d9-a98c-c44fb64453b4) **Way to reproduce** Run any addon that uses `bgl` module or run the script below (got it from [here](https://b3d.interplanety.org/en/drawing-in-blender-viewport/)): ```py import bpy import gpu from gpu_extras.batch import batch_for_shader import bgl vertices = [(0.0, 0.0, 0.0), (1.0, 0.0, 0.0), (0.0, 0.0, 0.0), (0.0, 1.0, 0.0), (0.0, 0.0, 0.0), (0.0, 0.0, 1.0)] shader = gpu.shader.from_builtin('3D_SMOOTH_COLOR') col = [(1.0, 0.0, 0.0, 1.0), (1.0, 0.0, 0.0, 1.0), (0.0, 1.0, 0.0, 1.0), (0.0, 1.0, 0.0, 1.0), (0.0, 0.0, 1.0, 1.0), (0.0, 0.0, 1.0, 1.0)] batch = batch_for_shader(shader, 'LINES', {"pos": vertices, "color": col}) def draw(): bgl.glLineWidth(5) shader.bind() batch.draw(shader) bgl.glLineWidth(1) draw_handler = bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_VIEW') for area in bpy.context.window.screen.areas: if area.type == 'VIEW_3D': area.tag_redraw() ```
135 KiB
Andrej added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2023-03-22 15:15:40 +01:00
Iliya Katushenock added the
Interest
Python API
label 2023-03-22 15:16:35 +01:00

From what I can see, the messages stop after a while.
But maybe it's too many messages.

@Jeroen-Bakker ^

From what I can see, the messages stop after a while. But maybe it's too many messages. @Jeroen-Bakker ^
Member

We can limit the number of messages, that is not a problem. As Blender 3.5 is already fixed, this should be done for 3.5.1 and 3.6. Users typically don't see these messages as they don't run with an open console. Users only see one message.

The other feature requests takes time to develop and should be considered as new features.

We can limit the number of messages, that is not a problem. As Blender 3.5 is already fixed, this should be done for 3.5.1 and 3.6. Users typically don't see these messages as they don't run with an open console. Users only see one message. The other feature requests takes time to develop and should be considered as new features.
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2023-03-23 07:53:29 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser Project (Legacy)
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#105997
No description provided.