Skip to content

Commit

Permalink
Fix: Attribute error on Blender 2.93
Browse files Browse the repository at this point in the history
  • Loading branch information
nutti committed Feb 3, 2024
1 parent ccfbc2f commit 05d550a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/screencast_keys/gpu_utils/imm.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ def immEnd():
scissor_box = inst.get_scissor()
# TODO: Other than OpenGL backend, scissor is not supported.
# Temporary turn off when gpu.state.scissor_set is implemented.
if hasattr(gpu.platform, "backend_type_get") and \
if hasattr(gpu, "hasattr") and \
hasattr(gpu.platform, "backend_type_get") and \
gpu.platform.backend_type_get() != 'OPENGL':
scissor_box = None

Expand Down
9 changes: 6 additions & 3 deletions src/screencast_keys/gpu_utils/shader.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ class ShaderManager:

@classmethod
def register_shaders(cls):
if hasattr(gpu.platform, "backend_type_get") and \
if hasattr(gpu, "platform") and \
hasattr(gpu.platform, "backend_type_get") and \
gpu.platform.backend_type_get() != 'OPENGL':
return

Expand Down Expand Up @@ -75,7 +76,8 @@ def register_shaders(cls):

@classmethod
def unregister_shaders(cls):
if hasattr(gpu.platform, "backend_type_get") and \
if hasattr(gpu, "platform") and \
hasattr(gpu.platform, "backend_type_get") and \
gpu.platform.backend_type_get() != 'OPENGL':
return

Expand All @@ -85,7 +87,8 @@ def unregister_shaders(cls):

@classmethod
def get_shader(cls, shader_name):
if hasattr(gpu.platform, "backend_type_get") and \
if hasattr(gpu, "platform") and \
hasattr(gpu.platform, "backend_type_get") and \
gpu.platform.backend_type_get() != 'OPENGL':
return None

Expand Down
4 changes: 2 additions & 2 deletions src/screencast_keys/utils/compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def add_if_exist(cls_name, space_name, space_types):


def blf_size(font_id, font_size, dpi):
if check_version(3, 4, 0) >= 0:
try:
blf.size(font_id, font_size)
else:
except TypeError:
blf.size(font_id, font_size, dpi)

0 comments on commit 05d550a

Please sign in to comment.