Some level and blender script updates
This commit is contained in:
parent
002122b4d6
commit
cda4e1716b
12
.vscode/launch.json
vendored
12
.vscode/launch.json
vendored
@ -55,6 +55,18 @@
|
|||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"program": "${workspaceFolder}/bin/hotreload/game.bin",
|
"program": "${workspaceFolder}/bin/hotreload/game.bin",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "lldb",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "Run Test (Linux / Mac)",
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"program": "odin",
|
||||||
|
"args": [
|
||||||
|
"test",
|
||||||
|
"common/container/xarr",
|
||||||
|
"-debug"
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "lldb",
|
"type": "lldb",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
|
BIN
assets/blender/test_level_blend/NurbsPath.glb
(Stored with Git LFS)
BIN
assets/blender/test_level_blend/NurbsPath.glb
(Stored with Git LFS)
Binary file not shown.
@ -3,11 +3,6 @@
|
|||||||
:pos (0.000000 0.000000 -20.000000)
|
:pos (0.000000 0.000000 -20.000000)
|
||||||
:rot (0.000000 0.000000 0.000000 1.000000)
|
:rot (0.000000 0.000000 0.000000 1.000000)
|
||||||
:scale (1.000000 1.000000 1.000000))
|
:scale (1.000000 1.000000 1.000000))
|
||||||
(inst
|
|
||||||
:model "assets/blender/test_level_blend/Plane.glb"
|
|
||||||
:pos (0.000000 -1.000000 -0.000000)
|
|
||||||
:rot (0.000000 0.000000 0.000000 1.000000)
|
|
||||||
:scale (22.469545 22.469545 22.469545))
|
|
||||||
(inst
|
(inst
|
||||||
:model "assets/blender/testblend_blend/Fire_Station.glb"
|
:model "assets/blender/testblend_blend/Fire_Station.glb"
|
||||||
:pos (10.500000 0.000000 -22.500000)
|
:pos (10.500000 0.000000 -22.500000)
|
||||||
@ -25,7 +20,7 @@
|
|||||||
:scale (1.000000 1.000000 1.000000))
|
:scale (1.000000 1.000000 1.000000))
|
||||||
(inst
|
(inst
|
||||||
:model "assets/blender/testblend_blend/Gas_Station_Shop.glb"
|
:model "assets/blender/testblend_blend/Gas_Station_Shop.glb"
|
||||||
:pos (-20.000000 -1.000000 -1.000000)
|
:pos (-17.000000 -1.000000 19.000000)
|
||||||
:rot (0.000000 0.000000 0.000000 1.000000)
|
:rot (0.000000 0.000000 0.000000 1.000000)
|
||||||
:scale (1.000000 1.000000 1.000000))
|
:scale (1.000000 1.000000 1.000000))
|
||||||
(inst
|
(inst
|
||||||
@ -35,7 +30,7 @@
|
|||||||
:scale (1.000000 1.000000 1.000000))
|
:scale (1.000000 1.000000 1.000000))
|
||||||
(inst
|
(inst
|
||||||
:model "assets/blender/testblend_blend/Hotel.glb"
|
:model "assets/blender/testblend_blend/Hotel.glb"
|
||||||
:pos (8.000000 0.000000 18.000000)
|
:pos (10.000000 0.000000 17.000000)
|
||||||
:rot (0.000000 0.000000 0.000000 1.000000)
|
:rot (0.000000 0.000000 0.000000 1.000000)
|
||||||
:scale (1.000000 1.000000 1.000000))
|
:scale (1.000000 1.000000 1.000000))
|
||||||
(inst
|
(inst
|
||||||
@ -43,3 +38,8 @@
|
|||||||
:pos (-4.000000 0.000000 12.000000)
|
:pos (-4.000000 0.000000 12.000000)
|
||||||
:rot (0.000000 0.000000 0.000000 1.000000)
|
:rot (0.000000 0.000000 0.000000 1.000000)
|
||||||
:scale (1.000000 1.000000 1.000000))
|
:scale (1.000000 1.000000 1.000000))
|
||||||
|
(inst
|
||||||
|
:model "assets/blender/testblend_blend/Hotel.glb"
|
||||||
|
:pos (9.000000 0.000000 46.000000)
|
||||||
|
:rot (0.000000 0.000000 0.000000 1.000000)
|
||||||
|
:scale (1.000000 1.000000 1.000000))
|
||||||
|
BIN
assets/blender/testblend_blend/Bakery.glb
(Stored with Git LFS)
BIN
assets/blender/testblend_blend/Bakery.glb
(Stored with Git LFS)
Binary file not shown.
BIN
assets/blender/testblend_blend/Fire_Station.glb
(Stored with Git LFS)
BIN
assets/blender/testblend_blend/Fire_Station.glb
(Stored with Git LFS)
Binary file not shown.
BIN
assets/blender/testblend_blend/Gas_Station_Shop.glb
(Stored with Git LFS)
BIN
assets/blender/testblend_blend/Gas_Station_Shop.glb
(Stored with Git LFS)
Binary file not shown.
BIN
assets/blender/testblend_blend/Green_House.glb
(Stored with Git LFS)
BIN
assets/blender/testblend_blend/Green_House.glb
(Stored with Git LFS)
Binary file not shown.
BIN
assets/blender/testblend_blend/Hotel.glb
(Stored with Git LFS)
BIN
assets/blender/testblend_blend/Hotel.glb
(Stored with Git LFS)
Binary file not shown.
@ -23,13 +23,10 @@ def temp_scene(name: str):
|
|||||||
finally:
|
finally:
|
||||||
assert bpy.context.window is not None
|
assert bpy.context.window is not None
|
||||||
bpy.context.window.scene = original_scene
|
bpy.context.window.scene = original_scene
|
||||||
print(f'removing scene {temp_scene}')
|
|
||||||
bpy.data.scenes.remove(temp_scene)
|
bpy.data.scenes.remove(temp_scene)
|
||||||
|
|
||||||
scene = bpy.context.scene
|
scene = bpy.context.scene
|
||||||
|
|
||||||
export_scene = bpy.data.scenes.new('__export')
|
|
||||||
|
|
||||||
def clean_blend_path(blend_path: str) -> str:
|
def clean_blend_path(blend_path: str) -> str:
|
||||||
return os.path.join(os.path.dirname(blend_path), bpy.path.clean_name(os.path.basename(blend_path)))
|
return os.path.join(os.path.dirname(blend_path), bpy.path.clean_name(os.path.basename(blend_path)))
|
||||||
|
|
||||||
@ -60,21 +57,18 @@ def export_object_as_glb(obj: bpy.types.Object, export_path: str):
|
|||||||
full_export_path = os.path.join(assets_path, export_path)
|
full_export_path = os.path.join(assets_path, export_path)
|
||||||
pathlib.Path(os.path.dirname(full_export_path)).mkdir(parents=True, exist_ok=True)
|
pathlib.Path(os.path.dirname(full_export_path)).mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
if obj.instance_type == 'COLLECTION' and obj.instance_collection:
|
with temp_scene('__export') as scn:
|
||||||
with temp_scene('__export') as scn:
|
if obj.instance_type == 'COLLECTION' and obj.instance_collection:
|
||||||
scn.collection.children.link(obj.instance_collection)
|
scn.collection.children.link(obj.instance_collection)
|
||||||
bpy.ops.export_scene.gltf(filepath=full_export_path, use_active_scene=True, export_apply=True)
|
else:
|
||||||
else:
|
scn.collection.objects.link(obj)
|
||||||
bpy.ops.object.select_all(action='DESELECT')
|
|
||||||
obj.select_set(True)
|
|
||||||
assert bpy.context.view_layer is not None
|
|
||||||
bpy.context.view_layer.objects.active = obj
|
|
||||||
|
|
||||||
if obj.type == 'CURVE':
|
obj.select_set(True)
|
||||||
bpy.ops.object.convert(target='MESH', keep_original=True)
|
|
||||||
|
|
||||||
bpy.ops.export_scene.gltf(filepath=full_export_path, use_selection=True, export_apply=True)
|
if obj.type == 'CURVE':
|
||||||
bpy.ops.object.delete()
|
bpy.ops.object.convert(target='MESH', keep_original=False)
|
||||||
|
|
||||||
|
bpy.ops.export_scene.gltf(filepath=full_export_path, use_active_scene=True, export_apply=True)
|
||||||
|
|
||||||
print(f"Exported {obj.name} -> {export_path}")
|
print(f"Exported {obj.name} -> {export_path}")
|
||||||
|
|
||||||
|
BIN
src_assets/test_level.blend
(Stored with Git LFS)
BIN
src_assets/test_level.blend
(Stored with Git LFS)
Binary file not shown.
BIN
src_assets/test_level.blend1
(Stored with Git LFS)
BIN
src_assets/test_level.blend1
(Stored with Git LFS)
Binary file not shown.
2
test.sh
2
test.sh
@ -1,3 +1,3 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
odin test common/encoding/sexp -collection:common=./common -collection:game=./game -collection:libs=./libs -strict-style -vet -sanitize:memory
|
odin test common/container/xarr -collection:common=./common -collection:game=./game -collection:libs=./libs -strict-style -vet -sanitize:memory
|
||||||
|
Loading…
x
Reference in New Issue
Block a user