Skip to content

Commit

Permalink
Merge pull request #57725 from jmb462/missing-sname-theme-setters
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga authored Feb 7, 2022
2 parents 6f42524 + a988fad commit b024602
Show file tree
Hide file tree
Showing 90 changed files with 1,706 additions and 1,706 deletions.
8 changes: 4 additions & 4 deletions editor/animation_track_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4368,7 +4368,7 @@ void AnimationTrackEditor::_update_tracks() {
g->set_timeline(timeline);
groups.push_back(g);
VBoxContainer *vb = memnew(VBoxContainer);
vb->add_theme_constant_override("separation", 0);
vb->add_theme_constant_override(SNAME("separation"), 0);
vb->add_child(g);
track_vbox->add_child(vb);
group_sort[base_path] = vb;
Expand Down Expand Up @@ -4519,7 +4519,7 @@ void AnimationTrackEditor::_notification(int p_what) {
view_group->set_icon(get_theme_icon(view_group->is_pressed() ? SNAME("AnimationTrackList") : SNAME("AnimationTrackGroup"), SNAME("EditorIcons")));
selected_filter->set_icon(get_theme_icon(SNAME("AnimationFilter"), SNAME("EditorIcons")));
imported_anim_warning->set_icon(get_theme_icon(SNAME("NodeWarning"), SNAME("EditorIcons")));
main_panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("bg"), SNAME("Tree")));
main_panel->add_theme_style_override(SNAME("panel"), get_theme_stylebox(SNAME("bg"), SNAME("Tree")));
edit->get_popup()->set_item_icon(edit->get_popup()->get_item_index(EDIT_APPLY_RESET), get_theme_icon(SNAME("Reload"), SNAME("EditorIcons")));
}

Expand Down Expand Up @@ -6085,7 +6085,7 @@ AnimationTrackEditor::AnimationTrackEditor() {
timeline_scroll->add_child(timeline_vbox);
timeline_vbox->set_v_size_flags(SIZE_EXPAND_FILL);
timeline_vbox->set_h_size_flags(SIZE_EXPAND_FILL);
timeline_vbox->add_theme_constant_override("separation", 0);
timeline_vbox->add_theme_constant_override(SNAME("separation"), 0);

info_message = memnew(Label);
info_message->set_text(TTR("Select an AnimationPlayer node to create and edit animations."));
Expand Down Expand Up @@ -6140,7 +6140,7 @@ AnimationTrackEditor::AnimationTrackEditor() {
scroll->add_child(track_vbox);
track_vbox->set_h_size_flags(SIZE_EXPAND_FILL);
scroll->set_horizontal_scroll_mode(ScrollContainer::SCROLL_MODE_DISABLED);
track_vbox->add_theme_constant_override("separation", 0);
track_vbox->add_theme_constant_override(SNAME("separation"), 0);

HBoxContainer *bottom_hb = memnew(HBoxContainer);
add_child(bottom_hb);
Expand Down
36 changes: 18 additions & 18 deletions editor/code_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void FindReplaceBar::_notification(int p_what) {
hide_button->set_pressed_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons")));
hide_button->set_custom_minimum_size(hide_button->get_normal_texture()->get_size());
} else if (p_what == NOTIFICATION_THEME_CHANGED) {
matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color(SNAME("font_color"), SNAME("Label")) : get_theme_color(SNAME("error_color"), SNAME("Editor")));
matches_label->add_theme_color_override(SNAME("font_color"), results_count > 0 ? get_theme_color(SNAME("font_color"), SNAME("Label")) : get_theme_color(SNAME("error_color"), SNAME("Editor")));
} else if (p_what == NOTIFICATION_PREDELETE) {
if (base_text_editor) {
base_text_editor->remove_find_replace_bar();
Expand Down Expand Up @@ -301,7 +301,7 @@ void FindReplaceBar::_replace_all() {
}

text_editor->set_v_scroll(vsval);
matches_label->add_theme_color_override("font_color", rc > 0 ? get_theme_color(SNAME("font_color"), SNAME("Label")) : get_theme_color(SNAME("error_color"), SNAME("Editor")));
matches_label->add_theme_color_override(SNAME("font_color"), rc > 0 ? get_theme_color(SNAME("font_color"), SNAME("Label")) : get_theme_color(SNAME("error_color"), SNAME("Editor")));
matches_label->set_text(vformat(TTR("%d replaced."), rc));

text_editor->call_deferred(SNAME("connect"), "text_changed", callable_mp(this, &FindReplaceBar::_editor_text_changed));
Expand Down Expand Up @@ -365,7 +365,7 @@ void FindReplaceBar::_update_matches_label() {
} else {
matches_label->show();

matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color(SNAME("font_color"), SNAME("Label")) : get_theme_color(SNAME("error_color"), SNAME("Editor")));
matches_label->add_theme_color_override(SNAME("font_color"), results_count > 0 ? get_theme_color(SNAME("font_color"), SNAME("Label")) : get_theme_color(SNAME("error_color"), SNAME("Editor")));
matches_label->set_text(vformat(results_count == 1 ? TTR("%d match.") : TTR("%d matches."), results_count));
}
}
Expand Down Expand Up @@ -818,7 +818,7 @@ void CodeTextEditor::_zoom_changed() {

void CodeTextEditor::_reset_zoom() {
EditorSettings::get_singleton()->set("interface/editor/code_font_size", 14);
text_editor->add_theme_font_size_override("font_size", 14 * EDSCALE);
text_editor->add_theme_font_size_override(SNAME("font_size"), 14 * EDSCALE);
}

void CodeTextEditor::_line_col_changed() {
Expand Down Expand Up @@ -936,7 +936,7 @@ bool CodeTextEditor::_add_font_size(int p_delta) {

if (new_size != old_size) {
EditorSettings::get_singleton()->set("interface/editor/code_font_size", new_size / EDSCALE);
text_editor->add_theme_font_size_override("font_size", new_size);
text_editor->add_theme_font_size_override(SNAME("font_size"), new_size);
}

return true;
Expand Down Expand Up @@ -1567,14 +1567,14 @@ void CodeTextEditor::_update_text_editor_theme() {

Ref<Font> status_bar_font = get_theme_font(SNAME("status_source"), SNAME("EditorFonts"));
int status_bar_font_size = get_theme_font_size(SNAME("status_source_size"), SNAME("EditorFonts"));
error->add_theme_font_override("font", status_bar_font);
error->add_theme_font_size_override("font_size", status_bar_font_size);
error->add_theme_font_override(SNAME("font"), status_bar_font);
error->add_theme_font_size_override(SNAME("font_size"), status_bar_font_size);
int count = status_bar->get_child_count();
for (int i = 0; i < count; i++) {
Control *n = Object::cast_to<Control>(status_bar->get_child(i));
if (n) {
n->add_theme_font_override("font", status_bar_font);
n->add_theme_font_size_override("font_size", status_bar_font_size);
n->add_theme_font_override(SNAME("font"), status_bar_font);
n->add_theme_font_size_override(SNAME("font_size"), status_bar_font_size);
}
}
error->end_bulk_theme_override();
Expand Down Expand Up @@ -1666,17 +1666,17 @@ void CodeTextEditor::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
error_button->set_icon(get_theme_icon(SNAME("StatusError"), SNAME("EditorIcons")));
error_button->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor")));
error_button->add_theme_font_override("font", get_theme_font(SNAME("status_source"), SNAME("EditorFonts")));
error_button->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("status_source_size"), SNAME("EditorFonts")));
error_button->add_theme_color_override(SNAME("font_color"), get_theme_color(SNAME("error_color"), SNAME("Editor")));
error_button->add_theme_font_override(SNAME("font"), get_theme_font(SNAME("status_source"), SNAME("EditorFonts")));
error_button->add_theme_font_size_override(SNAME("font_size"), get_theme_font_size(SNAME("status_source_size"), SNAME("EditorFonts")));

warning_button->set_icon(get_theme_icon(SNAME("NodeWarning"), SNAME("EditorIcons")));
warning_button->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), SNAME("Editor")));
warning_button->add_theme_font_override("font", get_theme_font(SNAME("status_source"), SNAME("EditorFonts")));
warning_button->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("status_source_size"), SNAME("EditorFonts")));
warning_button->add_theme_color_override(SNAME("font_color"), get_theme_color(SNAME("warning_color"), SNAME("Editor")));
warning_button->add_theme_font_override(SNAME("font"), get_theme_font(SNAME("status_source"), SNAME("EditorFonts")));
warning_button->add_theme_font_size_override(SNAME("font_size"), get_theme_font_size(SNAME("status_source_size"), SNAME("EditorFonts")));

line_and_col_txt->add_theme_font_override("font", get_theme_font(SNAME("status_source"), SNAME("EditorFonts")));
line_and_col_txt->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("status_source_size"), SNAME("EditorFonts")));
line_and_col_txt->add_theme_font_override(SNAME("font"), get_theme_font(SNAME("status_source"), SNAME("EditorFonts")));
line_and_col_txt->add_theme_font_size_override(SNAME("font_size"), get_theme_font_size(SNAME("status_source_size"), SNAME("EditorFonts")));

if (p_what == NOTIFICATION_ENTER_TREE) {
break;
Expand Down Expand Up @@ -1935,5 +1935,5 @@ CodeTextEditor::CodeTextEditor() {
font_resize_timer->connect("timeout", callable_mp(this, &CodeTextEditor::_font_resize_timeout));

EditorSettings::get_singleton()->connect("settings_changed", callable_mp(this, &CodeTextEditor::_on_settings_change));
add_theme_constant_override("separation", 4 * EDSCALE);
add_theme_constant_override(SNAME("separation"), 4 * EDSCALE);
}
4 changes: 2 additions & 2 deletions editor/connections_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ void ConnectDialog::init(ConnectionData p_cd, bool p_edit) {

void ConnectDialog::popup_dialog(const String &p_for_signal) {
from_signal->set_text(p_for_signal);
error_label->add_theme_color_override("font_color", error_label->get_theme_color(SNAME("error_color"), SNAME("Editor")));
error_label->add_theme_color_override(SNAME("font_color"), error_label->get_theme_color(SNAME("error_color"), SNAME("Editor")));
if (!advanced->is_pressed()) {
error_label->set_visible(!_find_first_script(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root()));
}
Expand Down Expand Up @@ -1200,7 +1200,7 @@ ConnectionsDock::ConnectionsDock(EditorNode *p_editor) {
tree->connect("item_activated", callable_mp(this, &ConnectionsDock::_tree_item_activated));
tree->connect("item_rmb_selected", callable_mp(this, &ConnectionsDock::_rmb_pressed));

add_theme_constant_override("separation", 3 * EDSCALE);
add_theme_constant_override(SNAME("separation"), 3 * EDSCALE);

EDITOR_DEF("interface/editors/default_signal_callback_name", "_on_{node_name}_{signal_name}");
}
Expand Down
4 changes: 2 additions & 2 deletions editor/create_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ CreateDialog::CreateDialog() {
favorites->set_allow_reselect(true);
favorites->connect("cell_selected", callable_mp(this, &CreateDialog::_favorite_selected));
favorites->connect("item_activated", callable_mp(this, &CreateDialog::_favorite_activated));
favorites->add_theme_constant_override("draw_guides", 1);
favorites->add_theme_constant_override(SNAME("draw_guides"), 1);
#ifndef _MSC_VER
#warning cannot forward drag data to a non control, must be fixed
#endif
Expand All @@ -760,7 +760,7 @@ CreateDialog::CreateDialog() {
recent->set_allow_reselect(true);
recent->connect("item_selected", callable_mp(this, &CreateDialog::_history_selected));
recent->connect("item_activated", callable_mp(this, &CreateDialog::_history_activated));
recent->add_theme_constant_override("draw_guides", 1);
recent->add_theme_constant_override(SNAME("draw_guides"), 1);

VBoxContainer *vbc = memnew(VBoxContainer);
vbc->set_custom_minimum_size(Size2(300, 0) * EDSCALE);
Expand Down
22 changes: 11 additions & 11 deletions editor/debugger/editor_debugger_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ EditorDebuggerNode::EditorDebuggerNode() {
singleton = this;
}

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));
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));

tabs = memnew(TabContainer);
tabs->set_tab_alignment(TabContainer::ALIGNMENT_LEFT);
Expand All @@ -66,7 +66,7 @@ EditorDebuggerNode::EditorDebuggerNode() {

Ref<StyleBoxEmpty> empty;
empty.instantiate();
tabs->add_theme_style_override("panel", empty);
tabs->add_theme_style_override(SNAME("panel"), empty);

auto_switch_remote_scene_tree = EDITOR_DEF("debugger/auto_switch_to_remote_scene_tree", false);
_add_debugger();
Expand Down Expand Up @@ -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("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("EditorStyles")));
tabs->add_theme_style_override(SNAME("panel"), EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("EditorStyles")));
}

if (!debugger_plugins.is_empty()) {
Expand Down Expand Up @@ -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("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));
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));

tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("EditorStyles")));
tabs->add_theme_style_override(SNAME("panel"), EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("EditorStyles")));
}
} break;
case NOTIFICATION_READY: {
Expand Down Expand Up @@ -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("font_color");
debugger_button->remove_theme_color_override(SNAME("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("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor")));
debugger_button->add_theme_color_override(SNAME("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("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor")));
debugger_button->add_theme_color_override(SNAME("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("font_color", get_theme_color(SNAME("warning_color"), SNAME("Editor")));
debugger_button->add_theme_color_override(SNAME("font_color"), get_theme_color(SNAME("warning_color"), SNAME("Editor")));
}
}
last_error_count = error_count;
Expand Down
6 changes: 3 additions & 3 deletions editor/debugger/editor_network_profiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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("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));
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));
}
}

Expand Down Expand Up @@ -126,7 +126,7 @@ bool EditorNetworkProfiler::is_profiling() {

EditorNetworkProfiler::EditorNetworkProfiler() {
HBoxContainer *hb = memnew(HBoxContainer);
hb->add_theme_constant_override("separation", 8 * EDSCALE);
hb->add_theme_constant_override(SNAME("separation"), 8 * EDSCALE);
add_child(hb);

activate = memnew(Button);
Expand Down
2 changes: 1 addition & 1 deletion editor/debugger/editor_profiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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("separation", 8 * EDSCALE);
hb->add_theme_constant_override(SNAME("separation"), 8 * EDSCALE);

h_split = memnew(HSplitContainer);
add_child(h_split);
Expand Down
2 changes: 1 addition & 1 deletion editor/debugger/editor_visual_profiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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("separation", 8 * EDSCALE);
hb->add_theme_constant_override(SNAME("separation"), 8 * EDSCALE);

h_split = memnew(HSplitContainer);
add_child(h_split);
Expand Down
Loading

0 comments on commit b024602

Please sign in to comment.