Disable blf shadow setting after use. Fixes #5387

This commit is contained in:
Manu Varkey
2024-09-19 17:16:58 +05:30
committed by Dion Moult
parent 4b7bb1533e
commit 4225643bc0
5 changed files with 9 additions and 3 deletions
@@ -468,11 +468,12 @@ class BaseDecorator:
blf.rotation(font_id, ang)
blf.color(font_id, *color)
# blf.enable(font_id, blf.SHADOW)
# blf.shadow(font_id, 5, 0, 0, 0, 1)
# blf.shadow_offset(font_id, 1, -1)
blf.enable(font_id, blf.SHADOW)
blf.shadow(font_id, 5, 0, 0, 0, 1)
blf.shadow_offset(font_id, 1, -1)
blf.draw(font_id, text)
blf.disable(font_id, blf.ROTATION)
blf.disable(font_id, blf.SHADOW)
def draw_dimension_text(self, context, get_text, description, dimension_data, **draw_label_kwargs):
prefix = dimension_data["text_prefix"]
@@ -77,6 +77,7 @@ class ItemDecorator:
coords_2d -= Vector((w * 0.5, h * 0.5))
blf.position(font_id, coords_2d[0], coords_2d[1], 0)
blf.draw(font_id, tag)
blf.disable(font_id, blf.SHADOW)
def draw(self, context):
def transparent_color(color, alpha=0.3):
@@ -154,6 +154,7 @@ class GeoreferenceDecorator:
location = location.normalized() * 3
text += "\n(Warning: Actual XYZ Not Shown)"
self.draw_text_at_position(context, text, location)
blf.disable(self.font_id, blf.SHADOW)
def draw_text_at_position(self, context, text, position):
coords_2d = location_3d_to_region_2d(context.region, context.region_data, position)
@@ -423,6 +423,7 @@ class PolylineDecorator:
blf.color(self.font_id, *color)
blf.position(self.font_id, mouse_pos[0] + offset, mouse_pos[1] - (new_line * i), 0)
blf.draw(self.font_id, field_name + formatted_value)
blf.disable(self.font_id, blf.SHADOW)
def draw_text_background(self, context, coords_dim, text_dim):
padding = 5
@@ -475,6 +476,7 @@ class PolylineDecorator:
text_dim = blf.dimensions(self.font_id, text)
self.draw_text_background(context, coords_angle, text_dim)
blf.draw(self.font_id, text)
blf.disable(self.font_id, blf.SHADOW)
def draw_snap_point(self, context):
self.line_shader = gpu.shader.from_builtin("POLYLINE_UNIFORM_COLOR")
@@ -91,6 +91,7 @@ class GridDecorator:
coords_2d -= Vector((w * 0.5, h * 0.5))
blf.position(font_id, coords_2d[0], coords_2d[1], 0)
blf.draw(font_id, tag)
blf.disable(font_id, blf.SHADOW)
def draw(self, context):
self.addon_prefs = tool.Blender.get_addon_preferences()