mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-25 05:07:12 +01:00
Allow to change the Stop shortcut used at runtime
(cherry picked from commit 409613ba7ba50e6cc985c61f6dcc482bac68746e)
This commit is contained in:
parent
9086bef38d
commit
65e1217d59
@ -241,6 +241,11 @@ Error EditorRun::run(const String &p_scene, const String &p_custom_args, const L
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pass the debugger stop shortcut to the running instance(s).
|
||||||
|
String shortcut;
|
||||||
|
VariantWriter::write_to_string(ED_GET_SHORTCUT("editor/stop"), shortcut);
|
||||||
|
OS::get_singleton()->set_environment("__GODOT_EDITOR_STOP_SHORTCUT__", shortcut);
|
||||||
|
|
||||||
printf("Running: %s", exec.utf8().get_data());
|
printf("Running: %s", exec.utf8().get_data());
|
||||||
for (List<String>::Element *E = args.front(); E; E = E->next()) {
|
for (List<String>::Element *E = args.front(); E; E = E->next()) {
|
||||||
printf(" %s", E->get().utf8().get_data());
|
printf(" %s", E->get().utf8().get_data());
|
||||||
|
@ -38,12 +38,13 @@
|
|||||||
#include "core/os/os.h"
|
#include "core/os/os.h"
|
||||||
#include "core/os/thread_pool.h"
|
#include "core/os/thread_pool.h"
|
||||||
#include "core/string/print_string.h"
|
#include "core/string/print_string.h"
|
||||||
#include "core/config/project_settings.h"
|
#include "core/variant/variant_parser.h"
|
||||||
#include "main/input_default.h"
|
#include "main/input_default.h"
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
#include "scene/3d/spatial.h"
|
#include "scene/3d/spatial.h"
|
||||||
#include "scene/animation/scene_tree_tween.h"
|
#include "scene/animation/scene_tree_tween.h"
|
||||||
#include "scene/debugger/script_debugger_remote.h"
|
#include "scene/debugger/script_debugger_remote.h"
|
||||||
|
#include "scene/gui/shortcut.h"
|
||||||
#include "scene/resources/dynamic_font.h"
|
#include "scene/resources/dynamic_font.h"
|
||||||
#include "scene/resources/material.h"
|
#include "scene/resources/material.h"
|
||||||
#include "scene/resources/mesh.h"
|
#include "scene/resources/mesh.h"
|
||||||
@ -468,9 +469,35 @@ void SceneTree::input_event(const Ref<InputEvent> &p_event) {
|
|||||||
call_group_flags(GROUP_CALL_REALTIME, "_viewports", "_vp_input", ev); //special one for GUI, as controls use their own process check
|
call_group_flags(GROUP_CALL_REALTIME, "_viewports", "_vp_input", ev); //special one for GUI, as controls use their own process check
|
||||||
|
|
||||||
if (ScriptDebugger::get_singleton() && ScriptDebugger::get_singleton()->is_remote()) {
|
if (ScriptDebugger::get_singleton() && ScriptDebugger::get_singleton()->is_remote()) {
|
||||||
//quit from game window using F8
|
// Quit from game window using the stop shortcut (F8 by default).
|
||||||
|
// The custom shortcut is provided via environment variable when running from the editor.
|
||||||
|
if (debugger_stop_shortcut.is_null()) {
|
||||||
|
String shortcut_str = OS::get_singleton()->get_environment("__GODOT_EDITOR_STOP_SHORTCUT__");
|
||||||
|
if (!shortcut_str.empty()) {
|
||||||
|
Variant shortcut_var;
|
||||||
|
|
||||||
|
VariantParser::StreamString ss;
|
||||||
|
ss.s = shortcut_str;
|
||||||
|
|
||||||
|
String errs;
|
||||||
|
int line;
|
||||||
|
VariantParser::parse(&ss, shortcut_var, errs, line);
|
||||||
|
debugger_stop_shortcut = shortcut_var;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debugger_stop_shortcut.is_null()) {
|
||||||
|
// Define a default shortcut if it wasn't provided or is invalid.
|
||||||
|
Ref<InputEventKey> ie;
|
||||||
|
ie.instance();
|
||||||
|
ie->set_scancode(KEY_F8);
|
||||||
|
ie->set_unicode(KEY_F8);
|
||||||
|
debugger_stop_shortcut.instance();
|
||||||
|
debugger_stop_shortcut->set_shortcut(ie);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Ref<InputEventKey> k = ev;
|
Ref<InputEventKey> k = ev;
|
||||||
if (k.is_valid() && k->is_pressed() && !k->is_echo() && k->get_scancode() == KEY_F8) {
|
if (k.is_valid() && k->is_pressed() && !k->is_echo() && debugger_stop_shortcut->is_shortcut(k)) {
|
||||||
ScriptDebugger::get_singleton()->request_quit();
|
ScriptDebugger::get_singleton()->request_quit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
class PackedScene;
|
class PackedScene;
|
||||||
class Node;
|
class Node;
|
||||||
class SceneTreeTween;
|
class SceneTreeTween;
|
||||||
|
class ShortCut;
|
||||||
class Spatial;
|
class Spatial;
|
||||||
class Viewport;
|
class Viewport;
|
||||||
class Material;
|
class Material;
|
||||||
@ -227,6 +228,9 @@ private:
|
|||||||
SelfList<Node>::List xform_change_list;
|
SelfList<Node>::List xform_change_list;
|
||||||
|
|
||||||
friend class ScriptDebuggerRemote;
|
friend class ScriptDebuggerRemote;
|
||||||
|
|
||||||
|
Ref<ShortCut> debugger_stop_shortcut;
|
||||||
|
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
|
|
||||||
Map<int, NodePath> live_edit_node_path_cache;
|
Map<int, NodePath> live_edit_node_path_cache;
|
||||||
|
Loading…
Reference in New Issue
Block a user