From 8111fe236987f1fea15138a75177fb4684b5477f Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Thu, 25 Sep 2025 17:22:35 +0200 Subject: [PATCH] Fix #146655: GPU: Call of deprecated function There are deprecation usages in the gpu presets and custom shapes python module. This PR uses the correct calls to remove the deprecation warnings. Pull Request: https://projects.blender.org/blender/blender/pulls/146746 --- scripts/modules/_bpy_types.py | 3 +-- scripts/modules/gpu_extras/presets.py | 7 ++++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/modules/_bpy_types.py b/scripts/modules/_bpy_types.py index ece8633b27f..83ccdab1ce9 100644 --- a/scripts/modules/_bpy_types.py +++ b/scripts/modules/_bpy_types.py @@ -970,7 +970,7 @@ class Gizmo(_StructRNA): with gpu.matrix.push_pop(): gpu.matrix.multiply_matrix(matrix) - batch.draw() + batch.draw(shader) if use_blend: gpu.state.blend_set('NONE') @@ -1002,7 +1002,6 @@ class Gizmo(_StructRNA): vbo.attr_fill(id=pos_id, data=verts) batch = GPUBatch(type=type, buf=vbo) shader = gpu.shader.from_builtin('UNIFORM_COLOR') - batch.program_set(shader) return (batch, shader) diff --git a/scripts/modules/gpu_extras/presets.py b/scripts/modules/gpu_extras/presets.py index b4d3a0375bb..0e880c8208a 100644 --- a/scripts/modules/gpu_extras/presets.py +++ b/scripts/modules/gpu_extras/presets.py @@ -51,10 +51,11 @@ def draw_circle_2d(position, color, radius, *, segments=None): vbo = GPUVertBuf(len=len(verts), format=fmt) vbo.attr_fill(id=pos_id, data=verts) batch = GPUBatch(type='LINE_STRIP', buf=vbo) - shader = gpu.shader.from_builtin('UNIFORM_COLOR') - batch.program_set(shader) + shader = gpu.shader.from_builtin('POLYLINE_UNIFORM_COLOR') + shader.uniform_float("viewportSize", gpu.state.viewport_get()[2:]) + shader.uniform_float("lineWidth", gpu.state.line_width_get()) shader.uniform_float("color", color) - batch.draw() + batch.draw(shader) def draw_texture_2d(texture, position, width, height):