From db455e6b6184a66ce928405948bc407c57972bc9 Mon Sep 17 00:00:00 2001 From: Yusarina Date: Thu, 13 Jun 2024 22:46:40 +0100 Subject: [PATCH 1/3] 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(' Date: Fri, 14 Jun 2024 01:16:14 +0100 Subject: [PATCH 2/3] Several Improvements - Fixes decode issues. --- core/pmx/import_pmx.py | 198 ++++++++++++++++++++--------------------- 1 file changed, 98 insertions(+), 100 deletions(-) diff --git a/core/pmx/import_pmx.py b/core/pmx/import_pmx.py index 8f2c7a0..3e65ece 100644 --- a/core/pmx/import_pmx.py +++ b/core/pmx/import_pmx.py @@ -21,10 +21,10 @@ def read_pmx_header(file): rigid_body_index_size = struct.unpack(' Date: Fri, 14 Jun 2024 23:44:52 +0100 Subject: [PATCH 3/3] Added Comments --- core/pmx/import_pmx.py | 204 +++++++++++++++++++++-------------------- 1 file changed, 103 insertions(+), 101 deletions(-) diff --git a/core/pmx/import_pmx.py b/core/pmx/import_pmx.py index 3e65ece..6a5bddc 100644 --- a/core/pmx/import_pmx.py +++ b/core/pmx/import_pmx.py @@ -3,172 +3,174 @@ import struct def read_pmx_header(file): # Read PMX header information - magic = file.read(4) + magic = file.read(4) # Read magic bytes (should be "PMX ") if magic != b'PMX ': raise ValueError("Invalid PMX file") - version = struct.unpack('