revamp loading and panels

This commit is contained in:
jrkb 2024-08-26 18:48:43 +02:00
parent 3631ac8e49
commit 97ca4f5d23
4 changed files with 219 additions and 93 deletions

View file

@ -8,7 +8,19 @@ from bpy.props import (StringProperty,
from bpy.types import Operator
from bpy_extras.io_utils import ImportHelper, ExportHelper
from io_scene_gltf2 import ConvertGLTF2_Base
from .common import Font
import importlib
# then import dependencies for our addon
if "Font" in locals():
importlib.reload(Font)
else:
from .common import Font
if "utils" in locals():
importlib.reload(utils)
else:
from .common import utils
# taken from blender_git/blender/scripts/addons/io_scene_gltf2/__init__.py
@ -25,7 +37,8 @@ def get_font_faces_in_file(filepath):
for node in gltf_importer.data.nodes:
if type(node.extras) != type(None) \
and "glyph" in node.extras \
and not ("type" in node.extras and node.extras["type"] == "metrics"):
and not ("type" in node.extras and node.extras["type"] == "metrics") \
and not (f"{utils.prefix()}_type" in node.extras and node.extras[f"{utils.prefix()}_type"] == "metrics"):
out.append(node.extras)
return out
@ -400,7 +413,9 @@ class ImportGLTF2(Operator, ConvertGLTF2_Base, ImportHelper):
set_extras(obj, n_vars["extras"])
if "glyph" in n_vars["extras"] and \
not ("type" in n_vars["extras"] and \
n_vars["extras"]["type"] == "metrics"):
n_vars["extras"]["type"] == "metrics") and \
not (f"{utils.prefix()}_type" in n_vars["extras"] and \
n_vars["extras"][f"{utils.prefix()}_type"] == "metrics"):
obj["type"] = "glyph"
for vi, vnode in gltf.vnodes.items():