load used glyphs on file load
This commit is contained in:
parent
cd1af39985
commit
460bbc8574
2 changed files with 15 additions and 1 deletions
13
__init__.py
13
__init__.py
|
@ -1418,6 +1418,18 @@ def detect_text():
|
||||||
a = test_availability(o["font_name"], o["face_name"], o["text"])
|
a = test_availability(o["font_name"], o["face_name"], o["text"])
|
||||||
butils.transfer_blender_object_to_text_properties(o, t)
|
butils.transfer_blender_object_to_text_properties(o, t)
|
||||||
|
|
||||||
|
def load_used_glyphs():
|
||||||
|
print("LOAD USED GLYPHS")
|
||||||
|
scene = bpy.context.scene
|
||||||
|
abc3d_data = scene.abc3d_data
|
||||||
|
for t in abc3d_data.available_texts:
|
||||||
|
a = Font.test_availability(t.font_name,
|
||||||
|
t.face_name,
|
||||||
|
t.text)
|
||||||
|
if len(a["maybe"]) > 0:
|
||||||
|
for fp in a["filepaths"]:
|
||||||
|
butils.load_font_from_filepath(fp, a["maybe"])
|
||||||
|
|
||||||
|
|
||||||
@persistent
|
@persistent
|
||||||
def load_handler(self, dummy):
|
def load_handler(self, dummy):
|
||||||
|
@ -1425,6 +1437,7 @@ def load_handler(self, dummy):
|
||||||
bpy.app.timers.register(butils.execute_queued_functions)
|
bpy.app.timers.register(butils.execute_queued_functions)
|
||||||
butils.run_in_main_thread(butils.update_available_fonts)
|
butils.run_in_main_thread(butils.update_available_fonts)
|
||||||
butils.run_in_main_thread(bpy.ops.abc3d.load_installed_fonts)
|
butils.run_in_main_thread(bpy.ops.abc3d.load_installed_fonts)
|
||||||
|
butils.run_in_main_thread(load_used_glyphs)
|
||||||
|
|
||||||
def load_handler_unload():
|
def load_handler_unload():
|
||||||
if bpy.app.timers.is_registered(butils.execute_queued_functions):
|
if bpy.app.timers.is_registered(butils.execute_queued_functions):
|
||||||
|
|
|
@ -234,13 +234,14 @@ def test_availability(font_name, face_name, text):
|
||||||
return MISSING_FONT
|
return MISSING_FONT
|
||||||
if fonts[font_name].faces.get(face_name) == None:
|
if fonts[font_name].faces.get(face_name) == None:
|
||||||
return MISSING_FACE
|
return MISSING_FACE
|
||||||
loaded, missing, maybe = test_glyphs_availability(font_name,
|
loaded, missing, maybe, filepaths = test_glyphs_availability(font_name,
|
||||||
face_name,
|
face_name,
|
||||||
text)
|
text)
|
||||||
return {
|
return {
|
||||||
"loaded": loaded,
|
"loaded": loaded,
|
||||||
"missing": missing,
|
"missing": missing,
|
||||||
"maybe": maybe,
|
"maybe": maybe,
|
||||||
|
"filepaths": filepaths,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue