From db455e6b6184a66ce928405948bc407c57972bc9 Mon Sep 17 00:00:00 2001 From: Yusarina Date: Thu, 13 Jun 2024 22:46:40 +0100 Subject: [PATCH] MMD Importing Start - This is a basic start to try and import both pmx and pmd files, not working 100% at the minute but I working on getting it working. --- core/__init__.py | 1 + core/pmd/import_pmd.py | 224 ++++++++++++++++++++++++++++++ core/pmx/import_pmx.py | 307 +++++++++++++++++++++++++++++++++++++++++ ui/quick_access.py | 38 ++++- 4 files changed, 569 insertions(+), 1 deletion(-) create mode 100644 core/pmd/import_pmd.py create mode 100644 core/pmx/import_pmx.py diff --git a/core/__init__.py b/core/__init__.py index 8f5256c..d9c067f 100644 --- a/core/__init__.py +++ b/core/__init__.py @@ -1,3 +1,4 @@ # core/__init__.py from .register import register_wrap +from . import pmx \ No newline at end of file diff --git a/core/pmd/import_pmd.py b/core/pmd/import_pmd.py new file mode 100644 index 0000000..d23f4a9 --- /dev/null +++ b/core/pmd/import_pmd.py @@ -0,0 +1,224 @@ +import bpy +import struct +import mathutils + +def read_pmd_header(file): + # Read PMD header information + magic = file.read(3) + if magic != b'Pmd': + raise ValueError("Invalid PMD file") + + version = struct.unpack('