1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Editor: Restructure editor code

Moving various editor files into sub folders to reduce clutter
This commit is contained in:
A Thousand Ships
2025-06-10 16:47:26 +02:00
parent 3954b2459d
commit f11aff3841
601 changed files with 1195 additions and 1019 deletions

View File

@@ -34,8 +34,8 @@
#include "editor/debugger/editor_debugger_node.h"
#include "editor/debugger/script_editor_debugger.h"
#include "editor/export/editor_export_platform.h"
#include "editor/gui/editor_run_bar.h"
#include "editor/plugins/script_editor_plugin.h"
#include "editor/run/editor_run_bar.h"
#include "editor/script/script_editor_plugin.h"
void DebugAdapterParser::_bind_methods() {
// Requests

View File

@@ -37,8 +37,8 @@
#include "editor/debugger/script_editor_debugger.h"
#include "editor/editor_log.h"
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "editor/gui/editor_run_bar.h"
#include "editor/run/editor_run_bar.h"
#include "editor/settings/editor_settings.h"
DebugAdapterProtocol *DebugAdapterProtocol::singleton = nullptr;

View File

@@ -32,7 +32,7 @@
#include "editor/editor_log.h"
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "editor/settings/editor_settings.h"
int DebugAdapterServer::port_override = -1;

View File

@@ -0,0 +1,271 @@
/**************************************************************************/
/* debugger_editor_plugin.cpp */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#include "debugger_editor_plugin.h"
#include "core/os/keyboard.h"
#include "editor/debugger/editor_debugger_node.h"
#include "editor/debugger/editor_debugger_server.h"
#include "editor/debugger/editor_file_server.h"
#include "editor/editor_node.h"
#include "editor/gui/editor_bottom_panel.h"
#include "editor/run/run_instances_dialog.h"
#include "editor/script/script_editor_plugin.h"
#include "editor/settings/editor_command_palette.h"
#include "editor/settings/editor_settings.h"
#include "scene/gui/popup_menu.h"
DebuggerEditorPlugin::DebuggerEditorPlugin(PopupMenu *p_debug_menu) {
EditorDebuggerServer::initialize();
ED_SHORTCUT("debugger/step_into", TTRC("Step Into"), Key::F11);
ED_SHORTCUT("debugger/step_over", TTRC("Step Over"), Key::F10);
ED_SHORTCUT("debugger/break", TTRC("Break"));
ED_SHORTCUT("debugger/continue", TTRC("Continue"), Key::F12);
ED_SHORTCUT("debugger/debug_with_external_editor", TTRC("Debug with External Editor"));
// File Server for deploy with remote filesystem.
file_server = memnew(EditorFileServer);
EditorDebuggerNode *debugger = memnew(EditorDebuggerNode);
Button *db = EditorNode::get_bottom_panel()->add_item(TTRC("Debugger"), debugger, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_debugger_bottom_panel", TTRC("Toggle Debugger Bottom Panel"), KeyModifierMask::ALT | Key::D));
debugger->set_tool_button(db);
// Main editor debug menu.
debug_menu = p_debug_menu;
debug_menu->set_hide_on_checkable_item_selection(false);
debug_menu->add_check_shortcut(ED_SHORTCUT("editor/deploy_with_remote_debug", TTRC("Deploy with Remote Debug")), RUN_DEPLOY_REMOTE_DEBUG);
debug_menu->set_item_tooltip(-1,
TTRC("When this option is enabled, using one-click deploy will make the executable attempt to connect to this computer's IP so the running project can be debugged.\nThis option is intended to be used for remote debugging (typically with a mobile device).\nYou don't need to enable it to use the GDScript debugger locally."));
debug_menu->add_check_shortcut(ED_SHORTCUT("editor/small_deploy_with_network_fs", TTRC("Small Deploy with Network Filesystem")), RUN_FILE_SERVER);
debug_menu->set_item_tooltip(-1,
TTRC("When this option is enabled, using one-click deploy for Android will only export an executable without the project data.\nThe filesystem will be provided from the project by the editor over the network.\nOn Android, deploying will use the USB cable for faster performance. This option speeds up testing for projects with large assets."));
debug_menu->add_separator();
debug_menu->add_check_shortcut(ED_SHORTCUT("editor/visible_collision_shapes", TTRC("Visible Collision Shapes")), RUN_DEBUG_COLLISIONS);
debug_menu->set_item_tooltip(-1,
TTRC("When this option is enabled, collision shapes and raycast nodes (for 2D and 3D) will be visible in the running project."));
debug_menu->add_check_shortcut(ED_SHORTCUT("editor/visible_paths", TTRC("Visible Paths")), RUN_DEBUG_PATHS);
debug_menu->set_item_tooltip(-1,
TTRC("When this option is enabled, curve resources used by path nodes will be visible in the running project."));
debug_menu->add_check_shortcut(ED_SHORTCUT("editor/visible_navigation", TTRC("Visible Navigation")), RUN_DEBUG_NAVIGATION);
debug_menu->set_item_tooltip(-1,
TTRC("When this option is enabled, navigation meshes, and polygons will be visible in the running project."));
debug_menu->add_check_shortcut(ED_SHORTCUT("editor/visible_avoidance", TTRC("Visible Avoidance")), RUN_DEBUG_AVOIDANCE);
debug_menu->set_item_tooltip(-1,
TTRC("When this option is enabled, avoidance object shapes, radiuses, and velocities will be visible in the running project."));
debug_menu->add_separator();
debug_menu->add_check_shortcut(ED_SHORTCUT("editor/visible_canvas_redraw", TTRC("Debug CanvasItem Redraws")), RUN_DEBUG_CANVAS_REDRAW);
debug_menu->set_item_tooltip(-1,
TTRC("When this option is enabled, redraw requests of 2D objects will become visible (as a short flash) in the running project.\nThis is useful to troubleshoot low processor mode."));
debug_menu->add_separator();
debug_menu->add_check_shortcut(ED_SHORTCUT("editor/sync_scene_changes", TTRC("Synchronize Scene Changes")), RUN_LIVE_DEBUG);
debug_menu->set_item_tooltip(-1,
TTRC("When this option is enabled, any changes made to the scene in the editor will be replicated in the running project.\nWhen used remotely on a device, this is more efficient when the network filesystem option is enabled."));
debug_menu->add_check_shortcut(ED_SHORTCUT("editor/sync_script_changes", TTRC("Synchronize Script Changes")), RUN_RELOAD_SCRIPTS);
debug_menu->set_item_tooltip(-1,
TTRC("When this option is enabled, any script that is saved will be reloaded in the running project.\nWhen used remotely on a device, this is more efficient when the network filesystem option is enabled."));
debug_menu->add_check_shortcut(ED_SHORTCUT("editor/keep_server_open", TTRC("Keep Debug Server Open")), SERVER_KEEP_OPEN);
debug_menu->set_item_tooltip(-1,
TTRC("When this option is enabled, the editor debug server will stay open and listen for new sessions started outside of the editor itself."));
// Multi-instance, start/stop.
debug_menu->add_separator();
debug_menu->add_item(TTRC("Customize Run Instances..."), RUN_MULTIPLE_INSTANCES);
debug_menu->connect(SceneStringName(id_pressed), callable_mp(this, &DebuggerEditorPlugin::_menu_option));
run_instances_dialog = memnew(RunInstancesDialog);
EditorNode::get_singleton()->get_gui_base()->add_child(run_instances_dialog);
}
DebuggerEditorPlugin::~DebuggerEditorPlugin() {
EditorDebuggerServer::deinitialize();
memdelete(file_server);
}
void DebuggerEditorPlugin::_menu_option(int p_option) {
switch (p_option) {
case RUN_FILE_SERVER: {
bool ischecked = debug_menu->is_item_checked(debug_menu->get_item_index(RUN_FILE_SERVER));
if (ischecked) {
file_server->stop();
set_process(false);
} else {
file_server->start();
set_process(true);
}
debug_menu->set_item_checked(debug_menu->get_item_index(RUN_FILE_SERVER), !ischecked);
if (!initializing) {
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_file_server", !ischecked);
}
} break;
case RUN_LIVE_DEBUG: {
bool ischecked = debug_menu->is_item_checked(debug_menu->get_item_index(RUN_LIVE_DEBUG));
debug_menu->set_item_checked(debug_menu->get_item_index(RUN_LIVE_DEBUG), !ischecked);
EditorDebuggerNode::get_singleton()->set_live_debugging(!ischecked);
if (!initializing) {
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_live_debug", !ischecked);
}
} break;
case RUN_DEPLOY_REMOTE_DEBUG: {
bool ischecked = debug_menu->is_item_checked(debug_menu->get_item_index(RUN_DEPLOY_REMOTE_DEBUG));
debug_menu->set_item_checked(debug_menu->get_item_index(RUN_DEPLOY_REMOTE_DEBUG), !ischecked);
if (!initializing) {
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_deploy_remote_debug", !ischecked);
}
} break;
case RUN_DEBUG_COLLISIONS: {
bool ischecked = debug_menu->is_item_checked(debug_menu->get_item_index(RUN_DEBUG_COLLISIONS));
debug_menu->set_item_checked(debug_menu->get_item_index(RUN_DEBUG_COLLISIONS), !ischecked);
if (!initializing) {
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_debug_collisions", !ischecked);
}
} break;
case RUN_DEBUG_PATHS: {
bool ischecked = debug_menu->is_item_checked(debug_menu->get_item_index(RUN_DEBUG_PATHS));
debug_menu->set_item_checked(debug_menu->get_item_index(RUN_DEBUG_PATHS), !ischecked);
if (!initializing) {
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_debug_paths", !ischecked);
}
} break;
case RUN_DEBUG_NAVIGATION: {
bool ischecked = debug_menu->is_item_checked(debug_menu->get_item_index(RUN_DEBUG_NAVIGATION));
debug_menu->set_item_checked(debug_menu->get_item_index(RUN_DEBUG_NAVIGATION), !ischecked);
if (!initializing) {
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_debug_navigation", !ischecked);
}
} break;
case RUN_DEBUG_AVOIDANCE: {
bool ischecked = debug_menu->is_item_checked(debug_menu->get_item_index(RUN_DEBUG_AVOIDANCE));
debug_menu->set_item_checked(debug_menu->get_item_index(RUN_DEBUG_AVOIDANCE), !ischecked);
if (!initializing) {
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_debug_avoidance", !ischecked);
}
} break;
case RUN_DEBUG_CANVAS_REDRAW: {
bool ischecked = debug_menu->is_item_checked(debug_menu->get_item_index(RUN_DEBUG_CANVAS_REDRAW));
debug_menu->set_item_checked(debug_menu->get_item_index(RUN_DEBUG_CANVAS_REDRAW), !ischecked);
if (!initializing) {
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_debug_canvas_redraw", !ischecked);
}
} break;
case RUN_RELOAD_SCRIPTS: {
bool ischecked = debug_menu->is_item_checked(debug_menu->get_item_index(RUN_RELOAD_SCRIPTS));
debug_menu->set_item_checked(debug_menu->get_item_index(RUN_RELOAD_SCRIPTS), !ischecked);
ScriptEditor::get_singleton()->set_live_auto_reload_running_scripts(!ischecked);
if (!initializing) {
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_reload_scripts", !ischecked);
}
} break;
case SERVER_KEEP_OPEN: {
bool ischecked = debug_menu->is_item_checked(debug_menu->get_item_index(SERVER_KEEP_OPEN));
debug_menu->set_item_checked(debug_menu->get_item_index(SERVER_KEEP_OPEN), !ischecked);
EditorDebuggerNode::get_singleton()->set_keep_open(!ischecked);
if (!initializing) {
EditorSettings::get_singleton()->set_project_metadata("debug_options", "server_keep_open", !ischecked);
}
} break;
case RUN_MULTIPLE_INSTANCES: {
run_instances_dialog->popup_dialog();
} break;
}
}
void DebuggerEditorPlugin::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_READY: {
_update_debug_options();
initializing = false;
} break;
case NOTIFICATION_PROCESS: {
file_server->poll();
} break;
}
}
void DebuggerEditorPlugin::_update_debug_options() {
bool check_deploy_remote = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_deploy_remote_debug", true);
bool check_file_server = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_file_server", false);
bool check_debug_collisions = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_collisions", false);
bool check_debug_paths = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_paths", false);
bool check_debug_navigation = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_navigation", false);
bool check_debug_avoidance = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_avoidance", false);
bool check_debug_canvas_redraw = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_canvas_redraw", false);
bool check_live_debug = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_live_debug", true);
bool check_reload_scripts = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_reload_scripts", true);
bool check_server_keep_open = EditorSettings::get_singleton()->get_project_metadata("debug_options", "server_keep_open", false);
if (check_deploy_remote) {
_menu_option(RUN_DEPLOY_REMOTE_DEBUG);
}
if (check_file_server) {
_menu_option(RUN_FILE_SERVER);
}
if (check_debug_collisions) {
_menu_option(RUN_DEBUG_COLLISIONS);
}
if (check_debug_paths) {
_menu_option(RUN_DEBUG_PATHS);
}
if (check_debug_navigation) {
_menu_option(RUN_DEBUG_NAVIGATION);
}
if (check_debug_avoidance) {
_menu_option(RUN_DEBUG_AVOIDANCE);
}
if (check_debug_canvas_redraw) {
_menu_option(RUN_DEBUG_CANVAS_REDRAW);
}
if (check_live_debug) {
_menu_option(RUN_LIVE_DEBUG);
}
if (check_reload_scripts) {
_menu_option(RUN_RELOAD_SCRIPTS);
}
if (check_server_keep_open) {
_menu_option(SERVER_KEEP_OPEN);
}
}

View File

@@ -0,0 +1,74 @@
/**************************************************************************/
/* debugger_editor_plugin.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#pragma once
#include "editor/plugins/editor_plugin.h"
class EditorFileServer;
class MenuButton;
class PopupMenu;
class RunInstancesDialog;
class DebuggerEditorPlugin : public EditorPlugin {
GDCLASS(DebuggerEditorPlugin, EditorPlugin);
private:
PopupMenu *debug_menu = nullptr;
EditorFileServer *file_server = nullptr;
RunInstancesDialog *run_instances_dialog = nullptr;
enum MenuOptions {
RUN_FILE_SERVER,
RUN_LIVE_DEBUG,
RUN_DEBUG_COLLISIONS,
RUN_DEBUG_PATHS,
RUN_DEBUG_NAVIGATION,
RUN_DEBUG_AVOIDANCE,
RUN_DEBUG_CANVAS_REDRAW,
RUN_DEPLOY_REMOTE_DEBUG,
RUN_RELOAD_SCRIPTS,
SERVER_KEEP_OPEN,
RUN_MULTIPLE_INSTANCES,
};
bool initializing = true;
void _update_debug_options();
void _notification(int p_what);
void _menu_option(int p_option);
public:
virtual String get_plugin_name() const override { return "Debugger"; }
bool has_main_screen() const override { return false; }
DebuggerEditorPlugin(PopupMenu *p_menu);
~DebuggerEditorPlugin();
};

View File

@@ -32,9 +32,9 @@
#include "core/debugger/debugger_marshalls.h"
#include "core/io/marshalls.h"
#include "editor/docks/inspector_dock.h"
#include "editor/editor_node.h"
#include "editor/editor_undo_redo_manager.h"
#include "editor/inspector_dock.h"
#include "scene/debugger/scene_debugger.h"
bool EditorDebuggerRemoteObjects::_set(const StringName &p_name, const Variant &p_value) {

View File

@@ -31,7 +31,7 @@
#pragma once
#include "core/variant/typed_dictionary.h"
#include "editor/editor_inspector.h"
#include "editor/inspector/editor_inspector.h"
class SceneDebuggerObject;

View File

@@ -31,19 +31,19 @@
#include "editor_debugger_node.h"
#include "core/object/undo_redo.h"
#include "editor/debugger/editor_debugger_plugin.h"
#include "editor/debugger/editor_debugger_tree.h"
#include "editor/debugger/script_editor_debugger.h"
#include "editor/docks/inspector_dock.h"
#include "editor/docks/scene_tree_dock.h"
#include "editor/editor_log.h"
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "editor/editor_string_names.h"
#include "editor/editor_undo_redo_manager.h"
#include "editor/gui/editor_bottom_panel.h"
#include "editor/gui/editor_run_bar.h"
#include "editor/inspector_dock.h"
#include "editor/plugins/editor_debugger_plugin.h"
#include "editor/plugins/script_editor_plugin.h"
#include "editor/scene_tree_dock.h"
#include "editor/run/editor_run_bar.h"
#include "editor/script/script_editor_plugin.h"
#include "editor/settings/editor_settings.h"
#include "editor/themes/editor_theme_manager.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/tab_container.h"

View File

@@ -0,0 +1,220 @@
/**************************************************************************/
/* editor_debugger_plugin.cpp */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#include "editor_debugger_plugin.h"
#include "editor/debugger/script_editor_debugger.h"
void EditorDebuggerSession::_breaked(bool p_really_did, bool p_can_debug, const String &p_message, bool p_has_stackdump) {
if (p_really_did) {
emit_signal(SNAME("breaked"), p_can_debug);
} else {
emit_signal(SNAME("continued"));
}
}
void EditorDebuggerSession::_started() {
emit_signal(SNAME("started"));
}
void EditorDebuggerSession::_stopped() {
emit_signal(SNAME("stopped"));
}
void EditorDebuggerSession::_bind_methods() {
ClassDB::bind_method(D_METHOD("send_message", "message", "data"), &EditorDebuggerSession::send_message, DEFVAL(Array()));
ClassDB::bind_method(D_METHOD("toggle_profiler", "profiler", "enable", "data"), &EditorDebuggerSession::toggle_profiler, DEFVAL(Array()));
ClassDB::bind_method(D_METHOD("is_breaked"), &EditorDebuggerSession::is_breaked);
ClassDB::bind_method(D_METHOD("is_debuggable"), &EditorDebuggerSession::is_debuggable);
ClassDB::bind_method(D_METHOD("is_active"), &EditorDebuggerSession::is_active);
ClassDB::bind_method(D_METHOD("add_session_tab", "control"), &EditorDebuggerSession::add_session_tab);
ClassDB::bind_method(D_METHOD("remove_session_tab", "control"), &EditorDebuggerSession::remove_session_tab);
ClassDB::bind_method(D_METHOD("set_breakpoint", "path", "line", "enabled"), &EditorDebuggerSession::set_breakpoint);
ADD_SIGNAL(MethodInfo("started"));
ADD_SIGNAL(MethodInfo("stopped"));
ADD_SIGNAL(MethodInfo("breaked", PropertyInfo(Variant::BOOL, "can_debug")));
ADD_SIGNAL(MethodInfo("continued"));
}
void EditorDebuggerSession::add_session_tab(Control *p_tab) {
ERR_FAIL_COND(!p_tab || !debugger);
debugger->add_debugger_tab(p_tab);
tabs.insert(p_tab);
}
void EditorDebuggerSession::remove_session_tab(Control *p_tab) {
ERR_FAIL_COND(!p_tab || !debugger);
debugger->remove_debugger_tab(p_tab);
tabs.erase(p_tab);
}
void EditorDebuggerSession::send_message(const String &p_message, const Array &p_args) {
ERR_FAIL_NULL_MSG(debugger, "Plugin is not attached to debugger.");
debugger->send_message(p_message, p_args);
}
void EditorDebuggerSession::toggle_profiler(const String &p_profiler, bool p_enable, const Array &p_data) {
ERR_FAIL_NULL_MSG(debugger, "Plugin is not attached to debugger.");
debugger->toggle_profiler(p_profiler, p_enable, p_data);
}
bool EditorDebuggerSession::is_breaked() {
ERR_FAIL_NULL_V_MSG(debugger, false, "Plugin is not attached to debugger.");
return debugger->is_breaked();
}
bool EditorDebuggerSession::is_debuggable() {
ERR_FAIL_NULL_V_MSG(debugger, false, "Plugin is not attached to debugger.");
return debugger->is_debuggable();
}
bool EditorDebuggerSession::is_active() {
ERR_FAIL_NULL_V_MSG(debugger, false, "Plugin is not attached to debugger.");
return debugger->is_session_active();
}
void EditorDebuggerSession::set_breakpoint(const String &p_path, int p_line, bool p_enabled) {
ERR_FAIL_NULL_MSG(debugger, "Plugin is not attached to debugger.");
debugger->set_breakpoint(p_path, p_line, p_enabled);
}
void EditorDebuggerSession::detach_debugger() {
if (!debugger) {
return;
}
debugger->disconnect("started", callable_mp(this, &EditorDebuggerSession::_started));
debugger->disconnect("stopped", callable_mp(this, &EditorDebuggerSession::_stopped));
debugger->disconnect("breaked", callable_mp(this, &EditorDebuggerSession::_breaked));
debugger->disconnect(SceneStringName(tree_exited), callable_mp(this, &EditorDebuggerSession::_debugger_gone_away));
for (Control *tab : tabs) {
debugger->remove_debugger_tab(tab);
}
tabs.clear();
debugger = nullptr;
}
void EditorDebuggerSession::_debugger_gone_away() {
debugger = nullptr;
tabs.clear();
}
EditorDebuggerSession::EditorDebuggerSession(ScriptEditorDebugger *p_debugger) {
ERR_FAIL_NULL(p_debugger);
debugger = p_debugger;
debugger->connect("started", callable_mp(this, &EditorDebuggerSession::_started));
debugger->connect("stopped", callable_mp(this, &EditorDebuggerSession::_stopped));
debugger->connect("breaked", callable_mp(this, &EditorDebuggerSession::_breaked));
debugger->connect(SceneStringName(tree_exited), callable_mp(this, &EditorDebuggerSession::_debugger_gone_away), CONNECT_ONE_SHOT);
}
EditorDebuggerSession::~EditorDebuggerSession() {
detach_debugger();
}
/// EditorDebuggerPlugin
EditorDebuggerPlugin::~EditorDebuggerPlugin() {
clear();
}
void EditorDebuggerPlugin::clear() {
for (Ref<EditorDebuggerSession> &session : sessions) {
session->detach_debugger();
}
sessions.clear();
}
void EditorDebuggerPlugin::create_session(ScriptEditorDebugger *p_debugger) {
sessions.push_back(Ref<EditorDebuggerSession>(memnew(EditorDebuggerSession(p_debugger))));
setup_session(sessions.size() - 1);
}
void EditorDebuggerPlugin::setup_session(int p_idx) {
GDVIRTUAL_CALL(_setup_session, p_idx);
}
Ref<EditorDebuggerSession> EditorDebuggerPlugin::get_session(int p_idx) {
ERR_FAIL_INDEX_V(p_idx, sessions.size(), nullptr);
return sessions.get(p_idx);
}
Array EditorDebuggerPlugin::get_sessions() {
Array ret;
for (const Ref<EditorDebuggerSession> &session : sessions) {
ret.push_back(session);
}
return ret;
}
bool EditorDebuggerPlugin::has_capture(const String &p_message) const {
bool ret = false;
if (GDVIRTUAL_CALL(_has_capture, p_message, ret)) {
return ret;
}
return false;
}
bool EditorDebuggerPlugin::capture(const String &p_message, const Array &p_data, int p_session_id) {
bool ret = false;
if (GDVIRTUAL_CALL(_capture, p_message, p_data, p_session_id, ret)) {
return ret;
}
return false;
}
void EditorDebuggerPlugin::goto_script_line(const Ref<Script> &p_script, int p_line) {
GDVIRTUAL_CALL(_goto_script_line, p_script, p_line);
}
void EditorDebuggerPlugin::breakpoints_cleared_in_tree() {
GDVIRTUAL_CALL(_breakpoints_cleared_in_tree);
}
void EditorDebuggerPlugin::breakpoint_set_in_tree(const Ref<Script> &p_script, int p_line, bool p_enabled) {
GDVIRTUAL_CALL(_breakpoint_set_in_tree, p_script, p_line, p_enabled);
}
void EditorDebuggerPlugin::_bind_methods() {
GDVIRTUAL_BIND(_setup_session, "session_id");
GDVIRTUAL_BIND(_has_capture, "capture");
GDVIRTUAL_BIND(_capture, "message", "data", "session_id");
GDVIRTUAL_BIND(_goto_script_line, "script", "line");
GDVIRTUAL_BIND(_breakpoints_cleared_in_tree);
GDVIRTUAL_BIND(_breakpoint_set_in_tree, "script", "line", "enabled");
ClassDB::bind_method(D_METHOD("get_session", "id"), &EditorDebuggerPlugin::get_session);
ClassDB::bind_method(D_METHOD("get_sessions"), &EditorDebuggerPlugin::get_sessions);
}
EditorDebuggerPlugin::EditorDebuggerPlugin() {
EditorDebuggerNode::get_singleton()->connect("goto_script_line", callable_mp(this, &EditorDebuggerPlugin::goto_script_line));
EditorDebuggerNode::get_singleton()->connect("breakpoints_cleared_in_tree", callable_mp(this, &EditorDebuggerPlugin::breakpoints_cleared_in_tree));
EditorDebuggerNode::get_singleton()->connect("breakpoint_set_in_tree", callable_mp(this, &EditorDebuggerPlugin::breakpoint_set_in_tree));
}

View File

@@ -0,0 +1,104 @@
/**************************************************************************/
/* editor_debugger_plugin.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#pragma once
#include "scene/gui/control.h"
class ScriptEditorDebugger;
class EditorDebuggerSession : public RefCounted {
GDCLASS(EditorDebuggerSession, RefCounted);
private:
HashSet<Control *> tabs;
ScriptEditorDebugger *debugger = nullptr;
void _breaked(bool p_really_did, bool p_can_debug, const String &p_message, bool p_has_stackdump);
void _started();
void _stopped();
void _debugger_gone_away();
protected:
static void _bind_methods();
public:
void detach_debugger();
void add_session_tab(Control *p_tab);
void remove_session_tab(Control *p_tab);
void send_message(const String &p_message, const Array &p_args = Array());
void toggle_profiler(const String &p_profiler, bool p_enable, const Array &p_data = Array());
bool is_breaked();
bool is_debuggable();
bool is_active();
void set_breakpoint(const String &p_path, int p_line, bool p_enabled);
EditorDebuggerSession(ScriptEditorDebugger *p_debugger);
~EditorDebuggerSession();
};
class EditorDebuggerPlugin : public RefCounted {
GDCLASS(EditorDebuggerPlugin, RefCounted);
private:
List<Ref<EditorDebuggerSession>> sessions;
protected:
static void _bind_methods();
public:
void create_session(ScriptEditorDebugger *p_debugger);
void clear();
virtual void setup_session(int p_idx);
virtual bool capture(const String &p_message, const Array &p_data, int p_session);
virtual bool has_capture(const String &p_capture) const;
Ref<EditorDebuggerSession> get_session(int p_session_id);
Array get_sessions();
GDVIRTUAL3R(bool, _capture, const String &, const Array &, int);
GDVIRTUAL1RC(bool, _has_capture, const String &);
GDVIRTUAL1(_setup_session, int);
virtual void goto_script_line(const Ref<Script> &p_script, int p_line);
virtual void breakpoints_cleared_in_tree();
virtual void breakpoint_set_in_tree(const Ref<Script> &p_script, int p_line, bool p_enabled);
GDVIRTUAL2(_goto_script_line, const Ref<Script> &, int);
GDVIRTUAL0(_breakpoints_cleared_in_tree);
GDVIRTUAL3(_breakpoint_set_in_tree, const Ref<Script> &, int, bool);
EditorDebuggerPlugin();
~EditorDebuggerPlugin();
};

View File

@@ -34,7 +34,7 @@
#include "core/os/thread.h"
#include "editor/editor_log.h"
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "editor/settings/editor_settings.h"
class EditorDebuggerServerTCP : public EditorDebuggerServer {
private:

View File

@@ -31,12 +31,12 @@
#include "editor_debugger_tree.h"
#include "editor/debugger/editor_debugger_node.h"
#include "editor/docks/scene_tree_dock.h"
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "editor/editor_string_names.h"
#include "editor/gui/editor_file_dialog.h"
#include "editor/gui/editor_toaster.h"
#include "editor/scene_tree_dock.h"
#include "editor/settings/editor_settings.h"
#include "scene/debugger/scene_debugger.h"
#include "scene/gui/texture_rect.h"
#include "scene/resources/packed_scene.h"

View File

@@ -30,9 +30,9 @@
#include "editor_file_server.h"
#include "../editor_settings.h"
#include "editor/editor_node.h"
#include "editor/export/editor_export_platform.h"
#include "editor/settings/editor_settings.h"
#define FILESYSTEM_PROTOCOL_VERSION 1
#define PASSWORD_LENGTH 32

View File

@@ -32,7 +32,7 @@
#include "core/io/tcp_server.h"
#include "core/os/thread.h"
#include "editor/editor_file_system.h"
#include "editor/file_system/editor_file_system.h"
class EditorFileServer : public Object {
GDCLASS(EditorFileServer, Object);

View File

@@ -30,9 +30,9 @@
#include "editor_performance_profiler.h"
#include "editor/editor_property_name_processor.h"
#include "editor/editor_settings.h"
#include "editor/editor_string_names.h"
#include "editor/inspector/editor_property_name_processor.h"
#include "editor/settings/editor_settings.h"
#include "editor/themes/editor_scale.h"
#include "editor/themes/editor_theme_manager.h"
#include "main/performance.h"

View File

@@ -31,9 +31,9 @@
#include "editor_profiler.h"
#include "core/io/image.h"
#include "editor/editor_settings.h"
#include "editor/editor_string_names.h"
#include "editor/gui/editor_run_bar.h"
#include "editor/run/editor_run_bar.h"
#include "editor/settings/editor_settings.h"
#include "editor/themes/editor_scale.h"
#include "scene/gui/check_box.h"
#include "scene/gui/flow_container.h"

View File

@@ -31,9 +31,9 @@
#include "editor_visual_profiler.h"
#include "core/io/image.h"
#include "editor/editor_settings.h"
#include "editor/editor_string_names.h"
#include "editor/gui/editor_run_bar.h"
#include "editor/run/editor_run_bar.h"
#include "editor/settings/editor_settings.h"
#include "editor/themes/editor_scale.h"
#include "scene/gui/flow_container.h"
#include "scene/resources/image_texture.h"

View File

@@ -34,23 +34,23 @@
#include "core/debugger/remote_debugger.h"
#include "core/string/ustring.h"
#include "core/version.h"
#include "editor/debugger/editor_debugger_plugin.h"
#include "editor/debugger/editor_expression_evaluator.h"
#include "editor/debugger/editor_performance_profiler.h"
#include "editor/debugger/editor_profiler.h"
#include "editor/debugger/editor_visual_profiler.h"
#include "editor/editor_file_system.h"
#include "editor/docks/filesystem_dock.h"
#include "editor/docks/inspector_dock.h"
#include "editor/editor_log.h"
#include "editor/editor_node.h"
#include "editor/editor_property_name_processor.h"
#include "editor/editor_settings.h"
#include "editor/editor_string_names.h"
#include "editor/filesystem_dock.h"
#include "editor/file_system/editor_file_system.h"
#include "editor/gui/editor_file_dialog.h"
#include "editor/gui/editor_toaster.h"
#include "editor/inspector_dock.h"
#include "editor/plugins/canvas_item_editor_plugin.h"
#include "editor/plugins/editor_debugger_plugin.h"
#include "editor/plugins/node_3d_editor_plugin.h"
#include "editor/inspector/editor_property_name_processor.h"
#include "editor/scene/3d/node_3d_editor_plugin.h"
#include "editor/scene/canvas_item_editor_plugin.h"
#include "editor/settings/editor_settings.h"
#include "editor/themes/editor_scale.h"
#include "main/performance.h"
#include "scene/3d/camera_3d.h"