From 0a79bb2c4028f8d46dbb5b03f78d91ae8cb297bc Mon Sep 17 00:00:00 2001 From: Sebastien Benard Date: Fri, 22 Sep 2023 10:35:04 +0200 Subject: [PATCH] Added debug shortcut for custom commands --- src/electron.renderer/App.hx | 3 ++- src/electron.renderer/EditorTypes.hx | 3 ++- src/electron.renderer/page/Editor.hx | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/electron.renderer/App.hx b/src/electron.renderer/App.hx index da72b7b88..7128a588a 100644 --- a/src/electron.renderer/App.hx +++ b/src/electron.renderer/App.hx @@ -189,7 +189,7 @@ class App extends dn.Process { // Parse AppCommands meta var meta = haxe.rtti.Meta.getFields(AppCommand); - var keyNameReg = ~/(ctrl|shift|alt| |-|\+|\[wasd\]|\[zqsd\]|\[arrows\]|\[win\]|\[linux\]|\[mac\])/gi; + var keyNameReg = ~/(ctrl|shift|alt| |-|\+|\[wasd\]|\[zqsd\]|\[arrows\]|\[win\]|\[linux\]|\[mac\]|\[debug\])/gi; for(k in AppCommand.getConstructors()) { var cmd = AppCommand.createByName(k); var cmdMeta : Dynamic = Reflect.field(meta, k); @@ -247,6 +247,7 @@ class App extends dn.Process { alt: rawCombo.indexOf("alt")>=0, navKeys: navKeys, os: os, + debug: rawCombo.indexOf("[debug]")>=0, allowInInputs: Reflect.hasField(cmdMeta, "input"), command: cmd, }); diff --git a/src/electron.renderer/EditorTypes.hx b/src/electron.renderer/EditorTypes.hx index d15d760de..9f06eb80a 100644 --- a/src/electron.renderer/EditorTypes.hx +++ b/src/electron.renderer/EditorTypes.hx @@ -243,6 +243,7 @@ typedef KeyBinding = { var navKeys : Null; var os : Null; + var debug: Bool; var allowInInputs : Bool; @@ -263,7 +264,7 @@ enum AppCommand { @k("tab") C_ZenMode; @k("h") C_ShowHelp; @k("shift w, ², `, [zqsd] w, [arrows] w") C_ToggleWorldMode; - @k("ctrl r") @input C_RunCommand; + @k("ctrl r, [debug] ctrl shift r") @input C_RunCommand; @k("ctrl q") @input C_ExitApp; @k("pagedown") C_GotoPreviousWorldLayer; @k("pageup") C_GotoNextWorldLayer; diff --git a/src/electron.renderer/page/Editor.hx b/src/electron.renderer/page/Editor.hx index 1b8d2947e..f57dbd282 100644 --- a/src/electron.renderer/page/Editor.hx +++ b/src/electron.renderer/page/Editor.hx @@ -556,6 +556,11 @@ class Editor extends Page { if( b.navKeys!=null && b.navKeys!=settings.v.navigationKeys ) continue; + #if( !debug ) + if( b.debug ) + continue; + #end + switch b.os { case null: case "win": if( !App.isWindows() ) continue;