Skip to content

Commit

Permalink
Blender 4.0 API change
Browse files Browse the repository at this point in the history
  • Loading branch information
chsh2 committed Dec 6, 2023
1 parent dd534ba commit a21bf4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions operators/operator_io_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ def execute(self, context):

# Create an icon by scaling the brush texture down
icon_obj = img_obj.copy()
icon_obj.name = "icon_"+new_brush.name
icon_filepath = os.path.join(icon_dir, new_brush.name+'.png')
icon_obj.name = f"icon_{f.name.split('.')[0]}_{i}"
icon_filepath = os.path.join(icon_dir, icon_obj.name+'.png')
icon_obj.filepath = icon_filepath
icon_obj.scale(256,256)
icon_obj.save()
Expand Down
7 changes: 6 additions & 1 deletion ui_viewport_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,12 @@ def draw_callback_px(self, op, context):
blf.color(self.font_id, 0, 0, 0, 1)
blf.enable(self.font_id, blf.SHADOW)
blf.shadow(self.font_id, 3, 0.8, 0.8, 0.8, 0.95)
blf.size(self.font_id, 36 if stroke.select else 24, 72)
# The third parameter became optional since Blender 3.4,
# and was deprecated in Blender 4.0
if bpy.app.version > (3, 6, 0):
blf.size(self.font_id, 36 if stroke.select else 24)
else:
blf.size(self.font_id, 36 if stroke.select else 24, 72)
blf.position(self.font_id, view_co[0], view_co[1], 0)
blf.draw(self.font_id, str(i))

Expand Down

0 comments on commit a21bf4d

Please sign in to comment.