mirror of
https://github.com/tiennm99/godot.git
synced 2026-08-13 02:22:43 +00:00
Revert "Add missing SNAME macro optimization to all theme methods call"
This reverts commit a988fad9a0.
As discussed in #57725 and clarified in #57788, `SNAME` is not meant to be used
everywhere but only in critical code paths. For theme methods specifically, it
was by design that only getters use `SNAME` and not setters.
This commit is contained in:
@@ -55,8 +55,8 @@ EditorDebuggerNode::EditorDebuggerNode() {
|
||||
singleton = this;
|
||||
}
|
||||
|
||||
add_theme_constant_override(SNAME("margin_left"), -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("BottomPanelDebuggerOverride"), SNAME("EditorStyles"))->get_margin(SIDE_LEFT));
|
||||
add_theme_constant_override(SNAME("margin_right"), -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("BottomPanelDebuggerOverride"), SNAME("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_alignment(TabContainer::ALIGNMENT_LEFT);
|
||||
@@ -66,7 +66,7 @@ EditorDebuggerNode::EditorDebuggerNode() {
|
||||
|
||||
Ref<StyleBoxEmpty> empty;
|
||||
empty.instantiate();
|
||||
tabs->add_theme_style_override(SNAME("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();
|
||||
@@ -113,7 +113,7 @@ ScriptEditorDebugger *EditorDebuggerNode::_add_debugger() {
|
||||
if (tabs->get_tab_count() > 1) {
|
||||
node->clear_style();
|
||||
tabs->set_tabs_visible(true);
|
||||
tabs->add_theme_style_override(SNAME("panel"), EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("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()) {
|
||||
@@ -233,10 +233,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(SNAME("margin_left"), -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("BottomPanelDebuggerOverride"), SNAME("EditorStyles"))->get_margin(SIDE_LEFT));
|
||||
add_theme_constant_override(SNAME("margin_right"), -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("BottomPanelDebuggerOverride"), SNAME("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(SNAME("panel"), EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("EditorStyles")));
|
||||
tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("EditorStyles")));
|
||||
}
|
||||
} break;
|
||||
case NOTIFICATION_READY: {
|
||||
@@ -271,20 +271,20 @@ void EditorDebuggerNode::_notification(int p_what) {
|
||||
|
||||
if (error_count == 0 && warning_count == 0) {
|
||||
debugger_button->set_text(TTR("Debugger"));
|
||||
debugger_button->remove_theme_color_override(SNAME("font_color"));
|
||||
debugger_button->remove_theme_color_override("font_color");
|
||||
debugger_button->set_icon(Ref<Texture2D>());
|
||||
} 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(SNAME("ErrorWarning"), SNAME("EditorIcons")));
|
||||
// Use error color to represent the highest level of severity reported.
|
||||
debugger_button->add_theme_color_override(SNAME("font_color"), get_theme_color(SNAME("error_color"), SNAME("Editor")));
|
||||
debugger_button->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor")));
|
||||
} else if (error_count >= 1) {
|
||||
debugger_button->set_icon(get_theme_icon(SNAME("Error"), SNAME("EditorIcons")));
|
||||
debugger_button->add_theme_color_override(SNAME("font_color"), get_theme_color(SNAME("error_color"), SNAME("Editor")));
|
||||
debugger_button->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor")));
|
||||
} else {
|
||||
debugger_button->set_icon(get_theme_icon(SNAME("Warning"), SNAME("EditorIcons")));
|
||||
debugger_button->add_theme_color_override(SNAME("font_color"), get_theme_color(SNAME("warning_color"), SNAME("Editor")));
|
||||
debugger_button->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), SNAME("Editor")));
|
||||
}
|
||||
}
|
||||
last_error_count = error_count;
|
||||
|
||||
@@ -46,8 +46,8 @@ void EditorNetworkProfiler::_notification(int p_what) {
|
||||
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(SNAME("font_uneditable_color"), get_theme_color(SNAME("font_color"), SNAME("Editor")) * Color(1, 1, 1, 0.5));
|
||||
outgoing_bandwidth_text->add_theme_color_override(SNAME("font_uneditable_color"), get_theme_color(SNAME("font_color"), SNAME("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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ bool EditorNetworkProfiler::is_profiling() {
|
||||
|
||||
EditorNetworkProfiler::EditorNetworkProfiler() {
|
||||
HBoxContainer *hb = memnew(HBoxContainer);
|
||||
hb->add_theme_constant_override(SNAME("separation"), 8 * EDSCALE);
|
||||
hb->add_theme_constant_override("separation", 8 * EDSCALE);
|
||||
add_child(hb);
|
||||
|
||||
activate = memnew(Button);
|
||||
|
||||
@@ -618,7 +618,7 @@ EditorProfiler::EditorProfiler() {
|
||||
hb->add_child(cursor_metric_edit);
|
||||
cursor_metric_edit->connect("value_changed", callable_mp(this, &EditorProfiler::_cursor_metric_changed));
|
||||
|
||||
hb->add_theme_constant_override(SNAME("separation"), 8 * EDSCALE);
|
||||
hb->add_theme_constant_override("separation", 8 * EDSCALE);
|
||||
|
||||
h_split = memnew(HSplitContainer);
|
||||
add_child(h_split);
|
||||
|
||||
@@ -758,7 +758,7 @@ EditorVisualProfiler::EditorVisualProfiler() {
|
||||
hb->add_child(cursor_metric_edit);
|
||||
cursor_metric_edit->connect("value_changed", callable_mp(this, &EditorVisualProfiler::_cursor_metric_changed));
|
||||
|
||||
hb->add_theme_constant_override(SNAME("separation"), 8 * EDSCALE);
|
||||
hb->add_theme_constant_override("separation", 8 * EDSCALE);
|
||||
|
||||
h_split = memnew(HSplitContainer);
|
||||
add_child(h_split);
|
||||
|
||||
@@ -147,7 +147,7 @@ void ScriptEditorDebugger::update_tabs() {
|
||||
}
|
||||
|
||||
void ScriptEditorDebugger::clear_style() {
|
||||
tabs->remove_theme_style_override(SNAME("panel"));
|
||||
tabs->remove_theme_style_override("panel");
|
||||
}
|
||||
|
||||
void ScriptEditorDebugger::save_node(ObjectID p_id, const String &p_file) {
|
||||
@@ -762,13 +762,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(SNAME("font_color"), get_theme_color(SNAME("error_color"), SNAME("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(SNAME("font_color"), get_theme_color(SNAME("warning_color"), SNAME("Editor")));
|
||||
reason->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), SNAME("Editor")));
|
||||
break;
|
||||
default:
|
||||
reason->add_theme_color_override(SNAME("font_color"), get_theme_color(SNAME("success_color"), SNAME("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));
|
||||
@@ -793,7 +793,7 @@ void ScriptEditorDebugger::_notification(int p_what) {
|
||||
vmem_export->set_icon(get_theme_icon(SNAME("Save"), SNAME("EditorIcons")));
|
||||
search->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
|
||||
|
||||
reason->add_theme_color_override(SNAME("font_color"), get_theme_color(SNAME("error_color"), SNAME("Editor")));
|
||||
reason->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor")));
|
||||
|
||||
} break;
|
||||
case NOTIFICATION_PROCESS: {
|
||||
@@ -855,8 +855,8 @@ void ScriptEditorDebugger::_notification(int p_what) {
|
||||
};
|
||||
} break;
|
||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||
if (tabs->has_theme_stylebox_override(SNAME("panel"))) {
|
||||
tabs->add_theme_style_override(SNAME("panel"), editor->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("EditorStyles")));
|
||||
if (tabs->has_theme_stylebox_override("panel")) {
|
||||
tabs->add_theme_style_override("panel", editor->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("EditorStyles")));
|
||||
}
|
||||
|
||||
copy->set_icon(get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons")));
|
||||
@@ -1665,7 +1665,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
|
||||
|
||||
tabs = memnew(TabContainer);
|
||||
tabs->set_tab_alignment(TabContainer::ALIGNMENT_LEFT);
|
||||
tabs->add_theme_style_override(SNAME("panel"), editor->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("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);
|
||||
|
||||
Reference in New Issue
Block a user