From 9c1b76d5c64f232050e14260e14e42b8ad0fb634 Mon Sep 17 00:00:00 2001 From: num0005 Date: Wed, 11 Dec 2024 00:30:16 +0000 Subject: [PATCH] Sample Pytolith loading code --- .gitmodules | 4 ++++ io_scene_halo/__init__.py | 15 +++++++++++++++ io_scene_halo/packages/Pytolith | 1 + 3 files changed, 20 insertions(+) create mode 100644 .gitmodules create mode 160000 io_scene_halo/packages/Pytolith diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..e17c2f841 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "io_scene_halo/packages/Pytolith"] + path = io_scene_halo/packages/Pytolith + url = git@github.com:num0005/Pytolith.git + branch = master diff --git a/io_scene_halo/__init__.py b/io_scene_halo/__init__.py index 56d61aa3d..a58e25773 100644 --- a/io_scene_halo/__init__.py +++ b/io_scene_halo/__init__.py @@ -50,6 +50,13 @@ FloatVectorProperty ) +# enable loading packages from "packages" +import pathlib +import os +import sys +root_directory = pathlib.Path(os.path.abspath(__file__)).parent +sys.path.append(str(root_directory/"packages")) + from . import global_ui from . import file_ass from . import file_jma @@ -60,6 +67,14 @@ from . import file_wrl from . import misc +# sample code + +import sys +from Pytolith import Definitions + +defs = Definitions.Definitions() +defs.load_from_xml(r"X:\Halo2TagLayout") + modules = [ global_ui, file_ass, diff --git a/io_scene_halo/packages/Pytolith b/io_scene_halo/packages/Pytolith new file mode 160000 index 000000000..b82b03200 --- /dev/null +++ b/io_scene_halo/packages/Pytolith @@ -0,0 +1 @@ +Subproject commit b82b03200db86e28a788126c0835aa52afe86ea2