diff options
author | reduz <reduzio@gmail.com> | 2021-07-17 18:22:52 -0300 |
---|---|---|
committer | reduz <reduzio@gmail.com> | 2021-07-18 21:20:02 -0300 |
commit | 6631f66c2a9d54dc80d57df60376c84ce1252d08 (patch) | |
tree | 9b68d49611f1b732e4f3901ff12e3b678d45adbd /editor/debugger | |
parent | b76dfde329592ecfd6f6b952082ae21859039e67 (diff) |
Optimize StringName usage
* Added a new macro SNAME() that constructs and caches a local stringname.
* Subsequent usages use the cached version.
* Since these use a global static variable, a second refcounter of static usages need to be kept for cleanup time.
* Replaced all theme usages by this new macro.
* Replace all signal emission usages by this new macro.
* Replace all call_deferred usages by this new macro.
This is part of ongoing work to optimize GUI and the editor.
Diffstat (limited to 'editor/debugger')
-rw-r--r-- | editor/debugger/editor_debugger_inspector.cpp | 8 | ||||
-rw-r--r-- | editor/debugger/editor_debugger_node.cpp | 28 | ||||
-rw-r--r-- | editor/debugger/editor_debugger_node.h | 2 | ||||
-rw-r--r-- | editor/debugger/editor_debugger_tree.cpp | 10 | ||||
-rw-r--r-- | editor/debugger/editor_network_profiler.cpp | 22 | ||||
-rw-r--r-- | editor/debugger/editor_performance_profiler.cpp | 10 | ||||
-rw-r--r-- | editor/debugger/editor_profiler.cpp | 18 | ||||
-rw-r--r-- | editor/debugger/editor_visual_profiler.cpp | 22 | ||||
-rw-r--r-- | editor/debugger/script_editor_debugger.cpp | 88 |
9 files changed, 104 insertions, 104 deletions
diff --git a/editor/debugger/editor_debugger_inspector.cpp b/editor/debugger/editor_debugger_inspector.cpp index 6035cc072e..a629bf6159 100644 --- a/editor/debugger/editor_debugger_inspector.cpp +++ b/editor/debugger/editor_debugger_inspector.cpp @@ -41,7 +41,7 @@ bool EditorDebuggerRemoteObject::_set(const StringName &p_name, const Variant &p } prop_values[p_name] = p_value; - emit_signal("value_edited", remote_object_id, p_name, p_value); + emit_signal(SNAME("value_edited"), remote_object_id, p_name, p_value); return true; } @@ -114,11 +114,11 @@ void EditorDebuggerInspector::_notification(int p_what) { } void EditorDebuggerInspector::_object_edited(ObjectID p_id, const String &p_prop, const Variant &p_value) { - emit_signal("object_edited", p_id, p_prop, p_value); + emit_signal(SNAME("object_edited"), p_id, p_prop, p_value); } void EditorDebuggerInspector::_object_selected(ObjectID p_object) { - emit_signal("object_selected", p_object); + emit_signal(SNAME("object_selected"), p_object); } ObjectID EditorDebuggerInspector::add_object(const Array &p_arr) { @@ -190,7 +190,7 @@ ObjectID EditorDebuggerInspector::add_object(const Array &p_arr) { if (old_prop_size == debugObj->prop_list.size() && new_props_added == 0) { //only some may have changed, if so, then update those, if exist for (Set<String>::Element *E = changed.front(); E; E = E->next()) { - emit_signal("object_property_updated", debugObj->remote_object_id, E->get()); + emit_signal(SNAME("object_property_updated"), debugObj->remote_object_id, E->get()); } } else { //full update, because props were added or removed diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp index 5f90680115..690ce98cb9 100644 --- a/editor/debugger/editor_debugger_node.cpp +++ b/editor/debugger/editor_debugger_node.cpp @@ -55,8 +55,8 @@ EditorDebuggerNode::EditorDebuggerNode() { singleton = this; } - add_theme_constant_override("margin_left", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(SIDE_LEFT)); - add_theme_constant_override("margin_right", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(SIDE_RIGHT)); + add_theme_constant_override("margin_left", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("BottomPanelDebuggerOverride"), SNAME("EditorStyles"))->get_margin(SIDE_LEFT)); + add_theme_constant_override("margin_right", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("BottomPanelDebuggerOverride"), SNAME("EditorStyles"))->get_margin(SIDE_RIGHT)); tabs = memnew(TabContainer); tabs->set_tab_align(TabContainer::ALIGN_LEFT); @@ -112,7 +112,7 @@ ScriptEditorDebugger *EditorDebuggerNode::_add_debugger() { if (tabs->get_tab_count() > 1) { node->clear_style(); tabs->set_tabs_visible(true); - tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("DebuggerPanel", "EditorStyles")); + tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("EditorStyles"))); } if (!debugger_plugins.is_empty()) { @@ -135,7 +135,7 @@ void EditorDebuggerNode::_stack_frame_selected(int p_debugger) { void EditorDebuggerNode::_error_selected(const String &p_file, int p_line, int p_debugger) { Ref<Script> s = ResourceLoader::load(p_file); - emit_signal("goto_script_line", s, p_line - 1); + emit_signal(SNAME("goto_script_line"), s, p_line - 1); } void EditorDebuggerNode::_text_editor_stack_goto(const ScriptEditorDebugger *p_debugger) { @@ -145,8 +145,8 @@ void EditorDebuggerNode::_text_editor_stack_goto(const ScriptEditorDebugger *p_d } stack_script = ResourceLoader::load(file); const int line = p_debugger->get_stack_script_line() - 1; - emit_signal("goto_script_line", stack_script, line); - emit_signal("set_execution", stack_script, line); + emit_signal(SNAME("goto_script_line"), stack_script, line); + emit_signal(SNAME("set_execution"), stack_script, line); stack_script.unref(); // Why?!? } @@ -226,10 +226,10 @@ void EditorDebuggerNode::_notification(int p_what) { switch (p_what) { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { if (tabs->get_tab_count() > 1) { - add_theme_constant_override("margin_left", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(SIDE_LEFT)); - add_theme_constant_override("margin_right", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(SIDE_RIGHT)); + add_theme_constant_override("margin_left", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("BottomPanelDebuggerOverride"), SNAME("EditorStyles"))->get_margin(SIDE_LEFT)); + add_theme_constant_override("margin_right", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("BottomPanelDebuggerOverride"), SNAME("EditorStyles"))->get_margin(SIDE_RIGHT)); - tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("DebuggerPanel", "EditorStyles")); + tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("EditorStyles"))); } } break; case NOTIFICATION_READY: { @@ -268,11 +268,11 @@ void EditorDebuggerNode::_notification(int p_what) { } else { debugger_button->set_text(TTR("Debugger") + " (" + itos(error_count + warning_count) + ")"); if (error_count >= 1 && warning_count >= 1) { - debugger_button->set_icon(get_theme_icon("ErrorWarning", "EditorIcons")); + debugger_button->set_icon(get_theme_icon(SNAME("ErrorWarning"), SNAME("EditorIcons"))); } else if (error_count >= 1) { - debugger_button->set_icon(get_theme_icon("Error", "EditorIcons")); + debugger_button->set_icon(get_theme_icon(SNAME("Error"), SNAME("EditorIcons"))); } else { - debugger_button->set_icon(get_theme_icon("Warning", "EditorIcons")); + debugger_button->set_icon(get_theme_icon(SNAME("Warning"), SNAME("EditorIcons"))); } } last_error_count = error_count; @@ -359,7 +359,7 @@ void EditorDebuggerNode::_debugger_wants_stop(int p_id) { // Ask editor to kill PID. int pid = get_debugger(p_id)->get_remote_pid(); if (pid) { - EditorNode::get_singleton()->call_deferred("stop_child_process", pid); + EditorNode::get_singleton()->call_deferred(SNAME("stop_child_process"), pid); } } @@ -475,7 +475,7 @@ void EditorDebuggerNode::_breaked(bool p_breaked, bool p_can_debug, int p_debugg } _break_state_changed(); EditorNode::get_singleton()->get_pause_button()->set_pressed(p_breaked); - emit_signal("breaked", p_breaked, p_can_debug); + emit_signal(SNAME("breaked"), p_breaked, p_can_debug); } bool EditorDebuggerNode::is_skip_breakpoints() const { diff --git a/editor/debugger/editor_debugger_node.h b/editor/debugger/editor_debugger_node.h index 3510ac0726..9a40383c17 100644 --- a/editor/debugger/editor_debugger_node.h +++ b/editor/debugger/editor_debugger_node.h @@ -123,7 +123,7 @@ protected: void _save_node_requested(ObjectID p_id, const String &p_file, int p_debugger); void _clear_execution(REF p_script) { - emit_signal("clear_execution", p_script); + emit_signal(SNAME("clear_execution"), p_script); } void _text_editor_stack_goto(const ScriptEditorDebugger *p_debugger); diff --git a/editor/debugger/editor_debugger_tree.cpp b/editor/debugger/editor_debugger_tree.cpp index ec92edc795..1feab98948 100644 --- a/editor/debugger/editor_debugger_tree.cpp +++ b/editor/debugger/editor_debugger_tree.cpp @@ -75,7 +75,7 @@ void EditorDebuggerTree::_scene_tree_selected() { inspected_object_id = uint64_t(item->get_metadata(0)); - emit_signal("object_selected", inspected_object_id, debugger_id); + emit_signal(SNAME("object_selected"), inspected_object_id, debugger_id); } void EditorDebuggerTree::_scene_tree_folded(Object *p_obj) { @@ -105,8 +105,8 @@ void EditorDebuggerTree::_scene_tree_rmb_selected(const Vector2 &p_position) { item->select(0); item_menu->clear(); - 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->add_icon_item(get_theme_icon(SNAME("CreateNewSceneFrom"), SNAME("EditorIcons")), TTR("Save Branch as Scene"), ITEM_MENU_SAVE_REMOTE_NODE); + item_menu->add_icon_item(get_theme_icon(SNAME("CopyNodePath"), SNAME("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(); } @@ -211,7 +211,7 @@ void EditorDebuggerTree::update_scene_tree(const SceneDebuggerTree *p_tree, int } debugger_id = p_debugger; // Needed by hook, could be avoided if every debugger had its own tree if (scroll_item) { - call_deferred("scroll_to_item", scroll_item); + call_deferred(SNAME("scroll_to_item"), scroll_item); } last_filter = filter; updating_scene_tree = false; @@ -279,5 +279,5 @@ void EditorDebuggerTree::_file_selected(const String &p_file) { if (inspected_object_id.is_null()) { return; } - emit_signal("save_node", inspected_object_id, p_file, debugger_id); + emit_signal(SNAME("save_node"), inspected_object_id, p_file, debugger_id); } diff --git a/editor/debugger/editor_network_profiler.cpp b/editor/debugger/editor_network_profiler.cpp index 1c781c4d98..9479fbd5d4 100644 --- a/editor/debugger/editor_network_profiler.cpp +++ b/editor/debugger/editor_network_profiler.cpp @@ -40,14 +40,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_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")); + activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons"))); + clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons"))); + incoming_bandwidth_text->set_right_icon(get_theme_icon(SNAME("ArrowDown"), SNAME("EditorIcons"))); + outgoing_bandwidth_text->set_right_icon(get_theme_icon(SNAME("ArrowUp"), SNAME("EditorIcons"))); // This needs to be done here to set the faded color when the profiler is first opened - incoming_bandwidth_text->add_theme_color_override("font_uneditable_color", get_theme_color("font_color", "Editor") * Color(1, 1, 1, 0.5)); - outgoing_bandwidth_text->add_theme_color_override("font_uneditable_color", get_theme_color("font_color", "Editor") * Color(1, 1, 1, 0.5)); + incoming_bandwidth_text->add_theme_color_override("font_uneditable_color", get_theme_color(SNAME("font_color"), SNAME("Editor")) * Color(1, 1, 1, 0.5)); + outgoing_bandwidth_text->add_theme_color_override("font_uneditable_color", get_theme_color(SNAME("font_color"), SNAME("Editor")) * Color(1, 1, 1, 0.5)); } } @@ -73,13 +73,13 @@ void EditorNetworkProfiler::_update_frame() { void EditorNetworkProfiler::_activate_pressed() { if (activate->is_pressed()) { - activate->set_icon(get_theme_icon("Stop", "EditorIcons")); + activate->set_icon(get_theme_icon(SNAME("Stop"), SNAME("EditorIcons"))); activate->set_text(TTR("Stop")); } else { - activate->set_icon(get_theme_icon("Play", "EditorIcons")); + activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons"))); activate->set_text(TTR("Start")); } - emit_signal("enable_profiling", activate->is_pressed()); + emit_signal(SNAME("enable_profiling"), activate->is_pressed()); } void EditorNetworkProfiler::_clear_pressed() { @@ -114,10 +114,10 @@ void EditorNetworkProfiler::set_bandwidth(int p_incoming, int p_outgoing) { // Make labels more prominent when the bandwidth is greater than 0 to attract user attention incoming_bandwidth_text->add_theme_color_override( "font_uneditable_color", - get_theme_color("font_color", "Editor") * Color(1, 1, 1, p_incoming > 0 ? 1 : 0.5)); + get_theme_color(SNAME("font_color"), SNAME("Editor")) * Color(1, 1, 1, p_incoming > 0 ? 1 : 0.5)); outgoing_bandwidth_text->add_theme_color_override( "font_uneditable_color", - get_theme_color("font_color", "Editor") * Color(1, 1, 1, p_outgoing > 0 ? 1 : 0.5)); + get_theme_color(SNAME("font_color"), SNAME("Editor")) * Color(1, 1, 1, p_outgoing > 0 ? 1 : 0.5)); } bool EditorNetworkProfiler::is_profiling() { diff --git a/editor/debugger/editor_performance_profiler.cpp b/editor/debugger/editor_performance_profiler.cpp index 08609080c5..08ed675d16 100644 --- a/editor/debugger/editor_performance_profiler.cpp +++ b/editor/debugger/editor_performance_profiler.cpp @@ -109,9 +109,9 @@ void EditorPerformanceProfiler::_monitor_draw() { info_message->hide(); - Ref<StyleBox> graph_style_box = get_theme_stylebox("normal", "TextEdit"); - Ref<Font> graph_font = get_theme_font("font", "TextEdit"); - int font_size = get_theme_font_size("font_size", "TextEdit"); + Ref<StyleBox> graph_style_box = get_theme_stylebox(SNAME("normal"), SNAME("TextEdit")); + Ref<Font> graph_font = get_theme_font(SNAME("font"), SNAME("TextEdit")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("TextEdit")); int columns = int(Math::ceil(Math::sqrt(float(active.size())))); int rows = int(Math::ceil(float(active.size()) / float(columns))); @@ -130,7 +130,7 @@ void EditorPerformanceProfiler::_monitor_draw() { rect.position += graph_style_box->get_offset(); rect.size -= graph_style_box->get_minimum_size(); - Color draw_color = get_theme_color("accent_color", "Editor"); + Color draw_color = get_theme_color(SNAME("accent_color"), SNAME("Editor")); draw_color.set_hsv(Math::fmod(hue_shift * float(current.frame_index), 0.9f), draw_color.get_s() * 0.9f, draw_color.get_v() * value_multiplier, 0.6f); monitor_draw->draw_string(graph_font, rect.position + Point2(0, graph_font->get_ascent(font_size)), current.item->get_text(0), HALIGN_LEFT, rect.size.x, font_size, draw_color); @@ -271,7 +271,7 @@ void EditorPerformanceProfiler::_marker_input(const Ref<InputEvent> &p_event) { } else { marker_key = ""; } - Ref<StyleBox> graph_style_box = get_theme_stylebox("normal", "TextEdit"); + Ref<StyleBox> graph_style_box = get_theme_stylebox(SNAME("normal"), SNAME("TextEdit")); rect.position += graph_style_box->get_offset(); rect.size -= graph_style_box->get_minimum_size(); Vector2 point = mb->get_position() - rect.position; diff --git a/editor/debugger/editor_profiler.cpp b/editor/debugger/editor_profiler.cpp index 5f4d1b6f36..585552e1fc 100644 --- a/editor/debugger/editor_profiler.cpp +++ b/editor/debugger/editor_profiler.cpp @@ -135,11 +135,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_theme_color("error_color", "Editor"); + Color bc = get_theme_color(SNAME("error_color"), SNAME("Editor")); double rot = ABS(double(p_signature.hash()) / double(0x7FFFFFFF)); Color c; c.set_hsv(rot, bc.get_s(), bc.get_v()); - return c.lerp(get_theme_color("base_color", "Editor"), 0.07); + return c.lerp(get_theme_color(SNAME("base_color"), SNAME("Editor")), 0.07); } void EditorProfiler::_item_edited() { @@ -180,7 +180,7 @@ void EditorProfiler::_update_plot() { } uint8_t *wr = graph_image.ptrw(); - const Color background_color = get_theme_color("dark_color_2", "Editor"); + const Color background_color = get_theme_color(SNAME("dark_color_2"), SNAME("Editor")); // Clear the previous frame and set the background color. for (int i = 0; i < desired_len; i += 4) { @@ -376,14 +376,14 @@ void EditorProfiler::_update_frame() { void EditorProfiler::_activate_pressed() { if (activate->is_pressed()) { - activate->set_icon(get_theme_icon("Stop", "EditorIcons")); + activate->set_icon(get_theme_icon(SNAME("Stop"), SNAME("EditorIcons"))); activate->set_text(TTR("Stop")); _clear_pressed(); } else { - activate->set_icon(get_theme_icon("Play", "EditorIcons")); + activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons"))); activate->set_text(TTR("Start")); } - emit_signal("enable_profiling", activate->is_pressed()); + emit_signal(SNAME("enable_profiling"), activate->is_pressed()); } void EditorProfiler::_clear_pressed() { @@ -394,8 +394,8 @@ void EditorProfiler::_clear_pressed() { void EditorProfiler::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_LAYOUT_DIRECTION_CHANGED || p_what == NOTIFICATION_TRANSLATION_CHANGED) { - activate->set_icon(get_theme_icon("Play", "EditorIcons")); - clear_button->set_icon(get_theme_icon("Clear", "EditorIcons")); + activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons"))); + clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons"))); } } @@ -462,7 +462,7 @@ void EditorProfiler::_graph_tex_input(const Ref<InputEvent> &p_ev) { if (activate->is_pressed()) { if (!seeking) { - emit_signal("break_request"); + emit_signal(SNAME("break_request")); } } diff --git a/editor/debugger/editor_visual_profiler.cpp b/editor/debugger/editor_visual_profiler.cpp index a0e8a3bd35..a61e9bd73e 100644 --- a/editor/debugger/editor_visual_profiler.cpp +++ b/editor/debugger/editor_visual_profiler.cpp @@ -123,11 +123,11 @@ String EditorVisualProfiler::_get_time_as_text(float p_time) { } Color EditorVisualProfiler::_get_color_from_signature(const StringName &p_signature) const { - Color bc = get_theme_color("error_color", "Editor"); + Color bc = get_theme_color(SNAME("error_color"), SNAME("Editor")); double rot = ABS(double(p_signature.hash()) / double(0x7FFFFFFF)); Color c; c.set_hsv(rot, bc.get_s(), bc.get_v()); - return c.lerp(get_theme_color("base_color", "Editor"), 0.07); + return c.lerp(get_theme_color(SNAME("base_color"), SNAME("Editor")), 0.07); } void EditorVisualProfiler::_item_selected() { @@ -318,7 +318,7 @@ void EditorVisualProfiler::_update_plot() { void EditorVisualProfiler::_update_frame(bool p_focus_selected) { int cursor_metric = _get_cursor_index(); - Ref<Texture> track_icon = get_theme_icon("TrackColor", "EditorIcons"); + Ref<Texture> track_icon = get_theme_icon(SNAME("TrackColor"), SNAME("EditorIcons")); ERR_FAIL_INDEX(cursor_metric, frame_metrics.size()); @@ -407,14 +407,14 @@ void EditorVisualProfiler::_update_frame(bool p_focus_selected) { void EditorVisualProfiler::_activate_pressed() { if (activate->is_pressed()) { - activate->set_icon(get_theme_icon("Stop", "EditorIcons")); + activate->set_icon(get_theme_icon(SNAME("Stop"), SNAME("EditorIcons"))); activate->set_text(TTR("Stop")); _clear_pressed(); //always clear on start } else { - activate->set_icon(get_theme_icon("Play", "EditorIcons")); + activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons"))); activate->set_text(TTR("Start")); } - emit_signal("enable_profiling", activate->is_pressed()); + emit_signal(SNAME("enable_profiling"), activate->is_pressed()); } void EditorVisualProfiler::_clear_pressed() { @@ -425,11 +425,11 @@ void EditorVisualProfiler::_clear_pressed() { void EditorVisualProfiler::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_LAYOUT_DIRECTION_CHANGED || p_what == NOTIFICATION_TRANSLATION_CHANGED) { if (is_layout_rtl()) { - activate->set_icon(get_theme_icon("PlayBackwards", "EditorIcons")); + activate->set_icon(get_theme_icon(SNAME("PlayBackwards"), SNAME("EditorIcons"))); } else { - activate->set_icon(get_theme_icon("Play", "EditorIcons")); + activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons"))); } - clear_button->set_icon(get_theme_icon("Clear", "EditorIcons")); + clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons"))); } } @@ -437,8 +437,8 @@ void EditorVisualProfiler::_graph_tex_draw() { if (last_metric < 0) { return; } - Ref<Font> font = get_theme_font("font", "Label"); - int font_size = get_theme_font_size("font_size", "Label"); + Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label")); + int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label")); if (seeking) { int max_frames = frame_metrics.size(); int frame = cursor_metric_edit->get_value() - (frame_metrics[last_metric].frame_number - max_frames + 1); diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index 09bbf846fe..e704609639 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -87,9 +87,9 @@ void ScriptEditorDebugger::debug_copy() { void ScriptEditorDebugger::debug_skip_breakpoints() { skip_breakpoints_value = !skip_breakpoints_value; if (skip_breakpoints_value) { - skip_breakpoints->set_icon(get_theme_icon("DebugSkipBreakpointsOn", "EditorIcons")); + skip_breakpoints->set_icon(get_theme_icon(SNAME("DebugSkipBreakpointsOn"), SNAME("EditorIcons"))); } else { - skip_breakpoints->set_icon(get_theme_icon("DebugSkipBreakpointsOff", "EditorIcons")); + skip_breakpoints->set_icon(get_theme_icon(SNAME("DebugSkipBreakpointsOff"), SNAME("EditorIcons"))); } Array msg; @@ -136,11 +136,11 @@ void ScriptEditorDebugger::update_tabs() { } else { errors_tab->set_name(TTR("Errors") + " (" + itos(error_count + warning_count) + ")"); if (error_count >= 1 && warning_count >= 1) { - tabs->set_tab_icon(errors_tab->get_index(), get_theme_icon("ErrorWarning", "EditorIcons")); + tabs->set_tab_icon(errors_tab->get_index(), get_theme_icon(SNAME("ErrorWarning"), SNAME("EditorIcons"))); } else if (error_count >= 1) { - tabs->set_tab_icon(errors_tab->get_index(), get_theme_icon("Error", "EditorIcons")); + tabs->set_tab_icon(errors_tab->get_index(), get_theme_icon(SNAME("Error"), SNAME("EditorIcons"))); } else { - tabs->set_tab_icon(errors_tab->get_index(), get_theme_icon("Warning", "EditorIcons")); + tabs->set_tab_icon(errors_tab->get_index(), get_theme_icon(SNAME("Warning"), SNAME("EditorIcons"))); } } } @@ -264,7 +264,7 @@ Object *ScriptEditorDebugger::get_remote_object(ObjectID p_id) { } void ScriptEditorDebugger::_remote_object_selected(ObjectID p_id) { - emit_signal("remote_object_requested", p_id); + emit_signal(SNAME("remote_object_requested"), p_id); } void ScriptEditorDebugger::_remote_object_edited(ObjectID p_id, const String &p_prop, const Variant &p_value) { @@ -273,7 +273,7 @@ void ScriptEditorDebugger::_remote_object_edited(ObjectID p_id, const String &p_ } void ScriptEditorDebugger::_remote_object_property_updated(ObjectID p_id, const String &p_property) { - emit_signal("remote_object_property_updated", p_id, p_property); + emit_signal(SNAME("remote_object_property_updated"), p_id, p_property); } void ScriptEditorDebugger::_video_mem_request() { @@ -305,7 +305,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da can_debug = can_continue; _update_buttons_state(); _set_reason_text(error, MESSAGE_ERROR); - emit_signal("breaked", true, can_continue); + emit_signal(SNAME("breaked"), true, can_continue); DisplayServer::get_singleton()->window_move_to_foreground(); if (error != "") { tabs->set_current_tab(0); @@ -319,7 +319,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da _clear_execution(); _update_buttons_state(); _set_reason_text(TTR("Execution resumed."), MESSAGE_SUCCESS); - emit_signal("breaked", false, false); + emit_signal(SNAME("breaked"), false, false); profiler->set_enabled(true); profiler->disable_seeking(); } else if (p_msg == "set_pid") { @@ -332,12 +332,12 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da } else if (p_msg == "scene:scene_tree") { scene_tree->nodes.clear(); scene_tree->deserialize(p_data); - emit_signal("remote_tree_updated"); + emit_signal(SNAME("remote_tree_updated")); _update_buttons_state(); } else if (p_msg == "scene:inspect_object") { ObjectID id = inspector->add_object(p_data); if (id.is_valid()) { - emit_signal("remote_object_updated", id); + emit_signal(SNAME("remote_object_updated"), id); } } else if (p_msg == "memory:usage") { vmem_tree->clear(); @@ -357,8 +357,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_theme_icon(type, "EditorIcons")) { - it->set_icon(0, get_theme_icon(type, "EditorIcons")); + if (has_theme_icon(type, SNAME("EditorIcons"))) { + it->set_icon(0, get_theme_icon(type, SNAME("EditorIcons"))); } } @@ -698,7 +698,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da network_profiler->set_bandwidth(p_data[0], p_data[1]); } else if (p_msg == "request_quit") { - emit_signal("stop_requested"); + emit_signal(SNAME("stop_requested")); _stop_and_notify(); } else if (p_msg == "performance:profile_names") { @@ -739,13 +739,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_theme_color_override("font_color", get_theme_color("error_color", "Editor")); + reason->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor"))); break; case MESSAGE_WARNING: - reason->add_theme_color_override("font_color", get_theme_color("warning_color", "Editor")); + reason->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), SNAME("Editor"))); break; default: - reason->add_theme_color_override("font_color", get_theme_color("success_color", "Editor")); + reason->add_theme_color_override("font_color", get_theme_color(SNAME("success_color"), SNAME("Editor"))); } reason->set_text(p_reason); reason->set_tooltip(p_reason.word_wrap(80)); @@ -754,21 +754,21 @@ void ScriptEditorDebugger::_set_reason_text(const String &p_reason, MessageType void ScriptEditorDebugger::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { - skip_breakpoints->set_icon(get_theme_icon("DebugSkipBreakpointsOff", "EditorIcons")); - copy->set_icon(get_theme_icon("ActionCopy", "EditorIcons")); + skip_breakpoints->set_icon(get_theme_icon(SNAME("DebugSkipBreakpointsOff"), SNAME("EditorIcons"))); + copy->set_icon(get_theme_icon(SNAME("ActionCopy"), SNAME("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")); + step->set_icon(get_theme_icon(SNAME("DebugStep"), SNAME("EditorIcons"))); + next->set_icon(get_theme_icon(SNAME("DebugNext"), SNAME("EditorIcons"))); + dobreak->set_icon(get_theme_icon(SNAME("Pause"), SNAME("EditorIcons"))); + docontinue->set_icon(get_theme_icon(SNAME("DebugContinue"), SNAME("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_theme_icon("Reload", "EditorIcons")); - vmem_export->set_icon(get_theme_icon("Save", "EditorIcons")); + vmem_refresh->set_icon(get_theme_icon(SNAME("Reload"), SNAME("EditorIcons"))); + vmem_export->set_icon(get_theme_icon(SNAME("Save"), SNAME("EditorIcons"))); - reason->add_theme_color_override("font_color", get_theme_color("error_color", "Editor")); + reason->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor"))); } break; case NOTIFICATION_PROCESS: { @@ -831,16 +831,16 @@ void ScriptEditorDebugger::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { if (tabs->has_theme_stylebox_override("panel")) { - tabs->add_theme_style_override("panel", editor->get_gui_base()->get_theme_stylebox("DebuggerPanel", "EditorStyles")); + tabs->add_theme_style_override("panel", editor->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("EditorStyles"))); } - 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")); - vmem_export->set_icon(get_theme_icon("Save", "EditorIcons")); + copy->set_icon(get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons"))); + step->set_icon(get_theme_icon(SNAME("DebugStep"), SNAME("EditorIcons"))); + next->set_icon(get_theme_icon(SNAME("DebugNext"), SNAME("EditorIcons"))); + dobreak->set_icon(get_theme_icon(SNAME("Pause"), SNAME("EditorIcons"))); + docontinue->set_icon(get_theme_icon(SNAME("DebugContinue"), SNAME("EditorIcons"))); + vmem_refresh->set_icon(get_theme_icon(SNAME("Reload"), SNAME("EditorIcons"))); + vmem_export->set_icon(get_theme_icon(SNAME("Save"), SNAME("EditorIcons"))); } break; } } @@ -854,7 +854,7 @@ void ScriptEditorDebugger::_clear_execution() { Dictionary d = ti->get_metadata(0); stack_script = ResourceLoader::load(d["file"]); - emit_signal("clear_execution", stack_script); + emit_signal(SNAME("clear_execution"), stack_script); stack_script.unref(); stack_dump->clear(); inspector->clear_stack_variables(); @@ -878,7 +878,7 @@ void ScriptEditorDebugger::start(Ref<RemoteDebuggerPeer> p_peer) { tabs->set_current_tab(0); _set_reason_text(TTR("Debug session started."), MESSAGE_SUCCESS); _update_buttons_state(); - emit_signal("started"); + emit_signal(SNAME("started")); } void ScriptEditorDebugger::_update_buttons_state() { @@ -896,7 +896,7 @@ void ScriptEditorDebugger::_update_buttons_state() { void ScriptEditorDebugger::_stop_and_notify() { stop(); - emit_signal("stopped"); + emit_signal(SNAME("stopped")); _set_reason_text(TTR("Debug session closed."), MESSAGE_WARNING); } @@ -959,7 +959,7 @@ void ScriptEditorDebugger::_profiler_seeked() { } void ScriptEditorDebugger::_stack_dump_frame_selected() { - emit_signal("stack_frame_selected"); + emit_signal(SNAME("stack_frame_selected")); int frame = get_stack_script_frame(); @@ -1332,7 +1332,7 @@ void ScriptEditorDebugger::_error_selected() { return; } - emit_signal("error_selected", String(meta[0]), int(meta[1])); + emit_signal(SNAME("error_selected"), String(meta[0]), int(meta[1])); } void ScriptEditorDebugger::_expand_errors_list() { @@ -1373,8 +1373,8 @@ 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_theme_icon("ActionCopy", "EditorIcons"), TTR("Copy Error"), ACTION_COPY_ERROR); - item_menu->add_icon_item(get_theme_icon("Instance", "EditorIcons"), TTR("Open C++ Source on GitHub"), ACTION_OPEN_SOURCE); + item_menu->add_icon_item(get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons")), TTR("Copy Error"), ACTION_COPY_ERROR); + item_menu->add_icon_item(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")), TTR("Open C++ Source on GitHub"), ACTION_OPEN_SOURCE); } if (item_menu->get_item_count() > 0) { @@ -1393,9 +1393,9 @@ void ScriptEditorDebugger::_item_menu_id_pressed(int p_option) { String type; - if (ti->get_icon(0) == get_theme_icon("Warning", "EditorIcons")) { + if (ti->get_icon(0) == get_theme_icon(SNAME("Warning"), SNAME("EditorIcons"))) { type = "W "; - } else if (ti->get_icon(0) == get_theme_icon("Error", "EditorIcons")) { + } else if (ti->get_icon(0) == get_theme_icon(SNAME("Error"), SNAME("EditorIcons"))) { type = "E "; } @@ -1518,7 +1518,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { tabs = memnew(TabContainer); tabs->set_tab_align(TabContainer::ALIGN_LEFT); - tabs->add_theme_style_override("panel", editor->get_gui_base()->get_theme_stylebox("DebuggerPanel", "EditorStyles")); + tabs->add_theme_style_override("panel", editor->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("EditorStyles"))); tabs->connect("tab_changed", callable_mp(this, &ScriptEditorDebugger::_tab_changed)); add_child(tabs); |