Massive art import, fix scale coord transform bug. Remove zig from build

main
parent b668125d25
commit 265166c4d4

BIN
art/Cube.295_color.png.png (Stored with Git LFS)

Binary file not shown.

BIN
art/Cube.296_color.png.png (Stored with Git LFS)

Binary file not shown.

BIN
art/Cube.297_color.png.png (Stored with Git LFS)

Binary file not shown.

BIN
art/Cube.314_color.png.png (Stored with Git LFS)

Binary file not shown.

BIN
art/Cylinder.130_color.png.png (Stored with Git LFS)

Binary file not shown.

BIN
art/Cylinder.131_color.png.png (Stored with Git LFS)

Binary file not shown.

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2d77ccfd742ef34528b7466363858c2ca26b0e8acd5ec3b504d75e9edff3d2f4
size 3034306

@ -84,7 +84,6 @@ project_directory = bpy.path.abspath("//")
def is_file_in_project(file_path): def is_file_in_project(file_path):
file_name = os.path.basename(file_path) file_name = os.path.basename(file_path)
for root, dirs, files in os.walk(project_directory): for root, dirs, files in os.walk(project_directory):
print(f"Looking for {file_name} Dirs: {dirs} files: {files}")
if file_name in files: if file_name in files:
return True return True
return False return False
@ -111,7 +110,14 @@ def ensure_tex_saved_and_get_name(o) -> str:
img_obj.save(filepath=bpy.path.abspath(save_to)) img_obj.save(filepath=bpy.path.abspath(save_to))
else: else:
assert img_obj.filepath != "", f"{img_obj.filepath} in mesh {mesh_name} Isn't there but should be, as it has no packed image" assert img_obj.filepath != "", f"{img_obj.filepath} in mesh {mesh_name} Isn't there but should be, as it has no packed image"
assert is_file_in_project(bpy.path.abspath(img_obj.filepath)), f"The image {image_filename} has filepath {img_obj.filepath} which isn't in the project directory {project_directory}" old_path = bpy.path.abspath(img_obj.filepath)
if not is_file_in_project(old_path):
print(f"Image {image_filename} has filepath {img_obj.filepath}, outside of the current directory. So we're copying it baby. Hoo-rah!")
new_path = bpy.path.abspath(f"//{image_filename}")
assert not os.path.exists(new_path), f"Tried to migrate {image_filename} to a new home {new_path}, but its already taken. It's over!"
shutil.copyfile(old_path, new_path)
img_obj.filepath = new_path
assert is_file_in_project(bpy.path.abspath(img_obj.filepath)), f"The image {image_filename} has filepath {img_obj.filepath} which isn't in the project directory {project_directory}, even after copying it! WTF"
shutil.copyfile(bpy.path.abspath(img_obj.filepath),bpy.path.abspath(save_to)) shutil.copyfile(bpy.path.abspath(img_obj.filepath),bpy.path.abspath(save_to))
return image_filename return image_filename
@ -119,6 +125,7 @@ def ensure_tex_saved_and_get_name(o) -> str:
# meshes can either be Meshes, or Armatures. Armatures contain all mesh data to draw it, and any anims it has # meshes can either be Meshes, or Armatures. Armatures contain all mesh data to draw it, and any anims it has
for o in D.objects: for o in D.objects:
if o.hide_get(): continue
if o.type == "MESH": if o.type == "MESH":
if o.parent and o.parent.type == "ARMATURE": if o.parent and o.parent.type == "ARMATURE":
mesh_object = o mesh_object = o
@ -320,6 +327,7 @@ for o in D.objects:
vertices.append((position, uv)) vertices.append((position, uv))
write_u64(f, len(vertices)) write_u64(f, len(vertices))
print(f"\n\n{output_filepath} vertices:")
for v_and_uv in vertices: for v_and_uv in vertices:
v, uv = v_and_uv v, uv = v_and_uv
write_f32(f, v.x) write_f32(f, v.x)
@ -327,6 +335,8 @@ for o in D.objects:
write_f32(f, v.z) write_f32(f, v.z)
write_f32(f, uv.x) write_f32(f, uv.x)
write_f32(f, uv.y) write_f32(f, uv.y)
if len(vertices) < 100:
print(v)
print(f"Wrote {len(vertices)} vertices") print(f"Wrote {len(vertices)} vertices")
with open(bpy.path.abspath(f"//{EXPORT_DIRECTORY}/{LEVEL_EXPORT_NAME}.bin"), "wb") as f: with open(bpy.path.abspath(f"//{EXPORT_DIRECTORY}/{LEVEL_EXPORT_NAME}.bin"), "wb") as f:

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:5b050b460e023a08ad7a66750adc512c931b171eee84d49f0b66eabe7ebd6ea6 oid sha256:54df86175ef7a0c9724cc9102ff01a334140526709f747da337f86465ed33581
size 10991788 size 22694204

@ -4,7 +4,7 @@
if "%1" == "codegen" ( call run_codegen.bat || goto :error ) else ( echo NOT RUNNING CODEGEN ) if "%1" == "codegen" ( call run_codegen.bat || goto :error ) else ( echo NOT RUNNING CODEGEN )
start /B zig cc -DDEVTOOLS -Igen -Ithirdparty -lDbghelp -lGdi32 -lD3D11 -lOle32 -lwinhttp -gfull -gcodeview -o main_zig.exe main.c @REM start /B zig cc -DDEVTOOLS -Igen -Ithirdparty -lDbghelp -lGdi32 -lD3D11 -lOle32 -lwinhttp -gfull -gcodeview -o main_zig.exe main.c
cl /diagnostics:caret /DDEVTOOLS /Igen /Ithirdparty /W3 /Zi /WX Dbghelp.lib winhttp.lib main.c || goto :error cl /diagnostics:caret /DDEVTOOLS /Igen /Ithirdparty /W3 /Zi /WX Dbghelp.lib winhttp.lib main.c || goto :error
goto :EOF goto :EOF

@ -1036,6 +1036,7 @@ typedef struct
Armature load_armature(MD_Arena *arena, MD_String8 binary_file, MD_String8 armature_name) Armature load_armature(MD_Arena *arena, MD_String8 binary_file, MD_String8 armature_name)
{ {
assert(binary_file.str);
MD_ArenaTemp scratch = MD_GetScratch(&arena, 1); MD_ArenaTemp scratch = MD_GetScratch(&arena, 1);
SerState ser = { SerState ser = {
.data = binary_file.str, .data = binary_file.str,
@ -1232,7 +1233,9 @@ Transform blender_to_game_transform(BlenderTransform blender_transform)
to_return.offset = blender_transform.pos; to_return.offset = blender_transform.pos;
to_return.scale = blender_transform.scale; to_return.scale.x = blender_transform.scale.x;
to_return.scale.y = blender_transform.scale.z;
to_return.scale.z = blender_transform.scale.y;
Mat4 rotation_matrix = M4D(1.0f); Mat4 rotation_matrix = M4D(1.0f);
rotation_matrix = MulM4(Rotate_RH(AngleRad(blender_transform.euler_rotation.x), V3(1,0,0)), rotation_matrix); rotation_matrix = MulM4(Rotate_RH(AngleRad(blender_transform.euler_rotation.x), V3(1,0,0)), rotation_matrix);

Loading…
Cancel
Save