Skip to content

Commit

Permalink
feat: add scene renderer tool (#472)
Browse files Browse the repository at this point in the history
* feat: add scene renderer tool

* add test

* check fixed

* fix typo

* test debug ssh

* Revert "test debug ssh"

This reverts commit 62c47cd.

* test

* debug prints

* fix ci
fix test-tools

* fix more static scene and ci

* remove duplicated files

---------

Co-authored-by: Mateo "Kuruk" Miccino <[email protected]>
  • Loading branch information
leanmendoza and kuruk-mm authored Oct 29, 2024
1 parent f96488b commit c102cc9
Show file tree
Hide file tree
Showing 24 changed files with 864 additions and 405 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: snapshots
name: coverage-snapshots
path: |
tests/snapshots/scenes/comparison/**/*
tests/snapshots/avatar-image-generation/comparison/**/*
29 changes: 23 additions & 6 deletions .github/workflows/docker_build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ jobs:
uses: redhat-actions/buildah-build@v2
with:
image: godot-explorer
tags: latest ${{ github.sha }}
tags: |
${{ github.sha }}
${{ github.ref == 'refs/heads/main' && 'latest' || 'next' }}
dockerfiles: |
./Dockerfile
build-args: |
Expand All @@ -47,21 +49,36 @@ jobs:

- name: Run avatar test
run: |
mkdir -p output
mkdir -p avatars-output
podman run --rm -v \
$(pwd)/tests/avatars-test-input.json:/app/avatars.json \
-v $(pwd)/output:/app/output localhost/godot-explorer:latest
-v $(pwd)/avatars-output:/app/output localhost/godot-explorer:${{ github.sha }}
- name: Compare images with snapshots
run: |
cargo run -- compare-image-folders \
--snapshots tests/snapshots/avatar-image-generation/ \
--result ${{ github.workspace }}/output/
--result ${{ github.workspace }}/avatars-output/
- name: Run scene-rendering test
run: |
mkdir -p scenes-output
podman run --rm -v \
$(pwd)/tests/scene-renderer-test-input.json:/app/scenes.json \
--env PRESET_ARGS="--scene-renderer --scene-input-file scenes.json" \
-v $(pwd)/scenes-output:/app/output localhost/godot-explorer:${{ github.sha }}
- name: Compare images with snapshots
run: |
cargo run -- compare-image-folders \
--snapshots tests/snapshots/scene-image-generation/ \
--result ${{ github.workspace }}/scenes-output/
- name: Upload artifacts
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: avatar-snapshots
name: docker-snapshots
path: |
${{ github.workspace }}/output/**/*
${{ github.workspace }}/avatar-output/**/*
${{ github.workspace }}/scenes-output/**/*
11 changes: 10 additions & 1 deletion entry-point.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,13 @@

/usr/bin/Xvfb -ac :99 -screen 0 1280x1024x24 &
export DISPLAY=:99
./decentraland.godot.client.x86_64 --rendering-driver opengl3 --avatar-renderer --avatars avatars.json || true

# Check PRESET_ARGS environment variable
if [ -z "$PRESET_ARGS" ]; then
echo "PRESET_ARGS is not set. Using default arguments."
PRESET_ARGS="--avatar-renderer --avatars avatars.json"
else
echo "PRESET_ARGS is set to '$PRESET_ARGS'."
fi

./decentraland.godot.client.x86_64 --rendering-driver opengl3 $PRESET_ARGS || true
8 changes: 5 additions & 3 deletions godot/src/main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@ func _start():
var args = OS.get_cmdline_args()

if Global.is_xr():
print("Running in XR mode")
get_tree().change_scene_to_file("res://src/vr/vr_lobby.tscn")
elif args.has("--avatar-renderer"):
print("Running in Avatar-Renderer mode")
get_tree().change_scene_to_file(
"res://src/tool/avatar_renderer/avatar_renderer_standalone.tscn"
)
elif args.has("--scene-renderer"):
get_tree().change_scene_to_file("res://src/tool/scene_renderer/scene.tscn")
elif args.has("--scene-test"):
elif args.has("--scene-test") or args.has("--scene-renderer"):
print("Running in Scene Test mode")
Global.get_config().guest_profile = {}
Global.get_config().save_to_settings_file()
Global.player_identity.set_default_profile()
Expand All @@ -55,5 +56,6 @@ func _start():
Global.get_config().session_account = new_stored_account
get_tree().change_scene_to_file("res://src/ui/explorer.tscn")
else:
print("Running in regular mode")
Global.music_player.play("music_authentication")
get_tree().change_scene_to_file("res://src/ui/components/auth/lobby.tscn")
10 changes: 5 additions & 5 deletions godot/src/tool/avatar_renderer/avatar_renderer_standalone.gd
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ var current_avatar: DclAvatarWireFormat

# TODO: this can be a command line parser and get some helpers like get_string("--realm"), etc
func get_params_from_cmd():
if USE_TEST_INPUT:
var args := OS.get_cmdline_args()

# Only use from the editor
if USE_TEST_INPUT or args.has("--use-test-input"):
return [
AvatarRendererHelper.AvatarFile.from_file_path(
"res://src/tool/avatar_renderer/test-input.json"
)
AvatarRendererHelper.AvatarFile.from_file_path("res://../tests/avatars-test-input.json")
]

var args := OS.get_cmdline_args()
var avatar_data = null
var avatar_in_place := args.find("--avatars")

Expand Down
Loading

0 comments on commit c102cc9

Please sign in to comment.