Skip to content

Commit

Permalink
feat: debug panel with console (#114)
Browse files Browse the repository at this point in the history
* chore: add -l/--link-libs to `cargo run -- run -l` to link libraries instead of copying those (only linux)

* feat: add debug panel

* fix focuses

* add right click copy

* fix onready and add scroll to the last (when doesn't have focus)
  • Loading branch information
kuruk-mm authored Dec 4, 2023
1 parent 73184f4 commit c854e25
Show file tree
Hide file tree
Showing 98 changed files with 1,123 additions and 139 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_md5="66f5094c07a7adf640dd3d1bc683edc1"
dest_md5="dddcd734ec45e9d09e8bd98e4815a94a"

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_md5="ff64f80093c851681274ccaaab1aefff"
dest_md5="2d9c0c8cdb3c691c23a36d052e6d9c4a"

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_md5="c2d73e0a7a31758af2c79237dee73012"
dest_md5="7419999a924fe2890d46e705dc92fa96"

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_md5="501055c42266d83ab2ae636a12af375f"
dest_md5="7439345d58e198bb1d64b79caeb34b69"

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_md5="fcba03e97cdb1aba18e8bec1b53f33a6"
dest_md5="d1db4788204697d502570142bb777a0f"

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_md5="18c8ce22c03da359e12b5f2501f12659"
dest_md5="184f3120ed5612866707a6f3b00ec133"

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_md5="8719a3ee53fde1c94a1f528778b0ce49"
dest_md5="c4f70b698db9b2b420af14d31212b9fb"

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_md5="39b4d69a92244b21bd2edb9f402e8aa6"
dest_md5="f9eac1acce88a54b1966ecbb134cc08b"

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_md5="29c07d0ec1641467db271184902bc9f2"
dest_md5="8e7a5c6ffcb61ac10d1787a1c7f5272c"

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_md5="c6f8489a24c5909c11924f2e44888793"
dest_md5="d1d32cf982d02313ca6ce997b46eecdf"

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_md5="dca4552d04c206a40983aa998f535f85"
dest_md5="29e68655b9b9cc7e858504c5716d2372"

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_md5="1463ac6d8449e754f32415b9aa098a0b"
dest_md5="48bb1b34e6c274dfe4ebe69059e51ae0"

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_md5="2759de5c01527bd9730b4d1838e6c938"
dest_md5="c9dd4db7a292e1d4239b97c7ba4a38be"

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_md5="8fe9bb7990d719209970c79f6725ad2c"
dest_md5="6ec2e3639ea70fef74df0c8c8c347ba5"

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_md5="7a6e0b9be23395043d950c8ac7805537"
dest_md5="5c6a76ac80f5a079c58dee0527e89637"

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_md5="3e80281f6eb759ba2aced5f67861b238"
dest_md5="7919803d7d9b7c6d96a2d5c50095e71b"

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_md5="6182e1e355a7ef76eec827d91ad9af88"
dest_md5="bd1c4d7b364f981ec1acb593bf3af4c9"

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_md5="8f6d8c547f6106da2d880e1b8116f3ae"
dest_md5="2d4b50769665463a2a189c7a8e43edf5"

Binary file modified godot/.godot/uid_cache.bin
Binary file not shown.
16 changes: 8 additions & 8 deletions godot/assets/themes/theme.tres

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions godot/src/global.gd
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,29 @@ func _process(_dt: float):
http_requester.poll()


func get_explorer():
var explorer = get_node_or_null("/root/explorer")
if is_instance_valid(explorer):
return explorer
return null


func explorer_has_focus() -> bool:
var explorer = get_explorer()
if explorer == null:
return false

return explorer.ui_root.has_focus()


func explorer_grab_focus() -> void:
var explorer = get_explorer()
if explorer == null:
return

return explorer.ui_root.grab_focus.call_deferred()


func capture_mouse():
var explorer = get_node_or_null("/root/explorer")
if is_instance_valid(explorer):
Expand Down
6 changes: 5 additions & 1 deletion godot/src/logic/player/player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func _input(event):
_clamp_camera_rotation()

# Toggle first or third person camera
if event is InputEventMouseButton:
if event is InputEventMouseButton and Global.explorer_has_focus():
if !camera_mode_change_blocked:
if event.button_index == MOUSE_BUTTON_WHEEL_DOWN:
if camera.get_camera_mode() == Global.CameraMode.FIRST_PERSON:
Expand All @@ -136,6 +136,10 @@ func _input(event):

func _physics_process(delta: float) -> void:
var input_dir := Input.get_vector("ia_left", "ia_right", "ia_forward", "ia_backward")

if not Global.explorer_has_focus(): # ignore input
input_dir = Vector2(0, 0)

direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
current_direction = current_direction.move_toward(direction, 10 * delta)

Expand Down
30 changes: 0 additions & 30 deletions godot/src/ui/components/advance_settings/advance_settings.gd
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ var h_slider_scene_radius = $VBoxContainer/ColorRect_Background/HBoxContainer/VB
@onready
var label_scene_radius_value = $VBoxContainer/ColorRect_Background/HBoxContainer/VBoxContainer_General/VBoxContainer_SceneRadius/HBoxContainer/Label_SceneRadiusValue
@onready
var rich_text_label_console = $VBoxContainer/ColorRect_Background/HBoxContainer/VBoxContainer_General2/Panel_Console/RichTextLabel_Console
@onready
var spin_box_gravity = $VBoxContainer/ColorRect_Background/HBoxContainer/VBoxContainer_General/HBoxContainer/HBoxContainer_Gravity/SpinBox_Gravity
@onready
var spin_box_jump_velocity = $VBoxContainer/ColorRect_Background/HBoxContainer/VBoxContainer_General/HBoxContainer/HBoxContainer_JumpVelocity/SpinBox_JumpVelocity
Expand Down Expand Up @@ -76,10 +74,6 @@ func _on_check_button_pause_toggled(button_pressed):
emit_signal("request_pause_scenes", check_button_pause.button_pressed)


func _on_button_clear_console_pressed():
rich_text_label_console.clear()


func set_ws_state(connected: bool) -> void:
if connected:
label_ws_state.text = "Connected"
Expand Down Expand Up @@ -149,24 +143,6 @@ func _on_button_connect_preview_pressed():
)


func on_console_add(scene_title: String, level: int, timestamp: float, text: String) -> void:
var color := Color.BLACK
match level:
SceneLogLevel.LOG:
color = Color.DARK_SLATE_BLUE
SceneLogLevel.SCENE_ERROR:
color = Color.DARK_RED
SceneLogLevel.SYSTEM_ERROR:
color = Color.RED

timestamp = round(timestamp * 100.0) / 100.0
var msg = "(" + str(timestamp) + ") " + scene_title + " > " + text
rich_text_label_console.push_color(color)
rich_text_label_console.add_text(msg)
rich_text_label_console.pop()
rich_text_label_console.newline()


func _on_spin_box_walk_speed_value_changed(value):
Global.config.walk_velocity = value
Global.config.save_to_settings_file()
Expand All @@ -185,9 +161,3 @@ func _on_spin_box_jump_velocity_value_changed(value):
func _on_spin_box_gravity_value_changed(value):
Global.config.gravity = value
Global.config.save_to_settings_file()


func _on_button_copy_console_content_pressed():
rich_text_label_console.select_all()
var text = rich_text_label_console.get_parsed_text()
DisplayServer.clipboard_set(text)
Loading

0 comments on commit c854e25

Please sign in to comment.