Fix T70590: Python Gizmo API misses opacity & anti-aliasing
Thanks to @mano-wii for finding root cause.
This commit is contained in:
@@ -639,17 +639,27 @@ class Gizmo(StructRNA):
|
|||||||
|
|
||||||
if select_id is not None:
|
if select_id is not None:
|
||||||
gpu.select.load_id(select_id)
|
gpu.select.load_id(select_id)
|
||||||
|
use_blend = False
|
||||||
else:
|
else:
|
||||||
if self.is_highlight:
|
if self.is_highlight:
|
||||||
color = (*self.color_highlight, self.alpha_highlight)
|
color = (*self.color_highlight, self.alpha_highlight)
|
||||||
else:
|
else:
|
||||||
color = (*self.color, self.alpha)
|
color = (*self.color, self.alpha)
|
||||||
shader.uniform_float("color", color)
|
shader.uniform_float("color", color)
|
||||||
|
use_blend = color[3] < 1.0
|
||||||
|
|
||||||
|
if use_blend:
|
||||||
|
# TODO: wrap GPU_blend from GPU state.
|
||||||
|
from bgl import glEnable, glDisable, GL_BLEND
|
||||||
|
glEnable(GL_BLEND)
|
||||||
|
|
||||||
with gpu.matrix.push_pop():
|
with gpu.matrix.push_pop():
|
||||||
gpu.matrix.multiply_matrix(matrix)
|
gpu.matrix.multiply_matrix(matrix)
|
||||||
batch.draw()
|
batch.draw()
|
||||||
|
|
||||||
|
if use_blend:
|
||||||
|
glDisable(GL_BLEND)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def new_custom_shape(type, verts):
|
def new_custom_shape(type, verts):
|
||||||
"""
|
"""
|
||||||
|
Reference in New Issue
Block a user