Make sure that the editor can be built even when the new code_editor module is disabled.

This commit is contained in:
Relintai 2023-02-17 23:20:10 +01:00
parent 7a2b7825a8
commit 8d7090241a
25 changed files with 192 additions and 82 deletions

View File

@ -30,25 +30,25 @@
#include "connections_dialog.h"
#include "core/object/class_db.h"
#include "core/math/color.h"
#include "core/variant/dictionary.h"
#include "core/error/error_macros.h"
#include "core/containers/list.h"
#include "core/error/error_macros.h"
#include "core/math/aabb.h"
#include "core/math/basis.h"
#include "core/math/color.h"
#include "core/math/plane.h"
#include "core/math/quaternion.h"
#include "core/math/rect2.h"
#include "core/math/transform.h"
#include "core/math/vector2.h"
#include "core/math/vector3.h"
#include "core/os/memory.h"
#include "core/object/class_db.h"
#include "core/object/ref_ptr.h"
#include "core/object/reference.h"
#include "core/object/script_language.h"
#include "core/typedefs.h"
#include "core/object/undo_redo.h"
#include "core/os/memory.h"
#include "core/typedefs.h"
#include "core/variant/dictionary.h"
#include "core/variant/variant.h"
#include "editor/doc/doc_data.h"
#include "editor/editor_help.h"
@ -816,9 +816,11 @@ void ConnectionsDock::_go_to_script(TreeItem &item) {
return;
}
#ifdef MODULE_CODE_EDITOR_ENABLED
if (script.is_valid() && ScriptEditor::get_singleton()->script_goto_method(script, c.method)) {
editor->call("_editor_select", EditorNode::EDITOR_SCRIPT);
}
#endif
}
void ConnectionsDock::_handle_signal_menu_option(int option) {

View File

@ -30,14 +30,14 @@
#include "editor_data.h"
#include "core/object/class_db.h"
#include "core/config/project_settings.h"
#include "core/error/error_list.h"
#include "core/error/error_macros.h"
#include "core/io/config_file.h"
#include "core/io/resource_loader.h"
#include "core/object/class_db.h"
#include "core/os/file_access.h"
#include "core/os/memory.h"
#include "core/config/project_settings.h"
#include "editor/editor_plugin.h"
#include "editor_node.h"
#include "scene/main/node.h"
@ -557,9 +557,11 @@ void EditorData::remove_scene(int p_idx) {
current_edited_scene--;
}
#ifdef MODULE_CODE_EDITOR_ENABLED
if (edited_scene[p_idx].path != String()) {
ScriptEditor::get_singleton()->close_builtin_scripts_from_scene(edited_scene[p_idx].path);
}
#endif
edited_scene.remove(p_idx);
}

View File

@ -317,7 +317,6 @@ bool EditorExportPlatform::fill_log_messages(RichTextLabel *p_log, Error p_err)
void EditorExportPlatform::gen_debug_flags(Vector<String> &r_flags, int p_flags) {
String host = EditorSettings::get_singleton()->get("network/debug/remote_host");
int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port");
if (p_flags & DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST) {
host = "localhost";
@ -334,6 +333,9 @@ void EditorExportPlatform::gen_debug_flags(Vector<String> &r_flags, int p_flags)
}
}
#ifdef MODULE_CODE_EDITOR_ENABLED
int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port");
if (p_flags & DEBUG_FLAG_REMOTE_DEBUG) {
r_flags.push_back("--remote-debug");
@ -355,6 +357,7 @@ void EditorExportPlatform::gen_debug_flags(Vector<String> &r_flags, int p_flags)
r_flags.push_back(bpoints);
}
}
#endif
if (p_flags & DEBUG_FLAG_VIEW_COLLISONS) {
r_flags.push_back("--debug-collisions");
@ -1241,7 +1244,6 @@ Error EditorExportPlatform::export_zip(const Ref<EditorExportPreset> &p_preset,
void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags) {
String host = EditorSettings::get_singleton()->get("network/debug/remote_host");
int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port");
if (p_flags & DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST) {
host = "localhost";
@ -1258,6 +1260,9 @@ void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags
}
}
#ifdef MODULE_CODE_EDITOR_ENABLED
int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port");
if (p_flags & DEBUG_FLAG_REMOTE_DEBUG) {
r_flags.push_back("--remote-debug");
@ -1279,6 +1284,7 @@ void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags
r_flags.push_back(bpoints);
}
}
#endif
if (p_flags & DEBUG_FLAG_VIEW_COLLISONS) {
r_flags.push_back("--debug-collisions");

View File

@ -30,33 +30,33 @@
#include "editor_help.h"
#include "core/containers/list.h"
#include "core/containers/pair.h"
#include "core/containers/rb_set.h"
#include "core/input/input.h"
#include "core/input/input_event.h"
#include "core/io/resource_loader.h"
#include "core/math/math_defs.h"
#include "core/math/math_funcs.h"
#include "core/math/rect2.h"
#include "core/math/vector2.h"
#include "core/object/class_db.h"
#include "core/os/keyboard.h"
#include "core/os/memory.h"
#include "core/os/os.h"
#include "core/typedefs.h"
#include "core/variant/variant.h"
#include "core/version_generated.gen.h"
#include "doc_data_compressed.gen.h"
#include "editor_node.h"
#include "editor_scale.h"
#include "editor_settings.h"
#include "scene/gui/texture_button.h"
#include "core/object/class_db.h"
#include "core/io/resource_loader.h"
#include "core/containers/list.h"
#include "core/math/math_defs.h"
#include "core/math/math_funcs.h"
#include "core/math/rect2.h"
#include "core/math/vector2.h"
#include "core/input/input_event.h"
#include "core/os/memory.h"
#include "core/os/os.h"
#include "core/containers/pair.h"
#include "core/containers/rb_set.h"
#include "core/typedefs.h"
#include "core/variant/variant.h"
#include "scene/2d/canvas_item.h"
#include "scene/gui/control.h"
#include "scene/gui/label.h"
#include "scene/gui/line_edit.h"
#include "scene/gui/scroll_bar.h"
#include "scene/gui/texture_button.h"
#include "scene/gui/tool_button.h"
#include "scene/main/node.h"
#include "scene/resources/font.h"
@ -1703,7 +1703,9 @@ EditorHelp::~EditorHelp() {
void EditorHelpBit::_go_to_help(String p_what) {
EditorNode::get_singleton()->set_visible_editor(EditorNode::EDITOR_SCRIPT);
#ifdef MODULE_CODE_EDITOR_ENABLED
ScriptEditor::get_singleton()->goto_help(p_what);
#endif
emit_signal("request_hide");
}

View File

@ -100,6 +100,7 @@
#include "editor/import/resource_importer_texture_atlas.h"
#include "editor/import/resource_importer_wav.h"
#include "editor/import_dock.h"
#include "editor/inspector_dock.h"
#include "editor/multi_node_edit.h"
#include "editor/node_dock.h"
#include "editor/plugin_config_dialog.h"
@ -588,10 +589,12 @@ void EditorNode::_notification(int p_what) {
recent_scenes->set_as_minsize();
#ifdef MODULE_CODE_EDITOR_ENABLED
// debugger area
if (ScriptEditor::get_singleton()->get_debugger()->is_visible()) {
bottom_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles"));
}
#endif
// update_icons
for (int i = 0; i < singleton->main_editor_buttons.size(); i++) {
@ -2009,7 +2012,9 @@ void EditorNode::_edit_current(bool p_skip_foreign) {
Object *prev_inspected_object = get_inspector()->get_edited_object();
bool disable_folding = bool(EDITOR_GET("interface/inspector/disable_folding"));
#ifdef MODULE_CODE_EDITOR_ENABLED
bool stay_in_script_editor_on_node_selected = bool(EDITOR_GET("text_editor/navigation/stay_in_script_editor_on_node_selected"));
#endif
bool is_resource = current_obj->is_class("Resource");
bool is_node = current_obj->is_class("Node");
@ -2048,9 +2053,11 @@ void EditorNode::_edit_current(bool p_skip_foreign) {
node_dock->set_node(current_node);
scene_tree_dock->set_selected(current_node);
inspector_dock->update(current_node);
#ifdef MODULE_CODE_EDITOR_ENABLED
if (!inspector_only) {
inspector_only = stay_in_script_editor_on_node_selected && ScriptEditor::get_singleton()->is_visible_in_tree();
}
#endif
} else {
node_dock->set_node(nullptr);
scene_tree_dock->set_selected(nullptr);
@ -2128,12 +2135,12 @@ void EditorNode::_edit_current(bool p_skip_foreign) {
if (!changing_scene) {
main_plugin->edit(current_obj);
}
}
else if (main_plugin != editor_plugin_screen && (!ScriptEditor::get_singleton() || !ScriptEditor::get_singleton()->is_visible_in_tree() || ScriptEditor::get_singleton()->can_take_away_focus())) {
#ifdef MODULE_CODE_EDITOR_ENABLED
} else if (main_plugin != editor_plugin_screen && (!ScriptEditor::get_singleton() || !ScriptEditor::get_singleton()->is_visible_in_tree() || ScriptEditor::get_singleton()->can_take_away_focus())) {
// update screen main_plugin
_editor_select(plugin_index);
main_plugin->edit(current_obj);
#endif
} else {
editor_plugin_screen->edit(current_obj);
}
@ -2233,7 +2240,10 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
editor_data.get_editor_breakpoints(&breakpoints);
args = ProjectSettings::get_singleton()->get("editor/main_run_args");
#ifdef MODULE_CODE_EDITOR_ENABLED
skip_breakpoints = ScriptEditor::get_singleton()->get_debugger()->is_skip_breakpoints();
#endif
emit_signal("play_pressed");
Error error = editor_run.run(run_filename, args, breakpoints, skip_breakpoints);
@ -2400,9 +2410,11 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
if (!scene) {
if (p_option == FILE_SAVE_SCENE) {
#ifdef MODULE_CODE_EDITOR_ENABLED
// Pressing Ctrl + S saves the current script if a scene is currently open, but it won't if the scene has no root node.
// Work around this by explicitly saving the script in this case (similar to pressing Ctrl + Alt + S).
ScriptEditor::get_singleton()->save_current_script();
#endif
}
const int saved = _save_external_resources();
@ -2719,7 +2731,9 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
bool ischecked = debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(RUN_LIVE_DEBUG));
debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(RUN_LIVE_DEBUG), !ischecked);
#ifdef MODULE_CODE_EDITOR_ENABLED
ScriptEditor::get_singleton()->get_debugger()->set_live_debugging(!ischecked);
#endif
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_live_debug", !ischecked);
} break;
@ -2757,7 +2771,9 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
bool ischecked = debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(RUN_RELOAD_SCRIPTS));
debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(RUN_RELOAD_SCRIPTS), !ischecked);
#ifdef MODULE_CODE_EDITOR_ENABLED
ScriptEditor::get_singleton()->set_live_auto_reload_running_scripts(!ischecked);
#endif
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_reload_scripts", !ischecked);
} break;
@ -3449,8 +3465,10 @@ void EditorNode::_set_main_scene_state(Dictionary p_state, Node *p_for_scene) {
//this should only happen at the very end
#ifdef MODULE_CODE_EDITOR_ENABLED
ScriptEditor::get_singleton()->get_debugger()->update_live_edit_root();
ScriptEditor::get_singleton()->set_scene_root_script(editor_data.get_scene_root_script(editor_data.get_edited_scene()));
#endif
editor_data.notify_edited_scene_changed();
}
@ -3681,7 +3699,9 @@ Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, b
opening_prev = false;
scene_tree_dock->set_selected(new_scene);
#ifdef MODULE_CODE_EDITOR_ENABLED
ScriptEditor::get_singleton()->get_debugger()->update_live_edit_root();
#endif
push_item(new_scene);
@ -3865,7 +3885,6 @@ void EditorNode::register_editor_types() {
ClassDB::register_class<EditorResourcePreviewGenerator>();
ClassDB::register_virtual_class<EditorFileSystem>();
ClassDB::register_class<EditorFileSystemDirectory>();
ClassDB::register_virtual_class<ScriptEditor>();
ClassDB::register_virtual_class<EditorInterface>();
ClassDB::register_class<EditorExportPlugin>();
ClassDB::register_class<EditorResourceConversionPlugin>();
@ -5110,11 +5129,15 @@ void EditorNode::_bottom_panel_switch(bool p_enable, int p_idx) {
bottom_panel_items[i].button->set_pressed(i == p_idx);
bottom_panel_items[i].control->set_visible(i == p_idx);
}
#ifdef MODULE_CODE_EDITOR_ENABLED
if (ScriptEditor::get_singleton()->get_debugger() == bottom_panel_items[p_idx].control) { // this is the debug panel which uses tabs, so the top section should be smaller
bottom_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles"));
} else {
bottom_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox("panel", "TabContainer"));
}
#endif
center_split->set_dragger_visibility(SplitContainer::DRAGGER_VISIBLE);
center_split->set_collapsed(false);
if (bottom_panel_raise->is_pressed()) {

View File

@ -38,6 +38,8 @@
#include "editor/inspector_dock.h"
#include "editor/scene_tree_dock.h"
#include "editor_plugin.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/split_container.h"

View File

@ -211,7 +211,9 @@ void EditorInterface::edit_node(Node *p_node) {
}
void EditorInterface::edit_script(const Ref<Script> &p_script, int p_line, int p_col, bool p_grab_focus) {
#ifdef MODULE_CODE_EDITOR_ENABLED
ScriptEditor::get_singleton()->edit(p_script, p_line, p_col, p_grab_focus);
#endif
}
void EditorInterface::open_scene_from_path(const String &scene_path) {
@ -272,9 +274,11 @@ Array EditorInterface::get_open_scenes() const {
return ret;
}
#ifdef MODULE_CODE_EDITOR_ENABLED
ScriptEditor *EditorInterface::get_script_editor() {
return ScriptEditor::get_singleton();
}
#endif
void EditorInterface::select_file(const String &p_file) {
EditorNode::get_singleton()->get_filesystem_dock()->select_file(p_file);
@ -362,7 +366,9 @@ void EditorInterface::_bind_methods() {
ClassDB::bind_method(D_METHOD("inspect_object", "object", "for_property", "inspector_only"), &EditorInterface::inspect_object, DEFVAL(String()), DEFVAL(false));
ClassDB::bind_method(D_METHOD("get_selection"), &EditorInterface::get_selection);
ClassDB::bind_method(D_METHOD("get_editor_settings"), &EditorInterface::get_editor_settings);
#ifdef MODULE_CODE_EDITOR_ENABLED
ClassDB::bind_method(D_METHOD("get_script_editor"), &EditorInterface::get_script_editor);
#endif
ClassDB::bind_method(D_METHOD("get_base_control"), &EditorInterface::get_base_control);
ClassDB::bind_method(D_METHOD("get_editor_scale"), &EditorInterface::get_editor_scale);
ClassDB::bind_method(D_METHOD("edit_resource", "resource"), &EditorInterface::edit_resource);
@ -883,11 +889,11 @@ void EditorPlugin::_bind_methods() {
ClassDB::bind_method(D_METHOD("add_control_to_container", "container", "control"), &EditorPlugin::add_control_to_container);
ClassDB::bind_method(D_METHOD("add_control_to_bottom_panel", "control", "title"), &EditorPlugin::add_control_to_bottom_panel);
ClassDB::bind_method(D_METHOD("add_control_to_dock", "slot", "control"), &EditorPlugin::add_control_to_dock);
ClassDB::bind_method(D_METHOD("remove_control_from_docks", "control"), &EditorPlugin::remove_control_from_docks);
ClassDB::bind_method(D_METHOD("remove_control_from_bottom_panel", "control"), &EditorPlugin::remove_control_from_bottom_panel);
ClassDB::bind_method(D_METHOD("remove_control_from_container", "container", "control"), &EditorPlugin::remove_control_from_container);
ClassDB::bind_method(D_METHOD("add_tool_menu_item", "name", "handler", "callback", "ud"), &EditorPlugin::add_tool_menu_item, DEFVAL(Variant()));
ClassDB::bind_method(D_METHOD("add_tool_submenu_item", "name", "submenu"), &EditorPlugin::add_tool_submenu_item);
ClassDB::bind_method(D_METHOD("remove_tool_menu_item", "name"), &EditorPlugin::remove_tool_menu_item);
@ -895,7 +901,7 @@ void EditorPlugin::_bind_methods() {
ClassDB::bind_method(D_METHOD("add_convert_menu_item", "name", "handler", "callback", "ud"), &EditorPlugin::add_convert_menu_item, DEFVAL(Variant()));
ClassDB::bind_method(D_METHOD("add_convert_submenu_item", "name", "submenu"), &EditorPlugin::add_convert_submenu_item);
ClassDB::bind_method(D_METHOD("remove_convert_menu_item", "name"), &EditorPlugin::remove_convert_menu_item);
ClassDB::bind_method(D_METHOD("add_custom_type", "type", "base", "script", "icon"), &EditorPlugin::add_custom_type);
ClassDB::bind_method(D_METHOD("remove_custom_type", "type"), &EditorPlugin::remove_custom_type);

View File

@ -51,6 +51,8 @@
#include "core/variant/dictionary.h"
#include "core/variant/variant.h"
#include "modules/modules_enabled.gen.h"
class EditorNode;
class Spatial;
class Camera;
@ -108,7 +110,9 @@ public:
Node *get_edited_scene_root();
Array get_open_scenes() const;
#ifdef MODULE_CODE_EDITOR_ENABLED
ScriptEditor *get_script_editor();
#endif
void select_file(const String &p_file);
String get_selected_path() const;

View File

@ -30,33 +30,32 @@
#include "editor_resource_picker.h"
#include "core/containers/pair.h"
#include "core/containers/rb_map.h"
#include "core/error/error_macros.h"
#include "core/input/input_event.h"
#include "core/io/resource_loader.h"
#include "core/math/color.h"
#include "core/math/math_defs.h"
#include "core/math/rect2.h"
#include "core/object/class_db.h"
#include "core/object/ref_ptr.h"
#include "core/object/script_language.h"
#include "core/os/memory.h"
#include "core/string/string_name.h"
#include "core/typedefs.h"
#include "core/variant/dictionary.h"
#include "editor/editor_data.h"
#include "editor/editor_file_dialog.h"
#include "editor/editor_file_system.h"
#include "editor/editor_resource_preview.h"
#include "editor/property_editor.h"
#include "editor/quick_open.h"
#include "editor/scene_tree_dock.h"
#include "editor_node.h"
#include "editor_scale.h"
#include "editor_settings.h"
#include "filesystem_dock.h"
#include "scene/main/viewport.h"
#include "core/object/class_db.h"
#include "core/math/color.h"
#include "core/variant/dictionary.h"
#include "core/error/error_macros.h"
#include "core/io/resource_loader.h"
#include "core/containers/rb_map.h"
#include "core/math/math_defs.h"
#include "core/math/rect2.h"
#include "core/input/input_event.h"
#include "core/os/memory.h"
#include "core/containers/pair.h"
#include "core/object/ref_ptr.h"
#include "core/object/script_language.h"
#include "core/string/string_name.h"
#include "core/typedefs.h"
#include "editor/editor_data.h"
#include "editor/editor_file_dialog.h"
#include "editor/editor_file_system.h"
#include "editor/property_editor.h"
#include "editor/quick_open.h"
#include "editor/scene_tree_dock.h"
#include "scene/2d/canvas_item.h"
#include "scene/gui/button.h"
#include "scene/gui/control.h"
@ -64,6 +63,7 @@
#include "scene/gui/tab_container.h"
#include "scene/gui/texture_rect.h"
#include "scene/main/node.h"
#include "scene/main/viewport.h"
#include "scene/resources/material.h"
#include "scene/resources/shader.h"
#include "scene/resources/style_box.h"
@ -583,10 +583,12 @@ bool EditorResourcePicker::_is_drop_valid(const Dictionary &p_drag_data) const {
Ref<Resource> res;
if (drag_data.has("type") && String(drag_data["type"]) == "script_list_element") {
#ifdef MODULE_CODE_EDITOR_ENABLED
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(drag_data["script_list_element"]);
if (se) {
res = se->get_edited_resource();
}
#endif
} else if (drag_data.has("type") && String(drag_data["type"]) == "resource") {
res = drag_data["resource"];
}
@ -652,10 +654,12 @@ void EditorResourcePicker::drop_data_fw(const Point2 &p_point, const Variant &p_
Ref<Resource> dropped_resource;
if (drag_data.has("type") && String(drag_data["type"]) == "script_list_element") {
#ifdef MODULE_CODE_EDITOR_ENABLED
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(drag_data["script_list_element"]);
if (se) {
dropped_resource = se->get_edited_resource();
}
#endif
} else if (drag_data.has("type") && String(drag_data["type"]) == "resource") {
dropped_resource = drag_data["resource"];
}

View File

@ -68,6 +68,7 @@ Error EditorRun::run(const String &p_scene, const String &p_custom_args, const L
args.push_back("--remote-debug");
#ifdef MODULE_CODE_EDITOR_ENABLED
const String conn_string = ScriptEditor::get_singleton()->get_debugger()->get_connection_string();
if (!conn_string.empty()) {
args.push_back(ScriptEditor::get_singleton()->get_debugger()->get_connection_string());
@ -76,6 +77,7 @@ Error EditorRun::run(const String &p_scene, const String &p_custom_args, const L
const int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port");
args.push_back(remote_host + ":" + String::num(remote_port));
}
#endif
#ifdef ANDROID_ENABLED
const bool android_force_side_by_side_window = EditorSettings::get_singleton()->get("run/window_placement/android_force_launch_adjacent");

View File

@ -3909,9 +3909,11 @@ void CanvasItemEditor::_notification(int p_what) {
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
if (!is_visible() && override_camera_button->is_pressed()) {
#ifdef MODULE_CODE_EDITOR_ENABLED
ScriptEditorDebugger *debugger = ScriptEditor::get_singleton()->get_debugger();
debugger->set_camera_override(ScriptEditorDebugger::OVERRIDE_NONE);
#endif
override_camera_button->set_pressed(false);
}
}
@ -4324,6 +4326,7 @@ void CanvasItemEditor::_button_toggle_grid_snap(bool p_status) {
viewport->update();
}
void CanvasItemEditor::_button_override_camera(bool p_pressed) {
#ifdef MODULE_CODE_EDITOR_ENABLED
ScriptEditorDebugger *debugger = ScriptEditor::get_singleton()->get_debugger();
if (p_pressed) {
@ -4331,6 +4334,7 @@ void CanvasItemEditor::_button_override_camera(bool p_pressed) {
} else {
debugger->set_camera_override(ScriptEditorDebugger::OVERRIDE_NONE);
}
#endif
}
void CanvasItemEditor::_button_tool_select(int p_index) {
@ -5965,10 +5969,12 @@ void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String &
}
if (parent) {
#ifdef MODULE_CODE_EDITOR_ENABLED
String new_name = parent->validate_child_name(child);
ScriptEditorDebugger *sed = ScriptEditor::get_singleton()->get_debugger();
editor_data->get_undo_redo().add_do_method(sed, "live_debug_create_node", editor->get_edited_scene()->get_path_to(parent), child->get_class(), new_name);
editor_data->get_undo_redo().add_undo_method(sed, "live_debug_remove_node", NodePath(String(editor->get_edited_scene()->get_path_to(parent)) + "/" + new_name));
#endif
}
// handle with different property for texture
@ -6035,10 +6041,12 @@ bool CanvasItemEditorViewport::_create_instance(Node *parent, String &path, cons
editor_data->get_undo_redo().add_do_reference(instanced_scene);
editor_data->get_undo_redo().add_undo_method(parent, "remove_child", instanced_scene);
#ifdef MODULE_CODE_EDITOR_ENABLED
String new_name = parent->validate_child_name(instanced_scene);
ScriptEditorDebugger *sed = ScriptEditor::get_singleton()->get_debugger();
editor_data->get_undo_redo().add_do_method(sed, "live_debug_instance_node", editor->get_edited_scene()->get_path_to(parent), path, new_name);
editor_data->get_undo_redo().add_undo_method(sed, "live_debug_remove_node", NodePath(String(editor->get_edited_scene()->get_path_to(parent)) + "/" + new_name));
#endif
CanvasItem *instance_ci = Object::cast_to<CanvasItem>(instanced_scene);
if (instance_ci) {

View File

@ -32,10 +32,10 @@
#include "core/config/engine.h"
#include "core/config/project_settings.h"
#include "core/containers/rb_map.h"
#include "core/containers/pool_vector.h"
#include "core/containers/rid_handle.h"
#include "core/containers/rb_map.h"
#include "core/containers/rb_set.h"
#include "core/containers/rid_handle.h"
#include "core/input/input.h"
#include "core/input/input_event.h"
#include "core/input/shortcut.h"
@ -4238,10 +4238,12 @@ bool SpatialEditorViewport::_create_instance(Node *parent, String &path, const P
editor_data->get_undo_redo().add_do_reference(instanced_scene);
editor_data->get_undo_redo().add_undo_method(parent, "remove_child", instanced_scene);
#ifdef MODULE_CODE_EDITOR_ENABLED
String new_name = parent->validate_child_name(instanced_scene);
ScriptEditorDebugger *sed = ScriptEditor::get_singleton()->get_debugger();
editor_data->get_undo_redo().add_do_method(sed, "live_debug_instance_node", editor->get_edited_scene()->get_path_to(parent), path, new_name);
editor_data->get_undo_redo().add_undo_method(sed, "live_debug_remove_node", NodePath(String(editor->get_edited_scene()->get_path_to(parent)) + "/" + new_name));
#endif
Spatial *spatial = Object::cast_to<Spatial>(instanced_scene);
if (spatial) {
@ -5477,6 +5479,7 @@ void SpatialEditor::_menu_item_toggled(bool pressed, int p_option) {
} break;
case MENU_TOOL_OVERRIDE_CAMERA: {
#ifdef MODULE_CODE_EDITOR_ENABLED
ScriptEditorDebugger *const debugger = ScriptEditor::get_singleton()->get_debugger();
if (pressed) {
@ -5486,7 +5489,7 @@ void SpatialEditor::_menu_item_toggled(bool pressed, int p_option) {
} else {
debugger->set_camera_override(ScriptEditorDebugger::OVERRIDE_NONE);
}
#endif
} break;
}
}
@ -5534,6 +5537,7 @@ void SpatialEditor::_update_camera_override_viewport(Object *p_viewport) {
return;
}
#ifdef MODULE_CODE_EDITOR_ENABLED
ScriptEditorDebugger *const debugger = ScriptEditor::get_singleton()->get_debugger();
camera_override_viewport_id = current_viewport->index;
@ -5542,6 +5546,7 @@ void SpatialEditor::_update_camera_override_viewport(Object *p_viewport) {
debugger->set_camera_override((Override)(Override::OVERRIDE_3D_1 + camera_override_viewport_id));
}
#endif
}
void SpatialEditor::_menu_item_pressed(int p_option) {
@ -6786,9 +6791,11 @@ void SpatialEditor::_notification(int p_what) {
_init_grid();
} else if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
if (!is_visible() && tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->is_pressed()) {
#ifdef MODULE_CODE_EDITOR_ENABLED
ScriptEditorDebugger *debugger = ScriptEditor::get_singleton()->get_debugger();
debugger->set_camera_override(ScriptEditorDebugger::OVERRIDE_NONE);
#endif
tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->set_pressed(false);
}
}

View File

@ -281,10 +281,12 @@ void SceneTreeDock::_perform_instance_scenes(const Vector<String> &p_files, Node
editor_data->get_undo_redo().add_do_reference(instanced_scene);
editor_data->get_undo_redo().add_undo_method(parent, "remove_child", instanced_scene);
#ifdef MODULE_CODE_EDITOR_ENABLED
String new_name = parent->validate_child_name(instanced_scene);
ScriptEditorDebugger *sed = ScriptEditor::get_singleton()->get_debugger();
editor_data->get_undo_redo().add_do_method(sed, "live_debug_instance_node", edited_scene->get_path_to(parent), p_files[i], new_name);
editor_data->get_undo_redo().add_undo_method(sed, "live_debug_remove_node", NodePath(String(edited_scene->get_path_to(parent)).plus_file(new_name)));
#endif
}
editor_data->get_undo_redo().commit_action();
@ -768,10 +770,11 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
editor_data->get_undo_redo().add_undo_method(parent, "remove_child", dup);
editor_data->get_undo_redo().add_do_reference(dup);
#ifdef MODULE_CODE_EDITOR_ENABLED
ScriptEditorDebugger *sed = ScriptEditor::get_singleton()->get_debugger();
editor_data->get_undo_redo().add_do_method(sed, "live_debug_duplicate_node", edited_scene->get_path_to(node), dup->get_name());
editor_data->get_undo_redo().add_undo_method(sed, "live_debug_remove_node", NodePath(String(edited_scene->get_path_to(parent)).plus_file(dup->get_name())));
#endif
add_below_node = dup;
}
@ -1001,9 +1004,11 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
} break;
case TOOL_OPEN_DOCUMENTATION: {
List<Node *> selection = editor_selection->get_selected_node_list();
#ifdef MODULE_CODE_EDITOR_ENABLED
for (int i = 0; i < selection.size(); i++) {
ScriptEditor::get_singleton()->goto_help("class_name:" + selection[i]->get_class());
}
#endif
EditorNode::get_singleton()->set_visible_editor(EditorNode::EDITOR_SCRIPT);
} break;
case TOOL_SCENE_EDITABLE_CHILDREN: {
@ -1893,7 +1898,9 @@ void SceneTreeDock::_do_reparent(Node *p_new_parent, int p_position_in_parent, V
editor_data->get_undo_redo().add_do_method(new_parent, "move_child", node, p_position_in_parent + inc);
}
#ifdef MODULE_CODE_EDITOR_ENABLED
ScriptEditorDebugger *sed = ScriptEditor::get_singleton()->get_debugger();
#endif
String old_name = former_names[ni];
String new_name = new_parent->validate_child_name(node);
@ -1920,8 +1927,10 @@ void SceneTreeDock::_do_reparent(Node *p_new_parent, int p_position_in_parent, V
}
}
#ifdef MODULE_CODE_EDITOR_ENABLED
editor_data->get_undo_redo().add_do_method(sed, "live_debug_reparent_node", edited_scene->get_path_to(node), edited_scene->get_path_to(new_parent), new_name, p_position_in_parent + inc);
editor_data->get_undo_redo().add_undo_method(sed, "live_debug_reparent_node", NodePath(String(edited_scene->get_path_to(new_parent)).plus_file(new_name)), edited_scene->get_path_to(node->get_parent()), node->get_name(), node->get_index());
#endif
if (p_keep_global_xform) {
if (Object::cast_to<Node2D>(node)) {
@ -2170,9 +2179,11 @@ void SceneTreeDock::_delete_confirm(bool p_cut) {
editor_data->get_undo_redo().add_undo_method(this, "_set_owners", edited_scene, owners);
editor_data->get_undo_redo().add_undo_reference(n);
#ifdef MODULE_CODE_EDITOR_ENABLED
ScriptEditorDebugger *sed = ScriptEditor::get_singleton()->get_debugger();
editor_data->get_undo_redo().add_do_method(sed, "live_debug_remove_and_keep_node", edited_scene->get_path_to(n), n->get_instance_id());
editor_data->get_undo_redo().add_undo_method(sed, "live_debug_restore_node", n->get_instance_id(), edited_scene->get_path_to(n->get_parent()), n->get_index());
#endif
}
}
editor_data->get_undo_redo().commit_action();
@ -2265,11 +2276,12 @@ void SceneTreeDock::_do_create(Node *p_parent) {
editor_data->get_undo_redo().add_do_reference(child);
editor_data->get_undo_redo().add_undo_method(p_parent, "remove_child", child);
#ifdef MODULE_CODE_EDITOR_ENABLED
String new_name = p_parent->validate_child_name(child);
ScriptEditorDebugger *sed = ScriptEditor::get_singleton()->get_debugger();
editor_data->get_undo_redo().add_do_method(sed, "live_debug_create_node", edited_scene->get_path_to(p_parent), child->get_class(), new_name);
editor_data->get_undo_redo().add_undo_method(sed, "live_debug_remove_node", NodePath(String(edited_scene->get_path_to(p_parent)).plus_file(new_name)));
#endif
} else {
editor_data->get_undo_redo().add_do_method(editor, "set_edited_scene", child);
editor_data->get_undo_redo().add_do_method(scene_tree, "update_tree");

View File

@ -30,21 +30,21 @@
#include "scene_tree_editor.h"
#include "core/variant/array.h"
#include "core/object/class_db.h"
#include "core/math/color.h"
#include "core/variant/dictionary.h"
#include "core/error/error_macros.h"
#include "core/containers/hashfuncs.h"
#include "core/error/error_macros.h"
#include "core/math/color.h"
#include "core/math/math_defs.h"
#include "core/math/transform_2d.h"
#include "core/object/class_db.h"
#include "core/object/message_queue.h"
#include "core/os/memory.h"
#include "core/object/ref_ptr.h"
#include "core/object/reference.h"
#include "core/object/resource.h"
#include "core/object/script_language.h"
#include "core/object/undo_redo.h"
#include "core/os/memory.h"
#include "core/variant/array.h"
#include "core/variant/dictionary.h"
#include "editor/editor_data.h"
#include "editor/editor_file_system.h"
#include "editor/editor_node.h"
@ -1130,6 +1130,7 @@ bool SceneTreeEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_d
}
if (String(d["type"]) == "script_list_element") {
#ifdef MODULE_CODE_EDITOR_ENABLED
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(d["script_list_element"]);
if (se) {
String sp = se->get_edited_resource()->get_path();
@ -1138,6 +1139,7 @@ bool SceneTreeEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_d
return true;
}
}
#endif
}
return String(d["type"]) == "nodes" && filter == String();
@ -1181,6 +1183,7 @@ void SceneTreeEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data,
}
if (String(d["type"]) == "script_list_element") {
#ifdef MODULE_CODE_EDITOR_ENABLED
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(d["script_list_element"]);
if (se) {
String sp = se->get_edited_resource()->get_path();
@ -1188,6 +1191,7 @@ void SceneTreeEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data,
emit_signal("script_dropped", sp, np);
}
}
#endif
}
}

View File

@ -30,28 +30,28 @@
#include "settings_config_dialog.h"
#include "core/containers/list.h"
#include "core/containers/rb_map.h"
#include "core/error/error_macros.h"
#include "core/input/input_event.h"
#include "core/input/shortcut.h"
#include "core/math/color.h"
#include "core/math/math_defs.h"
#include "core/math/rect2.h"
#include "core/math/vector2.h"
#include "core/object/class_db.h"
#include "core/object/undo_redo.h"
#include "core/os/keyboard.h"
#include "core/os/memory.h"
#include "core/typedefs.h"
#include "core/variant/variant.h"
#include "editor/editor_inspector.h"
#include "editor/editor_sectioned_inspector.h"
#include "editor_log.h"
#include "editor_node.h"
#include "editor_property_name_processor.h"
#include "editor_scale.h"
#include "editor_settings.h"
#include "script_editor_debugger.h"
#include "core/object/class_db.h"
#include "core/math/color.h"
#include "core/error/error_macros.h"
#include "core/containers/list.h"
#include "core/containers/rb_map.h"
#include "core/math/math_defs.h"
#include "core/math/rect2.h"
#include "core/math/vector2.h"
#include "core/input/input_event.h"
#include "core/os/memory.h"
#include "core/typedefs.h"
#include "core/object/undo_redo.h"
#include "core/variant/variant.h"
#include "editor/editor_inspector.h"
#include "editor/editor_sectioned_inspector.h"
#include "scene/gui/box_container.h"
#include "scene/gui/button.h"
#include "scene/gui/control.h"
@ -59,13 +59,13 @@
#include "scene/gui/line_edit.h"
#include "scene/gui/panel_container.h"
#include "scene/gui/popup.h"
#include "core/input/shortcut.h"
#include "scene/gui/tab_container.h"
#include "scene/gui/texture_rect.h"
#include "scene/gui/tool_button.h"
#include "scene/gui/tree.h"
#include "scene/main/node.h"
#include "scene/main/timer.h"
#include "script_editor_debugger.h"
#include "modules/modules_enabled.gen.h"
@ -148,10 +148,12 @@ void EditorSettingsDialog::_undo_redo_callback(void *p_self, const String &p_nam
void EditorSettingsDialog::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_READY: {
#ifdef MODULE_CODE_EDITOR_ENABLED
ScriptEditorDebugger *sed = ScriptEditor::get_singleton()->get_debugger();
undo_redo->set_method_notify_callback(sed->_method_changeds, sed);
undo_redo->set_property_notify_callback(sed->_property_changeds, sed);
undo_redo->set_commit_notify_callback(_undo_redo_callback, this);
#endif
} break;
case NOTIFICATION_ENTER_TREE: {
_update_icons();

View File

@ -5,6 +5,7 @@ def can_build(env, platform):
return False
env.module_add_dependencies("text_editor", ["freetype"], True)
env.module_add_dependencies("text_editor", ["code_editor"], False)
return True

View File

@ -2066,7 +2066,10 @@ bool Main::start() {
if (serr != OK)
ERR_PRINT("Failed to load scene");
}
OS::get_singleton()->set_context(OS::CONTEXT_EDITOR);
#ifdef MODULE_CODE_EDITOR_ENABLED
// Start debug server.
if (!debug_server_uri.empty()) {
int idx = debug_server_uri.rfind(":");
@ -2074,6 +2077,7 @@ bool Main::start() {
int port = debug_server_uri.substr(idx + 1).to_int();
ScriptEditor::get_singleton()->get_debugger()->start(port, addr);
}
#endif
}
#endif
if (!editor) {

View File

@ -10,6 +10,7 @@
void register_code_editor_types(ModuleRegistrationLevel p_level) {
if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) {
//ClassDB::register_class<>();
ClassDB::register_virtual_class<ScriptEditor>();
}
#ifdef TOOLS_ENABLED

View File

@ -37,6 +37,8 @@
#include "cscript.h"
#include "cscript_tokenizer.h"
#include "modules/modules_enabled.gen.h"
CScriptLanguage *script_language_cscript = nullptr;
Ref<ResourceFormatLoaderCScript> resource_loader_cscript;
Ref<ResourceFormatSaverCScript> resource_saver_cscript;
@ -154,7 +156,9 @@ void register_cscript_types(ModuleRegistrationLevel p_level) {
#ifdef TOOLS_ENABLED
if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) {
#ifdef MODULE_CODE_EDITOR_ENABLED
ScriptEditor::register_create_syntax_highlighter_function(CScriptSyntaxHighlighter::create);
#endif
EditorNode::add_init_callback(_editor_init);
}
#endif // TOOLS_ENABLED

View File

@ -37,6 +37,8 @@
#include "gdscript.h"
#include "gdscript_tokenizer.h"
#include "modules/modules_enabled.gen.h"
GDScriptLanguage *script_language_gd = nullptr;
Ref<ResourceFormatLoaderGDScript> resource_loader_gd;
Ref<ResourceFormatSaverGDScript> resource_saver_gd;
@ -155,7 +157,9 @@ void register_gdscript_types(ModuleRegistrationLevel p_level) {
#ifdef TOOLS_ENABLED
if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) {
#ifdef MODULE_CODE_EDITOR_ENABLED
ScriptEditor::register_create_syntax_highlighter_function(GDScriptSyntaxHighlighter::create);
#endif
EditorNode::add_init_callback(_editor_init);
}
#endif // TOOLS_ENABLED

View File

@ -35,6 +35,8 @@
#include "editor/editor_plugin.h"
#include "scene/gui/box_container.h"
#include "scene/gui/item_list.h"
#include "editor/pane_drag.h"
#include "grid_map.h"

View File

@ -40,6 +40,8 @@
#include "scene/resources/navigation_mesh.h"
#include "scene/gui/label.h"
#include "scene/gui/dialogs.h"
void NavigationMeshEditor::_node_removed(Node *p_node) {
if (p_node == node) {
node = nullptr;

View File

@ -25,6 +25,8 @@ SOFTWARE.
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/gui/panel_container.h"
class TerrainWorld;
class SpatialEditorPlugin;
class HSlider;

View File

@ -25,6 +25,8 @@ SOFTWARE.
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/gui/panel_container.h"
#include "../defines.h"
class Terrain2DWorld;

View File

@ -25,6 +25,8 @@ SOFTWARE.
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/gui/panel_container.h"
#include "../defines.h"
class VoxelWorld;