player animations and blender export

This commit is contained in:
Jonas H
2026-07-10 08:17:40 +02:00
parent 69bf70060c
commit b1d9f96068
7 changed files with 717 additions and 3 deletions

Binary file not shown.

View File

@@ -0,0 +1,703 @@
{
"asset":{
"generator":"Khronos glTF Blender I/O v5.0.21",
"version":"2.0"
},
"scene":0,
"scenes":[
{
"name":"Scene",
"nodes":[
5
]
}
],
"nodes":[
{
"mesh":0,
"name":"Cube",
"rotation":[
0,
-0.7071067094802856,
0,
0.7071068286895752
],
"translation":[
-0.17764922976493835,
0.08727341890335083,
-0.0852796733379364
]
},
{
"mesh":1,
"name":"Cylinder",
"rotation":[
0,
-0.7071067094802856,
0,
0.7071068286895752
],
"translation":[
-0.011309560388326645,
0.6912503242492676,
0.09866997599601746
]
},
{
"mesh":2,
"name":"Icosphere",
"rotation":[
0,
-0.7071067094802856,
0,
0.7071068286895752
],
"scale":[
1.2789157629013062,
1.2789157629013062,
1.2789157629013062
],
"translation":[
-0.011309552937746048,
2.127289056777954,
-0.04439057782292366
]
},
{
"mesh":3,
"name":"Sphere",
"rotation":[
0,
-0.7071067094802856,
0,
0.7071068286895752
],
"scale":[
1,
0.7825989127159119,
1
],
"translation":[
-0.011309560388326645,
1.4572832584381104,
0.09866997599601746
]
},
{
"mesh":4,
"name":"Sphere.001",
"rotation":[
0,
-0.7071067094802856,
0,
0.7071068286895752
],
"scale":[
1.1163828372955322,
0.6869162917137146,
1.1163828372955322
],
"translation":[
-0.011309560388326645,
1.6550889015197754,
0.09866997599601746
]
},
{
"children":[
0,
1,
2,
3,
4
],
"name":"Control"
}
],
"animations":[
{
"channels":[
{
"sampler":0,
"target":{
"node":5,
"path":"rotation"
}
}
],
"name":"Walk_Start",
"samplers":[
{
"input":20,
"interpolation":"LINEAR",
"output":21
}
]
},
{
"channels":[
{
"sampler":0,
"target":{
"node":5,
"path":"rotation"
}
}
],
"name":"Walk_Loop",
"samplers":[
{
"input":22,
"interpolation":"LINEAR",
"output":23
}
]
},
{
"channels":[
{
"sampler":0,
"target":{
"node":5,
"path":"translation"
}
},
{
"sampler":1,
"target":{
"node":5,
"path":"rotation"
}
}
],
"name":"Roll_Start",
"samplers":[
{
"input":24,
"interpolation":"LINEAR",
"output":25
},
{
"input":24,
"interpolation":"LINEAR",
"output":26
}
]
},
{
"channels":[
{
"sampler":0,
"target":{
"node":5,
"path":"translation"
}
},
{
"sampler":1,
"target":{
"node":5,
"path":"rotation"
}
}
],
"name":"Roll_Loop",
"samplers":[
{
"input":22,
"interpolation":"LINEAR",
"output":27
},
{
"input":22,
"interpolation":"LINEAR",
"output":28
}
]
}
],
"meshes":[
{
"name":"Cube",
"primitives":[
{
"attributes":{
"POSITION":0,
"NORMAL":1,
"TEXCOORD_0":2
},
"indices":3
}
]
},
{
"name":"Cylinder",
"primitives":[
{
"attributes":{
"POSITION":4,
"NORMAL":5,
"TEXCOORD_0":6
},
"indices":7
}
]
},
{
"name":"Icosphere",
"primitives":[
{
"attributes":{
"POSITION":8,
"NORMAL":9,
"TEXCOORD_0":10
},
"indices":11
}
]
},
{
"name":"Sphere",
"primitives":[
{
"attributes":{
"POSITION":12,
"NORMAL":13,
"TEXCOORD_0":14
},
"indices":15
}
]
},
{
"name":"Sphere.001",
"primitives":[
{
"attributes":{
"POSITION":16,
"NORMAL":17,
"TEXCOORD_0":18
},
"indices":19
}
]
}
],
"accessors":[
{
"bufferView":0,
"componentType":5126,
"count":28,
"max":[
0.5332646369934082,
0.10000000149011612,
0.1496274322271347
],
"min":[
0.08683373779058456,
-0.10000000149011612,
-0.4823067784309387
],
"type":"VEC3"
},
{
"bufferView":1,
"componentType":5126,
"count":28,
"type":"VEC3"
},
{
"bufferView":2,
"componentType":5126,
"count":28,
"type":"VEC2"
},
{
"bufferView":3,
"componentType":5123,
"count":72,
"type":"SCALAR"
},
{
"bufferView":4,
"componentType":5126,
"count":196,
"max":[
0.5,
0.3750000596046448,
0.5
],
"min":[
-0.4704191982746124,
-0.375,
-0.5
],
"type":"VEC3"
},
{
"bufferView":5,
"componentType":5126,
"count":196,
"type":"VEC3"
},
{
"bufferView":6,
"componentType":5126,
"count":196,
"type":"VEC2"
},
{
"bufferView":7,
"componentType":5123,
"count":756,
"type":"SCALAR"
},
{
"bufferView":8,
"componentType":5126,
"count":63,
"max":[
0.09510578960180283,
0.09064047038555145,
0.10000000894069672
],
"min":[
-0.09510578960180283,
-0.09064047038555145,
-0.10000000894069672
],
"type":"VEC3"
},
{
"bufferView":9,
"componentType":5126,
"count":63,
"type":"VEC3"
},
{
"bufferView":10,
"componentType":5126,
"count":63,
"type":"VEC2"
},
{
"bufferView":11,
"componentType":5123,
"count":240,
"type":"SCALAR"
},
{
"bufferView":12,
"componentType":5126,
"count":155,
"max":[
0.6142896413803101,
0.5,
0.5
],
"min":[
-0.4999999701976776,
-0.5,
-0.5
],
"type":"VEC3"
},
{
"bufferView":13,
"componentType":5126,
"count":155,
"type":"VEC3"
},
{
"bufferView":14,
"componentType":5126,
"count":155,
"type":"VEC2"
},
{
"bufferView":15,
"componentType":5123,
"count":696,
"type":"SCALAR"
},
{
"bufferView":16,
"componentType":5126,
"count":151,
"max":[
0.5302433967590332,
0.6051621437072754,
0.5
],
"min":[
-0.4954048991203308,
-0.2840111255645752,
-0.5
],
"type":"VEC3"
},
{
"bufferView":17,
"componentType":5126,
"count":151,
"type":"VEC3"
},
{
"bufferView":18,
"componentType":5126,
"count":151,
"type":"VEC2"
},
{
"bufferView":19,
"componentType":5123,
"count":672,
"type":"SCALAR"
},
{
"bufferView":20,
"componentType":5126,
"count":4,
"max":[
0.125
],
"min":[
0
],
"type":"SCALAR"
},
{
"bufferView":21,
"componentType":5126,
"count":4,
"type":"VEC4"
},
{
"bufferView":22,
"componentType":5126,
"count":7,
"max":[
0.25
],
"min":[
0
],
"type":"SCALAR"
},
{
"bufferView":23,
"componentType":5126,
"count":7,
"type":"VEC4"
},
{
"bufferView":24,
"componentType":5126,
"count":18,
"max":[
0.7083333333333334
],
"min":[
0
],
"type":"SCALAR"
},
{
"bufferView":25,
"componentType":5126,
"count":18,
"type":"VEC3"
},
{
"bufferView":26,
"componentType":5126,
"count":18,
"type":"VEC4"
},
{
"bufferView":27,
"componentType":5126,
"count":7,
"type":"VEC3"
},
{
"bufferView":28,
"componentType":5126,
"count":7,
"type":"VEC4"
}
],
"bufferViews":[
{
"buffer":0,
"byteLength":336,
"byteOffset":0,
"target":34962
},
{
"buffer":0,
"byteLength":336,
"byteOffset":336,
"target":34962
},
{
"buffer":0,
"byteLength":224,
"byteOffset":672,
"target":34962
},
{
"buffer":0,
"byteLength":144,
"byteOffset":896,
"target":34963
},
{
"buffer":0,
"byteLength":2352,
"byteOffset":1040,
"target":34962
},
{
"buffer":0,
"byteLength":2352,
"byteOffset":3392,
"target":34962
},
{
"buffer":0,
"byteLength":1568,
"byteOffset":5744,
"target":34962
},
{
"buffer":0,
"byteLength":1512,
"byteOffset":7312,
"target":34963
},
{
"buffer":0,
"byteLength":756,
"byteOffset":8824,
"target":34962
},
{
"buffer":0,
"byteLength":756,
"byteOffset":9580,
"target":34962
},
{
"buffer":0,
"byteLength":504,
"byteOffset":10336,
"target":34962
},
{
"buffer":0,
"byteLength":480,
"byteOffset":10840,
"target":34963
},
{
"buffer":0,
"byteLength":1860,
"byteOffset":11320,
"target":34962
},
{
"buffer":0,
"byteLength":1860,
"byteOffset":13180,
"target":34962
},
{
"buffer":0,
"byteLength":1240,
"byteOffset":15040,
"target":34962
},
{
"buffer":0,
"byteLength":1392,
"byteOffset":16280,
"target":34963
},
{
"buffer":0,
"byteLength":1812,
"byteOffset":17672,
"target":34962
},
{
"buffer":0,
"byteLength":1812,
"byteOffset":19484,
"target":34962
},
{
"buffer":0,
"byteLength":1208,
"byteOffset":21296,
"target":34962
},
{
"buffer":0,
"byteLength":1344,
"byteOffset":22504,
"target":34963
},
{
"buffer":0,
"byteLength":16,
"byteOffset":23848
},
{
"buffer":0,
"byteLength":64,
"byteOffset":23864
},
{
"buffer":0,
"byteLength":28,
"byteOffset":23928
},
{
"buffer":0,
"byteLength":112,
"byteOffset":23956
},
{
"buffer":0,
"byteLength":72,
"byteOffset":24068
},
{
"buffer":0,
"byteLength":216,
"byteOffset":24140
},
{
"buffer":0,
"byteLength":288,
"byteOffset":24356
},
{
"buffer":0,
"byteLength":84,
"byteOffset":24644
},
{
"buffer":0,
"byteLength":112,
"byteOffset":24728
}
],
"buffers":[
{
"byteLength":24840,
"uri":"player_mesh.bin"
}
]
}

View File

@@ -58,7 +58,7 @@ class SNOWTRAIL_OT_export_gltf(bpy.types.Operator):
props = context.scene.snow_trail_export
bpy.ops.export_scene.gltf(
gltf_kwargs = dict(
filepath=str(export_path),
export_format='GLTF_SEPARATE',
use_selection=True,
@@ -66,11 +66,22 @@ class SNOWTRAIL_OT_export_gltf(bpy.types.Operator):
export_yup=True,
export_texcoords=True,
export_normals=True,
export_colors=props.export_vertex_colors,
export_vertex_color='ACTIVE' if props.export_vertex_colors else 'NONE',
export_materials='NONE' if not props.export_materials else 'EXPORT',
export_animations=props.export_animations,
)
if props.export_animations:
gltf_kwargs.update(
export_animation_mode='NLA_TRACKS',
export_anim_slide_to_zero=True,
export_optimize_animation_size=False,
export_force_sampling=True,
export_nla_strips=False,
)
bpy.ops.export_scene.gltf(**gltf_kwargs)
rel_path = export_path.relative_to(find_project_root())
self.report({'INFO'}, f"Exported → {rel_path}")
return {'FINISHED'}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -49,7 +49,7 @@ pub mod meshes
pub fn player() -> String
{
format!("{}/player_mesh.glb", MESHES_DIR)
format!("{}/player_mesh.gltf", MESHES_DIR)
}
}