Fix for error when exporting mesh with no armature

This commit is contained in:
Colin Basnett
2025-02-06 21:10:13 -08:00
parent d1bae944f1
commit 5f3bfc0ff3
2 changed files with 11 additions and 2 deletions

View File

@@ -130,7 +130,7 @@ def build_psk(context, input_objects: PskInputObjects, options: PskBuildOptions)
psk_bone.children_count = 0 psk_bone.children_count = 0
psk_bone.parent_index = 0 psk_bone.parent_index = 0
psk_bone.location = Vector3.zero() psk_bone.location = Vector3.zero()
psk_bone.rotation = coordinate_system_default_rotation psk_bone.rotation = Quaternion.from_bpy_quaternion(coordinate_system_default_rotation)
psk.bones.append(psk_bone) psk.bones.append(psk_bone)
else: else:
bone_names = get_export_bone_names(armature_object, options.bone_filter_mode, options.bone_collection_indices) bone_names = get_export_bone_names(armature_object, options.bone_filter_mode, options.bone_collection_indices)

View File

@@ -2,7 +2,7 @@ from ctypes import *
from typing import Tuple from typing import Tuple
from bpy.props import EnumProperty from bpy.props import EnumProperty
from mathutils import Vector, Matrix from mathutils import Vector, Matrix, Quaternion as BpyQuaternion
class Color(Structure): class Color(Structure):
@@ -84,6 +84,15 @@ class Quaternion(Structure):
def identity(cls): def identity(cls):
return Quaternion(0, 0, 0, 1) return Quaternion(0, 0, 0, 1)
@classmethod
def from_bpy_quaternion(cls, other: BpyQuaternion) -> BpyQuaternion:
quaternion = Quaternion()
quaternion.x = other.x
quaternion.y = other.y
quaternion.z = other.z
quaternion.w = other.w
return quaternion
class Section(Structure): class Section(Structure):
_fields_ = [ _fields_ = [