From e83cce910d3a60c66c9be267aed5bcc900d449e7 Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Tue, 19 Aug 2025 07:42:44 +0200 Subject: [PATCH] Fix #144700: Incorrect operator model draw example The example script for the Model Draw Operator was out of date. It didn't used the polyline shader. This PR updates the example to use the polyline shader. Pull Request: https://projects.blender.org/blender/blender/pulls/144722 --- scripts/templates_py/operator_modal_draw.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/templates_py/operator_modal_draw.py b/scripts/templates_py/operator_modal_draw.py index 5cb5d91d8e2..521c146b887 100644 --- a/scripts/templates_py/operator_modal_draw.py +++ b/scripts/templates_py/operator_modal_draw.py @@ -15,15 +15,15 @@ def draw_callback_px(self, context): blf.draw(font_id, "Hello Word " + str(len(self.mouse_path))) # 50% alpha, 2 pixel width line - shader = gpu.shader.from_builtin('UNIFORM_COLOR') gpu.state.blend_set('ALPHA') - gpu.state.line_width_set(2.0) - batch = batch_for_shader(shader, 'LINE_STRIP', {"pos": self.mouse_path}) + shader = gpu.shader.from_builtin('POLYLINE_UNIFORM_COLOR') shader.uniform_float("color", (0.0, 0.0, 0.0, 0.5)) + shader.uniform_float("viewportSize", (context.area.width, context.area.height)) + shader.uniform_float('lineWidth', 2.0) + batch = batch_for_shader(shader, 'LINE_STRIP', {"pos": self.mouse_path}) batch.draw(shader) - # restore opengl defaults - gpu.state.line_width_set(1.0) + # restore gpu defaults gpu.state.blend_set('NONE')