22import re
33import os
44from math import pi
5- from .helpers import select_all , unselect_all , add_object , select_object , set_active_object , in_charset
5+ from .helpers import *
66from .key import Profile , Label , Key
77from .char_ranges import CJK_RANGES , DEJAVU_RANGES
88from typing import Tuple , List
@@ -77,7 +77,7 @@ def add_curve(key: Key, curve, text_length: int, label_material_name: str, label
7777 curve .modifiers ["Remesh" ].mode = 'SMOOTH'
7878 curve .modifiers ["Remesh" ].octree_depth = (4 if text_length == 1 else 7 )
7979 curve .modifiers ["Remesh" ].use_remove_disconnected = False
80- ops . object . modifier_apply ( apply_as = 'DATA' , modifier = "Remesh" )
80+ apply_modifier ( "Remesh" )
8181
8282 unselect_all ()
8383 set_active_object (curve )
@@ -90,7 +90,7 @@ def add_curve(key: Key, curve, text_length: int, label_material_name: str, label
9090 context .object .modifiers ["Shrinkwrap" ].use_positive_direction = True
9191 context .object .modifiers ["Shrinkwrap" ].use_negative_direction = True
9292 context .object .modifiers ["Shrinkwrap" ].target = key_object
93- ops . object . modifier_apply ( apply_as = 'DATA' , modifier = "Shrinkwrap" )
93+ apply_modifier ( "Shrinkwrap" )
9494
9595 # create clipping cube
9696 ops .mesh .primitive_cube_add (location = (box [0 ] - box [2 ] * 0.5 , box [1 ] + box [3 ] * 0.5 , key_object .location [2 ] + key_object .dimensions [2 ] / 2 ))
@@ -107,7 +107,7 @@ def add_curve(key: Key, curve, text_length: int, label_material_name: str, label
107107 ops .object .modifier_add (type = 'BOOLEAN' )
108108 context .object .modifiers ["Boolean" ].operation = 'INTERSECT'
109109 context .object .modifiers ["Boolean" ].object = cube
110- ops . object . modifier_apply ( apply_as = 'DATA' , modifier = "Boolean" )
110+ apply_modifier ( "Boolean" )
111111 data .objects .remove (cube )
112112
113113 for edge in context .object .data .edges :
@@ -194,7 +194,8 @@ def add(key: Key, fonts: List, label_position: int, material_name: str, key_obj)
194194 label_length = len (key_label .text )
195195
196196 curve = None
197- if (match := re .fullmatch (r"<i class=['\"](fa|kb) (fa|kb)-([a-zA-Z0-9\-]+)['\"]><\/i>" , key_label .text )) is not None :
197+ match = re .fullmatch (r"<i class=['\"](fa|kb) (fa|kb)-([a-zA-Z0-9\-]+)['\"]><\/i>" , key_label .text )
198+ if match is not None :
198199 label_size *= 0.5
199200 curve = add_icon (match [1 ], match [3 ], label_size , label_position , box )
200201 label_length = 1
0 commit comments