formatting etc
This commit is contained in:
jrkb 2025-05-13 16:59:32 +02:00
parent 9276ad4fac
commit c063c7af1d

View file

@ -2,7 +2,6 @@ import importlib
import os
import queue
import re
from multiprocessing import Process
import bpy
import mathutils
@ -132,7 +131,6 @@ def calc_tangent_on_bezier(bezier_point_1, bezier_point_2, t):
).normalized()
from math import acos, pi, radians, sqrt
def align_rotations_auto_pivot(
@ -403,7 +401,7 @@ def move_in_fontcollection(obj, fontcollection, allow_duplicates=False):
fontcollection.objects.link(glyphs_obj)
glyphs_obj.parent = face_obj
elif len(glyphs_objs) > 1:
print(f"found more glyphs objects than expected")
print("found more glyphs objects than expected")
# now it must exist
glyphs_obj = find_objects_by_name(face_obj.children, startswith="glyphs")[0]
@ -445,9 +443,9 @@ def register_font_from_filepath(filepath):
font_name = a["font_name"]
face_name = a["face_name"]
glyph = a["glyph"]
if not font_name in fonts:
if font_name not in fonts:
fonts[font_name] = {}
if not face_name in fonts[font_name]:
if face_name not in fonts[font_name]:
fonts[font_name][face_name] = []
fonts[font_name][face_name].append(glyph)
for font_name in fonts:
@ -460,7 +458,7 @@ def register_font_from_filepath(filepath):
def load_font_from_filepath(filepath, glyphs="", font_name="", face_name=""):
if not filepath.endswith(".glb") and not filepath.endswith(".gltf"):
ShowMessageBox(
f"Font loading error",
"Font loading error",
"ERROR",
f"Filepath({filepath}) is not a *.glb or *.gltf file",
)
@ -524,7 +522,7 @@ def load_font_from_filepath(filepath, glyphs="", font_name="", face_name=""):
update_available_fonts()
remove_list = []
for o in bpy.context.scene.collection.all_objects:
if not o.name in fontcollection.all_objects:
if o.name not in fontcollection.all_objects:
if marker_property in o and o[marker_property] == True:
remove_list.append(o)
@ -656,13 +654,13 @@ def completely_delete_objects(objs, recursive=True):
try:
if hasattr(g, "children") and len(g.children) > 0:
completely_delete_objects(g.children)
except ReferenceError as e:
except ReferenceError:
# not important
pass
try:
bpy.data.objects.remove(g, do_unlink=True)
except ReferenceError as e:
except ReferenceError:
# not important
pass
@ -699,7 +697,7 @@ def is_glyph(o):
and is_mesh(o)
and not is_metrics_object(o)
)
except ReferenceError as e:
except ReferenceError:
return False
@ -1442,7 +1440,7 @@ def align_metrics_of_objects_to_active_object(objects=None):
# do it
for o in objects:
is_possibly_glyph = is_glyph(o)
if is_possibly_glyph and not o is bpy.context.active_object:
if is_possibly_glyph and o is not bpy.context.active_object:
metrics = []
for c in o.children:
if is_metrics_object(c):