Skip to content

Commit 9a8d662

Browse files
committed
[Scene] Add SceneStringName::hover
1 parent cf038de commit 9a8d662

11 files changed

+38
-37
lines changed

editor/animation_track_editor.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2061,7 +2061,7 @@ void AnimationTrackEdit::_notification(int p_what) {
20612061

20622062
const Ref<StyleBox> &stylebox_odd = get_theme_stylebox(SNAME("odd"), SNAME("AnimationTrackEdit"));
20632063
const Ref<StyleBox> &stylebox_focus = get_theme_stylebox(SNAME("focus"), SNAME("AnimationTrackEdit"));
2064-
const Ref<StyleBox> &stylebox_hover = get_theme_stylebox(SNAME("hover"), SNAME("AnimationTrackEdit"));
2064+
const Ref<StyleBox> &stylebox_hover = get_theme_stylebox(SceneStringName(hover), SNAME("AnimationTrackEdit"));
20652065

20662066
const Color h_line_color = get_theme_color(SNAME("h_line_color"), SNAME("AnimationTrackEdit"));
20672067
const int h_separation = get_theme_constant(SNAME("h_separation"), SNAME("AnimationTrackEdit"));

editor/editor_audio_buses.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
849849
Control *child = Object::cast_to<Control>(hbc->get_child(i));
850850
child->begin_bulk_theme_override();
851851
child->add_theme_style_override(CoreStringName(normal), sbempty);
852-
child->add_theme_style_override("hover", sbempty);
852+
child->add_theme_style_override(SceneStringName(hover), sbempty);
853853
child->add_theme_style_override("hover_mirrored", sbempty);
854854
child->add_theme_style_override("focus", sbempty);
855855
child->add_theme_style_override("focus_mirrored", sbempty);

editor/gui/editor_quick_open_dialog.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ void QuickOpenResultItem::_notification(int p_what) {
816816
} break;
817817
case NOTIFICATION_THEME_CHANGED: {
818818
selected_stylebox = get_theme_stylebox("selected", "Tree");
819-
hovering_stylebox = get_theme_stylebox("hover", "Tree");
819+
hovering_stylebox = get_theme_stylebox(SceneStringName(hover), "Tree");
820820
highlighted_font_color = get_theme_color("font_focus_color", EditorStringName(Editor));
821821
} break;
822822
case NOTIFICATION_DRAW: {

editor/gui/editor_zoom_widget.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ EditorZoomWidget::EditorZoomWidget() {
199199

200200
Ref<StyleBoxEmpty> empty_stylebox = memnew(StyleBoxEmpty);
201201
zoom_reset->add_theme_style_override(CoreStringName(normal), empty_stylebox);
202-
zoom_reset->add_theme_style_override("hover", empty_stylebox);
202+
zoom_reset->add_theme_style_override(SceneStringName(hover), empty_stylebox);
203203
zoom_reset->add_theme_style_override("focus", empty_stylebox);
204204
zoom_reset->add_theme_style_override(SceneStringName(pressed), empty_stylebox);
205205
zoom_reset->add_theme_constant_override("outline_size", Math::ceil(2 * EDSCALE));

editor/import/3d/scene_import_settings.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1314,7 +1314,7 @@ void SceneImportSettingsDialog::_notification(int p_what) {
13141314
case NOTIFICATION_THEME_CHANGED: {
13151315
action_menu->begin_bulk_theme_override();
13161316
action_menu->add_theme_style_override(CoreStringName(normal), get_theme_stylebox(CoreStringName(normal), "Button"));
1317-
action_menu->add_theme_style_override("hover", get_theme_stylebox("hover", "Button"));
1317+
action_menu->add_theme_style_override(SceneStringName(hover), get_theme_stylebox(SceneStringName(hover), "Button"));
13181318
action_menu->add_theme_style_override(SceneStringName(pressed), get_theme_stylebox(SceneStringName(pressed), "Button"));
13191319
action_menu->end_bulk_theme_override();
13201320

editor/plugins/node_3d_editor_plugin.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -3156,7 +3156,7 @@ void Node3DEditorViewport::_notification(int p_what) {
31563156
view_menu->begin_bulk_theme_override();
31573157
view_menu->add_theme_style_override(CoreStringName(normal), information_3d_stylebox);
31583158
view_menu->add_theme_style_override("normal_mirrored", information_3d_stylebox);
3159-
view_menu->add_theme_style_override("hover", information_3d_stylebox);
3159+
view_menu->add_theme_style_override(SceneStringName(hover), information_3d_stylebox);
31603160
view_menu->add_theme_style_override("hover_mirrored", information_3d_stylebox);
31613161
view_menu->add_theme_style_override("hover_pressed", information_3d_stylebox);
31623162
view_menu->add_theme_style_override("hover_pressed_mirrored", information_3d_stylebox);
@@ -3171,7 +3171,7 @@ void Node3DEditorViewport::_notification(int p_what) {
31713171
preview_camera->begin_bulk_theme_override();
31723172
preview_camera->add_theme_style_override(CoreStringName(normal), information_3d_stylebox);
31733173
preview_camera->add_theme_style_override("normal_mirrored", information_3d_stylebox);
3174-
preview_camera->add_theme_style_override("hover", information_3d_stylebox);
3174+
preview_camera->add_theme_style_override(SceneStringName(hover), information_3d_stylebox);
31753175
preview_camera->add_theme_style_override("hover_mirrored", information_3d_stylebox);
31763176
preview_camera->add_theme_style_override("hover_pressed", information_3d_stylebox);
31773177
preview_camera->add_theme_style_override("hover_pressed_mirrored", information_3d_stylebox);

editor/plugins/tiles/tile_set_atlas_source_editor.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ void TileSetAtlasSourceEditor::_update_atlas_view() {
998998
button->set_flat(true);
999999
button->set_button_icon(get_editor_theme_icon(SNAME("Add")));
10001000
button->add_theme_style_override(CoreStringName(normal), memnew(StyleBoxEmpty));
1001-
button->add_theme_style_override("hover", memnew(StyleBoxEmpty));
1001+
button->add_theme_style_override(SceneStringName(hover), memnew(StyleBoxEmpty));
10021002
button->add_theme_style_override("focus", memnew(StyleBoxEmpty));
10031003
button->add_theme_style_override(SceneStringName(pressed), memnew(StyleBoxEmpty));
10041004
button->connect(SceneStringName(pressed), callable_mp(tile_set_atlas_source, &TileSetAtlasSource::create_alternative_tile).bind(tile_id, TileSetSource::INVALID_TILE_ALTERNATIVE));

editor/themes/editor_theme_manager.cpp

+18-18
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
725725
// Button.
726726

727727
p_theme->set_stylebox(CoreStringName(normal), "Button", p_config.button_style);
728-
p_theme->set_stylebox("hover", "Button", p_config.button_style_hover);
728+
p_theme->set_stylebox(SceneStringName(hover), "Button", p_config.button_style_hover);
729729
p_theme->set_stylebox(SceneStringName(pressed), "Button", p_config.button_style_pressed);
730730
p_theme->set_stylebox("focus", "Button", p_config.button_style_focus);
731731
p_theme->set_stylebox("disabled", "Button", p_config.button_style_disabled);
@@ -753,7 +753,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
753753
// MenuButton.
754754

755755
p_theme->set_stylebox(CoreStringName(normal), "MenuButton", p_config.panel_container_style);
756-
p_theme->set_stylebox("hover", "MenuButton", p_config.button_style_hover);
756+
p_theme->set_stylebox(SceneStringName(hover), "MenuButton", p_config.button_style_hover);
757757
p_theme->set_stylebox(SceneStringName(pressed), "MenuButton", p_config.panel_container_style);
758758
p_theme->set_stylebox("focus", "MenuButton", p_config.panel_container_style);
759759
p_theme->set_stylebox("disabled", "MenuButton", p_config.panel_container_style);
@@ -769,7 +769,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
769769
// MenuBar.
770770

771771
p_theme->set_stylebox(CoreStringName(normal), "MenuBar", p_config.button_style);
772-
p_theme->set_stylebox("hover", "MenuBar", p_config.button_style_hover);
772+
p_theme->set_stylebox(SceneStringName(hover), "MenuBar", p_config.button_style_hover);
773773
p_theme->set_stylebox(SceneStringName(pressed), "MenuBar", p_config.button_style_pressed);
774774
p_theme->set_stylebox("disabled", "MenuBar", p_config.button_style_disabled);
775775

@@ -806,7 +806,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
806806

807807
p_theme->set_stylebox("focus", "OptionButton", option_button_focus_style);
808808
p_theme->set_stylebox(CoreStringName(normal), "OptionButton", p_config.button_style);
809-
p_theme->set_stylebox("hover", "OptionButton", p_config.button_style_hover);
809+
p_theme->set_stylebox(SceneStringName(hover), "OptionButton", p_config.button_style_hover);
810810
p_theme->set_stylebox(SceneStringName(pressed), "OptionButton", p_config.button_style_pressed);
811811
p_theme->set_stylebox("disabled", "OptionButton", p_config.button_style_disabled);
812812

@@ -841,7 +841,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
841841
p_theme->set_stylebox(CoreStringName(normal), "CheckButton", p_config.panel_container_style);
842842
p_theme->set_stylebox(SceneStringName(pressed), "CheckButton", p_config.panel_container_style);
843843
p_theme->set_stylebox("disabled", "CheckButton", p_config.panel_container_style);
844-
p_theme->set_stylebox("hover", "CheckButton", p_config.panel_container_style);
844+
p_theme->set_stylebox(SceneStringName(hover), "CheckButton", p_config.panel_container_style);
845845
p_theme->set_stylebox("hover_pressed", "CheckButton", p_config.panel_container_style);
846846

847847
p_theme->set_icon("checked", "CheckButton", p_theme->get_icon(SNAME("GuiToggleOn"), EditorStringName(EditorIcons)));
@@ -879,7 +879,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
879879
p_theme->set_stylebox(CoreStringName(normal), "CheckBox", checkbox_style);
880880
p_theme->set_stylebox(SceneStringName(pressed), "CheckBox", checkbox_style);
881881
p_theme->set_stylebox("disabled", "CheckBox", checkbox_style);
882-
p_theme->set_stylebox("hover", "CheckBox", checkbox_style);
882+
p_theme->set_stylebox(SceneStringName(hover), "CheckBox", checkbox_style);
883883
p_theme->set_stylebox("hover_pressed", "CheckBox", checkbox_style);
884884
p_theme->set_icon("checked", "CheckBox", p_theme->get_icon(SNAME("GuiChecked"), EditorStringName(EditorIcons)));
885885
p_theme->set_icon("unchecked", "CheckBox", p_theme->get_icon(SNAME("GuiUnchecked"), EditorStringName(EditorIcons)));
@@ -1334,7 +1334,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
13341334
Ref<StyleBoxFlat> style_menu_hover = p_config.button_style_hover->duplicate();
13351335
// Don't use rounded corners for hover highlights since the StyleBox touches the PopupMenu's edges.
13361336
style_menu_hover->set_corner_radius_all(0);
1337-
p_theme->set_stylebox("hover", "PopupMenu", style_menu_hover);
1337+
p_theme->set_stylebox(SceneStringName(hover), "PopupMenu", style_menu_hover);
13381338

13391339
Ref<StyleBoxLine> style_popup_separator(memnew(StyleBoxLine));
13401340
style_popup_separator->set_color(p_config.separator_color);
@@ -1796,7 +1796,7 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
17961796
tag->set_corner_radius(CORNER_BOTTOM_LEFT, 0);
17971797
tag->set_corner_radius(CORNER_TOP_RIGHT, 4);
17981798
tag->set_corner_radius(CORNER_BOTTOM_RIGHT, 4);
1799-
p_theme->set_stylebox("hover", "ProjectTag", tag);
1799+
p_theme->set_stylebox(SceneStringName(hover), "ProjectTag", tag);
18001800

18011801
tag = p_config.button_style_pressed->duplicate();
18021802
tag->set_corner_radius(CORNER_TOP_LEFT, 0);
@@ -1883,15 +1883,15 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
18831883
p_theme->set_stylebox("normal_mirrored", "MainScreenButton", menu_transparent_style);
18841884
p_theme->set_stylebox(SceneStringName(pressed), "MainScreenButton", menu_transparent_style);
18851885
p_theme->set_stylebox("pressed_mirrored", "MainScreenButton", menu_transparent_style);
1886-
p_theme->set_stylebox("hover", "MainScreenButton", main_screen_button_hover);
1886+
p_theme->set_stylebox(SceneStringName(hover), "MainScreenButton", main_screen_button_hover);
18871887
p_theme->set_stylebox("hover_mirrored", "MainScreenButton", main_screen_button_hover);
18881888
p_theme->set_stylebox("hover_pressed", "MainScreenButton", main_screen_button_hover);
18891889
p_theme->set_stylebox("hover_pressed_mirrored", "MainScreenButton", main_screen_button_hover);
18901890

18911891
p_theme->set_type_variation("MainMenuBar", "FlatMenuButton");
18921892
p_theme->set_stylebox(CoreStringName(normal), "MainMenuBar", menu_transparent_style);
18931893
p_theme->set_stylebox(SceneStringName(pressed), "MainMenuBar", main_screen_button_hover);
1894-
p_theme->set_stylebox("hover", "MainMenuBar", main_screen_button_hover);
1894+
p_theme->set_stylebox(SceneStringName(hover), "MainMenuBar", main_screen_button_hover);
18951895
p_theme->set_stylebox("hover_pressed", "MainMenuBar", main_screen_button_hover);
18961896

18971897
// Run bar.
@@ -1907,7 +1907,7 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
19071907
p_theme->set_stylebox(CoreStringName(normal), "BottomPanelButton", menu_transparent_style);
19081908
p_theme->set_stylebox(SceneStringName(pressed), "BottomPanelButton", menu_transparent_style);
19091909
p_theme->set_stylebox("hover_pressed", "BottomPanelButton", main_screen_button_hover);
1910-
p_theme->set_stylebox("hover", "BottomPanelButton", main_screen_button_hover);
1910+
p_theme->set_stylebox(SceneStringName(hover), "BottomPanelButton", main_screen_button_hover);
19111911
// Don't tint the icon even when in "pressed" state.
19121912
p_theme->set_color("icon_pressed_color", "BottomPanelButton", Color(1, 1, 1, 1));
19131913
Color icon_hover_color = p_config.icon_normal_color * (p_config.dark_theme ? 1.15 : 1.0);
@@ -1991,12 +1991,12 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
19911991
style_flat_button_pressed->set_bg_color(flat_pressed_color);
19921992

19931993
p_theme->set_stylebox(CoreStringName(normal), SceneStringName(FlatButton), style_flat_button);
1994-
p_theme->set_stylebox("hover", SceneStringName(FlatButton), style_flat_button_hover);
1994+
p_theme->set_stylebox(SceneStringName(hover), SceneStringName(FlatButton), style_flat_button_hover);
19951995
p_theme->set_stylebox(SceneStringName(pressed), SceneStringName(FlatButton), style_flat_button_pressed);
19961996
p_theme->set_stylebox("disabled", SceneStringName(FlatButton), style_flat_button);
19971997

19981998
p_theme->set_stylebox(CoreStringName(normal), "FlatMenuButton", style_flat_button);
1999-
p_theme->set_stylebox("hover", "FlatMenuButton", style_flat_button_hover);
1999+
p_theme->set_stylebox(SceneStringName(hover), "FlatMenuButton", style_flat_button_hover);
20002000
p_theme->set_stylebox(SceneStringName(pressed), "FlatMenuButton", style_flat_button_pressed);
20012001
p_theme->set_stylebox("disabled", "FlatMenuButton", style_flat_button);
20022002

@@ -2022,7 +2022,7 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
20222022
editor_log_button_pressed->set_bg_color(flat_pressed_color.lightened(0.5));
20232023
}
20242024
p_theme->set_stylebox(CoreStringName(normal), "EditorLogFilterButton", style_flat_button);
2025-
p_theme->set_stylebox("hover", "EditorLogFilterButton", style_flat_button_hover);
2025+
p_theme->set_stylebox(SceneStringName(hover), "EditorLogFilterButton", style_flat_button_hover);
20262026
p_theme->set_stylebox(SceneStringName(pressed), "EditorLogFilterButton", editor_log_button_pressed);
20272027
}
20282028

@@ -2043,7 +2043,7 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
20432043
panel_button_style_disabled->set_bg_color(p_config.disabled_bg_color);
20442044

20452045
p_theme->set_stylebox(CoreStringName(normal), "PanelBackgroundButton", panel_button_style);
2046-
p_theme->set_stylebox("hover", "PanelBackgroundButton", panel_button_style_hover);
2046+
p_theme->set_stylebox(SceneStringName(hover), "PanelBackgroundButton", panel_button_style_hover);
20472047
p_theme->set_stylebox(SceneStringName(pressed), "PanelBackgroundButton", panel_button_style_pressed);
20482048
p_theme->set_stylebox("disabled", "PanelBackgroundButton", panel_button_style_disabled);
20492049
}
@@ -2086,7 +2086,7 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
20862086

20872087
style_inspector_action = p_config.button_style_hover->duplicate();
20882088
style_inspector_action->set_content_margin(SIDE_RIGHT, action_extra_margin);
2089-
p_theme->set_stylebox("hover", "InspectorActionButton", style_inspector_action);
2089+
p_theme->set_stylebox(SceneStringName(hover), "InspectorActionButton", style_inspector_action);
20902090

20912091
style_inspector_action = p_config.button_style_hover->duplicate();
20922092
style_inspector_action->set_content_margin(SIDE_LEFT, action_extra_margin);
@@ -2125,7 +2125,7 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
21252125
p_theme->set_color("icon_hover_color", "PreviewLightButton", dim_light_highlighted_color);
21262126

21272127
p_theme->set_stylebox(CoreStringName(normal), "PreviewLightButton", sb_empty_borderless);
2128-
p_theme->set_stylebox("hover", "PreviewLightButton", sb_empty_borderless);
2128+
p_theme->set_stylebox(SceneStringName(hover), "PreviewLightButton", sb_empty_borderless);
21292129
p_theme->set_stylebox("focus", "PreviewLightButton", sb_empty_borderless);
21302130
p_theme->set_stylebox(SceneStringName(pressed), "PreviewLightButton", sb_empty_borderless);
21312131
}
@@ -2330,7 +2330,7 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
23302330
Ref<StyleBoxFlat> style_animation_track_hover = make_flat_stylebox(Color(0.5, 0.5, 0.5, 0.1), 0, 0, 0, 0, p_config.corner_radius);
23312331

23322332
p_theme->set_stylebox("odd", "AnimationTrackEdit", style_animation_track_odd);
2333-
p_theme->set_stylebox("hover", "AnimationTrackEdit", style_animation_track_hover);
2333+
p_theme->set_stylebox(SceneStringName(hover), "AnimationTrackEdit", style_animation_track_hover);
23342334
p_theme->set_stylebox("focus", "AnimationTrackEdit", p_config.button_style_focus);
23352335

23362336
p_theme->set_color("h_line_color", "AnimationTrackEdit", p_config.font_color * Color(1, 1, 1, 0.2));

scene/gui/color_picker.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ void ColorPicker::_notification(int p_what) {
115115
mode_btns[i]->begin_bulk_theme_override();
116116
mode_btns[i]->add_theme_style_override(SceneStringName(pressed), theme_cache.mode_button_pressed);
117117
mode_btns[i]->add_theme_style_override(CoreStringName(normal), theme_cache.mode_button_normal);
118-
mode_btns[i]->add_theme_style_override(SNAME("hover"), theme_cache.mode_button_hover);
118+
mode_btns[i]->add_theme_style_override(SceneStringName(hover), theme_cache.mode_button_hover);
119119
mode_btns[i]->end_bulk_theme_override();
120120
}
121121

scene/scene_string_names.h

+1
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ class SceneStringNames {
142142
const StringName pressed = StaticCString::create("pressed");
143143
const StringName id_pressed = StaticCString::create("id_pressed");
144144
const StringName toggled = StaticCString::create("toggled");
145+
const StringName hover = StaticCString::create("hover");
145146

146147
const StringName panel = StaticCString::create("panel");
147148
const StringName item_selected = StaticCString::create("item_selected");

0 commit comments

Comments
 (0)