import bpy import struct import mathutils import traceback import os from bpy.types import Material, Operator, Context, Object, Image, Mesh, MeshUVLoopLayer, Float2AttributeValue, ShaderNodeTexImage, ShaderNodeBsdfPrincipled, ShaderNodeOutputMaterial 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('