diff --git a/art/Exporter.py b/art/Exporter.py index 437c523..285db92 100644 --- a/art/Exporter.py +++ b/art/Exporter.py @@ -13,7 +13,6 @@ D = bpy.data ROOMS_EXPORT_NAME = "rooms" EXPORT_DIRECTORY = "../assets/exported_3d" - if os.path.exists(bpy.path.abspath(f"//{EXPORT_DIRECTORY}")): shutil.rmtree(bpy.path.abspath(f"//{EXPORT_DIRECTORY}")) os.makedirs(bpy.path.abspath(f"//{EXPORT_DIRECTORY}")) @@ -152,6 +151,7 @@ def export_armatures(): with open(output_filepath, "wb") as f: write_b8(f, True) # first byte is true if it's an armature file + write_string(f, armature_object.name) write_string(f, mesh_image_filename) bones_in_armature = [] for b in armature_object.data.bones: @@ -173,6 +173,7 @@ def export_armatures(): assert False, f"Couldn't find parent of bone {b}" #print(f"Parent of bone {b.name} is index {parent_index} in list {bones_in_armature}") + write_string(f, b.name) write_i32(f, parent_index) write_4x4matrix(f, model_space_pose) write_4x4matrix(f, inverse_model_space_pose) @@ -451,4 +452,4 @@ def export_meshes_and_levels(): export_armatures() -export_meshes_and_levels() \ No newline at end of file +export_meshes_and_levels() diff --git a/main.c b/main.c index 8b38c34..ba8628f 100644 --- a/main.c +++ b/main.c @@ -916,6 +916,7 @@ typedef struct Bone struct Bone *parent; Mat4 matrix_local; Mat4 inverse_model_space_pos; + MD_String8 name; float length; } Bone; @@ -1096,6 +1097,8 @@ Armature load_armature(MD_Arena *arena, MD_String8 binary_file, MD_String8 armat ser_bool(&ser, &is_armature); assert(is_armature); + ser_MD_String8(&ser, &to_return.name, arena); + MD_String8 image_filename; ser_MD_String8(&ser, &image_filename, scratch.arena); arena->align = 16; // SSE requires quaternions are 16 byte aligned @@ -1113,6 +1116,7 @@ Armature load_armature(MD_Arena *arena, MD_String8 binary_file, MD_String8 armat BlenderMat inverse_model_space_pose; MD_i32 parent_index; + ser_MD_String8(&ser, &next_bone->name, arena); ser_int(&ser, &parent_index); ser_BlenderMat(&ser, &model_space_pose); ser_BlenderMat(&ser, &inverse_model_space_pose);