Collection Manager: Replace deprecated bgl module. Task: T69577 #104703
No reviewers
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#104703
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "Imaginer/blender-addons:object_collection_manager-bgl-removal"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Replace using the deprecated bgl API with the new gpu API to draw
the QCD Move widget.
Thanks to Oxicid and Germano Cavalcante (mano-wii) for helping.
#104547
@ -101,2 +96,2 @@
bgl.glEnable(bgl.GL_LINE_SMOOTH)
bgl.glHint(bgl.GL_LINE_SMOOTH_HINT, bgl.GL_NICEST)
thickness = round(1 * scale_factor())
thickness = max(thickness, 1)
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.
Although ok, I notice some changes unrelated to removing the use of the bgl module.
But if you disregard that and that
shader.bind()
is no longer needed in these cases, the code looks ok.I would double check if the drawing hasn't changed.
@ -121,1 +114,3 @@
batch.draw(shader)
if not outline:
batch = batch_for_shader(shader, draw_type, {"pos": vertices})
shader.bind()
shader.bind()
is no longer needed here.@ -122,0 +117,4 @@
shader.uniform_float("color", color)
batch.draw(shader)
else:
batch = batch_for_shader(shader, draw_type, {"pos": [(v[0], v[1], 0) for v in vertices], "color": [color for v in vertices]})
This looks like a change unrelated to the removal of the bgl module.
It should be in a separate commit.
No, this is related. I needed to add a separate line shader to work with the new approved methods, so this handles that.
@ -122,0 +118,4 @@
batch.draw(shader)
else:
batch = batch_for_shader(shader, draw_type, {"pos": [(v[0], v[1], 0) for v in vertices], "color": [color for v in vertices]})
shader.bind()
shader.bind()
is no needed here.@ -138,1 +136,3 @@
batch.draw(shader)
if not outline:
batch = batch_for_shader(shader, draw_type, {"pos": vertices})
shader.bind()
shader.bind() is no longer needed here.
@ -139,0 +140,4 @@
batch.draw(shader)
else:
batch = batch_for_shader(shader, draw_type, {"pos": [(v[0], v[1], 0) for v in vertices], "color": [color for v in vertices]})
shader.bind()
shader.bind() is no needed here.
@ -265,2 +282,3 @@
batch = batch_for_shader(shader, 'LINE_STRIP', {"pos": vertices})
batch = batch_for_shader(shader, 'LINE_STRIP', {"pos": [(v[0], v[1], 0) for v in vertices], "color": [color for v in vertices]})
shader.bind()
shader.bind() is no needed here.
Thanks for the review! The
shader.bind
calls don't seem to cause any problems and seem to be needed on previous versions of Blender (I distribute this add-on in multiple places), so it's just easier to have them. I think I could remove them for the line shader, but if I just keep them everywhere it's simpler to keep track of.The drawing is a little different using gpu, but it's fairly close and 3.6 seems to be quite close to how it looked with bgl.