Blender Kitsu: Make PyGPU Key backwards compatible #65

Merged
Sebastian Parborg merged 1 commits from fix/PyGPU-keys-backwards-compatible into main 2023-06-01 17:37:39 +02:00
Showing only changes of commit 4ecc9de5a6 - Show all commits

View File

@ -36,8 +36,12 @@ rect_coords = ((0, 0), (1, 0), (1, 1), (0, 1))
# If running in the background, no handles are registered, as drawing extra UI
# elements does not make sense.
# See register() and unregister().
if bpy.app.version_string.split('.')[0] == '3':
color_key = "2D_UNIFORM_COLOR"
else:
color_key = "UNIFORM_COLOR"
if not bpy.app.background:
ucolor_2d_shader = gpu.shader.from_builtin("UNIFORM_COLOR") # TEST THIS HOTFX
ucolor_2d_shader = gpu.shader.from_builtin(color_key)
ucolor_2d_rect_batch = batch_for_shader(
ucolor_2d_shader, "TRI_FAN", {"pos": rect_coords}
)