Skip to content

Commit

Permalink
Merge branch 'main' into restore-bump-godot-4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
leanmendoza committed Nov 1, 2024
2 parents 63ffa89 + 2ce7a3c commit 86b1f8d
Show file tree
Hide file tree
Showing 64 changed files with 1,709 additions and 1,124 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/**/*
2 changes: 1 addition & 1 deletion .github/workflows/linux_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

# Build section
- name: Cargo install
run: cargo run -- install
run: cargo run -- install --platforms linux

- name: Build
working-directory: lib
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

# Build section
- name: Cargo install
run: cargo run -- install
run: cargo run -- install --platforms macos

- name: Build
working-directory: lib
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:

# Build section
- name: Cargo install
run: cargo run -- install
run: cargo run -- install --platforms windows

- name: Build
working-directory: lib
Expand Down
10 changes: 9 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
"useTabs": false,
"semi": false
}
},
{
"files": "*.json",
"options": {
"tabWidth": 2,
"printWidth": 80,
"useTabs": false
}
}
]
}
}
52 changes: 15 additions & 37 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,32 @@
"program": "${workspaceFolder}/.bin/godot/godot4_bin",
"args": [
"--path",
"${workspaceFolder}/godot"
"${workspaceFolder}/godot",
"--skip-lobby",
"--realm",
"http://localhost:8000",
"--preview"
],
"stopAtEntry": false,
"cwd": "${workspaceRoot}/godot",
"environment": [
{
"name": "RUST_LOG",
"value": "debug"
"value": "dclgodot=debug"
}
],
"externalConsole": true,
"preLaunchTask": "Build GDExtension Lib",
"sourceFileMap": {
"/rustc/cc66ad468955717ab92600c770da8c1601a4ff33": "${env:HOME}${env:USERPROFILE}\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\src\\rust"
"/rustc/129f3b9964af4d4a709d1383930ade12dfe7c081": "${env:HOME}${env:USERPROFILE}\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\src\\rust"
}
},
{
"name": "(Windows) Run Test",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/.bin/godot/godot4_bin",
"args": [
"--path",
"${workspaceFolder}/godot",
"--test"
],
"args": ["--path", "${workspaceFolder}/godot", "--test"],
"stopAtEntry": false,
"cwd": "${workspaceRoot}/godot",
"environment": [
Expand All @@ -50,11 +50,7 @@
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/.bin/godot/godot4_bin",
"args": [
"--path",
"${workspaceFolder}/godot",
"-e"
],
"args": ["--path", "${workspaceFolder}/godot", "-e"],
"stopAtEntry": false,
"cwd": "${workspaceRoot}/godot",
"environment": [],
Expand All @@ -66,11 +62,7 @@
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/.bin/godot/godot4_bin",
"args": [
"--path",
"${workspaceFolder}/godot",
"-e"
],
"args": ["--path", "${workspaceFolder}/godot", "-e"],
"stopAtEntry": false,
"cwd": "${workspaceRoot}/godot",
"environment": [],
Expand All @@ -82,10 +74,7 @@
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/.bin/godot/godot4_bin",
"args": [
"--path",
"${workspaceFolder}/godot"
],
"args": ["--path", "${workspaceFolder}/godot"],
"stopAtEntry": false,
"cwd": "${workspaceRoot}/godot",
"environment": [
Expand All @@ -111,11 +100,7 @@
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/.bin/godot/godot4_bin",
"args": [
"--path",
"${workspaceFolder}/godot",
"--test"
],
"args": ["--path", "${workspaceFolder}/godot", "--test"],
"stopAtEntry": false,
"cwd": "${workspaceRoot}/godot",
"environment": [],
Expand All @@ -136,11 +121,7 @@
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/.bin/godot/godot4_bin",
"args": [
"--path",
"${workspaceFolder}/godot",
"-e"
],
"args": ["--path", "${workspaceFolder}/godot", "-e"],
"stopAtEntry": false,
"cwd": "${workspaceRoot}/godot",
"environment": [],
Expand All @@ -153,10 +134,7 @@
"request": "launch",
"targetArchitecture": "arm64",
"program": "${workspaceFolder}/.bin/godot/godot4_bin",
"args": [
"--path",
"${workspaceFolder}/godot"
],
"args": ["--path", "${workspaceFolder}/godot"],
"stopAtEntry": false,
"cwd": "${workspaceRoot}/godot",
"environment": [],
Expand All @@ -172,4 +150,4 @@
]
}
]
}
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
- set `LIBCLANG_PATH` = `path to LLVM\x64\bin` (this is packaged with visual studio, or can be downloaded separately)
- the `.github/workflows/ci.yml` file can be useful to guide you

4. Run `cargo run -- install` in the repo root folder.
4. Run `cargo run -- install --platforms linux` in the repo root folder (change linux to your target platform).

## Running and editing the project

Expand All @@ -43,7 +43,7 @@ cd lib
cd ../../ # return

# Compile for Linux
cargo run -- install
cargo run -- install --platforms android
cargo run -- run --only-build
cd ../../ # return

Expand Down
2 changes: 1 addition & 1 deletion build-android-apk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fi

echo "Build for Linux x86_64"
cd ${EXPLORER_PATH}
cargo run -- install
cargo run -- install --platforms android
cargo run -- run --only-build

echo "Link export templates"
Expand Down
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
1 change: 1 addition & 0 deletions godot/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/.godot/

/android/
/addons/**/~*.dll

# Godot-specific ignores
.import/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static func _async_request(
url += "?pageNum=%d" % page_number
url += "&pageSize=%d" % page_size

var promise: Promise = Global.http_requester.request_json(url, HTTPClient.METHOD_GET, "", [])
var promise: Promise = Global.http_requester.request_json(url, HTTPClient.METHOD_GET, "", {})

var result = await PromiseUtils.async_awaiter(promise)

Expand Down
6 changes: 6 additions & 0 deletions godot/src/global.gd
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,19 @@ func _ready():
get_tree().root.add_child.call_deferred(self.portable_experience_controller)
get_tree().root.add_child.call_deferred(self.testing_tools)
get_tree().root.add_child.call_deferred(self.metrics)
get_tree().root.add_child.call_deferred(self.network_inspector)

var custom_importer = load("res://src/logic/custom_gltf_importer.gd").new()
GLTFDocument.register_gltf_document_extension(custom_importer)

if args.has("--raycast-debugger"):
set_raycast_debugger_enable(true)

if args.has("--network-debugger"):
self.network_inspector.set_is_active(true)
else:
self.network_inspector.set_is_active(false)

DclMeshRenderer.init_primitive_shapes()


Expand Down
8 changes: 4 additions & 4 deletions godot/src/logic/content/opensea_nft_fetcher.gd
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ func fetch_nft(urn: DclUrn) -> Promise:

func _async_request_nft(completed_promise: Promise, urn: DclUrn):
var url = RETRIEVE_ASSETS_ENDPOINT % [urn.chain, urn.contract_address, urn.token_id]
var headers = [
"Content-Type: application/json",
"X-API-KEY: " + API_KEY,
]
var headers = {
"Content-Type": "application/json",
"X-API-KEY": API_KEY,
}
var asset_promise: Promise = Global.http_requester.request_json(
url, HTTPClient.METHOD_GET, "", headers
)
Expand Down
4 changes: 2 additions & 2 deletions godot/src/logic/player/player_identity.gd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func _on_realm_changed():
# TODO: replace with Global.content_provider.fetch_profile when it supports multiple lambda server
func async_fetch_profile(address: String, requested_lambda_server_base_url: String) -> void:
var url = requested_lambda_server_base_url + "profiles/" + address
var promise: Promise = Global.http_requester.request_json(url, HTTPClient.METHOD_GET, "", [])
var promise: Promise = Global.http_requester.request_json(url, HTTPClient.METHOD_GET, "", {})
var response = await PromiseUtils.async_awaiter(promise)

# Are we still needing to fetch this profile?
Expand Down Expand Up @@ -78,7 +78,7 @@ func async_deploy_profile(new_profile: DclUserProfile, has_new_snapshots: bool)
return

var body_payload = (ret as Dictionary).get("body_payload")
var headers := ["Content-Type: " + (ret as Dictionary).get("content_type")]
var headers := {"Content-Type": (ret as Dictionary).get("content_type")}
var url := Global.realm.get_profile_content_url() + "entities/"
var promise_req := Global.http_requester.request_json_bin(
url, HTTPClient.METHOD_POST, body_payload, headers
Expand Down
4 changes: 2 additions & 2 deletions godot/src/logic/realm.gd
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func async_set_realm(new_realm_string: String, search_new_pos: bool = false) ->
realm_url = Realm.ensure_starts_with_https(realm_url)

var promise: Promise = Global.http_requester.request_json(
realm_url + "about", HTTPClient.METHOD_GET, "", []
realm_url + "about", HTTPClient.METHOD_GET, "", {}
)

var res = await PromiseUtils.async_awaiter(promise)
Expand Down Expand Up @@ -211,7 +211,7 @@ func async_request_set_position(scene_urn):
prints(scene_urn)
var url = scene_urn.baseUrl + scene_urn.entityId

var promise: Promise = Global.http_requester.request_json(url, HTTPClient.METHOD_GET, "", [])
var promise: Promise = Global.http_requester.request_json(url, HTTPClient.METHOD_GET, "", {})

var res = await PromiseUtils.async_awaiter(promise)
if res is PromiseError:
Expand Down
Loading

0 comments on commit 86b1f8d

Please sign in to comment.