diff options
Diffstat (limited to 'editor/debugger')
-rw-r--r-- | editor/debugger/SCsub | 2 | ||||
-rw-r--r-- | editor/debugger/editor_debugger_inspector.cpp | 6 | ||||
-rw-r--r-- | editor/debugger/editor_debugger_node.cpp | 27 | ||||
-rw-r--r-- | editor/debugger/editor_debugger_node.h | 8 | ||||
-rw-r--r-- | editor/debugger/editor_debugger_tree.cpp | 17 | ||||
-rw-r--r-- | editor/debugger/editor_debugger_tree.h | 4 | ||||
-rw-r--r-- | editor/debugger/editor_network_profiler.cpp | 26 | ||||
-rw-r--r-- | editor/debugger/editor_profiler.cpp | 16 | ||||
-rw-r--r-- | editor/debugger/editor_visual_profiler.cpp | 18 | ||||
-rw-r--r-- | editor/debugger/script_editor_debugger.cpp | 93 | ||||
-rw-r--r-- | editor/debugger/script_editor_debugger.h | 4 |
11 files changed, 111 insertions, 110 deletions
diff --git a/editor/debugger/SCsub b/editor/debugger/SCsub index 2b1e889fb0..359d04e5df 100644 --- a/editor/debugger/SCsub +++ b/editor/debugger/SCsub @@ -1,5 +1,5 @@ #!/usr/bin/env python -Import('env') +Import("env") env.add_source_files(env.editor_sources, "*.cpp") diff --git a/editor/debugger/editor_debugger_inspector.cpp b/editor/debugger/editor_debugger_inspector.cpp index 9587daf93e..00ed2bbc4c 100644 --- a/editor/debugger/editor_debugger_inspector.cpp +++ b/editor/debugger/editor_debugger_inspector.cpp @@ -125,7 +125,7 @@ void EditorDebuggerInspector::_object_selected(ObjectID p_object) { } ObjectID EditorDebuggerInspector::add_object(const Array &p_arr) { - EditorDebuggerRemoteObject *debugObj = NULL; + EditorDebuggerRemoteObject *debugObj = nullptr; SceneDebuggerObject obj; obj.deserialize(p_arr); @@ -211,7 +211,7 @@ void EditorDebuggerInspector::clear_cache() { for (Map<ObjectID, EditorDebuggerRemoteObject *>::Element *E = remote_objects.front(); E; E = E->next()) { EditorNode *editor = EditorNode::get_singleton(); if (editor->get_editor_history()->get_current() == E->value()->get_instance_id()) { - editor->push_item(NULL); + editor->push_item(nullptr); } memdelete(E->value()); } @@ -221,7 +221,7 @@ void EditorDebuggerInspector::clear_cache() { Object *EditorDebuggerInspector::get_object(ObjectID p_id) { if (remote_objects.has(p_id)) return remote_objects[p_id]; - return NULL; + return nullptr; } void EditorDebuggerInspector::add_stack_variable(const Array &p_array) { diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp index f4a8102b79..3302b50103 100644 --- a/editor/debugger/editor_debugger_node.cpp +++ b/editor/debugger/editor_debugger_node.cpp @@ -47,14 +47,14 @@ void _for_all(TabContainer *p_node, const Func &p_func) { } } -EditorDebuggerNode *EditorDebuggerNode::singleton = NULL; +EditorDebuggerNode *EditorDebuggerNode::singleton = nullptr; EditorDebuggerNode::EditorDebuggerNode() { if (!singleton) singleton = this; - add_constant_override("margin_left", -EditorNode::get_singleton()->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_LEFT)); - add_constant_override("margin_right", -EditorNode::get_singleton()->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_RIGHT)); + add_theme_constant_override("margin_left", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_LEFT)); + add_theme_constant_override("margin_right", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_RIGHT)); tabs = memnew(TabContainer); tabs->set_tab_align(TabContainer::ALIGN_LEFT); @@ -64,7 +64,7 @@ EditorDebuggerNode::EditorDebuggerNode() { Ref<StyleBoxEmpty> empty; empty.instance(); - tabs->add_style_override("panel", empty); + tabs->add_theme_style_override("panel", empty); auto_switch_remote_scene_tree = EDITOR_DEF("debugger/auto_switch_to_remote_scene_tree", false); _add_debugger(); @@ -110,7 +110,7 @@ ScriptEditorDebugger *EditorDebuggerNode::_add_debugger() { if (tabs->get_tab_count() > 1) { node->clear_style(); tabs->set_tabs_visible(true); - tabs->add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("DebuggerPanel", "EditorStyles")); + tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("DebuggerPanel", "EditorStyles")); } return node; @@ -223,10 +223,10 @@ void EditorDebuggerNode::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { if (tabs->get_tab_count() > 1) { - add_constant_override("margin_left", -EditorNode::get_singleton()->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_LEFT)); - add_constant_override("margin_right", -EditorNode::get_singleton()->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_RIGHT)); + add_theme_constant_override("margin_left", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_LEFT)); + add_theme_constant_override("margin_right", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_RIGHT)); - tabs->add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("DebuggerPanel", "EditorStyles")); + tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("DebuggerPanel", "EditorStyles")); } } break; default: @@ -262,9 +262,9 @@ void EditorDebuggerNode::_notification(int p_what) { } else { debugger_button->set_text(TTR("Debugger") + " (" + itos(error_count + warning_count) + ")"); if (error_count == 0) { - debugger_button->set_icon(get_icon("Warning", "EditorIcons")); + debugger_button->set_icon(get_theme_icon("Warning", "EditorIcons")); } else { - debugger_button->set_icon(get_icon("Error", "EditorIcons")); + debugger_button->set_icon(get_theme_icon("Error", "EditorIcons")); } } last_error_count = error_count; @@ -291,13 +291,13 @@ void EditorDebuggerNode::_notification(int p_what) { // Take connections. if (server->is_connection_available()) { - ScriptEditorDebugger *debugger = NULL; + ScriptEditorDebugger *debugger = nullptr; _for_all(tabs, [&](ScriptEditorDebugger *dbg) { if (debugger || dbg->is_session_active()) return; debugger = dbg; }); - if (debugger == NULL) { + if (debugger == nullptr) { if (tabs->get_tab_count() <= 4) { // Max 4 debugging sessions active. debugger = _add_debugger(); } else { @@ -356,7 +356,7 @@ void EditorDebuggerNode::_debugger_changed(int p_tab) { if (get_inspected_remote_object()) { // Clear inspected object, you can only inspect objects in selected debugger. // Hopefully, in the future, we will have one inspector per debugger. - EditorNode::get_singleton()->push_item(NULL); + EditorNode::get_singleton()->push_item(nullptr); } if (remote_scene_tree->is_visible_in_tree()) { get_current_debugger()->request_remote_tree(); @@ -371,7 +371,6 @@ void EditorDebuggerNode::set_script_debug_button(MenuButton *p_button) { script_menu->set_text(TTR("Debug")); script_menu->set_switch_on_hover(true); PopupMenu *p = script_menu->get_popup(); - p->set_hide_on_window_lose_focus(true); p->add_shortcut(ED_GET_SHORTCUT("debugger/step_into"), DEBUG_STEP); p->add_shortcut(ED_GET_SHORTCUT("debugger/step_over"), DEBUG_NEXT); p->add_separator(); diff --git a/editor/debugger/editor_debugger_node.h b/editor/debugger/editor_debugger_node.h index 6181ccdb5f..9467442c9a 100644 --- a/editor/debugger/editor_debugger_node.h +++ b/editor/debugger/editor_debugger_node.h @@ -85,9 +85,9 @@ private: }; Ref<EditorDebuggerServer> server; - TabContainer *tabs = NULL; - Button *debugger_button = NULL; - MenuButton *script_menu = NULL; + TabContainer *tabs = nullptr; + Button *debugger_button = nullptr; + MenuButton *script_menu = nullptr; Ref<Script> stack_script; // Why?!? @@ -95,7 +95,7 @@ private: int last_warning_count = 0; float inspect_edited_object_timeout = 0; - EditorDebuggerTree *remote_scene_tree = NULL; + EditorDebuggerTree *remote_scene_tree = nullptr; float remote_scene_tree_timeout = 0.0; bool auto_switch_remote_scene_tree = false; bool debug_with_external_editor = false; diff --git a/editor/debugger/editor_debugger_tree.cpp b/editor/debugger/editor_debugger_tree.cpp index 019a5d0fc3..c2b94c79bb 100644 --- a/editor/debugger/editor_debugger_tree.cpp +++ b/editor/debugger/editor_debugger_tree.cpp @@ -33,6 +33,7 @@ #include "editor/editor_node.h" #include "scene/debugger/scene_debugger.h" #include "scene/resources/packed_scene.h" +#include "servers/display_server.h" EditorDebuggerTree::EditorDebuggerTree() { set_v_size_flags(SIZE_EXPAND_FILL); @@ -106,9 +107,9 @@ void EditorDebuggerTree::_scene_tree_rmb_selected(const Vector2 &p_position) { item->select(0); item_menu->clear(); - item_menu->add_icon_item(get_icon("CreateNewSceneFrom", "EditorIcons"), TTR("Save Branch as Scene"), ITEM_MENU_SAVE_REMOTE_NODE); - item_menu->add_icon_item(get_icon("CopyNodePath", "EditorIcons"), TTR("Copy Node Path"), ITEM_MENU_COPY_NODE_PATH); - item_menu->set_global_position(get_global_mouse_position()); + item_menu->add_icon_item(get_theme_icon("CreateNewSceneFrom", "EditorIcons"), TTR("Save Branch as Scene"), ITEM_MENU_SAVE_REMOTE_NODE); + item_menu->add_icon_item(get_theme_icon("CopyNodePath", "EditorIcons"), TTR("Copy Node Path"), ITEM_MENU_COPY_NODE_PATH); + item_menu->set_position(get_screen_transform().xform(get_local_mouse_position())); item_menu->popup(); } @@ -134,7 +135,7 @@ void EditorDebuggerTree::update_scene_tree(const SceneDebuggerTree *p_tree, int // Nodes are in a flatten list, depth first. Use a stack of parents, avoid recursion. List<Pair<TreeItem *, int>> parents; for (int i = 0; i < p_tree->nodes.size(); i++) { - TreeItem *parent = NULL; + TreeItem *parent = nullptr; if (parents.size()) { // Find last parent. Pair<TreeItem *, int> &p = parents[0]; parent = p.first; @@ -190,7 +191,7 @@ void EditorDebuggerTree::update_scene_tree(const SceneDebuggerTree *p_tree, int // Check if parent expects more children. for (int j = 0; j < parents.size(); j++) { if (parents[j].first == item) { - parent = NULL; + parent = nullptr; break; // Might have more children. } } @@ -210,7 +211,7 @@ String EditorDebuggerTree::get_selected_path() { String EditorDebuggerTree::_get_path(TreeItem *p_item) { ERR_FAIL_COND_V(!p_item, ""); - if (p_item->get_parent() == NULL) { + if (p_item->get_parent() == nullptr) { return "/root"; } String text = p_item->get_text(0); @@ -229,7 +230,7 @@ void EditorDebuggerTree::_item_menu_id_pressed(int p_option) { case ITEM_MENU_SAVE_REMOTE_NODE: { file_dialog->set_access(EditorFileDialog::ACCESS_RESOURCES); - file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE); + file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); List<String> extensions; Ref<PackedScene> sd = memnew(PackedScene); @@ -257,7 +258,7 @@ void EditorDebuggerTree::_item_menu_id_pressed(int p_option) { text = text.substr(slash + 1); } } - OS::get_singleton()->set_clipboard(text); + DisplayServer::get_singleton()->clipboard_set(text); } break; } } diff --git a/editor/debugger/editor_debugger_tree.h b/editor/debugger/editor_debugger_tree.h index d9084bc596..342eb23194 100644 --- a/editor/debugger/editor_debugger_tree.h +++ b/editor/debugger/editor_debugger_tree.h @@ -50,8 +50,8 @@ private: int debugger_id = 0; bool updating_scene_tree = false; Set<ObjectID> unfold_cache; - PopupMenu *item_menu = NULL; - EditorFileDialog *file_dialog = NULL; + PopupMenu *item_menu = nullptr; + EditorFileDialog *file_dialog = nullptr; String _get_path(TreeItem *p_item); void _scene_tree_folded(Object *p_obj); diff --git a/editor/debugger/editor_network_profiler.cpp b/editor/debugger/editor_network_profiler.cpp index 21ef66d1aa..b8c795d9ca 100644 --- a/editor/debugger/editor_network_profiler.cpp +++ b/editor/debugger/editor_network_profiler.cpp @@ -41,14 +41,14 @@ void EditorNetworkProfiler::_bind_methods() { void EditorNetworkProfiler::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { - activate->set_icon(get_icon("Play", "EditorIcons")); - clear_button->set_icon(get_icon("Clear", "EditorIcons")); - incoming_bandwidth_text->set_right_icon(get_icon("ArrowDown", "EditorIcons")); - outgoing_bandwidth_text->set_right_icon(get_icon("ArrowUp", "EditorIcons")); + activate->set_icon(get_theme_icon("Play", "EditorIcons")); + clear_button->set_icon(get_theme_icon("Clear", "EditorIcons")); + incoming_bandwidth_text->set_right_icon(get_theme_icon("ArrowDown", "EditorIcons")); + outgoing_bandwidth_text->set_right_icon(get_theme_icon("ArrowUp", "EditorIcons")); // This needs to be done here to set the faded color when the profiler is first opened - incoming_bandwidth_text->add_color_override("font_color_uneditable", get_color("font_color", "Editor") * Color(1, 1, 1, 0.5)); - outgoing_bandwidth_text->add_color_override("font_color_uneditable", get_color("font_color", "Editor") * Color(1, 1, 1, 0.5)); + incoming_bandwidth_text->add_theme_color_override("font_color_uneditable", get_theme_color("font_color", "Editor") * Color(1, 1, 1, 0.5)); + outgoing_bandwidth_text->add_theme_color_override("font_color_uneditable", get_theme_color("font_color", "Editor") * Color(1, 1, 1, 0.5)); } } @@ -77,10 +77,10 @@ void EditorNetworkProfiler::_update_frame() { void EditorNetworkProfiler::_activate_pressed() { if (activate->is_pressed()) { - activate->set_icon(get_icon("Stop", "EditorIcons")); + activate->set_icon(get_theme_icon("Stop", "EditorIcons")); activate->set_text(TTR("Stop")); } else { - activate->set_icon(get_icon("Play", "EditorIcons")); + activate->set_icon(get_theme_icon("Play", "EditorIcons")); activate->set_text(TTR("Start")); } emit_signal("enable_profiling", activate->is_pressed()); @@ -118,12 +118,12 @@ void EditorNetworkProfiler::set_bandwidth(int p_incoming, int p_outgoing) { outgoing_bandwidth_text->set_text(vformat(TTR("%s/s"), String::humanize_size(p_outgoing))); // Make labels more prominent when the bandwidth is greater than 0 to attract user attention - incoming_bandwidth_text->add_color_override( + incoming_bandwidth_text->add_theme_color_override( "font_color_uneditable", - get_color("font_color", "Editor") * Color(1, 1, 1, p_incoming > 0 ? 1 : 0.5)); - outgoing_bandwidth_text->add_color_override( + get_theme_color("font_color", "Editor") * Color(1, 1, 1, p_incoming > 0 ? 1 : 0.5)); + outgoing_bandwidth_text->add_theme_color_override( "font_color_uneditable", - get_color("font_color", "Editor") * Color(1, 1, 1, p_outgoing > 0 ? 1 : 0.5)); + get_theme_color("font_color", "Editor") * Color(1, 1, 1, p_outgoing > 0 ? 1 : 0.5)); } bool EditorNetworkProfiler::is_profiling() { @@ -133,7 +133,7 @@ bool EditorNetworkProfiler::is_profiling() { EditorNetworkProfiler::EditorNetworkProfiler() { HBoxContainer *hb = memnew(HBoxContainer); - hb->add_constant_override("separation", 8 * EDSCALE); + hb->add_theme_constant_override("separation", 8 * EDSCALE); add_child(hb); activate = memnew(Button); diff --git a/editor/debugger/editor_profiler.cpp b/editor/debugger/editor_profiler.cpp index ca4979563d..1577e24ac0 100644 --- a/editor/debugger/editor_profiler.cpp +++ b/editor/debugger/editor_profiler.cpp @@ -132,11 +132,11 @@ String EditorProfiler::_get_time_as_text(const Metric &m, float p_time, int p_ca Color EditorProfiler::_get_color_from_signature(const StringName &p_signature) const { - Color bc = get_color("error_color", "Editor"); + Color bc = get_theme_color("error_color", "Editor"); double rot = ABS(double(p_signature.hash()) / double(0x7FFFFFFF)); Color c; c.set_hsv(rot, bc.get_s(), bc.get_v()); - return c.linear_interpolate(get_color("base_color", "Editor"), 0.07); + return c.linear_interpolate(get_theme_color("base_color", "Editor"), 0.07); } void EditorProfiler::_item_edited() { @@ -176,7 +176,7 @@ void EditorProfiler::_update_plot() { } uint8_t *wr = graph_image.ptrw(); - const Color background_color = get_color("dark_color_2", "Editor"); + const Color background_color = get_theme_color("dark_color_2", "Editor"); // Clear the previous frame and set the background color. for (int i = 0; i < desired_len; i += 4) { @@ -420,10 +420,10 @@ void EditorProfiler::_update_frame() { void EditorProfiler::_activate_pressed() { if (activate->is_pressed()) { - activate->set_icon(get_icon("Stop", "EditorIcons")); + activate->set_icon(get_theme_icon("Stop", "EditorIcons")); activate->set_text(TTR("Stop")); } else { - activate->set_icon(get_icon("Play", "EditorIcons")); + activate->set_icon(get_theme_icon("Play", "EditorIcons")); activate->set_text(TTR("Start")); } emit_signal("enable_profiling", activate->is_pressed()); @@ -438,8 +438,8 @@ void EditorProfiler::_clear_pressed() { void EditorProfiler::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - activate->set_icon(get_icon("Play", "EditorIcons")); - clear_button->set_icon(get_icon("Clear", "EditorIcons")); + activate->set_icon(get_theme_icon("Play", "EditorIcons")); + clear_button->set_icon(get_theme_icon("Clear", "EditorIcons")); } } @@ -712,7 +712,7 @@ EditorProfiler::EditorProfiler() { hb->add_child(cursor_metric_edit); cursor_metric_edit->connect("value_changed", callable_mp(this, &EditorProfiler::_cursor_metric_changed)); - hb->add_constant_override("separation", 8 * EDSCALE); + hb->add_theme_constant_override("separation", 8 * EDSCALE); h_split = memnew(HSplitContainer); add_child(h_split); diff --git a/editor/debugger/editor_visual_profiler.cpp b/editor/debugger/editor_visual_profiler.cpp index 48425062d1..d2edba5970 100644 --- a/editor/debugger/editor_visual_profiler.cpp +++ b/editor/debugger/editor_visual_profiler.cpp @@ -128,11 +128,11 @@ String EditorVisualProfiler::_get_time_as_text(float p_time) { Color EditorVisualProfiler::_get_color_from_signature(const StringName &p_signature) const { - Color bc = get_color("error_color", "Editor"); + Color bc = get_theme_color("error_color", "Editor"); double rot = ABS(double(p_signature.hash()) / double(0x7FFFFFFF)); Color c; c.set_hsv(rot, bc.get_s(), bc.get_v()); - return c.linear_interpolate(get_color("base_color", "Editor"), 0.07); + return c.linear_interpolate(get_theme_color("base_color", "Editor"), 0.07); } void EditorVisualProfiler::_item_selected() { @@ -327,7 +327,7 @@ void EditorVisualProfiler::_update_frame(bool p_focus_selected) { int cursor_metric = _get_cursor_index(); - Ref<Texture> track_icon = get_icon("TrackColor", "EditorIcons"); + Ref<Texture> track_icon = get_theme_icon("TrackColor", "EditorIcons"); ERR_FAIL_INDEX(cursor_metric, frame_metrics.size()); @@ -418,11 +418,11 @@ void EditorVisualProfiler::_update_frame(bool p_focus_selected) { void EditorVisualProfiler::_activate_pressed() { if (activate->is_pressed()) { - activate->set_icon(get_icon("Stop", "EditorIcons")); + activate->set_icon(get_theme_icon("Stop", "EditorIcons")); activate->set_text(TTR("Stop")); _clear_pressed(); //always clear on start } else { - activate->set_icon(get_icon("Play", "EditorIcons")); + activate->set_icon(get_theme_icon("Play", "EditorIcons")); activate->set_text(TTR("Start")); } emit_signal("enable_profiling", activate->is_pressed()); @@ -437,8 +437,8 @@ void EditorVisualProfiler::_clear_pressed() { void EditorVisualProfiler::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - activate->set_icon(get_icon("Play", "EditorIcons")); - clear_button->set_icon(get_icon("Clear", "EditorIcons")); + activate->set_icon(get_theme_icon("Play", "EditorIcons")); + clear_button->set_icon(get_theme_icon("Clear", "EditorIcons")); } } @@ -446,7 +446,7 @@ void EditorVisualProfiler::_graph_tex_draw() { if (last_metric < 0) return; - Ref<Font> font = get_font("font", "Label"); + Ref<Font> font = get_theme_font("font", "Label"); if (seeking) { int max_frames = frame_metrics.size(); @@ -777,7 +777,7 @@ EditorVisualProfiler::EditorVisualProfiler() { hb->add_child(cursor_metric_edit); cursor_metric_edit->connect("value_changed", callable_mp(this, &EditorVisualProfiler::_cursor_metric_changed)); - hb->add_constant_override("separation", 8 * EDSCALE); + hb->add_theme_constant_override("separation", 8 * EDSCALE); h_split = memnew(HSplitContainer); add_child(h_split); diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index dcb1611f71..1971abadc4 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -42,10 +42,10 @@ #include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/plugins/canvas_item_editor_plugin.h" -#include "editor/plugins/spatial_editor_plugin.h" +#include "editor/plugins/node_3d_editor_plugin.h" #include "editor/property_editor.h" #include "main/performance.h" -#include "scene/3d/camera.h" +#include "scene/3d/camera_3d.h" #include "scene/debugger/scene_debugger.h" #include "scene/gui/dialogs.h" #include "scene/gui/label.h" @@ -58,6 +58,7 @@ #include "scene/gui/texture_button.h" #include "scene/gui/tree.h" #include "scene/resources/packed_scene.h" +#include "servers/display_server.h" using CameraOverride = EditorDebuggerNode::CameraOverride; @@ -73,15 +74,15 @@ void ScriptEditorDebugger::_put_msg(String p_message, Array p_data) { void ScriptEditorDebugger::debug_copy() { String msg = reason->get_text(); if (msg == "") return; - OS::get_singleton()->set_clipboard(msg); + DisplayServer::get_singleton()->clipboard_set(msg); } void ScriptEditorDebugger::debug_skip_breakpoints() { skip_breakpoints_value = !skip_breakpoints_value; if (skip_breakpoints_value) - skip_breakpoints->set_icon(get_icon("DebugSkipBreakpointsOn", "EditorIcons")); + skip_breakpoints->set_icon(get_theme_icon("DebugSkipBreakpointsOn", "EditorIcons")); else - skip_breakpoints->set_icon(get_icon("DebugSkipBreakpointsOff", "EditorIcons")); + skip_breakpoints->set_icon(get_theme_icon("DebugSkipBreakpointsOff", "EditorIcons")); Array msg; msg.push_back(skip_breakpoints_value); @@ -116,7 +117,7 @@ void ScriptEditorDebugger::debug_continue() { // Allow focus stealing only if we actually run this client for security. if (remote_pid && EditorNode::get_singleton()->has_child_process(remote_pid)) - OS::get_singleton()->enable_for_stealing_focus(remote_pid); + DisplayServer::get_singleton()->enable_for_stealing_focus(remote_pid); _clear_execution(); _put_msg("continue", Array()); @@ -129,15 +130,15 @@ void ScriptEditorDebugger::update_tabs() { } else { errors_tab->set_name(TTR("Errors") + " (" + itos(error_count + warning_count) + ")"); if (error_count == 0) { - tabs->set_tab_icon(errors_tab->get_index(), get_icon("Warning", "EditorIcons")); + tabs->set_tab_icon(errors_tab->get_index(), get_theme_icon("Warning", "EditorIcons")); } else { - tabs->set_tab_icon(errors_tab->get_index(), get_icon("Error", "EditorIcons")); + tabs->set_tab_icon(errors_tab->get_index(), get_theme_icon("Error", "EditorIcons")); } } } void ScriptEditorDebugger::clear_style() { - tabs->add_style_override("panel", NULL); + tabs->add_theme_style_override("panel", nullptr); } void ScriptEditorDebugger::save_node(ObjectID p_id, const String &p_file) { @@ -253,7 +254,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da _update_buttons_state(); _set_reason_text(error, MESSAGE_ERROR); emit_signal("breaked", true, can_continue); - OS::get_singleton()->move_window_to_foreground(); + DisplayServer::get_singleton()->window_move_to_foreground(); if (error != "") { tabs->set_current_tab(0); } @@ -310,8 +311,8 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da it->set_text(3, String::humanize_size(bytes)); total += bytes; - if (has_icon(type, "EditorIcons")) - it->set_icon(0, get_icon(type, "EditorIcons")); + if (has_theme_icon(type, "EditorIcons")) + it->set_icon(0, get_theme_icon(type, "EditorIcons")); } vmem_total->set_tooltip(TTR("Bytes:") + " " + itos(total)); @@ -442,7 +443,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da TreeItem *error = error_tree->create_item(r); error->set_collapsed(true); - error->set_icon(0, get_icon(oe.warning ? "Warning" : "Error", "EditorIcons")); + error->set_icon(0, get_theme_icon(oe.warning ? "Warning" : "Error", "EditorIcons")); error->set_text(0, time); error->set_text_align(0, TreeItem::ALIGN_LEFT); @@ -660,13 +661,13 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da void ScriptEditorDebugger::_set_reason_text(const String &p_reason, MessageType p_type) { switch (p_type) { case MESSAGE_ERROR: - reason->add_color_override("font_color", get_color("error_color", "Editor")); + reason->add_theme_color_override("font_color", get_theme_color("error_color", "Editor")); break; case MESSAGE_WARNING: - reason->add_color_override("font_color", get_color("warning_color", "Editor")); + reason->add_theme_color_override("font_color", get_theme_color("warning_color", "Editor")); break; default: - reason->add_color_override("font_color", get_color("success_color", "Editor")); + reason->add_theme_color_override("font_color", get_theme_color("success_color", "Editor")); } reason->set_text(p_reason); reason->set_tooltip(p_reason.word_wrap(80)); @@ -693,8 +694,8 @@ void ScriptEditorDebugger::_performance_draw() { info_message->hide(); - Ref<StyleBox> graph_sb = get_stylebox("normal", "TextEdit"); - Ref<Font> graph_font = get_font("font", "TextEdit"); + Ref<StyleBox> graph_sb = get_theme_stylebox("normal", "TextEdit"); + Ref<Font> graph_font = get_theme_font("font", "TextEdit"); int cols = Math::ceil(Math::sqrt((float)which.size())); int rows = Math::ceil((float)which.size() / cols); @@ -714,7 +715,7 @@ void ScriptEditorDebugger::_performance_draw() { r.position += graph_sb->get_offset(); r.size -= graph_sb->get_minimum_size(); int pi = which[i]; - Color c = get_color("accent_color", "Editor"); + Color c = get_theme_color("accent_color", "Editor"); float h = (float)which[i] / (float)(perf_items.size()); // Use a darker color on light backgrounds for better visibility float value_multiplier = EditorSettings::get_singleton()->is_dark_theme() ? 1.4 : 0.55; @@ -753,20 +754,20 @@ void ScriptEditorDebugger::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { - skip_breakpoints->set_icon(get_icon("DebugSkipBreakpointsOff", "EditorIcons")); - copy->set_icon(get_icon("ActionCopy", "EditorIcons")); + skip_breakpoints->set_icon(get_theme_icon("DebugSkipBreakpointsOff", "EditorIcons")); + copy->set_icon(get_theme_icon("ActionCopy", "EditorIcons")); - step->set_icon(get_icon("DebugStep", "EditorIcons")); - next->set_icon(get_icon("DebugNext", "EditorIcons")); - dobreak->set_icon(get_icon("Pause", "EditorIcons")); - docontinue->set_icon(get_icon("DebugContinue", "EditorIcons")); + step->set_icon(get_theme_icon("DebugStep", "EditorIcons")); + next->set_icon(get_theme_icon("DebugNext", "EditorIcons")); + dobreak->set_icon(get_theme_icon("Pause", "EditorIcons")); + docontinue->set_icon(get_theme_icon("DebugContinue", "EditorIcons")); le_set->connect("pressed", callable_mp(this, &ScriptEditorDebugger::_live_edit_set)); le_clear->connect("pressed", callable_mp(this, &ScriptEditorDebugger::_live_edit_clear)); error_tree->connect("item_selected", callable_mp(this, &ScriptEditorDebugger::_error_selected)); error_tree->connect("item_activated", callable_mp(this, &ScriptEditorDebugger::_error_activated)); - vmem_refresh->set_icon(get_icon("Reload", "EditorIcons")); + vmem_refresh->set_icon(get_theme_icon("Reload", "EditorIcons")); - reason->add_color_override("font_color", get_color("error_color", "Editor")); + reason->add_theme_color_override("font_color", get_theme_color("error_color", "Editor")); } break; case NOTIFICATION_PROCESS: { @@ -790,12 +791,12 @@ void ScriptEditorDebugger::_notification(int p_what) { } else if (camera_override >= CameraOverride::OVERRIDE_3D_1) { int viewport_idx = camera_override - CameraOverride::OVERRIDE_3D_1; - SpatialEditorViewport *viewport = SpatialEditor::get_singleton()->get_editor_viewport(viewport_idx); - Camera *const cam = viewport->get_camera(); + Node3DEditorViewport *viewport = Node3DEditor::get_singleton()->get_editor_viewport(viewport_idx); + Camera3D *const cam = viewport->get_camera(); Array msg; msg.push_back(cam->get_camera_transform()); - if (cam->get_projection() == Camera::PROJECTION_ORTHOGONAL) { + if (cam->get_projection() == Camera3D::PROJECTION_ORTHOGONAL) { msg.push_back(false); msg.push_back(cam->get_size()); } else { @@ -829,16 +830,16 @@ void ScriptEditorDebugger::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - if (tabs->has_stylebox_override("panel")) { - tabs->add_style_override("panel", editor->get_gui_base()->get_stylebox("DebuggerPanel", "EditorStyles")); + if (tabs->has_theme_stylebox_override("panel")) { + tabs->add_theme_style_override("panel", editor->get_gui_base()->get_theme_stylebox("DebuggerPanel", "EditorStyles")); } - copy->set_icon(get_icon("ActionCopy", "EditorIcons")); - step->set_icon(get_icon("DebugStep", "EditorIcons")); - next->set_icon(get_icon("DebugNext", "EditorIcons")); - dobreak->set_icon(get_icon("Pause", "EditorIcons")); - docontinue->set_icon(get_icon("DebugContinue", "EditorIcons")); - vmem_refresh->set_icon(get_icon("Reload", "EditorIcons")); + copy->set_icon(get_theme_icon("ActionCopy", "EditorIcons")); + step->set_icon(get_theme_icon("DebugStep", "EditorIcons")); + next->set_icon(get_theme_icon("DebugNext", "EditorIcons")); + dobreak->set_icon(get_theme_icon("Pause", "EditorIcons")); + docontinue->set_icon(get_theme_icon("DebugContinue", "EditorIcons")); + vmem_refresh->set_icon(get_theme_icon("Reload", "EditorIcons")); } break; } } @@ -922,7 +923,7 @@ void ScriptEditorDebugger::stop() { res_path_cache.clear(); profiler_signature.clear(); - inspector->edit(NULL); + inspector->edit(nullptr); _update_buttons_state(); } @@ -972,13 +973,13 @@ void ScriptEditorDebugger::_stack_dump_frame_selected() { msg.push_back(frame); _put_msg("get_stack_frame_vars", msg); } else { - inspector->edit(NULL); + inspector->edit(nullptr); } } void ScriptEditorDebugger::_export_csv() { - file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE); + file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM); file_dialog->popup_centered_ratio(); } @@ -1388,7 +1389,7 @@ void ScriptEditorDebugger::_error_tree_item_rmb_selected(const Vector2 &p_pos) { item_menu->set_size(Size2(1, 1)); if (error_tree->is_anything_selected()) { - item_menu->add_icon_item(get_icon("ActionCopy", "EditorIcons"), TTR("Copy Error"), 0); + item_menu->add_icon_item(get_theme_icon("ActionCopy", "EditorIcons"), TTR("Copy Error"), 0); } if (item_menu->get_item_count() > 0) { @@ -1404,9 +1405,9 @@ void ScriptEditorDebugger::_item_menu_id_pressed(int p_option) { String type; - if (ti->get_icon(0) == get_icon("Warning", "EditorIcons")) { + if (ti->get_icon(0) == get_theme_icon("Warning", "EditorIcons")) { type = "W "; - } else if (ti->get_icon(0) == get_icon("Error", "EditorIcons")) { + } else if (ti->get_icon(0) == get_theme_icon("Error", "EditorIcons")) { type = "E "; } @@ -1420,7 +1421,7 @@ void ScriptEditorDebugger::_item_menu_id_pressed(int p_option) { ci = ci->get_next(); } - OS::get_singleton()->set_clipboard(text); + DisplayServer::get_singleton()->clipboard_set(text); } void ScriptEditorDebugger::_tab_changed(int p_tab) { @@ -1461,7 +1462,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { tabs = memnew(TabContainer); tabs->set_tab_align(TabContainer::ALIGN_LEFT); - tabs->add_style_override("panel", editor->get_gui_base()->get_stylebox("DebuggerPanel", "EditorStyles")); + tabs->add_theme_style_override("panel", editor->get_gui_base()->get_theme_stylebox("DebuggerPanel", "EditorStyles")); tabs->connect("tab_changed", callable_mp(this, &ScriptEditorDebugger::_tab_changed)); add_child(tabs); diff --git a/editor/debugger/script_editor_debugger.h b/editor/debugger/script_editor_debugger.h index 7944d7cb99..9cb7dc2edf 100644 --- a/editor/debugger/script_editor_debugger.h +++ b/editor/debugger/script_editor_debugger.h @@ -107,7 +107,7 @@ private: Button *docontinue; // Reference to "Remote" tab in scene tree. Needed by _live_edit_set and buttons state. // Each debugger should have it's tree in the future I guess. - const Tree *editor_remote_tree = NULL; + const Tree *editor_remote_tree = nullptr; List<Vector<float>> perf_history; Vector<float> perf_max; @@ -255,7 +255,7 @@ public: bool is_skip_breakpoints(); virtual Size2 get_minimum_size() const; - ScriptEditorDebugger(EditorNode *p_editor = NULL); + ScriptEditorDebugger(EditorNode *p_editor = nullptr); ~ScriptEditorDebugger(); }; |