summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFredia Huya-Kouadio <fhuya@meta.com>2023-10-12 17:58:41 -0700
committerFredia Huya-Kouadio <fhuya@meta.com>2023-10-12 17:58:41 -0700
commit98d7ff296a385bb5e219b1f630826b7de405c0ba (patch)
tree67a56aa686000f82edde512b1ae232fac6746940
parent360ac7ac6d72e81285d8c5a9da4d24f136a9555e (diff)
downloadgodot-android-samples-98d7ff296a385bb5e219b1f630826b7de405c0ba.tar.gz
godot-android-samples-98d7ff296a385bb5e219b1f630826b7de405c0ba.tar.bz2
godot-android-samples-98d7ff296a385bb5e219b1f630826b7de405c0ba.zip
Update the project settings for the GLTF Viewer sample app to enforce gdscript static typing
-rw-r--r--apps/gltf_viewer/src/main/assets/main.gd12
-rw-r--r--apps/gltf_viewer/src/main/assets/project.godot1
2 files changed, 7 insertions, 6 deletions
diff --git a/apps/gltf_viewer/src/main/assets/main.gd b/apps/gltf_viewer/src/main/assets/main.gd
index 4b9bfdd..026ac5a 100644
--- a/apps/gltf_viewer/src/main/assets/main.gd
+++ b/apps/gltf_viewer/src/main/assets/main.gd
@@ -3,11 +3,11 @@ extends Node3D
# Reference to the gltf model that's currently being shown.
var current_gltf_node: Node3D = null
-func _ready():
+func _ready() -> void:
# Default asset to load when the app starts
_load_gltf("res://gltfs/food_kit/turkey.glb")
- var appPlugin = Engine.get_singleton("AppPlugin")
+ var appPlugin := Engine.get_singleton("AppPlugin")
if appPlugin:
print("App plugin is available")
@@ -17,7 +17,7 @@ func _ready():
print("App plugin is not available")
-func _process(delta):
+func _process(_delta: float) -> void:
if current_gltf_node == null:
return
@@ -25,7 +25,7 @@ func _process(delta):
current_gltf_node.rotate_y(0.001)
-func _unhandled_input(event):
+func _unhandled_input(event: InputEvent) -> void:
if current_gltf_node == null:
return
@@ -35,13 +35,13 @@ func _unhandled_input(event):
if event is InputEventMouseMotion and event.button_mask == MOUSE_BUTTON_MASK_LEFT:
# Rotate the gltf model based on swipe gestures
- var relative_drag = event.relative
+ var relative_drag: Vector2 = event.relative
current_gltf_node.rotate_y(relative_drag.x / 100)
current_gltf_node.rotate_x(relative_drag.y / 100)
# Load the gltf model specified by the given path
-func _load_gltf(gltf_path: String):
+func _load_gltf(gltf_path: String) -> void:
if current_gltf_node != null:
remove_child(current_gltf_node)
diff --git a/apps/gltf_viewer/src/main/assets/project.godot b/apps/gltf_viewer/src/main/assets/project.godot
index 8599945..fb80bae 100644
--- a/apps/gltf_viewer/src/main/assets/project.godot
+++ b/apps/gltf_viewer/src/main/assets/project.godot
@@ -18,6 +18,7 @@ config/icon="res://icon.svg"
[debug]
settings/stdout/verbose_stdout=true
+gdscript/warnings/untyped_declaration=2
[display]