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:
parent
0154ce2c8d
commit
fc076ece3d
90 changed files with 1648 additions and 1648 deletions
|
|
@ -353,7 +353,7 @@ MarginContainer *VBoxContainer::add_margin_child(const String &p_label, Control
|
|||
l->set_text(p_label);
|
||||
add_child(l);
|
||||
MarginContainer *mc = memnew(MarginContainer);
|
||||
mc->add_theme_constant_override(SNAME("margin_left"), 0);
|
||||
mc->add_theme_constant_override("margin_left", 0);
|
||||
mc->add_child(p_control, true);
|
||||
add_child(mc);
|
||||
if (p_expand) {
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ void Button::_notification(int p_what) {
|
|||
} break;
|
||||
case DRAW_HOVER_PRESSED: {
|
||||
// Edge case for CheckButton and CheckBox.
|
||||
if (has_theme_stylebox(SNAME("hover_pressed"))) {
|
||||
if (has_theme_stylebox("hover_pressed")) {
|
||||
if (rtl && has_theme_stylebox(SNAME("hover_pressed_mirrored"))) {
|
||||
style = get_theme_stylebox(SNAME("hover_pressed_mirrored"));
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ void ColorPicker::_notification(int p_what) {
|
|||
w_edit->set_custom_minimum_size(Size2(get_theme_constant(SNAME("h_width")), 0));
|
||||
|
||||
wheel_edit->set_custom_minimum_size(Size2(get_theme_constant(SNAME("sv_width")), get_theme_constant(SNAME("sv_height"))));
|
||||
wheel_margin->add_theme_constant_override(SNAME("margin_bottom"), 8 * get_theme_default_base_scale());
|
||||
wheel_margin->add_theme_constant_override("margin_bottom", 8 * get_theme_default_base_scale());
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
labels[i]->set_custom_minimum_size(Size2(get_theme_constant(SNAME("label_width")), 0));
|
||||
|
|
@ -191,22 +191,22 @@ void ColorPicker::_update_controls() {
|
|||
|
||||
if (raw_mode_enabled) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
scroll[i]->remove_theme_icon_override(SNAME("grabber"));
|
||||
scroll[i]->remove_theme_icon_override(SNAME("grabber_highlight"));
|
||||
scroll[i]->remove_theme_style_override(SNAME("slider"));
|
||||
scroll[i]->remove_theme_style_override(SNAME("grabber_area"));
|
||||
scroll[i]->remove_theme_style_override(SNAME("grabber_area_highlight"));
|
||||
scroll[i]->remove_theme_icon_override("grabber");
|
||||
scroll[i]->remove_theme_icon_override("grabber_highlight");
|
||||
scroll[i]->remove_theme_style_override("slider");
|
||||
scroll[i]->remove_theme_style_override("grabber_area");
|
||||
scroll[i]->remove_theme_style_override("grabber_area_highlight");
|
||||
}
|
||||
} else {
|
||||
Ref<StyleBoxEmpty> style_box_empty(memnew(StyleBoxEmpty));
|
||||
Ref<Texture2D> bar_arrow = get_theme_icon(SNAME("bar_arrow"));
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
scroll[i]->add_theme_icon_override(SNAME("grabber"), bar_arrow);
|
||||
scroll[i]->add_theme_icon_override(SNAME("grabber_highlight"), bar_arrow);
|
||||
scroll[i]->add_theme_style_override(SNAME("slider"), style_box_empty);
|
||||
scroll[i]->add_theme_style_override(SNAME("grabber_area"), style_box_empty);
|
||||
scroll[i]->add_theme_style_override(SNAME("grabber_area_highlight"), style_box_empty);
|
||||
scroll[i]->add_theme_icon_override("grabber", bar_arrow);
|
||||
scroll[i]->add_theme_icon_override("grabber_highlight", bar_arrow);
|
||||
scroll[i]->add_theme_style_override("slider", style_box_empty);
|
||||
scroll[i]->add_theme_style_override("grabber_area", style_box_empty);
|
||||
scroll[i]->add_theme_style_override("grabber_area_highlight", style_box_empty);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1245,7 +1245,7 @@ ColorPicker::ColorPicker() :
|
|||
circle_mat.instantiate();
|
||||
circle_mat->set_shader(circle_shader);
|
||||
|
||||
wheel_margin->add_theme_constant_override(SNAME("margin_bottom"), 8);
|
||||
wheel_margin->add_theme_constant_override("margin_bottom", 8);
|
||||
wheel_edit->add_child(wheel_margin);
|
||||
|
||||
wheel_margin->add_child(wheel);
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ void AcceptDialog::_notification(int p_what) {
|
|||
}
|
||||
} break;
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
bg->add_theme_style_override(SNAME("panel"), bg->get_theme_stylebox(SNAME("panel"), SNAME("AcceptDialog")));
|
||||
bg->add_theme_style_override("panel", bg->get_theme_stylebox(SNAME("panel"), SNAME("AcceptDialog")));
|
||||
} break;
|
||||
case NOTIFICATION_EXIT_TREE: {
|
||||
if (parent_visible) {
|
||||
|
|
|
|||
|
|
@ -65,30 +65,30 @@ void FileDialog::_theme_changed() {
|
|||
Color font_focus_color = vbox->get_theme_color(SNAME("font_focus_color"), SNAME("Button"));
|
||||
Color font_pressed_color = vbox->get_theme_color(SNAME("font_pressed_color"), SNAME("Button"));
|
||||
|
||||
dir_up->add_theme_color_override(SNAME("icon_normal_color"), font_color);
|
||||
dir_up->add_theme_color_override(SNAME("icon_hover_color"), font_hover_color);
|
||||
dir_up->add_theme_color_override(SNAME("icon_focus_color"), font_focus_color);
|
||||
dir_up->add_theme_color_override(SNAME("icon_pressed_color"), font_pressed_color);
|
||||
dir_up->add_theme_color_override("icon_normal_color", font_color);
|
||||
dir_up->add_theme_color_override("icon_hover_color", font_hover_color);
|
||||
dir_up->add_theme_color_override("icon_focus_color", font_focus_color);
|
||||
dir_up->add_theme_color_override("icon_pressed_color", font_pressed_color);
|
||||
|
||||
dir_prev->add_theme_color_override(SNAME("icon_color_normal"), font_color);
|
||||
dir_prev->add_theme_color_override(SNAME("icon_color_hover"), font_hover_color);
|
||||
dir_prev->add_theme_color_override(SNAME("icon_focus_color"), font_focus_color);
|
||||
dir_prev->add_theme_color_override(SNAME("icon_color_pressed"), font_pressed_color);
|
||||
dir_prev->add_theme_color_override("icon_color_normal", font_color);
|
||||
dir_prev->add_theme_color_override("icon_color_hover", font_hover_color);
|
||||
dir_prev->add_theme_color_override("icon_focus_color", font_focus_color);
|
||||
dir_prev->add_theme_color_override("icon_color_pressed", font_pressed_color);
|
||||
|
||||
dir_next->add_theme_color_override(SNAME("icon_color_normal"), font_color);
|
||||
dir_next->add_theme_color_override(SNAME("icon_color_hover"), font_hover_color);
|
||||
dir_next->add_theme_color_override(SNAME("icon_focus_color"), font_focus_color);
|
||||
dir_next->add_theme_color_override(SNAME("icon_color_pressed"), font_pressed_color);
|
||||
dir_next->add_theme_color_override("icon_color_normal", font_color);
|
||||
dir_next->add_theme_color_override("icon_color_hover", font_hover_color);
|
||||
dir_next->add_theme_color_override("icon_focus_color", font_focus_color);
|
||||
dir_next->add_theme_color_override("icon_color_pressed", font_pressed_color);
|
||||
|
||||
refresh->add_theme_color_override(SNAME("icon_normal_color"), font_color);
|
||||
refresh->add_theme_color_override(SNAME("icon_hover_color"), font_hover_color);
|
||||
refresh->add_theme_color_override(SNAME("icon_focus_color"), font_focus_color);
|
||||
refresh->add_theme_color_override(SNAME("icon_pressed_color"), font_pressed_color);
|
||||
refresh->add_theme_color_override("icon_normal_color", font_color);
|
||||
refresh->add_theme_color_override("icon_hover_color", font_hover_color);
|
||||
refresh->add_theme_color_override("icon_focus_color", font_focus_color);
|
||||
refresh->add_theme_color_override("icon_pressed_color", font_pressed_color);
|
||||
|
||||
show_hidden->add_theme_color_override(SNAME("icon_normal_color"), font_color);
|
||||
show_hidden->add_theme_color_override(SNAME("icon_hover_color"), font_hover_color);
|
||||
show_hidden->add_theme_color_override(SNAME("icon_focus_color"), font_focus_color);
|
||||
show_hidden->add_theme_color_override(SNAME("icon_pressed_color"), font_pressed_color);
|
||||
show_hidden->add_theme_color_override("icon_normal_color", font_color);
|
||||
show_hidden->add_theme_color_override("icon_hover_color", font_hover_color);
|
||||
show_hidden->add_theme_color_override("icon_focus_color", font_focus_color);
|
||||
show_hidden->add_theme_color_override("icon_pressed_color", font_pressed_color);
|
||||
}
|
||||
|
||||
void FileDialog::_notification(int p_what) {
|
||||
|
|
|
|||
|
|
@ -242,9 +242,9 @@ void PopupPanel::_update_child_rects() {
|
|||
|
||||
void PopupPanel::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
panel->add_theme_style_override(SNAME("panel"), get_theme_stylebox(SNAME("panel"), get_class_name()));
|
||||
panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), get_class_name()));
|
||||
} else if (p_what == NOTIFICATION_READY || p_what == NOTIFICATION_ENTER_TREE) {
|
||||
panel->add_theme_style_override(SNAME("panel"), get_theme_stylebox(SNAME("panel"), get_class_name()));
|
||||
panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), get_class_name()));
|
||||
_update_child_rects();
|
||||
} else if (p_what == NOTIFICATION_WM_SIZE_CHANGED) {
|
||||
_update_child_rects();
|
||||
|
|
|
|||
|
|
@ -846,10 +846,10 @@ void PopupMenu::_notification(int p_what) {
|
|||
|
||||
// Set margin on the margin container
|
||||
Ref<StyleBox> panel_style = get_theme_stylebox(SNAME("panel"));
|
||||
margin_container->add_theme_constant_override(SNAME("margin_top"), panel_style->get_margin(Side::SIDE_TOP));
|
||||
margin_container->add_theme_constant_override(SNAME("margin_bottom"), panel_style->get_margin(Side::SIDE_BOTTOM));
|
||||
margin_container->add_theme_constant_override(SNAME("margin_left"), panel_style->get_margin(Side::SIDE_LEFT));
|
||||
margin_container->add_theme_constant_override(SNAME("margin_right"), panel_style->get_margin(Side::SIDE_RIGHT));
|
||||
margin_container->add_theme_constant_override("margin_top", panel_style->get_margin(Side::SIDE_TOP));
|
||||
margin_container->add_theme_constant_override("margin_bottom", panel_style->get_margin(Side::SIDE_BOTTOM));
|
||||
margin_container->add_theme_constant_override("margin_left", panel_style->get_margin(Side::SIDE_LEFT));
|
||||
margin_container->add_theme_constant_override("margin_right", panel_style->get_margin(Side::SIDE_RIGHT));
|
||||
}
|
||||
} break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4941,7 +4941,7 @@ Tree::Tree() {
|
|||
add_child(popup_editor, false, INTERNAL_MODE_FRONT);
|
||||
popup_editor_vb = memnew(VBoxContainer);
|
||||
popup_editor->add_child(popup_editor_vb);
|
||||
popup_editor_vb->add_theme_constant_override(SNAME("separation"), 0);
|
||||
popup_editor_vb->add_theme_constant_override("separation", 0);
|
||||
popup_editor_vb->set_anchors_and_offsets_preset(PRESET_WIDE);
|
||||
text_editor = memnew(LineEdit);
|
||||
popup_editor_vb->add_child(text_editor);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue