From 2a9a7ad07d10675055ea229457d1ccd160d1ab12 Mon Sep 17 00:00:00 2001 From: themancalledjakob Date: Wed, 14 Aug 2024 14:07:21 +0200 Subject: [PATCH] fix issues with adding non-existing objects --- butils.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/butils.py b/butils.py index 8e31766..d4d0476 100644 --- a/butils.py +++ b/butils.py @@ -403,10 +403,14 @@ def load_font_from_filepath(filepath): all_objects = [] for o in bpy.data.objects: all_objects.append(o) - for f in bpy.context.scene.abc3d_data.available_fonts.values(): - print(f"before loop available font: {f.font_name} {f.face_name}") for o in all_objects: - if o.name not in allObjectsBefore: + o_exists = True + try: + o, o.name + + except ReferenceError as e: + o_exists = False + if o_exists and o.name not in allObjectsBefore: # must be new if ("glyph" in o.keys() and "face_name" in o.keys() @@ -414,8 +418,6 @@ def load_font_from_filepath(filepath): and not ("type" in o.keys() and o["type"] == "metrics") and not is_metrics_object(o) ): - for f in bpy.context.scene.abc3d_data.available_fonts.values(): - print(f"super inside available font: {f.font_name} {f.face_name}") glyph_id = o["glyph"] font_name = o["font_name"] face_name = o["face_name"]