From 497478eb18de41675fc00d9b402d2899dc614ba6 Mon Sep 17 00:00:00 2001 From: 989onan Date: Sat, 15 Jun 2024 16:58:25 -0400 Subject: [PATCH] PMX working enough - now the parser doesn't explode and gets to the end of the morphs. so now PMX can be imported --- core/import_pmx.py | 212 +++++++++++++++++++++++++++++---------------- 1 file changed, 137 insertions(+), 75 deletions(-) diff --git a/core/import_pmx.py b/core/import_pmx.py index 67a6ae2..ee95b31 100644 --- a/core/import_pmx.py +++ b/core/import_pmx.py @@ -1,6 +1,7 @@ import bpy import struct import traceback +import mathutils from mathutils import Matrix, Vector @@ -40,7 +41,7 @@ def read_pmx_header(file): print(model_english_comment) return version, encoding, additional_uvs, vertex_index_size, texture_index_size, material_index_size, bone_index_size, morph_index_size, rigid_body_index_size, model_name, model_english_name, model_comment, model_english_comment -def read_vertex(file, bone_index_size, additional_uvs): +def read_vertex(file, string_build, byte_size, additional_uvs): position = struct.unpack('<3f', file.read(12)) normal = struct.unpack('<3f', file.read(12)) uv = struct.unpack('<2f', file.read(8)) @@ -50,48 +51,35 @@ def read_vertex(file, bone_index_size, additional_uvs): weight_deform_type = struct.unpack('