Skip to content

Cannot customize DebugToggleKey2D/3D due to incorrect setting access (missing "Key", doesn't support modifier) #12

Description

@hsandt

I'm using F11 and F12 for something else in my game so I needed to change the customizable shortcuts mentioned in #11

  • addons/RuntimeDebugTools/DebugToggleKey3D
  • addons/RuntimeDebugTools/DebugToggleKey3D

so I rebound them to Shift+F7 and Shift+F8

Image

However, they were not recognized. I found two mistakes in the code of res://addons/runtime_debug_tools/scripts/debugger_runtime.gd causing this:

  1. The code tries to access project setting "DebugToggle2D" instead of "DebugToggleKey2D" (as set in plugin.gd with add_project_keybinding("DebugToggleKey3D", "F12"), etc.)
  2. The code only checks keycode instead of get_keycode_with_modifiers(). For 3D check more below, it repeats the same mistake.

My fix diff looks like this:

Image
var key_2d = ProjectSettings.get_setting("addons/RuntimeDebugTools/DebugToggle2D")
=>
var key_2d = ProjectSettings.get_setting("addons/RuntimeDebugTools/DebugToggleKey2D")

var key_3d = ProjectSettings.get_setting("addons/RuntimeDebugTools/DebugToggle3D")
=>
var key_3d = ProjectSettings.get_setting("addons/RuntimeDebugTools/DebugToggleKey3D")

if key_event.keycode == _debug_key_3d or key_event.keycode == _debug_key_2d:
=>
if key_event.get_keycode_with_modifiers() == _debug_key_3d or key_event.get_keycode_with_modifiers() == _debug_key_2d:

var is_3d := key_event.keycode == _debug_key_3d
=>
var is_3d := key_event.get_keycode_with_modifiers() == _debug_key_3d

Although I would personally store the keycode with modifiers to avoid getting it several times.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions