cleanup
formatting etc
This commit is contained in:
parent
9276ad4fac
commit
c063c7af1d
1 changed files with 9 additions and 11 deletions
20
butils.py
20
butils.py
|
@ -2,7 +2,6 @@ import importlib
|
||||||
import os
|
import os
|
||||||
import queue
|
import queue
|
||||||
import re
|
import re
|
||||||
from multiprocessing import Process
|
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
import mathutils
|
import mathutils
|
||||||
|
@ -132,7 +131,6 @@ def calc_tangent_on_bezier(bezier_point_1, bezier_point_2, t):
|
||||||
).normalized()
|
).normalized()
|
||||||
|
|
||||||
|
|
||||||
from math import acos, pi, radians, sqrt
|
|
||||||
|
|
||||||
|
|
||||||
def align_rotations_auto_pivot(
|
def align_rotations_auto_pivot(
|
||||||
|
@ -403,7 +401,7 @@ def move_in_fontcollection(obj, fontcollection, allow_duplicates=False):
|
||||||
fontcollection.objects.link(glyphs_obj)
|
fontcollection.objects.link(glyphs_obj)
|
||||||
glyphs_obj.parent = face_obj
|
glyphs_obj.parent = face_obj
|
||||||
elif len(glyphs_objs) > 1:
|
elif len(glyphs_objs) > 1:
|
||||||
print(f"found more glyphs objects than expected")
|
print("found more glyphs objects than expected")
|
||||||
|
|
||||||
# now it must exist
|
# now it must exist
|
||||||
glyphs_obj = find_objects_by_name(face_obj.children, startswith="glyphs")[0]
|
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"]
|
font_name = a["font_name"]
|
||||||
face_name = a["face_name"]
|
face_name = a["face_name"]
|
||||||
glyph = a["glyph"]
|
glyph = a["glyph"]
|
||||||
if not font_name in fonts:
|
if font_name not in fonts:
|
||||||
fonts[font_name] = {}
|
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] = []
|
||||||
fonts[font_name][face_name].append(glyph)
|
fonts[font_name][face_name].append(glyph)
|
||||||
for font_name in fonts:
|
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=""):
|
def load_font_from_filepath(filepath, glyphs="", font_name="", face_name=""):
|
||||||
if not filepath.endswith(".glb") and not filepath.endswith(".gltf"):
|
if not filepath.endswith(".glb") and not filepath.endswith(".gltf"):
|
||||||
ShowMessageBox(
|
ShowMessageBox(
|
||||||
f"Font loading error",
|
"Font loading error",
|
||||||
"ERROR",
|
"ERROR",
|
||||||
f"Filepath({filepath}) is not a *.glb or *.gltf file",
|
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()
|
update_available_fonts()
|
||||||
remove_list = []
|
remove_list = []
|
||||||
for o in bpy.context.scene.collection.all_objects:
|
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:
|
if marker_property in o and o[marker_property] == True:
|
||||||
remove_list.append(o)
|
remove_list.append(o)
|
||||||
|
|
||||||
|
@ -656,13 +654,13 @@ def completely_delete_objects(objs, recursive=True):
|
||||||
try:
|
try:
|
||||||
if hasattr(g, "children") and len(g.children) > 0:
|
if hasattr(g, "children") and len(g.children) > 0:
|
||||||
completely_delete_objects(g.children)
|
completely_delete_objects(g.children)
|
||||||
except ReferenceError as e:
|
except ReferenceError:
|
||||||
# not important
|
# not important
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
bpy.data.objects.remove(g, do_unlink=True)
|
bpy.data.objects.remove(g, do_unlink=True)
|
||||||
except ReferenceError as e:
|
except ReferenceError:
|
||||||
# not important
|
# not important
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -699,7 +697,7 @@ def is_glyph(o):
|
||||||
and is_mesh(o)
|
and is_mesh(o)
|
||||||
and not is_metrics_object(o)
|
and not is_metrics_object(o)
|
||||||
)
|
)
|
||||||
except ReferenceError as e:
|
except ReferenceError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
@ -1442,7 +1440,7 @@ def align_metrics_of_objects_to_active_object(objects=None):
|
||||||
# do it
|
# do it
|
||||||
for o in objects:
|
for o in objects:
|
||||||
is_possibly_glyph = is_glyph(o)
|
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 = []
|
metrics = []
|
||||||
for c in o.children:
|
for c in o.children:
|
||||||
if is_metrics_object(c):
|
if is_metrics_object(c):
|
||||||
|
|
Loading…
Add table
Reference in a new issue