From 441f1a5fe9a3bf0e4e5dab578f793500b1ff6e3d Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Thu, 12 Mar 2020 09:37:40 -0300 Subject: Popups are now windows also (broken!) --- editor/animation_bezier_editor.cpp | 42 +- editor/animation_track_editor.cpp | 218 ++++----- editor/animation_track_editor_plugins.cpp | 90 ++-- editor/code_editor.cpp | 84 ++-- editor/connections_dialog.cpp | 22 +- editor/create_dialog.cpp | 14 +- editor/debugger/editor_debugger_node.cpp | 19 +- editor/debugger/editor_debugger_tree.cpp | 6 +- editor/debugger/editor_network_profiler.cpp | 26 +- editor/debugger/editor_profiler.cpp | 16 +- editor/debugger/editor_visual_profiler.cpp | 18 +- editor/debugger/script_editor_debugger.cpp | 68 +-- editor/dependency_editor.cpp | 12 +- editor/editor_about.cpp | 16 +- editor/editor_asset_installer.cpp | 24 +- editor/editor_audio_buses.cpp | 72 +-- editor/editor_autoload_settings.cpp | 8 +- editor/editor_dir_dialog.cpp | 2 +- editor/editor_feature_profile.cpp | 2 +- editor/editor_file_dialog.cpp | 78 ++-- editor/editor_help.cpp | 64 +-- editor/editor_help_search.cpp | 22 +- editor/editor_inspector.cpp | 110 ++--- editor/editor_log.cpp | 18 +- editor/editor_node.cpp | 192 ++++---- editor/editor_path.cpp | 2 +- editor/editor_plugin_settings.cpp | 2 +- editor/editor_properties.cpp | 98 ++-- editor/editor_properties_array_dict.cpp | 18 +- editor/editor_resource_preview.cpp | 2 +- editor/editor_sectioned_inspector.cpp | 4 +- editor/editor_spin_slider.cpp | 26 +- editor/export_template_manager.cpp | 6 +- editor/filesystem_dock.cpp | 141 +++--- editor/find_in_files.cpp | 10 +- editor/groups_editor.cpp | 28 +- editor/import_dock.cpp | 6 +- editor/inspector_dock.cpp | 44 +- editor/node_dock.cpp | 4 +- editor/pane_drag.cpp | 4 +- editor/plugins/abstract_polygon_2d_editor.cpp | 12 +- editor/plugins/animation_blend_space_1d_editor.cpp | 34 +- editor/plugins/animation_blend_space_2d_editor.cpp | 46 +- .../plugins/animation_blend_tree_editor_plugin.cpp | 28 +- editor/plugins/animation_player_editor_plugin.cpp | 30 +- editor/plugins/animation_state_machine_editor.cpp | 74 +-- editor/plugins/asset_library_editor_plugin.cpp | 68 +-- editor/plugins/audio_stream_editor_plugin.cpp | 26 +- editor/plugins/canvas_item_editor_plugin.cpp | 230 +++++----- editor/plugins/collision_polygon_editor_plugin.cpp | 6 +- .../plugins/collision_shape_2d_editor_plugin.cpp | 2 +- editor/plugins/cpu_particles_2d_editor_plugin.cpp | 2 +- editor/plugins/cpu_particles_editor_plugin.cpp | 2 +- editor/plugins/curve_editor_plugin.cpp | 22 +- editor/plugins/debugger_editor_plugin.cpp | 1 - editor/plugins/gi_probe_editor_plugin.cpp | 10 +- editor/plugins/item_list_editor_plugin.cpp | 4 +- editor/plugins/material_editor_plugin.cpp | 18 +- editor/plugins/mesh_editor_plugin.cpp | 8 +- editor/plugins/mesh_instance_editor_plugin.cpp | 2 +- editor/plugins/mesh_library_editor_plugin.cpp | 2 +- editor/plugins/multimesh_editor_plugin.cpp | 2 +- editor/plugins/particles_2d_editor_plugin.cpp | 2 +- editor/plugins/particles_editor_plugin.cpp | 2 +- editor/plugins/path_2d_editor_plugin.cpp | 18 +- editor/plugins/path_editor_plugin.cpp | 8 +- editor/plugins/physical_bone_plugin.cpp | 2 +- editor/plugins/polygon_2d_editor_plugin.cpp | 36 +- .../plugins/resource_preloader_editor_plugin.cpp | 8 +- editor/plugins/root_motion_editor_plugin.cpp | 6 +- editor/plugins/script_editor_plugin.cpp | 48 +- editor/plugins/script_editor_plugin.h | 2 +- editor/plugins/script_text_editor.cpp | 87 ++-- editor/plugins/script_text_editor.h | 2 +- editor/plugins/shader_editor_plugin.cpp | 69 ++- editor/plugins/skeleton_2d_editor_plugin.cpp | 2 +- editor/plugins/skeleton_editor_plugin.cpp | 2 +- editor/plugins/skeleton_ik_editor_plugin.cpp | 2 +- editor/plugins/spatial_editor_plugin.cpp | 196 ++++---- editor/plugins/sprite_editor_plugin.cpp | 2 +- editor/plugins/sprite_frames_editor_plugin.cpp | 28 +- editor/plugins/style_box_editor_plugin.cpp | 2 +- editor/plugins/text_editor.cpp | 72 +-- editor/plugins/text_editor.h | 2 +- editor/plugins/texture_editor_plugin.cpp | 4 +- editor/plugins/texture_region_editor_plugin.cpp | 14 +- editor/plugins/theme_editor_plugin.cpp | 22 +- editor/plugins/tile_map_editor_plugin.cpp | 38 +- editor/plugins/tile_set_editor_plugin.cpp | 76 +-- editor/plugins/version_control_editor_plugin.cpp | 32 +- editor/plugins/visual_shader_editor_plugin.cpp | 92 ++-- editor/progress_dialog.cpp | 16 +- editor/progress_dialog.h | 4 +- editor/project_export.cpp | 26 +- editor/project_manager.cpp | 50 +- editor/project_settings_editor.cpp | 70 +-- editor/property_editor.cpp | 80 ++-- editor/property_editor.h | 4 +- editor/property_selector.cpp | 58 +-- editor/quick_open.cpp | 8 +- editor/rename_dialog.cpp | 12 +- editor/scene_tree_dock.cpp | 87 ++-- editor/scene_tree_editor.cpp | 58 +-- editor/script_create_dialog.cpp | 20 +- editor/settings_config_dialog.cpp | 24 +- editor/spatial_editor_gizmos.cpp | 28 +- main/tests/test_gui.cpp | 2 +- .../gdnative/gdnative_library_editor_plugin.cpp | 24 +- .../gdnavigation/navigation_mesh_editor_plugin.cpp | 4 +- modules/gdscript/editor/gdscript_highlighter.cpp | 10 +- modules/gridmap/grid_map_editor_plugin.cpp | 10 +- modules/visual_script/visual_script_editor.cpp | 166 +++---- modules/visual_script/visual_script_editor.h | 2 +- .../visual_script_property_selector.cpp | 64 +-- platform/windows/display_server_windows.cpp | 32 +- platform/windows/display_server_windows.h | 2 +- scene/2d/canvas_item.cpp | 16 + scene/2d/canvas_item.h | 1 + scene/gui/box_container.cpp | 6 +- scene/gui/button.cpp | 86 ++-- scene/gui/check_box.cpp | 20 +- scene/gui/check_button.cpp | 16 +- scene/gui/color_picker.cpp | 38 +- scene/gui/control.cpp | 305 +++++++----- scene/gui/control.h | 74 +-- scene/gui/dialogs.cpp | 18 +- scene/gui/file_dialog.cpp | 36 +- scene/gui/gradient_edit.cpp | 6 +- scene/gui/graph_edit.cpp | 34 +- scene/gui/graph_node.cpp | 56 +-- scene/gui/grid_container.cpp | 8 +- scene/gui/item_list.cpp | 30 +- scene/gui/label.cpp | 34 +- scene/gui/line_edit.cpp | 70 +-- scene/gui/link_button.cpp | 20 +- scene/gui/margin_container.cpp | 16 +- scene/gui/menu_button.cpp | 14 +- scene/gui/option_button.cpp | 39 +- scene/gui/panel.cpp | 2 +- scene/gui/panel_container.cpp | 18 +- scene/gui/popup.cpp | 263 +++-------- scene/gui/popup.h | 39 +- scene/gui/popup_menu.cpp | 510 ++++++++++----------- scene/gui/popup_menu.h | 13 +- scene/gui/progress_bar.cpp | 14 +- scene/gui/rich_text_label.cpp | 82 ++-- scene/gui/scroll_bar.cpp | 50 +- scene/gui/scroll_container.cpp | 8 +- scene/gui/separator.cpp | 6 +- scene/gui/slider.cpp | 16 +- scene/gui/spin_box.cpp | 4 +- scene/gui/split_container.cpp | 26 +- scene/gui/tab_container.cpp | 98 ++-- scene/gui/tabs.cpp | 104 ++--- scene/gui/text_edit.cpp | 106 ++--- scene/gui/tree.cpp | 84 ++-- scene/main/viewport.cpp | 36 +- scene/main/window.cpp | 98 +++- scene/main/window.h | 18 + 159 files changed, 3284 insertions(+), 3258 deletions(-) diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index 6dcc9dd8ae..f3e3025e81 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -215,20 +215,20 @@ void AnimationBezierTrackEdit::_draw_line_clipped(const Vector2 &p_from, const V void AnimationBezierTrackEdit::_notification(int p_what) { if (p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_ENTER_TREE) { - bezier_icon = get_icon("KeyBezierPoint", "EditorIcons"); - bezier_handle_icon = get_icon("KeyBezierHandle", "EditorIcons"); - selected_icon = get_icon("KeyBezierSelected", "EditorIcons"); + bezier_icon = get_theme_icon("KeyBezierPoint", "EditorIcons"); + bezier_handle_icon = get_theme_icon("KeyBezierHandle", "EditorIcons"); + selected_icon = get_theme_icon("KeyBezierSelected", "EditorIcons"); if (handle_mode_option->get_item_count() == 0) { - handle_mode_option->add_icon_item(get_icon("BezierHandlesFree", "EditorIcons"), TTR("Free"), HANDLE_MODE_FREE); - handle_mode_option->add_icon_item(get_icon("BezierHandlesBalanced", "EditorIcons"), TTR("Balanced"), HANDLE_MODE_BALANCED); - handle_mode_option->add_icon_item(get_icon("BezierHandlesMirror", "EditorIcons"), TTR("Mirror"), HANDLE_MODE_MIRROR); + handle_mode_option->add_icon_item(get_theme_icon("BezierHandlesFree", "EditorIcons"), TTR("Free"), HANDLE_MODE_FREE); + handle_mode_option->add_icon_item(get_theme_icon("BezierHandlesBalanced", "EditorIcons"), TTR("Balanced"), HANDLE_MODE_BALANCED); + handle_mode_option->add_icon_item(get_theme_icon("BezierHandlesMirror", "EditorIcons"), TTR("Mirror"), HANDLE_MODE_MIRROR); } } if (p_what == NOTIFICATION_RESIZED) { int right_limit = get_size().width - timeline->get_buttons_width(); - int hsep = get_constant("hseparation", "ItemList"); - int vsep = get_constant("vseparation", "ItemList"); + int hsep = get_theme_constant("hseparation", "ItemList"); + int vsep = get_theme_constant("vseparation", "ItemList"); handle_mode_option->set_position(Vector2(right_limit + hsep, get_size().height - handle_mode_option->get_combined_minimum_size().height - vsep)); handle_mode_option->set_size(Vector2(timeline->get_buttons_width() - hsep * 2, handle_mode_option->get_combined_minimum_size().height)); @@ -240,15 +240,15 @@ void AnimationBezierTrackEdit::_notification(int p_what) { int limit = timeline->get_name_limit(); if (has_focus()) { - Color accent = get_color("accent_color", "Editor"); + Color accent = get_theme_color("accent_color", "Editor"); accent.a *= 0.7; draw_rect(Rect2(Point2(), get_size()), accent, false); } - Ref font = get_font("font", "Label"); - Color color = get_color("font_color", "Label"); - int hsep = get_constant("hseparation", "ItemList"); - int vsep = get_constant("vseparation", "ItemList"); + Ref font = get_theme_font("font", "Label"); + Color color = get_theme_color("font_color", "Label"); + int hsep = get_theme_constant("hseparation", "ItemList"); + int vsep = get_theme_constant("vseparation", "ItemList"); Color linecolor = color; linecolor.a = 0.2; @@ -258,7 +258,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) { draw_line(Point2(right_limit, 0), Point2(right_limit, get_size().height), linecolor); - Ref close_icon = get_icon("Close", "EditorIcons"); + Ref close_icon = get_theme_icon("Close", "EditorIcons"); close_icon_rect.position = Vector2(get_size().width - close_icon->get_width() - hsep, hsep); close_icon_rect.size = close_icon->get_size(); @@ -340,7 +340,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) { subtracks[i] = rect; } else { - Color ac = get_color("accent_color", "Editor"); + Color ac = get_theme_color("accent_color", "Editor"); ac.a = 0.5; draw_rect(rect, ac); } @@ -349,7 +349,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) { vofs += font->get_height() + vsep; } - Color accent = get_color("accent_color", "Editor"); + Color accent = get_theme_color("accent_color", "Editor"); { //guides float min_left_scale = font->get_height() + vsep; @@ -391,7 +391,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) { { //draw OTHER curves float scale = timeline->get_zoom_scale(); - Ref point = get_icon("KeyValue", "EditorIcons"); + Ref point = get_theme_icon("KeyValue", "EditorIcons"); for (Map::Element *E = subtrack_colors.front(); E; E = E->next()) { _draw_track(E->key(), E->get()); @@ -410,7 +410,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) { } //draw edited curve - const Color highlight = get_color("highlight_color", "Editor"); + const Color highlight = get_theme_color("highlight_color", "Editor"); _draw_track(track, highlight); } @@ -540,7 +540,7 @@ void AnimationBezierTrackEdit::_play_position_draw() { int px = (-timeline->get_value() + play_position_pos) * scale + timeline->get_name_limit(); if (px >= timeline->get_name_limit() && px < (get_size().width - timeline->get_buttons_width())) { - Color color = get_color("accent_color", "Editor"); + Color color = get_theme_color("accent_color", "Editor"); play_position->draw_line(Point2(px, 0), Point2(px, h), color); } } @@ -657,9 +657,9 @@ void AnimationBezierTrackEdit::_gui_input(const Ref &p_event) { menu->add_icon_item(bezier_icon, TTR("Insert Key Here"), MENU_KEY_INSERT); if (selection.size()) { menu->add_separator(); - menu->add_icon_item(get_icon("Duplicate", "EditorIcons"), TTR("Duplicate Selected Key(s)"), MENU_KEY_DUPLICATE); + menu->add_icon_item(get_theme_icon("Duplicate", "EditorIcons"), TTR("Duplicate Selected Key(s)"), MENU_KEY_DUPLICATE); menu->add_separator(); - menu->add_icon_item(get_icon("Remove", "EditorIcons"), TTR("Delete Selected Key(s)"), MENU_KEY_DELETE); + menu->add_icon_item(get_theme_icon("Remove", "EditorIcons"), TTR("Delete Selected Key(s)"), MENU_KEY_DELETE); } menu->set_as_minsize(); diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 48218c91dd..3da8f29697 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -1442,11 +1442,11 @@ void AnimationTimelineEdit::_anim_loop_pressed() { int AnimationTimelineEdit::get_buttons_width() const { - Ref interp_mode = get_icon("TrackContinuous", "EditorIcons"); - Ref interp_type = get_icon("InterpRaw", "EditorIcons"); - Ref loop_type = get_icon("InterpWrapClamp", "EditorIcons"); - Ref remove_icon = get_icon("Remove", "EditorIcons"); - Ref down_icon = get_icon("select_arrow", "Tree"); + Ref interp_mode = get_theme_icon("TrackContinuous", "EditorIcons"); + Ref interp_type = get_theme_icon("InterpRaw", "EditorIcons"); + Ref loop_type = get_theme_icon("InterpWrapClamp", "EditorIcons"); + Ref remove_icon = get_theme_icon("Remove", "EditorIcons"); + Ref down_icon = get_theme_icon("select_arrow", "Tree"); int total_w = interp_mode->get_width() + interp_type->get_width() + loop_type->get_width() + remove_icon->get_width(); total_w += (down_icon->get_width() + 4 * EDSCALE) * 4; @@ -1456,7 +1456,7 @@ int AnimationTimelineEdit::get_buttons_width() const { int AnimationTimelineEdit::get_name_limit() const { - Ref hsize_icon = get_icon("Hsize", "EditorIcons"); + Ref hsize_icon = get_theme_icon("Hsize", "EditorIcons"); int limit = MAX(name_limit, add_track->get_minimum_size().width + hsize_icon->get_width()); @@ -1468,17 +1468,17 @@ int AnimationTimelineEdit::get_name_limit() const { void AnimationTimelineEdit::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - add_track->set_icon(get_icon("Add", "EditorIcons")); - loop->set_icon(get_icon("Loop", "EditorIcons")); - time_icon->set_texture(get_icon("Time", "EditorIcons")); + add_track->set_icon(get_theme_icon("Add", "EditorIcons")); + loop->set_icon(get_theme_icon("Loop", "EditorIcons")); + time_icon->set_texture(get_theme_icon("Time", "EditorIcons")); add_track->get_popup()->clear(); - add_track->get_popup()->add_icon_item(get_icon("KeyValue", "EditorIcons"), TTR("Property Track")); - add_track->get_popup()->add_icon_item(get_icon("KeyXform", "EditorIcons"), TTR("3D Transform Track")); - add_track->get_popup()->add_icon_item(get_icon("KeyCall", "EditorIcons"), TTR("Call Method Track")); - add_track->get_popup()->add_icon_item(get_icon("KeyBezier", "EditorIcons"), TTR("Bezier Curve Track")); - add_track->get_popup()->add_icon_item(get_icon("KeyAudio", "EditorIcons"), TTR("Audio Playback Track")); - add_track->get_popup()->add_icon_item(get_icon("KeyAnimation", "EditorIcons"), TTR("Animation Playback Track")); + add_track->get_popup()->add_icon_item(get_theme_icon("KeyValue", "EditorIcons"), TTR("Property Track")); + add_track->get_popup()->add_icon_item(get_theme_icon("KeyXform", "EditorIcons"), TTR("3D Transform Track")); + add_track->get_popup()->add_icon_item(get_theme_icon("KeyCall", "EditorIcons"), TTR("Call Method Track")); + add_track->get_popup()->add_icon_item(get_theme_icon("KeyBezier", "EditorIcons"), TTR("Bezier Curve Track")); + add_track->get_popup()->add_icon_item(get_theme_icon("KeyAudio", "EditorIcons"), TTR("Audio Playback Track")); + add_track->get_popup()->add_icon_item(get_theme_icon("KeyAnimation", "EditorIcons"), TTR("Animation Playback Track")); } if (p_what == NOTIFICATION_RESIZED) { @@ -1493,8 +1493,8 @@ void AnimationTimelineEdit::_notification(int p_what) { if (!animation.is_valid()) return; - Ref font = get_font("font", "Label"); - Color color = get_color("font_color", "Label"); + Ref font = get_theme_font("font", "Label"); + Color color = get_theme_color("font_color", "Label"); int zoomw = key_range; float scale = get_zoom_scale(); @@ -1504,7 +1504,7 @@ void AnimationTimelineEdit::_notification(int p_what) { if (l <= 0) l = 0.001; //avoid crashor - Ref hsize_icon = get_icon("Hsize", "EditorIcons"); + Ref hsize_icon = get_theme_icon("Hsize", "EditorIcons"); hsize_rect = Rect2(get_name_limit() - hsize_icon->get_width() - 2 * EDSCALE, (get_size().height - hsize_icon->get_height()) / 2, hsize_icon->get_width(), hsize_icon->get_height()); draw_texture(hsize_icon, hsize_rect.position); @@ -1554,7 +1554,7 @@ void AnimationTimelineEdit::_notification(int p_what) { int end_px = (l - get_value()) * scale; int begin_px = -get_value() * scale; - Color notimecol = get_color("dark_color_2", "Editor"); + Color notimecol = get_theme_color("dark_color_2", "Editor"); Color timecolor = color; timecolor.a = 0.2; Color linecolor = color; @@ -1685,9 +1685,9 @@ void AnimationTimelineEdit::set_animation(const Ref &p_animation) { Size2 AnimationTimelineEdit::get_minimum_size() const { Size2 ms = add_track->get_minimum_size(); - Ref font = get_font("font", "Label"); + Ref font = get_theme_font("font", "Label"); ms.height = MAX(ms.height, font->get_height()); - ms.width = get_buttons_width() + add_track->get_minimum_size().width + get_icon("Hsize", "EditorIcons")->get_width() + 2; + ms.width = get_buttons_width() + add_track->get_minimum_size().width + get_theme_icon("Hsize", "EditorIcons")->get_width() + 2; return ms; } @@ -1746,11 +1746,11 @@ void AnimationTimelineEdit::_play_position_draw() { int px = (-get_value() + play_position_pos) * scale + get_name_limit(); if (px >= get_name_limit() && px < (play_position->get_size().width - get_buttons_width())) { - Color color = get_color("accent_color", "Editor"); + Color color = get_theme_color("accent_color", "Editor"); play_position->draw_line(Point2(px, 0), Point2(px, h), color, Math::round(2 * EDSCALE)); play_position->draw_texture( - get_icon("TimelineIndicator", "EditorIcons"), - Point2(px - get_icon("TimelineIndicator", "EditorIcons")->get_width() * 0.5, 0), + get_theme_icon("TimelineIndicator", "EditorIcons"), + Point2(px - get_theme_icon("TimelineIndicator", "EditorIcons")->get_width() * 0.5, 0), color); } } @@ -1921,23 +1921,23 @@ void AnimationTrackEdit::_notification(int p_what) { int limit = timeline->get_name_limit(); if (has_focus()) { - Color accent = get_color("accent_color", "Editor"); + Color accent = get_theme_color("accent_color", "Editor"); accent.a *= 0.7; // Offside so the horizontal sides aren't cutoff. draw_rect(Rect2(Point2(1 * EDSCALE, 0), get_size() - Size2(1 * EDSCALE, 0)), accent, false); } - Ref font = get_font("font", "Label"); - Color color = get_color("font_color", "Label"); + Ref font = get_theme_font("font", "Label"); + Color color = get_theme_color("font_color", "Label"); Ref type_icons[6] = { - get_icon("KeyValue", "EditorIcons"), - get_icon("KeyXform", "EditorIcons"), - get_icon("KeyCall", "EditorIcons"), - get_icon("KeyBezier", "EditorIcons"), - get_icon("KeyAudio", "EditorIcons"), - get_icon("KeyAnimation", "EditorIcons") + get_theme_icon("KeyValue", "EditorIcons"), + get_theme_icon("KeyXform", "EditorIcons"), + get_theme_icon("KeyCall", "EditorIcons"), + get_theme_icon("KeyBezier", "EditorIcons"), + get_theme_icon("KeyAudio", "EditorIcons"), + get_theme_icon("KeyAnimation", "EditorIcons") }; - int hsep = get_constant("hseparation", "ItemList"); + int hsep = get_theme_constant("hseparation", "ItemList"); Color linecolor = color; linecolor.a = 0.2; @@ -1945,7 +1945,7 @@ void AnimationTrackEdit::_notification(int p_what) { { - Ref check = animation->track_is_enabled(track) ? get_icon("checked", "CheckBox") : get_icon("unchecked", "CheckBox"); + Ref check = animation->track_is_enabled(track) ? get_theme_icon("checked", "CheckBox") : get_theme_icon("unchecked", "CheckBox"); int ofs = in_group ? check->get_width() : 0; //not the best reference for margin but.. @@ -1966,7 +1966,7 @@ void AnimationTrackEdit::_notification(int p_what) { String text; Color text_color = color; if (node && EditorNode::get_singleton()->get_editor_selection()->is_selected(node)) { - text_color = get_color("accent_color", "Editor"); + text_color = get_theme_color("accent_color", "Editor"); } if (in_group) { @@ -2045,25 +2045,25 @@ void AnimationTrackEdit::_notification(int p_what) { { Ref wrap_icon[2] = { - get_icon("InterpWrapClamp", "EditorIcons"), - get_icon("InterpWrapLoop", "EditorIcons"), + get_theme_icon("InterpWrapClamp", "EditorIcons"), + get_theme_icon("InterpWrapLoop", "EditorIcons"), }; Ref interp_icon[3] = { - get_icon("InterpRaw", "EditorIcons"), - get_icon("InterpLinear", "EditorIcons"), - get_icon("InterpCubic", "EditorIcons") + get_theme_icon("InterpRaw", "EditorIcons"), + get_theme_icon("InterpLinear", "EditorIcons"), + get_theme_icon("InterpCubic", "EditorIcons") }; Ref cont_icon[4] = { - get_icon("TrackContinuous", "EditorIcons"), - get_icon("TrackDiscrete", "EditorIcons"), - get_icon("TrackTrigger", "EditorIcons"), - get_icon("TrackCapture", "EditorIcons") + get_theme_icon("TrackContinuous", "EditorIcons"), + get_theme_icon("TrackDiscrete", "EditorIcons"), + get_theme_icon("TrackTrigger", "EditorIcons"), + get_theme_icon("TrackCapture", "EditorIcons") }; int ofs = get_size().width - timeline->get_buttons_width(); - Ref down_icon = get_icon("select_arrow", "Tree"); + Ref down_icon = get_theme_icon("select_arrow", "Tree"); draw_line(Point2(ofs, 0), Point2(ofs, get_size().height), linecolor, Math::round(EDSCALE)); @@ -2100,7 +2100,7 @@ void AnimationTrackEdit::_notification(int p_what) { update_mode_rect.size.x += down_icon->get_width(); bezier_edit_rect = Rect2(); } else if (animation->track_get_type(track) == Animation::TYPE_BEZIER) { - Ref bezier_icon = get_icon("EditBezier", "EditorIcons"); + Ref bezier_icon = get_theme_icon("EditBezier", "EditorIcons"); update_mode_rect.size.x += down_icon->get_width(); bezier_edit_rect.position = update_mode_rect.position + (update_mode_rect.size - bezier_icon->get_size()) / 2; bezier_edit_rect.size = bezier_icon->get_size(); @@ -2185,7 +2185,7 @@ void AnimationTrackEdit::_notification(int p_what) { { //erase - Ref icon = get_icon("Remove", "EditorIcons"); + Ref icon = get_theme_icon("Remove", "EditorIcons"); remove_rect.position.x = ofs + ((get_size().width - ofs) - icon->get_width()) / 2; remove_rect.position.y = int(get_size().height - icon->get_height()) / 2; @@ -2202,7 +2202,7 @@ void AnimationTrackEdit::_notification(int p_what) { } if (dropping_at != 0) { - Color drop_color = get_color("accent_color", "Editor"); + Color drop_color = get_theme_color("accent_color", "Editor"); if (dropping_at < 0) { draw_line(Vector2(0, 0), Vector2(get_size().width, 0), drop_color, Math::round(EDSCALE)); } else { @@ -2249,7 +2249,7 @@ void AnimationTrackEdit::draw_key_link(int p_index, float p_pixels_sec, int p_x, if (current != next) return; - Color color = get_color("font_color", "Label"); + Color color = get_theme_color("font_color", "Label"); color.a = 0.5; int from_x = MAX(p_x, p_clip_left); @@ -2273,15 +2273,15 @@ void AnimationTrackEdit::draw_key(int p_index, float p_pixels_sec, int p_x, bool const Variant &v = animation->track_get_key_value(track, p_index); Variant::Type valid_type = Variant::NIL; if (!_is_value_key_valid(v, valid_type)) { - icon_to_draw = get_icon("KeyInvalid", "EditorIcons"); + icon_to_draw = get_theme_icon("KeyInvalid", "EditorIcons"); } } Vector2 ofs(p_x - icon_to_draw->get_width() / 2, int(get_size().height - icon_to_draw->get_height()) / 2); if (animation->track_get_type(track) == Animation::TYPE_METHOD) { - Ref font = get_font("font", "Label"); - Color color = get_color("font_color", "Label"); + Ref font = get_theme_font("font", "Label"); + Color color = get_theme_color("font_color", "Label"); color.a = 0.5; Dictionary d = animation->track_get_key_value(track, p_index); @@ -2387,19 +2387,19 @@ void AnimationTrackEdit::set_animation_and_track(const Ref &p_animati update(); Ref type_icons[6] = { - get_icon("KeyValue", "EditorIcons"), - get_icon("KeyXform", "EditorIcons"), - get_icon("KeyCall", "EditorIcons"), - get_icon("KeyBezier", "EditorIcons"), - get_icon("KeyAudio", "EditorIcons"), - get_icon("KeyAnimation", "EditorIcons") + get_theme_icon("KeyValue", "EditorIcons"), + get_theme_icon("KeyXform", "EditorIcons"), + get_theme_icon("KeyCall", "EditorIcons"), + get_theme_icon("KeyBezier", "EditorIcons"), + get_theme_icon("KeyAudio", "EditorIcons"), + get_theme_icon("KeyAnimation", "EditorIcons") }; ERR_FAIL_INDEX(track, animation->get_track_count()); node_path = animation->track_get_path(p_track); type_icon = type_icons[animation->track_get_type(track)]; - selected_icon = get_icon("KeySelected", "EditorIcons"); + selected_icon = get_theme_icon("KeySelected", "EditorIcons"); } NodePath AnimationTrackEdit::get_path() const { @@ -2408,9 +2408,9 @@ NodePath AnimationTrackEdit::get_path() const { Size2 AnimationTrackEdit::get_minimum_size() const { - Ref texture = get_icon("Object", "EditorIcons"); - Ref font = get_font("font", "Label"); - int separation = get_constant("vseparation", "ItemList"); + Ref texture = get_theme_icon("Object", "EditorIcons"); + Ref font = get_theme_font("font", "Label"); + int separation = get_theme_constant("vseparation", "ItemList"); int max_h = MAX(texture->get_height(), font->get_height()); max_h = MAX(max_h, get_key_height()); @@ -2442,7 +2442,7 @@ void AnimationTrackEdit::_play_position_draw() { int px = (-timeline->get_value() + play_position_pos) * scale + timeline->get_name_limit(); if (px >= timeline->get_name_limit() && px < (get_size().width - timeline->get_buttons_width())) { - Color color = get_color("accent_color", "Editor"); + Color color = get_theme_color("accent_color", "Editor"); play_position->draw_line(Point2(px, 0), Point2(px, h), color, Math::round(2 * EDSCALE)); } } @@ -2689,14 +2689,14 @@ void AnimationTrackEdit::_gui_input(const Ref &p_event) { menu->connect("id_pressed", callable_mp(this, &AnimationTrackEdit::_menu_selected)); } menu->clear(); - menu->add_icon_item(get_icon("TrackContinuous", "EditorIcons"), TTR("Continuous"), MENU_CALL_MODE_CONTINUOUS); - menu->add_icon_item(get_icon("TrackDiscrete", "EditorIcons"), TTR("Discrete"), MENU_CALL_MODE_DISCRETE); - menu->add_icon_item(get_icon("TrackTrigger", "EditorIcons"), TTR("Trigger"), MENU_CALL_MODE_TRIGGER); - menu->add_icon_item(get_icon("TrackCapture", "EditorIcons"), TTR("Capture"), MENU_CALL_MODE_CAPTURE); + menu->add_icon_item(get_theme_icon("TrackContinuous", "EditorIcons"), TTR("Continuous"), MENU_CALL_MODE_CONTINUOUS); + menu->add_icon_item(get_theme_icon("TrackDiscrete", "EditorIcons"), TTR("Discrete"), MENU_CALL_MODE_DISCRETE); + menu->add_icon_item(get_theme_icon("TrackTrigger", "EditorIcons"), TTR("Trigger"), MENU_CALL_MODE_TRIGGER); + menu->add_icon_item(get_theme_icon("TrackCapture", "EditorIcons"), TTR("Capture"), MENU_CALL_MODE_CAPTURE); menu->set_as_minsize(); - Vector2 popup_pos = get_global_position() + update_mode_rect.position + Vector2(0, update_mode_rect.size.height); - menu->set_global_position(popup_pos); + Vector2 popup_pos = get_screen_position() + update_mode_rect.position + Vector2(0, update_mode_rect.size.height); + menu->set_position(popup_pos); menu->popup(); accept_event(); } @@ -2708,13 +2708,13 @@ void AnimationTrackEdit::_gui_input(const Ref &p_event) { menu->connect("id_pressed", callable_mp(this, &AnimationTrackEdit::_menu_selected)); } menu->clear(); - menu->add_icon_item(get_icon("InterpRaw", "EditorIcons"), TTR("Nearest"), MENU_INTERPOLATION_NEAREST); - menu->add_icon_item(get_icon("InterpLinear", "EditorIcons"), TTR("Linear"), MENU_INTERPOLATION_LINEAR); - menu->add_icon_item(get_icon("InterpCubic", "EditorIcons"), TTR("Cubic"), MENU_INTERPOLATION_CUBIC); + menu->add_icon_item(get_theme_icon("InterpRaw", "EditorIcons"), TTR("Nearest"), MENU_INTERPOLATION_NEAREST); + menu->add_icon_item(get_theme_icon("InterpLinear", "EditorIcons"), TTR("Linear"), MENU_INTERPOLATION_LINEAR); + menu->add_icon_item(get_theme_icon("InterpCubic", "EditorIcons"), TTR("Cubic"), MENU_INTERPOLATION_CUBIC); menu->set_as_minsize(); - Vector2 popup_pos = get_global_position() + interp_mode_rect.position + Vector2(0, interp_mode_rect.size.height); - menu->set_global_position(popup_pos); + Vector2 popup_pos = get_screen_position() + interp_mode_rect.position + Vector2(0, interp_mode_rect.size.height); + menu->set_position(popup_pos); menu->popup(); accept_event(); } @@ -2726,12 +2726,12 @@ void AnimationTrackEdit::_gui_input(const Ref &p_event) { menu->connect("id_pressed", callable_mp(this, &AnimationTrackEdit::_menu_selected)); } menu->clear(); - menu->add_icon_item(get_icon("InterpWrapClamp", "EditorIcons"), TTR("Clamp Loop Interp"), MENU_LOOP_CLAMP); - menu->add_icon_item(get_icon("InterpWrapLoop", "EditorIcons"), TTR("Wrap Loop Interp"), MENU_LOOP_WRAP); + menu->add_icon_item(get_theme_icon("InterpWrapClamp", "EditorIcons"), TTR("Clamp Loop Interp"), MENU_LOOP_CLAMP); + menu->add_icon_item(get_theme_icon("InterpWrapLoop", "EditorIcons"), TTR("Wrap Loop Interp"), MENU_LOOP_WRAP); menu->set_as_minsize(); - Vector2 popup_pos = get_global_position() + loop_mode_rect.position + Vector2(0, loop_mode_rect.size.height); - menu->set_global_position(popup_pos); + Vector2 popup_pos = get_screen_position() + loop_mode_rect.position + Vector2(0, loop_mode_rect.size.height); + menu->set_position(popup_pos); menu->popup(); accept_event(); } @@ -2822,17 +2822,17 @@ void AnimationTrackEdit::_gui_input(const Ref &p_event) { } menu->clear(); - menu->add_icon_item(get_icon("Key", "EditorIcons"), TTR("Insert Key"), MENU_KEY_INSERT); + menu->add_icon_item(get_theme_icon("Key", "EditorIcons"), TTR("Insert Key"), MENU_KEY_INSERT); if (editor->is_selection_active()) { menu->add_separator(); - menu->add_icon_item(get_icon("Duplicate", "EditorIcons"), TTR("Duplicate Key(s)"), MENU_KEY_DUPLICATE); + menu->add_icon_item(get_theme_icon("Duplicate", "EditorIcons"), TTR("Duplicate Key(s)"), MENU_KEY_DUPLICATE); menu->add_separator(); - menu->add_icon_item(get_icon("Remove", "EditorIcons"), TTR("Delete Key(s)"), MENU_KEY_DELETE); + menu->add_icon_item(get_theme_icon("Remove", "EditorIcons"), TTR("Delete Key(s)"), MENU_KEY_DELETE); } menu->set_as_minsize(); - Vector2 popup_pos = get_global_transform().xform(get_local_mouse_position()); - menu->set_global_position(popup_pos); + Vector2 popup_pos = get_screen_transform().xform(get_local_mouse_position()); + menu->set_position(popup_pos); menu->popup(); insert_at_pos = offset + timeline->get_value(); @@ -2850,7 +2850,7 @@ void AnimationTrackEdit::_gui_input(const Ref &p_event) { } path->set_text(animation->track_get_path(track)); - Vector2 theme_ofs = path->get_stylebox("normal", "LineEdit")->get_offset(); + Vector2 theme_ofs = path->get_theme_stylebox("normal", "LineEdit")->get_offset(); path->set_position(get_global_position() + path_rect.position - theme_ofs); path->set_size(path_rect.size); path->show_modal(); @@ -3158,18 +3158,18 @@ AnimationTrackEdit *AnimationTrackEditPlugin::create_animation_track_edit(Object void AnimationTrackEditGroup::_notification(int p_what) { if (p_what == NOTIFICATION_DRAW) { - Ref font = get_font("font", "Label"); - int separation = get_constant("hseparation", "ItemList"); - Color color = get_color("font_color", "Label"); + Ref font = get_theme_font("font", "Label"); + int separation = get_theme_constant("hseparation", "ItemList"); + Color color = get_theme_color("font_color", "Label"); if (root && root->has_node(node)) { Node *n = root->get_node(node); if (n && EditorNode::get_singleton()->get_editor_selection()->is_selected(n)) { - color = get_color("accent_color", "Editor"); + color = get_theme_color("accent_color", "Editor"); } } - Color bgcol = get_color("dark_color_2", "Editor"); + Color bgcol = get_theme_color("dark_color_2", "Editor"); bgcol.a *= 0.6; draw_rect(Rect2(Point2(), get_size()), bgcol); Color linecolor = color; @@ -3187,7 +3187,7 @@ void AnimationTrackEditGroup::_notification(int p_what) { int px = (-timeline->get_value() + timeline->get_play_position()) * timeline->get_zoom_scale() + timeline->get_name_limit(); if (px >= timeline->get_name_limit() && px < (get_size().width - timeline->get_buttons_width())) { - Color accent = get_color("accent_color", "Editor"); + Color accent = get_theme_color("accent_color", "Editor"); draw_line(Point2(px, 0), Point2(px, get_size().height), accent, Math::round(2 * EDSCALE)); } } @@ -3203,8 +3203,8 @@ void AnimationTrackEditGroup::set_type_and_name(const Ref &p_type, co Size2 AnimationTrackEditGroup::get_minimum_size() const { - Ref font = get_font("font", "Label"); - int separation = get_constant("vseparation", "ItemList"); + Ref font = get_theme_font("font", "Label"); + int separation = get_theme_constant("vseparation", "ItemList"); return Vector2(0, MAX(font->get_height(), icon->get_height()) + separation); } @@ -4207,7 +4207,7 @@ void AnimationTrackEditor::_update_tracks() { if (!group_sort.has(base_path)) { AnimationTrackEditGroup *g = memnew(AnimationTrackEditGroup); - Ref icon = get_icon("Node", "EditorIcons"); + Ref icon = get_theme_icon("Node", "EditorIcons"); String name = base_path; String tooltip; if (root && root->has_node(base_path)) { @@ -4225,7 +4225,7 @@ void AnimationTrackEditor::_update_tracks() { g->set_timeline(timeline); groups.push_back(g); VBoxContainer *vb = memnew(VBoxContainer); - vb->add_constant_override("separation", 0); + vb->add_theme_constant_override("separation", 0); vb->add_child(g); track_vbox->add_child(vb); group_sort[base_path] = vb; @@ -4368,12 +4368,12 @@ MenuButton *AnimationTrackEditor::get_edit_menu() { void AnimationTrackEditor::_notification(int p_what) { if (p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_ENTER_TREE) { - zoom_icon->set_texture(get_icon("Zoom", "EditorIcons")); - snap->set_icon(get_icon("Snap", "EditorIcons")); - view_group->set_icon(get_icon(view_group->is_pressed() ? "AnimationTrackList" : "AnimationTrackGroup", "EditorIcons")); - selected_filter->set_icon(get_icon("AnimationFilter", "EditorIcons")); - imported_anim_warning->set_icon(get_icon("NodeWarning", "EditorIcons")); - main_panel->add_style_override("panel", get_stylebox("bg", "Tree")); + zoom_icon->set_texture(get_theme_icon("Zoom", "EditorIcons")); + snap->set_icon(get_theme_icon("Snap", "EditorIcons")); + view_group->set_icon(get_theme_icon(view_group->is_pressed() ? "AnimationTrackList" : "AnimationTrackGroup", "EditorIcons")); + selected_filter->set_icon(get_theme_icon("AnimationFilter", "EditorIcons")); + imported_anim_warning->set_icon(get_theme_icon("NodeWarning", "EditorIcons")); + main_panel->add_theme_style_override("panel", get_theme_stylebox("bg", "Tree")); } if (p_what == NOTIFICATION_READY) { @@ -5050,8 +5050,8 @@ float AnimationTrackEditor::get_moving_selection_offset() const { void AnimationTrackEditor::_box_selection_draw() { const Rect2 selection_rect = Rect2(Point2(), box_selection->get_size()); - box_selection->draw_rect(selection_rect, get_color("box_selection_fill_color", "Editor")); - box_selection->draw_rect(selection_rect, get_color("box_selection_stroke_color", "Editor"), false, Math::round(EDSCALE)); + box_selection->draw_rect(selection_rect, get_theme_color("box_selection_fill_color", "Editor")); + box_selection->draw_rect(selection_rect, get_theme_color("box_selection_stroke_color", "Editor"), false, Math::round(EDSCALE)); } void AnimationTrackEditor::_scroll_input(const Ref &p_event) { @@ -5266,10 +5266,10 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) { } String text; - Ref icon = get_icon("Node", "EditorIcons"); + Ref icon = get_theme_icon("Node", "EditorIcons"); if (node) { - if (has_icon(node->get_class(), "EditorIcons")) { - icon = get_icon(node->get_class(), "EditorIcons"); + if (has_theme_icon(node->get_class(), "EditorIcons")) { + icon = get_theme_icon(node->get_class(), "EditorIcons"); } text = node->get_name(); @@ -5652,7 +5652,7 @@ void AnimationTrackEditor::_cleanup_animation(Ref p_animation) { void AnimationTrackEditor::_view_group_toggle() { _update_tracks(); - view_group->set_icon(get_icon(view_group->is_pressed() ? "AnimationTrackList" : "AnimationTrackGroup", "EditorIcons")); + view_group->set_icon(get_theme_icon(view_group->is_pressed() ? "AnimationTrackList" : "AnimationTrackGroup", "EditorIcons")); } bool AnimationTrackEditor::is_grouping_tracks() { @@ -5763,7 +5763,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_constant_override("separation", 0); + timeline_vbox->add_theme_constant_override("separation", 0); info_message = memnew(Label); info_message->set_text(TTR("Select an AnimationPlayer node to create and edit animations.")); @@ -5814,7 +5814,7 @@ AnimationTrackEditor::AnimationTrackEditor() { track_vbox->set_h_size_flags(SIZE_EXPAND_FILL); scroll->set_enable_h_scroll(false); scroll->set_enable_v_scroll(true); - track_vbox->add_constant_override("separation", 0); + track_vbox->add_theme_constant_override("separation", 0); HBoxContainer *bottom_hb = memnew(HBoxContainer); add_child(bottom_hb); diff --git a/editor/animation_track_editor_plugins.cpp b/editor/animation_track_editor_plugins.cpp index fc47a69a2c..7effe114ca 100644 --- a/editor/animation_track_editor_plugins.cpp +++ b/editor/animation_track_editor_plugins.cpp @@ -42,12 +42,12 @@ /// BOOL /// int AnimationTrackEditBool::get_key_height() const { - Ref checked = get_icon("checked", "CheckBox"); + Ref checked = get_theme_icon("checked", "CheckBox"); return checked->get_height(); } Rect2 AnimationTrackEditBool::get_key_rect(int p_index, float p_pixels_sec) { - Ref checked = get_icon("checked", "CheckBox"); + Ref checked = get_theme_icon("checked", "CheckBox"); return Rect2(-checked->get_width() / 2, 0, checked->get_width(), get_size().height); } @@ -58,7 +58,7 @@ bool AnimationTrackEditBool::is_key_selectable_by_distance() const { void AnimationTrackEditBool::draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right) { bool checked = get_animation()->track_get_key_value(get_track(), p_index); - Ref icon = get_icon(checked ? "checked" : "unchecked", "CheckBox"); + Ref icon = get_theme_icon(checked ? "checked" : "unchecked", "CheckBox"); Vector2 ofs(p_x - icon->get_width() / 2, int(get_size().height - icon->get_height()) / 2); @@ -71,7 +71,7 @@ void AnimationTrackEditBool::draw_key(int p_index, float p_pixels_sec, int p_x, draw_texture(icon, ofs); if (p_selected) { - Color color = get_color("accent_color", "Editor"); + Color color = get_theme_color("accent_color", "Editor"); draw_rect_clipped(Rect2(ofs, icon->get_size()), color, false); } } @@ -80,12 +80,12 @@ void AnimationTrackEditBool::draw_key(int p_index, float p_pixels_sec, int p_x, int AnimationTrackEditColor::get_key_height() const { - Ref font = get_font("font", "Label"); + Ref font = get_theme_font("font", "Label"); return font->get_height() * 0.8; } Rect2 AnimationTrackEditColor::get_key_rect(int p_index, float p_pixels_sec) { - Ref font = get_font("font", "Label"); + Ref font = get_theme_font("font", "Label"); int fh = font->get_height() * 0.8; return Rect2(-fh / 2, 0, fh, get_size().height); } @@ -97,7 +97,7 @@ bool AnimationTrackEditColor::is_key_selectable_by_distance() const { void AnimationTrackEditColor::draw_key_link(int p_index, float p_pixels_sec, int p_x, int p_next_x, int p_clip_left, int p_clip_right) { - Ref font = get_font("font", "Label"); + Ref font = get_theme_font("font", "Label"); int fh = (font->get_height() * 0.8); int x_from = p_x + fh / 2 - 1; @@ -146,7 +146,7 @@ void AnimationTrackEditColor::draw_key(int p_index, float p_pixels_sec, int p_x, Color color = get_animation()->track_get_key_value(get_track(), p_index); - Ref font = get_font("font", "Label"); + Ref font = get_theme_font("font", "Label"); int fh = font->get_height() * 0.8; Rect2 rect(Vector2(p_x - fh / 2, int(get_size().height - fh) / 2), Size2(fh, fh)); @@ -158,7 +158,7 @@ void AnimationTrackEditColor::draw_key(int p_index, float p_pixels_sec, int p_x, draw_rect_clipped(rect, color); if (p_selected) { - Color accent = get_color("accent_color", "Editor"); + Color accent = get_theme_color("accent_color", "Editor"); draw_rect_clipped(rect, accent, false); } } @@ -185,7 +185,7 @@ int AnimationTrackEditAudio::get_key_height() const { return AnimationTrackEdit::get_key_height(); } - Ref font = get_font("font", "Label"); + Ref font = get_theme_font("font", "Label"); return int(font->get_height() * 1.5); } Rect2 AnimationTrackEditAudio::get_key_rect(int p_index, float p_pixels_sec) { @@ -218,7 +218,7 @@ Rect2 AnimationTrackEditAudio::get_key_rect(int p_index, float p_pixels_sec) { return Rect2(0, 0, len * p_pixels_sec, get_size().height); } else { - Ref font = get_font("font", "Label"); + Ref font = get_theme_font("font", "Label"); int fh = font->get_height() * 0.8; return Rect2(0, 0, fh, get_size().height); } @@ -279,7 +279,7 @@ void AnimationTrackEditAudio::draw_key(int p_index, float p_pixels_sec, int p_x, if (to_x <= from_x) return; - Ref font = get_font("font", "Label"); + Ref font = get_theme_font("font", "Label"); float fh = int(font->get_height() * 1.5); Rect2 rect = Rect2(from_x, (get_size().height - fh) / 2, to_x - from_x, fh); draw_rect(rect, Color(0.25, 0.25, 0.25)); @@ -306,19 +306,19 @@ void AnimationTrackEditAudio::draw_key(int p_index, float p_pixels_sec, int p_x, VS::get_singleton()->canvas_item_add_multiline(get_canvas_item(), lines, color); if (p_selected) { - Color accent = get_color("accent_color", "Editor"); + Color accent = get_theme_color("accent_color", "Editor"); draw_rect(rect, accent, false); } } else { - Ref font = get_font("font", "Label"); + Ref font = get_theme_font("font", "Label"); int fh = font->get_height() * 0.8; Rect2 rect(Vector2(p_x, int(get_size().height - fh) / 2), Size2(fh, fh)); - Color color = get_color("font_color", "Label"); + Color color = get_theme_color("font_color", "Label"); draw_rect(rect, color); if (p_selected) { - Color accent = get_color("accent_color", "Editor"); + Color accent = get_theme_color("accent_color", "Editor"); draw_rect(rect, accent, false); } } @@ -344,7 +344,7 @@ int AnimationTrackEditSpriteFrame::get_key_height() const { return AnimationTrackEdit::get_key_height(); } - Ref font = get_font("font", "Label"); + Ref font = get_theme_font("font", "Label"); return int(font->get_height() * 2); } Rect2 AnimationTrackEditSpriteFrame::get_key_rect(int p_index, float p_pixels_sec) { @@ -413,7 +413,7 @@ Rect2 AnimationTrackEditSpriteFrame::get_key_rect(int p_index, float p_pixels_se size = size.floor(); - Ref font = get_font("font", "Label"); + Ref font = get_theme_font("font", "Label"); int height = int(font->get_height() * 2); int width = height * size.width / size.height; @@ -507,7 +507,7 @@ void AnimationTrackEditSpriteFrame::draw_key(int p_index, float p_pixels_sec, in region.size = texture->get_size(); } - Ref font = get_font("font", "Label"); + Ref font = get_theme_font("font", "Label"); int height = int(font->get_height() * 2); int width = height * region.size.width / region.size.height; @@ -520,7 +520,7 @@ void AnimationTrackEditSpriteFrame::draw_key(int p_index, float p_pixels_sec, in if (rect.position.x > p_clip_right) return; - Color accent = get_color("accent_color", "Editor"); + Color accent = get_theme_color("accent_color", "Editor"); Color bg = accent; bg.a = 0.15; @@ -551,7 +551,7 @@ int AnimationTrackEditSubAnim::get_key_height() const { return AnimationTrackEdit::get_key_height(); } - Ref font = get_font("font", "Label"); + Ref font = get_theme_font("font", "Label"); return int(font->get_height() * 1.5); } Rect2 AnimationTrackEditSubAnim::get_key_rect(int p_index, float p_pixels_sec) { @@ -580,7 +580,7 @@ Rect2 AnimationTrackEditSubAnim::get_key_rect(int p_index, float p_pixels_sec) { return Rect2(0, 0, len * p_pixels_sec, get_size().height); } else { - Ref font = get_font("font", "Label"); + Ref font = get_theme_font("font", "Label"); int fh = font->get_height() * 0.8; return Rect2(0, 0, fh, get_size().height); } @@ -633,12 +633,12 @@ void AnimationTrackEditSubAnim::draw_key(int p_index, float p_pixels_sec, int p_ if (to_x <= from_x) return; - Ref font = get_font("font", "Label"); + Ref font = get_theme_font("font", "Label"); int fh = font->get_height() * 1.5; Rect2 rect(from_x, int(get_size().height - fh) / 2, to_x - from_x, fh); - Color color = get_color("font_color", "Label"); + Color color = get_theme_color("font_color", "Label"); Color bg = color; bg.r = 1 - color.r; bg.g = 1 - color.g; @@ -682,19 +682,19 @@ void AnimationTrackEditSubAnim::draw_key(int p_index, float p_pixels_sec, int p_ } if (p_selected) { - Color accent = get_color("accent_color", "Editor"); + Color accent = get_theme_color("accent_color", "Editor"); draw_rect(rect, accent, false); } } else { - Ref font = get_font("font", "Label"); + Ref font = get_theme_font("font", "Label"); int fh = font->get_height() * 0.8; Rect2 rect(Vector2(p_x, int(get_size().height - fh) / 2), Size2(fh, fh)); - Color color = get_color("font_color", "Label"); + Color color = get_theme_color("font_color", "Label"); draw_rect(rect, color); if (p_selected) { - Color accent = get_color("accent_color", "Editor"); + Color accent = get_theme_color("accent_color", "Editor"); draw_rect(rect, accent, false); } } @@ -709,13 +709,13 @@ void AnimationTrackEditSubAnim::set_node(Object *p_object) { int AnimationTrackEditVolumeDB::get_key_height() const { - Ref volume_texture = get_icon("ColorTrackVu", "EditorIcons"); + Ref volume_texture = get_theme_icon("ColorTrackVu", "EditorIcons"); return volume_texture->get_height() * 1.2; } void AnimationTrackEditVolumeDB::draw_bg(int p_clip_left, int p_clip_right) { - Ref volume_texture = get_icon("ColorTrackVu", "EditorIcons"); + Ref volume_texture = get_theme_icon("ColorTrackVu", "EditorIcons"); int tex_h = volume_texture->get_height(); int y_from = (get_size().height - tex_h) / 2; @@ -727,7 +727,7 @@ void AnimationTrackEditVolumeDB::draw_bg(int p_clip_left, int p_clip_right) { void AnimationTrackEditVolumeDB::draw_fg(int p_clip_left, int p_clip_right) { - Ref volume_texture = get_icon("ColorTrackVu", "EditorIcons"); + Ref volume_texture = get_theme_icon("ColorTrackVu", "EditorIcons"); int tex_h = volume_texture->get_height(); int y_from = (get_size().height - tex_h) / 2; int db0 = y_from + (24 / 80.0) * tex_h; @@ -762,12 +762,12 @@ void AnimationTrackEditVolumeDB::draw_key_link(int p_index, float p_pixels_sec, to_x = p_clip_right; } - Ref volume_texture = get_icon("ColorTrackVu", "EditorIcons"); + Ref volume_texture = get_theme_icon("ColorTrackVu", "EditorIcons"); int tex_h = volume_texture->get_height(); int y_from = (get_size().height - tex_h) / 2; - Color color = get_color("font_color", "Label"); + Color color = get_theme_color("font_color", "Label"); color.a *= 0.7; draw_line(Point2(from_x, y_from + h * tex_h), Point2(to_x, y_from + h_n * tex_h), color, 2); @@ -790,7 +790,7 @@ void AnimationTrackEditTypeAudio::_preview_changed(ObjectID p_which) { int AnimationTrackEditTypeAudio::get_key_height() const { - Ref font = get_font("font", "Label"); + Ref font = get_theme_font("font", "Label"); return int(font->get_height() * 1.5); } Rect2 AnimationTrackEditTypeAudio::get_key_rect(int p_index, float p_pixels_sec) { @@ -854,7 +854,7 @@ void AnimationTrackEditTypeAudio::draw_key(int p_index, float p_pixels_sec, int } } - Ref font = get_font("font", "Label"); + Ref font = get_theme_font("font", "Label"); float fh = int(font->get_height() * 1.5); float len = stream->get_length(); @@ -928,7 +928,7 @@ void AnimationTrackEditTypeAudio::draw_key(int p_index, float p_pixels_sec, int VS::get_singleton()->canvas_item_add_multiline(get_canvas_item(), lines, color); - Color cut_color = get_color("accent_color", "Editor"); + Color cut_color = get_theme_color("accent_color", "Editor"); cut_color.a = 0.7; if (start_ofs > 0 && pixel_begin > p_clip_left) { draw_rect(Rect2(pixel_begin, rect.position.y, 1, rect.size.y), cut_color); @@ -938,7 +938,7 @@ void AnimationTrackEditTypeAudio::draw_key(int p_index, float p_pixels_sec, int } if (p_selected) { - Color accent = get_color("accent_color", "Editor"); + Color accent = get_theme_color("accent_color", "Editor"); draw_rect(rect, accent, false); } } @@ -1133,7 +1133,7 @@ int AnimationTrackEditTypeAnimation::get_key_height() const { return AnimationTrackEdit::get_key_height(); } - Ref font = get_font("font", "Label"); + Ref font = get_theme_font("font", "Label"); return int(font->get_height() * 1.5); } Rect2 AnimationTrackEditTypeAnimation::get_key_rect(int p_index, float p_pixels_sec) { @@ -1162,7 +1162,7 @@ Rect2 AnimationTrackEditTypeAnimation::get_key_rect(int p_index, float p_pixels_ return Rect2(0, 0, len * p_pixels_sec, get_size().height); } else { - Ref font = get_font("font", "Label"); + Ref font = get_theme_font("font", "Label"); int fh = font->get_height() * 0.8; return Rect2(0, 0, fh, get_size().height); } @@ -1215,12 +1215,12 @@ void AnimationTrackEditTypeAnimation::draw_key(int p_index, float p_pixels_sec, if (to_x <= from_x) return; - Ref font = get_font("font", "Label"); + Ref font = get_theme_font("font", "Label"); int fh = font->get_height() * 1.5; Rect2 rect(from_x, int(get_size().height - fh) / 2, to_x - from_x, fh); - Color color = get_color("font_color", "Label"); + Color color = get_theme_color("font_color", "Label"); Color bg = color; bg.r = 1 - color.r; bg.g = 1 - color.g; @@ -1264,19 +1264,19 @@ void AnimationTrackEditTypeAnimation::draw_key(int p_index, float p_pixels_sec, } if (p_selected) { - Color accent = get_color("accent_color", "Editor"); + Color accent = get_theme_color("accent_color", "Editor"); draw_rect(rect, accent, false); } } else { - Ref font = get_font("font", "Label"); + Ref font = get_theme_font("font", "Label"); int fh = font->get_height() * 0.8; Rect2 rect(Vector2(p_x, int(get_size().height - fh) / 2), Size2(fh, fh)); - Color color = get_color("font_color", "Label"); + Color color = get_theme_color("font_color", "Label"); draw_rect(rect, color); if (p_selected) { - Color accent = get_color("accent_color", "Editor"); + Color accent = get_theme_color("accent_color", "Editor"); draw_rect(rect, accent, false); } } diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 33743cecaf..26bc6dfaf2 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -91,25 +91,25 @@ void FindReplaceBar::_notification(int p_what) { if (p_what == NOTIFICATION_READY) { - find_prev->set_icon(get_icon("MoveUp", "EditorIcons")); - find_next->set_icon(get_icon("MoveDown", "EditorIcons")); - hide_button->set_normal_texture(get_icon("Close", "EditorIcons")); - hide_button->set_hover_texture(get_icon("Close", "EditorIcons")); - hide_button->set_pressed_texture(get_icon("Close", "EditorIcons")); + find_prev->set_icon(get_theme_icon("MoveUp", "EditorIcons")); + find_next->set_icon(get_theme_icon("MoveDown", "EditorIcons")); + hide_button->set_normal_texture(get_theme_icon("Close", "EditorIcons")); + hide_button->set_hover_texture(get_theme_icon("Close", "EditorIcons")); + hide_button->set_pressed_texture(get_theme_icon("Close", "EditorIcons")); hide_button->set_custom_minimum_size(hide_button->get_normal_texture()->get_size()); } else if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { set_process_unhandled_input(is_visible_in_tree()); } else if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { - find_prev->set_icon(get_icon("MoveUp", "EditorIcons")); - find_next->set_icon(get_icon("MoveDown", "EditorIcons")); - hide_button->set_normal_texture(get_icon("Close", "EditorIcons")); - hide_button->set_hover_texture(get_icon("Close", "EditorIcons")); - hide_button->set_pressed_texture(get_icon("Close", "EditorIcons")); + find_prev->set_icon(get_theme_icon("MoveUp", "EditorIcons")); + find_next->set_icon(get_theme_icon("MoveDown", "EditorIcons")); + hide_button->set_normal_texture(get_theme_icon("Close", "EditorIcons")); + hide_button->set_hover_texture(get_theme_icon("Close", "EditorIcons")); + hide_button->set_pressed_texture(get_theme_icon("Close", "EditorIcons")); hide_button->set_custom_minimum_size(hide_button->get_normal_texture()->get_size()); } else if (p_what == NOTIFICATION_THEME_CHANGED) { - matches_label->add_color_override("font_color", results_count > 0 ? get_color("font_color", "Label") : get_color("error_color", "Editor")); + matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color("font_color", "Label") : get_theme_color("error_color", "Editor")); } } @@ -277,7 +277,7 @@ void FindReplaceBar::_replace_all() { } text_edit->set_v_scroll(vsval); - matches_label->add_color_override("font_color", rc > 0 ? get_color("font_color", "Label") : get_color("error_color", "Editor")); + matches_label->add_theme_color_override("font_color", rc > 0 ? get_theme_color("font_color", "Label") : get_theme_color("error_color", "Editor")); matches_label->set_text(vformat(TTR("%d replaced."), rc)); text_edit->call_deferred("connect", "text_changed", Callable(this, "_editor_text_changed")); @@ -331,7 +331,7 @@ void FindReplaceBar::_update_matches_label() { } else { matches_label->show(); - matches_label->add_color_override("font_color", results_count > 0 ? get_color("font_color", "Label") : get_color("error_color", "Editor")); + matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color("font_color", "Label") : get_theme_color("error_color", "Editor")); matches_label->set_text(vformat(results_count == 1 ? TTR("%d match.") : TTR("%d matches."), results_count)); } } @@ -712,7 +712,7 @@ void CodeTextEditor::_text_editor_gui_input(const Ref &p_event) { Ref magnify_gesture = p_event; if (magnify_gesture.is_valid()) { - Ref font = text_editor->get_font("font"); + Ref font = text_editor->get_theme_font("font"); if (font.is_valid()) { if (font->get_size() != (int)font_size) { @@ -760,7 +760,7 @@ void CodeTextEditor::_zoom_changed() { } void CodeTextEditor::_reset_zoom() { - Ref font = text_editor->get_font("font"); // Reset source font size to default. + Ref font = text_editor->get_theme_font("font"); // Reset source font size to default. if (font.is_valid()) { EditorSettings::get_singleton()->set("interface/editor/code_font_size", 14); @@ -828,41 +828,41 @@ Ref CodeTextEditor::_get_completion_icon(const ScriptCodeCompletionOp Ref tex; switch (p_option.kind) { case ScriptCodeCompletionOption::KIND_CLASS: { - if (has_icon(p_option.display, "EditorIcons")) { - tex = get_icon(p_option.display, "EditorIcons"); + if (has_theme_icon(p_option.display, "EditorIcons")) { + tex = get_theme_icon(p_option.display, "EditorIcons"); } else { - tex = get_icon("Object", "EditorIcons"); + tex = get_theme_icon("Object", "EditorIcons"); } } break; case ScriptCodeCompletionOption::KIND_ENUM: - tex = get_icon("Enum", "EditorIcons"); + tex = get_theme_icon("Enum", "EditorIcons"); break; case ScriptCodeCompletionOption::KIND_FILE_PATH: - tex = get_icon("File", "EditorIcons"); + tex = get_theme_icon("File", "EditorIcons"); break; case ScriptCodeCompletionOption::KIND_NODE_PATH: - tex = get_icon("NodePath", "EditorIcons"); + tex = get_theme_icon("NodePath", "EditorIcons"); break; case ScriptCodeCompletionOption::KIND_VARIABLE: - tex = get_icon("Variant", "EditorIcons"); + tex = get_theme_icon("Variant", "EditorIcons"); break; case ScriptCodeCompletionOption::KIND_CONSTANT: - tex = get_icon("MemberConstant", "EditorIcons"); + tex = get_theme_icon("MemberConstant", "EditorIcons"); break; case ScriptCodeCompletionOption::KIND_MEMBER: - tex = get_icon("MemberProperty", "EditorIcons"); + tex = get_theme_icon("MemberProperty", "EditorIcons"); break; case ScriptCodeCompletionOption::KIND_SIGNAL: - tex = get_icon("MemberSignal", "EditorIcons"); + tex = get_theme_icon("MemberSignal", "EditorIcons"); break; case ScriptCodeCompletionOption::KIND_FUNCTION: - tex = get_icon("MemberMethod", "EditorIcons"); + tex = get_theme_icon("MemberMethod", "EditorIcons"); break; case ScriptCodeCompletionOption::KIND_PLAIN_TEXT: - tex = get_icon("CubeMesh", "EditorIcons"); + tex = get_theme_icon("CubeMesh", "EditorIcons"); break; default: - tex = get_icon("String", "EditorIcons"); + tex = get_theme_icon("String", "EditorIcons"); break; } return tex; @@ -877,7 +877,7 @@ void CodeTextEditor::_font_resize_timeout() { bool CodeTextEditor::_add_font_size(int p_delta) { - Ref font = text_editor->get_font("font"); + Ref font = text_editor->get_theme_font("font"); if (font.is_valid()) { int new_size = CLAMP(font->get_size() + p_delta, 8 * EDSCALE, 96 * EDSCALE); @@ -1454,18 +1454,18 @@ void CodeTextEditor::goto_error() { void CodeTextEditor::_update_font() { - text_editor->add_font_override("font", get_font("source", "EditorFonts")); + text_editor->add_theme_font_override("font", get_theme_font("source", "EditorFonts")); - error->add_font_override("font", get_font("status_source", "EditorFonts")); - error->add_color_override("font_color", get_color("error_color", "Editor")); + error->add_theme_font_override("font", get_theme_font("status_source", "EditorFonts")); + error->add_theme_color_override("font_color", get_theme_color("error_color", "Editor")); - Ref status_bar_font = get_font("status_source", "EditorFonts"); - error->add_font_override("font", status_bar_font); + Ref status_bar_font = get_theme_font("status_source", "EditorFonts"); + error->add_theme_font_override("font", status_bar_font); int count = status_bar->get_child_count(); for (int i = 0; i < count; i++) { Control *n = Object::cast_to(status_bar->get_child(i)); if (n) - n->add_font_override("font", status_bar_font); + n->add_theme_font_override("font", status_bar_font); } } @@ -1516,7 +1516,7 @@ void CodeTextEditor::_set_show_warnings_panel(bool p_show) { } void CodeTextEditor::_toggle_scripts_pressed() { - toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->toggle_scripts_panel() ? get_icon("Back", "EditorIcons") : get_icon("Forward", "EditorIcons")); + toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->toggle_scripts_panel() ? get_theme_icon("Back", "EditorIcons") : get_theme_icon("Forward", "EditorIcons")); } void CodeTextEditor::_error_pressed(const Ref &p_event) { @@ -1540,8 +1540,8 @@ void CodeTextEditor::_notification(int p_what) { _update_font(); } break; case NOTIFICATION_ENTER_TREE: { - warning_button->set_icon(get_icon("NodeWarning", "EditorIcons")); - add_constant_override("separation", 4 * EDSCALE); + warning_button->set_icon(get_theme_icon("NodeWarning", "EditorIcons")); + add_theme_constant_override("separation", 4 * EDSCALE); } break; case NOTIFICATION_VISIBILITY_CHANGED: { if (toggle_scripts_button->is_visible()) { @@ -1650,7 +1650,7 @@ void CodeTextEditor::show_toggle_scripts_button() { } void CodeTextEditor::update_toggle_scripts_button() { - toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->is_scripts_panel_toggled() ? get_icon("Back", "EditorIcons") : get_icon("Forward", "EditorIcons")); + toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->is_scripts_panel_toggled() ? get_theme_icon("Back", "EditorIcons") : get_theme_icon("Forward", "EditorIcons")); toggle_scripts_button->set_tooltip(TTR("Toggle Scripts Panel") + " (" + ED_GET_SHORTCUT("script_editor/toggle_scripts_panel")->get_as_text() + ")"); } @@ -1729,8 +1729,8 @@ CodeTextEditor::CodeTextEditor() { warning_count_label->set_default_cursor_shape(CURSOR_POINTING_HAND); warning_count_label->set_mouse_filter(MOUSE_FILTER_STOP); warning_count_label->set_tooltip(TTR("Warnings")); - warning_count_label->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("warning_color", "Editor")); - warning_count_label->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts")); + warning_count_label->add_theme_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_theme_color("warning_color", "Editor")); + warning_count_label->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font("status_source", "EditorFonts")); warning_count_label->connect("gui_input", callable_mp(this, &CodeTextEditor::_warning_label_gui_input)); is_warnings_panel_opened = false; @@ -1740,7 +1740,7 @@ CodeTextEditor::CodeTextEditor() { line_and_col_txt = memnew(Label); status_bar->add_child(line_and_col_txt); line_and_col_txt->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER); - line_and_col_txt->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts")); + line_and_col_txt->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font("status_source", "EditorFonts")); line_and_col_txt->set_tooltip(TTR("Line and column numbers.")); line_and_col_txt->set_mouse_filter(MOUSE_FILTER_STOP); diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index 9df75de8e8..7f03fd30f0 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -341,7 +341,7 @@ void ConnectDialog::init(ConnectionData c, bool bEdit) { void ConnectDialog::popup_dialog(const String &p_for_signal) { from_signal->set_text(p_for_signal); - error_label->add_color_override("font_color", error_label->get_color("error_color", "Editor")); + error_label->add_theme_color_override("font_color", error_label->get_theme_color("error_color", "Editor")); if (!advanced->is_pressed()) error_label->set_visible(!_find_first_script(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root())); @@ -497,7 +497,7 @@ ConnectDialog::~ConnectDialog() { Control *ConnectionsDockTree::make_custom_tooltip(const String &p_text) const { EditorHelpBit *help_bit = memnew(EditorHelpBit); - help_bit->add_style_override("panel", get_stylebox("panel", "TooltipPanel")); + help_bit->add_theme_style_override("panel", get_theme_stylebox("panel", "TooltipPanel")); help_bit->get_rich_text()->set_fixed_size_to_width(360 * EDSCALE); String text = TTR("Signal:") + " [u][b]" + p_text.get_slice("::", 0) + "[/b][/u]"; @@ -907,21 +907,21 @@ void ConnectionsDock::update_tree() { else name = scr->get_class(); - if (has_icon(scr->get_class(), "EditorIcons")) { - icon = get_icon(scr->get_class(), "EditorIcons"); + if (has_theme_icon(scr->get_class(), "EditorIcons")) { + icon = get_theme_icon(scr->get_class(), "EditorIcons"); } } } else { ClassDB::get_signal_list(base, &node_signals2, true); - if (has_icon(base, "EditorIcons")) { - icon = get_icon(base, "EditorIcons"); + if (has_theme_icon(base, "EditorIcons")) { + icon = get_theme_icon(base, "EditorIcons"); } name = base; } if (!icon.is_valid()) { - icon = get_icon("Object", "EditorIcons"); + icon = get_theme_icon("Object", "EditorIcons"); } TreeItem *pitem = NULL; @@ -932,7 +932,7 @@ void ConnectionsDock::update_tree() { pitem->set_icon(0, icon); pitem->set_selectable(0, false); pitem->set_editable(0, false); - pitem->set_custom_bg_color(0, get_color("prop_subsection", "Editor")); + pitem->set_custom_bg_color(0, get_theme_color("prop_subsection", "Editor")); node_signals2.sort(); } @@ -968,7 +968,7 @@ void ConnectionsDock::update_tree() { sinfo["name"] = signal_name; sinfo["args"] = argnames; item->set_metadata(0, sinfo); - item->set_icon(0, get_icon("Signal", "EditorIcons")); + item->set_icon(0, get_theme_icon("Signal", "EditorIcons")); // Set tooltip with the signal's documentation. { @@ -1043,7 +1043,7 @@ void ConnectionsDock::update_tree() { item2->set_text(0, path); Connection cd = c; item2->set_metadata(0, cd); - item2->set_icon(0, get_icon("Slot", "EditorIcons")); + item2->set_icon(0, get_theme_icon("Slot", "EditorIcons")); } } @@ -1106,7 +1106,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_constant_override("separation", 3 * EDSCALE); + add_theme_constant_override("separation", 3 * EDSCALE); } ConnectionsDock::~ConnectionsDock() { diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index 4524816a79..6210b580ba 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -193,7 +193,7 @@ void CreateDialog::add_type(const String &p_type, HashMap &p item->set_text(0, p_type + " (" + ScriptServer::get_global_class_path(p_type).get_file() + ")"); } if (!can_instance) { - item->set_custom_color(0, search_options->get_color("disabled_font_color", "Editor")); + item->set_custom_color(0, search_options->get_theme_color("disabled_font_color", "Editor")); item->set_selectable(0, false); } else if (!(*to_select && (*to_select)->get_text(0) == search_box->get_text())) { String search_term = search_box->get_text().to_lower(); @@ -310,8 +310,8 @@ void CreateDialog::_update_search() { EditorData &ed = EditorNode::get_editor_data(); root->set_text(0, base_type); - if (search_options->has_icon(base_type, "EditorIcons")) { - root->set_icon(0, search_options->get_icon(base_type, "EditorIcons")); + if (search_options->has_theme_icon(base_type, "EditorIcons")) { + root->set_icon(0, search_options->get_theme_icon(base_type, "EditorIcons")); } TreeItem *to_select = search_box->get_text() == base_type ? root : NULL; @@ -460,9 +460,9 @@ void CreateDialog::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { connect("confirmed", callable_mp(this, &CreateDialog::_confirmed)); - search_box->set_right_icon(search_options->get_icon("Search", "EditorIcons")); + search_box->set_right_icon(search_options->get_theme_icon("Search", "EditorIcons")); search_box->set_clear_button_enabled(true); - favorite->set_icon(search_options->get_icon("Favorites", "EditorIcons")); + favorite->set_icon(search_options->get_theme_icon("Favorites", "EditorIcons")); } break; case NOTIFICATION_EXIT_TREE: { disconnect("confirmed", callable_mp(this, &CreateDialog::_confirmed)); @@ -764,7 +764,7 @@ CreateDialog::CreateDialog() { #warning cant forward drag data to a non control, must be fixed #endif //favorites->set_drag_forwarding(this); - favorites->add_constant_override("draw_guides", 1); + favorites->add_theme_constant_override("draw_guides", 1); VBoxContainer *rec_vb = memnew(VBoxContainer); vsc->add_child(rec_vb); @@ -778,7 +778,7 @@ CreateDialog::CreateDialog() { recent->set_allow_reselect(true); recent->connect("cell_selected", callable_mp(this, &CreateDialog::_history_selected)); recent->connect("item_activated", callable_mp(this, &CreateDialog::_history_activated)); - recent->add_constant_override("draw_guides", 1); + recent->add_theme_constant_override("draw_guides", 1); VBoxContainer *vbc = memnew(VBoxContainer); hsc->add_child(vbc); diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp index f4a8102b79..5c9b977247 100644 --- a/editor/debugger/editor_debugger_node.cpp +++ b/editor/debugger/editor_debugger_node.cpp @@ -53,8 +53,8 @@ EditorDebuggerNode::EditorDebuggerNode() { if (!singleton) singleton = this; - add_constant_override("margin_left", -EditorNode::get_singleton()->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_LEFT)); - add_constant_override("margin_right", -EditorNode::get_singleton()->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_RIGHT)); + add_theme_constant_override("margin_left", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_LEFT)); + add_theme_constant_override("margin_right", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_RIGHT)); tabs = memnew(TabContainer); tabs->set_tab_align(TabContainer::ALIGN_LEFT); @@ -64,7 +64,7 @@ EditorDebuggerNode::EditorDebuggerNode() { Ref empty; empty.instance(); - tabs->add_style_override("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(); @@ -110,7 +110,7 @@ ScriptEditorDebugger *EditorDebuggerNode::_add_debugger() { if (tabs->get_tab_count() > 1) { node->clear_style(); tabs->set_tabs_visible(true); - tabs->add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("DebuggerPanel", "EditorStyles")); + tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("DebuggerPanel", "EditorStyles")); } return node; @@ -223,10 +223,10 @@ void EditorDebuggerNode::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { if (tabs->get_tab_count() > 1) { - add_constant_override("margin_left", -EditorNode::get_singleton()->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_LEFT)); - add_constant_override("margin_right", -EditorNode::get_singleton()->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_RIGHT)); + add_theme_constant_override("margin_left", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_LEFT)); + add_theme_constant_override("margin_right", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_RIGHT)); - tabs->add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("DebuggerPanel", "EditorStyles")); + tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("DebuggerPanel", "EditorStyles")); } } break; default: @@ -262,9 +262,9 @@ void EditorDebuggerNode::_notification(int p_what) { } else { debugger_button->set_text(TTR("Debugger") + " (" + itos(error_count + warning_count) + ")"); if (error_count == 0) { - debugger_button->set_icon(get_icon("Warning", "EditorIcons")); + debugger_button->set_icon(get_theme_icon("Warning", "EditorIcons")); } else { - debugger_button->set_icon(get_icon("Error", "EditorIcons")); + debugger_button->set_icon(get_theme_icon("Error", "EditorIcons")); } } last_error_count = error_count; @@ -371,7 +371,6 @@ void EditorDebuggerNode::set_script_debug_button(MenuButton *p_button) { script_menu->set_text(TTR("Debug")); script_menu->set_switch_on_hover(true); PopupMenu *p = script_menu->get_popup(); - p->set_hide_on_window_lose_focus(true); p->add_shortcut(ED_GET_SHORTCUT("debugger/step_into"), DEBUG_STEP); p->add_shortcut(ED_GET_SHORTCUT("debugger/step_over"), DEBUG_NEXT); p->add_separator(); diff --git a/editor/debugger/editor_debugger_tree.cpp b/editor/debugger/editor_debugger_tree.cpp index adc106eb81..427b929ccb 100644 --- a/editor/debugger/editor_debugger_tree.cpp +++ b/editor/debugger/editor_debugger_tree.cpp @@ -107,9 +107,9 @@ void EditorDebuggerTree::_scene_tree_rmb_selected(const Vector2 &p_position) { item->select(0); item_menu->clear(); - item_menu->add_icon_item(get_icon("CreateNewSceneFrom", "EditorIcons"), TTR("Save Branch as Scene"), ITEM_MENU_SAVE_REMOTE_NODE); - item_menu->add_icon_item(get_icon("CopyNodePath", "EditorIcons"), TTR("Copy Node Path"), ITEM_MENU_COPY_NODE_PATH); - item_menu->set_global_position(get_global_mouse_position()); + 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->set_position(get_screen_transform().xform(get_local_mouse_position())); item_menu->popup(); } diff --git a/editor/debugger/editor_network_profiler.cpp b/editor/debugger/editor_network_profiler.cpp index 21ef66d1aa..b8c795d9ca 100644 --- a/editor/debugger/editor_network_profiler.cpp +++ b/editor/debugger/editor_network_profiler.cpp @@ -41,14 +41,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_icon("Play", "EditorIcons")); - clear_button->set_icon(get_icon("Clear", "EditorIcons")); - incoming_bandwidth_text->set_right_icon(get_icon("ArrowDown", "EditorIcons")); - outgoing_bandwidth_text->set_right_icon(get_icon("ArrowUp", "EditorIcons")); + 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")); // This needs to be done here to set the faded color when the profiler is first opened - incoming_bandwidth_text->add_color_override("font_color_uneditable", get_color("font_color", "Editor") * Color(1, 1, 1, 0.5)); - outgoing_bandwidth_text->add_color_override("font_color_uneditable", get_color("font_color", "Editor") * Color(1, 1, 1, 0.5)); + incoming_bandwidth_text->add_theme_color_override("font_color_uneditable", get_theme_color("font_color", "Editor") * Color(1, 1, 1, 0.5)); + outgoing_bandwidth_text->add_theme_color_override("font_color_uneditable", get_theme_color("font_color", "Editor") * Color(1, 1, 1, 0.5)); } } @@ -77,10 +77,10 @@ void EditorNetworkProfiler::_update_frame() { void EditorNetworkProfiler::_activate_pressed() { if (activate->is_pressed()) { - activate->set_icon(get_icon("Stop", "EditorIcons")); + activate->set_icon(get_theme_icon("Stop", "EditorIcons")); activate->set_text(TTR("Stop")); } else { - activate->set_icon(get_icon("Play", "EditorIcons")); + activate->set_icon(get_theme_icon("Play", "EditorIcons")); activate->set_text(TTR("Start")); } emit_signal("enable_profiling", activate->is_pressed()); @@ -118,12 +118,12 @@ void EditorNetworkProfiler::set_bandwidth(int p_incoming, int p_outgoing) { outgoing_bandwidth_text->set_text(vformat(TTR("%s/s"), String::humanize_size(p_outgoing))); // Make labels more prominent when the bandwidth is greater than 0 to attract user attention - incoming_bandwidth_text->add_color_override( + incoming_bandwidth_text->add_theme_color_override( "font_color_uneditable", - get_color("font_color", "Editor") * Color(1, 1, 1, p_incoming > 0 ? 1 : 0.5)); - outgoing_bandwidth_text->add_color_override( + get_theme_color("font_color", "Editor") * Color(1, 1, 1, p_incoming > 0 ? 1 : 0.5)); + outgoing_bandwidth_text->add_theme_color_override( "font_color_uneditable", - get_color("font_color", "Editor") * Color(1, 1, 1, p_outgoing > 0 ? 1 : 0.5)); + get_theme_color("font_color", "Editor") * Color(1, 1, 1, p_outgoing > 0 ? 1 : 0.5)); } bool EditorNetworkProfiler::is_profiling() { @@ -133,7 +133,7 @@ bool EditorNetworkProfiler::is_profiling() { EditorNetworkProfiler::EditorNetworkProfiler() { HBoxContainer *hb = memnew(HBoxContainer); - hb->add_constant_override("separation", 8 * EDSCALE); + hb->add_theme_constant_override("separation", 8 * EDSCALE); add_child(hb); activate = memnew(Button); diff --git a/editor/debugger/editor_profiler.cpp b/editor/debugger/editor_profiler.cpp index ca4979563d..1577e24ac0 100644 --- a/editor/debugger/editor_profiler.cpp +++ b/editor/debugger/editor_profiler.cpp @@ -132,11 +132,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_color("error_color", "Editor"); + Color bc = get_theme_color("error_color", "Editor"); double rot = ABS(double(p_signature.hash()) / double(0x7FFFFFFF)); Color c; c.set_hsv(rot, bc.get_s(), bc.get_v()); - return c.linear_interpolate(get_color("base_color", "Editor"), 0.07); + return c.linear_interpolate(get_theme_color("base_color", "Editor"), 0.07); } void EditorProfiler::_item_edited() { @@ -176,7 +176,7 @@ void EditorProfiler::_update_plot() { } uint8_t *wr = graph_image.ptrw(); - const Color background_color = get_color("dark_color_2", "Editor"); + const Color background_color = get_theme_color("dark_color_2", "Editor"); // Clear the previous frame and set the background color. for (int i = 0; i < desired_len; i += 4) { @@ -420,10 +420,10 @@ void EditorProfiler::_update_frame() { void EditorProfiler::_activate_pressed() { if (activate->is_pressed()) { - activate->set_icon(get_icon("Stop", "EditorIcons")); + activate->set_icon(get_theme_icon("Stop", "EditorIcons")); activate->set_text(TTR("Stop")); } else { - activate->set_icon(get_icon("Play", "EditorIcons")); + activate->set_icon(get_theme_icon("Play", "EditorIcons")); activate->set_text(TTR("Start")); } emit_signal("enable_profiling", activate->is_pressed()); @@ -438,8 +438,8 @@ void EditorProfiler::_clear_pressed() { void EditorProfiler::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - activate->set_icon(get_icon("Play", "EditorIcons")); - clear_button->set_icon(get_icon("Clear", "EditorIcons")); + activate->set_icon(get_theme_icon("Play", "EditorIcons")); + clear_button->set_icon(get_theme_icon("Clear", "EditorIcons")); } } @@ -712,7 +712,7 @@ EditorProfiler::EditorProfiler() { hb->add_child(cursor_metric_edit); cursor_metric_edit->connect("value_changed", callable_mp(this, &EditorProfiler::_cursor_metric_changed)); - hb->add_constant_override("separation", 8 * EDSCALE); + hb->add_theme_constant_override("separation", 8 * EDSCALE); h_split = memnew(HSplitContainer); add_child(h_split); diff --git a/editor/debugger/editor_visual_profiler.cpp b/editor/debugger/editor_visual_profiler.cpp index 48425062d1..d2edba5970 100644 --- a/editor/debugger/editor_visual_profiler.cpp +++ b/editor/debugger/editor_visual_profiler.cpp @@ -128,11 +128,11 @@ String EditorVisualProfiler::_get_time_as_text(float p_time) { Color EditorVisualProfiler::_get_color_from_signature(const StringName &p_signature) const { - Color bc = get_color("error_color", "Editor"); + Color bc = get_theme_color("error_color", "Editor"); double rot = ABS(double(p_signature.hash()) / double(0x7FFFFFFF)); Color c; c.set_hsv(rot, bc.get_s(), bc.get_v()); - return c.linear_interpolate(get_color("base_color", "Editor"), 0.07); + return c.linear_interpolate(get_theme_color("base_color", "Editor"), 0.07); } void EditorVisualProfiler::_item_selected() { @@ -327,7 +327,7 @@ void EditorVisualProfiler::_update_frame(bool p_focus_selected) { int cursor_metric = _get_cursor_index(); - Ref track_icon = get_icon("TrackColor", "EditorIcons"); + Ref track_icon = get_theme_icon("TrackColor", "EditorIcons"); ERR_FAIL_INDEX(cursor_metric, frame_metrics.size()); @@ -418,11 +418,11 @@ void EditorVisualProfiler::_update_frame(bool p_focus_selected) { void EditorVisualProfiler::_activate_pressed() { if (activate->is_pressed()) { - activate->set_icon(get_icon("Stop", "EditorIcons")); + activate->set_icon(get_theme_icon("Stop", "EditorIcons")); activate->set_text(TTR("Stop")); _clear_pressed(); //always clear on start } else { - activate->set_icon(get_icon("Play", "EditorIcons")); + activate->set_icon(get_theme_icon("Play", "EditorIcons")); activate->set_text(TTR("Start")); } emit_signal("enable_profiling", activate->is_pressed()); @@ -437,8 +437,8 @@ void EditorVisualProfiler::_clear_pressed() { void EditorVisualProfiler::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - activate->set_icon(get_icon("Play", "EditorIcons")); - clear_button->set_icon(get_icon("Clear", "EditorIcons")); + activate->set_icon(get_theme_icon("Play", "EditorIcons")); + clear_button->set_icon(get_theme_icon("Clear", "EditorIcons")); } } @@ -446,7 +446,7 @@ void EditorVisualProfiler::_graph_tex_draw() { if (last_metric < 0) return; - Ref font = get_font("font", "Label"); + Ref font = get_theme_font("font", "Label"); if (seeking) { int max_frames = frame_metrics.size(); @@ -777,7 +777,7 @@ EditorVisualProfiler::EditorVisualProfiler() { hb->add_child(cursor_metric_edit); cursor_metric_edit->connect("value_changed", callable_mp(this, &EditorVisualProfiler::_cursor_metric_changed)); - hb->add_constant_override("separation", 8 * EDSCALE); + hb->add_theme_constant_override("separation", 8 * EDSCALE); h_split = memnew(HSplitContainer); add_child(h_split); diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index cf36397a9a..7526111eef 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -80,9 +80,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_icon("DebugSkipBreakpointsOn", "EditorIcons")); + skip_breakpoints->set_icon(get_theme_icon("DebugSkipBreakpointsOn", "EditorIcons")); else - skip_breakpoints->set_icon(get_icon("DebugSkipBreakpointsOff", "EditorIcons")); + skip_breakpoints->set_icon(get_theme_icon("DebugSkipBreakpointsOff", "EditorIcons")); Array msg; msg.push_back(skip_breakpoints_value); @@ -130,15 +130,15 @@ void ScriptEditorDebugger::update_tabs() { } else { errors_tab->set_name(TTR("Errors") + " (" + itos(error_count + warning_count) + ")"); if (error_count == 0) { - tabs->set_tab_icon(errors_tab->get_index(), get_icon("Warning", "EditorIcons")); + tabs->set_tab_icon(errors_tab->get_index(), get_theme_icon("Warning", "EditorIcons")); } else { - tabs->set_tab_icon(errors_tab->get_index(), get_icon("Error", "EditorIcons")); + tabs->set_tab_icon(errors_tab->get_index(), get_theme_icon("Error", "EditorIcons")); } } } void ScriptEditorDebugger::clear_style() { - tabs->add_style_override("panel", NULL); + tabs->add_theme_style_override("panel", NULL); } void ScriptEditorDebugger::save_node(ObjectID p_id, const String &p_file) { @@ -311,8 +311,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_icon(type, "EditorIcons")) - it->set_icon(0, get_icon(type, "EditorIcons")); + if (has_theme_icon(type, "EditorIcons")) + it->set_icon(0, get_theme_icon(type, "EditorIcons")); } vmem_total->set_tooltip(TTR("Bytes:") + " " + itos(total)); @@ -443,7 +443,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da TreeItem *error = error_tree->create_item(r); error->set_collapsed(true); - error->set_icon(0, get_icon(oe.warning ? "Warning" : "Error", "EditorIcons")); + error->set_icon(0, get_theme_icon(oe.warning ? "Warning" : "Error", "EditorIcons")); error->set_text(0, time); error->set_text_align(0, TreeItem::ALIGN_LEFT); @@ -661,13 +661,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_color_override("font_color", get_color("error_color", "Editor")); + reason->add_theme_color_override("font_color", get_theme_color("error_color", "Editor")); break; case MESSAGE_WARNING: - reason->add_color_override("font_color", get_color("warning_color", "Editor")); + reason->add_theme_color_override("font_color", get_theme_color("warning_color", "Editor")); break; default: - reason->add_color_override("font_color", get_color("success_color", "Editor")); + reason->add_theme_color_override("font_color", get_theme_color("success_color", "Editor")); } reason->set_text(p_reason); reason->set_tooltip(p_reason.word_wrap(80)); @@ -694,8 +694,8 @@ void ScriptEditorDebugger::_performance_draw() { info_message->hide(); - Ref graph_sb = get_stylebox("normal", "TextEdit"); - Ref graph_font = get_font("font", "TextEdit"); + Ref graph_sb = get_theme_stylebox("normal", "TextEdit"); + Ref graph_font = get_theme_font("font", "TextEdit"); int cols = Math::ceil(Math::sqrt((float)which.size())); int rows = Math::ceil((float)which.size() / cols); @@ -715,7 +715,7 @@ void ScriptEditorDebugger::_performance_draw() { r.position += graph_sb->get_offset(); r.size -= graph_sb->get_minimum_size(); int pi = which[i]; - Color c = get_color("accent_color", "Editor"); + Color c = get_theme_color("accent_color", "Editor"); float h = (float)which[i] / (float)(perf_items.size()); // Use a darker color on light backgrounds for better visibility float value_multiplier = EditorSettings::get_singleton()->is_dark_theme() ? 1.4 : 0.55; @@ -754,20 +754,20 @@ void ScriptEditorDebugger::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { - skip_breakpoints->set_icon(get_icon("DebugSkipBreakpointsOff", "EditorIcons")); - copy->set_icon(get_icon("ActionCopy", "EditorIcons")); + skip_breakpoints->set_icon(get_theme_icon("DebugSkipBreakpointsOff", "EditorIcons")); + copy->set_icon(get_theme_icon("ActionCopy", "EditorIcons")); - step->set_icon(get_icon("DebugStep", "EditorIcons")); - next->set_icon(get_icon("DebugNext", "EditorIcons")); - dobreak->set_icon(get_icon("Pause", "EditorIcons")); - docontinue->set_icon(get_icon("DebugContinue", "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")); 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_icon("Reload", "EditorIcons")); + vmem_refresh->set_icon(get_theme_icon("Reload", "EditorIcons")); - reason->add_color_override("font_color", get_color("error_color", "Editor")); + reason->add_theme_color_override("font_color", get_theme_color("error_color", "Editor")); } break; case NOTIFICATION_PROCESS: { @@ -830,16 +830,16 @@ void ScriptEditorDebugger::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - if (tabs->has_stylebox_override("panel")) { - tabs->add_style_override("panel", editor->get_gui_base()->get_stylebox("DebuggerPanel", "EditorStyles")); + if (tabs->has_theme_stylebox_override("panel")) { + tabs->add_theme_style_override("panel", editor->get_gui_base()->get_theme_stylebox("DebuggerPanel", "EditorStyles")); } - copy->set_icon(get_icon("ActionCopy", "EditorIcons")); - step->set_icon(get_icon("DebugStep", "EditorIcons")); - next->set_icon(get_icon("DebugNext", "EditorIcons")); - dobreak->set_icon(get_icon("Pause", "EditorIcons")); - docontinue->set_icon(get_icon("DebugContinue", "EditorIcons")); - vmem_refresh->set_icon(get_icon("Reload", "EditorIcons")); + 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")); } break; } } @@ -1389,7 +1389,7 @@ 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_icon("ActionCopy", "EditorIcons"), TTR("Copy Error"), 0); + item_menu->add_icon_item(get_theme_icon("ActionCopy", "EditorIcons"), TTR("Copy Error"), 0); } if (item_menu->get_item_count() > 0) { @@ -1405,9 +1405,9 @@ void ScriptEditorDebugger::_item_menu_id_pressed(int p_option) { String type; - if (ti->get_icon(0) == get_icon("Warning", "EditorIcons")) { + if (ti->get_icon(0) == get_theme_icon("Warning", "EditorIcons")) { type = "W "; - } else if (ti->get_icon(0) == get_icon("Error", "EditorIcons")) { + } else if (ti->get_icon(0) == get_theme_icon("Error", "EditorIcons")) { type = "E "; } @@ -1462,7 +1462,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { tabs = memnew(TabContainer); tabs->set_tab_align(TabContainer::ALIGN_LEFT); - tabs->add_style_override("panel", editor->get_gui_base()->get_stylebox("DebuggerPanel", "EditorStyles")); + tabs->add_theme_style_override("panel", editor->get_gui_base()->get_theme_stylebox("DebuggerPanel", "EditorStyles")); tabs->connect("tab_changed", callable_mp(this, &ScriptEditorDebugger::_tab_changed)); add_child(tabs); diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp index d0efa66124..8ba706d4b3 100644 --- a/editor/dependency_editor.cpp +++ b/editor/dependency_editor.cpp @@ -174,7 +174,7 @@ void DependencyEditor::_update_list() { TreeItem *root = tree->create_item(); - Ref folder = tree->get_icon("folder", "FileDialog"); + Ref folder = tree->get_theme_icon("folder", "FileDialog"); bool broken = false; @@ -422,17 +422,17 @@ void DependencyRemoveDialog::_build_removed_dependency_tree(const Vectorcreate_item(owners->get_root()); folder_item->set_text(0, rd.dependency_folder); - folder_item->set_icon(0, owners->get_icon("Folder", "EditorIcons")); + folder_item->set_icon(0, owners->get_theme_icon("Folder", "EditorIcons")); tree_items[rd.dependency_folder] = folder_item; } TreeItem *dependency_item = owners->create_item(tree_items[rd.dependency_folder]); dependency_item->set_text(0, rd.dependency); - dependency_item->set_icon(0, owners->get_icon("Warning", "EditorIcons")); + dependency_item->set_icon(0, owners->get_theme_icon("Warning", "EditorIcons")); tree_items[rd.dependency] = dependency_item; } else { TreeItem *dependency_item = owners->create_item(owners->get_root()); dependency_item->set_text(0, rd.dependency); - dependency_item->set_icon(0, owners->get_icon("Warning", "EditorIcons")); + dependency_item->set_icon(0, owners->get_theme_icon("Warning", "EditorIcons")); tree_items[rd.dependency] = dependency_item; } } @@ -678,7 +678,7 @@ bool OrphanResourcesDialog::_fill_owners(EditorFileSystemDirectory *efsd, HashMa if (p_parent) { dir_item = files->create_item(p_parent); dir_item->set_text(0, efsd->get_subdir(i)->get_name()); - dir_item->set_icon(0, files->get_icon("folder", "FileDialog")); + dir_item->set_icon(0, files->get_theme_icon("folder", "FileDialog")); } bool children = _fill_owners(efsd->get_subdir(i), refs, dir_item); @@ -717,7 +717,7 @@ bool OrphanResourcesDialog::_fill_owners(EditorFileSystemDirectory *efsd, HashMa int ds = efsd->get_file_deps(i).size(); ti->set_text(1, itos(ds)); if (ds) { - ti->add_button(1, files->get_icon("GuiVisibilityVisible", "EditorIcons"), -1, false, TTR("Show Dependencies")); + ti->add_button(1, files->get_theme_icon("GuiVisibilityVisible", "EditorIcons"), -1, false, TTR("Show Dependencies")); } ti->set_metadata(0, path); has_children = true; diff --git a/editor/editor_about.cpp b/editor/editor_about.cpp index ea1918be59..33ee95c2d8 100644 --- a/editor/editor_about.cpp +++ b/editor/editor_about.cpp @@ -40,12 +40,12 @@ void EditorAbout::_theme_changed() { Control *base = EditorNode::get_singleton()->get_gui_base(); - Ref font = base->get_font("source", "EditorFonts"); - _tpl_text->add_font_override("normal_font", font); - _tpl_text->add_constant_override("line_separation", 6 * EDSCALE); - _license_text->add_font_override("normal_font", font); - _license_text->add_constant_override("line_separation", 6 * EDSCALE); - _logo->set_texture(base->get_icon("Logo", "EditorIcons")); + Ref font = base->get_theme_font("source", "EditorFonts"); + _tpl_text->add_theme_font_override("normal_font", font); + _tpl_text->add_theme_constant_override("line_separation", 6 * EDSCALE); + _license_text->add_theme_font_override("normal_font", font); + _license_text->add_theme_constant_override("line_separation", 6 * EDSCALE); + _logo->set_texture(base->get_theme_icon("Logo", "EditorIcons")); } void EditorAbout::_notification(int p_what) { @@ -98,7 +98,7 @@ ScrollContainer *EditorAbout::_populate_list(const String &p_name, const Listset_same_column_width(true); il->set_auto_height(true); il->set_mouse_filter(Control::MOUSE_FILTER_IGNORE); - il->add_constant_override("hseparation", 16 * EDSCALE); + il->add_theme_constant_override("hseparation", 16 * EDSCALE); while (*names_ptr) { il->add_item(String::utf8(*names_ptr++), NULL, false); } @@ -124,7 +124,7 @@ EditorAbout::EditorAbout() { HBoxContainer *hbc = memnew(HBoxContainer); hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL); hbc->set_alignment(BoxContainer::ALIGN_CENTER); - hbc->add_constant_override("separation", 30 * EDSCALE); + hbc->add_theme_constant_override("separation", 30 * EDSCALE); add_child(vbc); vbc->add_child(hbc); diff --git a/editor/editor_asset_installer.cpp b/editor/editor_asset_installer.cpp index cbec6a18d8..d61fe8f08a 100644 --- a/editor/editor_asset_installer.cpp +++ b/editor/editor_asset_installer.cpp @@ -112,17 +112,17 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) { Map> extension_guess; { - extension_guess["png"] = tree->get_icon("ImageTexture", "EditorIcons"); - extension_guess["jpg"] = tree->get_icon("ImageTexture", "EditorIcons"); - extension_guess["atlastex"] = tree->get_icon("AtlasTexture", "EditorIcons"); - extension_guess["scn"] = tree->get_icon("PackedScene", "EditorIcons"); - extension_guess["tscn"] = tree->get_icon("PackedScene", "EditorIcons"); - extension_guess["shader"] = tree->get_icon("Shader", "EditorIcons"); - extension_guess["gd"] = tree->get_icon("GDScript", "EditorIcons"); - extension_guess["vs"] = tree->get_icon("VisualScript", "EditorIcons"); + extension_guess["png"] = tree->get_theme_icon("ImageTexture", "EditorIcons"); + extension_guess["jpg"] = tree->get_theme_icon("ImageTexture", "EditorIcons"); + extension_guess["atlastex"] = tree->get_theme_icon("AtlasTexture", "EditorIcons"); + extension_guess["scn"] = tree->get_theme_icon("PackedScene", "EditorIcons"); + extension_guess["tscn"] = tree->get_theme_icon("PackedScene", "EditorIcons"); + extension_guess["shader"] = tree->get_theme_icon("Shader", "EditorIcons"); + extension_guess["gd"] = tree->get_theme_icon("GDScript", "EditorIcons"); + extension_guess["vs"] = tree->get_theme_icon("VisualScript", "EditorIcons"); } - Ref generic_extension = tree->get_icon("Object", "EditorIcons"); + Ref generic_extension = tree->get_theme_icon("Object", "EditorIcons"); unzClose(pkg); @@ -131,7 +131,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) { TreeItem *root = tree->create_item(); root->set_cell_mode(0, TreeItem::CELL_MODE_CHECK); root->set_checked(0, true); - root->set_icon(0, tree->get_icon("folder", "FileDialog")); + root->set_icon(0, tree->get_theme_icon("folder", "FileDialog")); root->set_text(0, "res://"); root->set_editable(0, true); Map dir_map; @@ -180,7 +180,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) { if (isdir) { dir_map[path] = ti; ti->set_text(0, path.get_file() + "/"); - ti->set_icon(0, tree->get_icon("folder", "FileDialog")); + ti->set_icon(0, tree->get_theme_icon("folder", "FileDialog")); ti->set_metadata(0, String()); } else { String file = path.get_file(); @@ -194,7 +194,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) { String res_path = "res://" + path; if (FileAccess::exists(res_path)) { - ti->set_custom_color(0, tree->get_color("error_color", "Editor")); + ti->set_custom_color(0, tree->get_theme_color("error_color", "Editor")); ti->set_tooltip(0, vformat(TTR("%s (Already Exists)"), res_path)); ti->set_checked(0, false); } else { diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index 04f19a48ed..55bdd2070b 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -69,27 +69,27 @@ void EditorAudioBus::_notification(int p_what) { case NOTIFICATION_READY: { for (int i = 0; i < CHANNELS_MAX; i++) { - channel[i].vu_l->set_under_texture(get_icon("BusVuEmpty", "EditorIcons")); - channel[i].vu_l->set_progress_texture(get_icon("BusVuFull", "EditorIcons")); - channel[i].vu_r->set_under_texture(get_icon("BusVuEmpty", "EditorIcons")); - channel[i].vu_r->set_progress_texture(get_icon("BusVuFull", "EditorIcons")); + channel[i].vu_l->set_under_texture(get_theme_icon("BusVuEmpty", "EditorIcons")); + channel[i].vu_l->set_progress_texture(get_theme_icon("BusVuFull", "EditorIcons")); + channel[i].vu_r->set_under_texture(get_theme_icon("BusVuEmpty", "EditorIcons")); + channel[i].vu_r->set_progress_texture(get_theme_icon("BusVuFull", "EditorIcons")); channel[i].prev_active = true; } - disabled_vu = get_icon("BusVuFrozen", "EditorIcons"); + disabled_vu = get_theme_icon("BusVuFrozen", "EditorIcons"); Color solo_color = EditorSettings::get_singleton()->is_dark_theme() ? Color(1.0, 0.89, 0.22) : Color(1.0, 0.92, 0.44); Color mute_color = EditorSettings::get_singleton()->is_dark_theme() ? Color(1.0, 0.16, 0.16) : Color(1.0, 0.44, 0.44); Color bypass_color = EditorSettings::get_singleton()->is_dark_theme() ? Color(0.13, 0.8, 1.0) : Color(0.44, 0.87, 1.0); - solo->set_icon(get_icon("AudioBusSolo", "EditorIcons")); - solo->add_color_override("icon_color_pressed", solo_color); - mute->set_icon(get_icon("AudioBusMute", "EditorIcons")); - mute->add_color_override("icon_color_pressed", mute_color); - bypass->set_icon(get_icon("AudioBusBypass", "EditorIcons")); - bypass->add_color_override("icon_color_pressed", bypass_color); + solo->set_icon(get_theme_icon("AudioBusSolo", "EditorIcons")); + solo->add_theme_color_override("icon_color_pressed", solo_color); + mute->set_icon(get_theme_icon("AudioBusMute", "EditorIcons")); + mute->add_theme_color_override("icon_color_pressed", mute_color); + bypass->set_icon(get_theme_icon("AudioBusBypass", "EditorIcons")); + bypass->add_theme_color_override("icon_color_pressed", bypass_color); - bus_options->set_icon(get_icon("GuiTabMenu", "EditorIcons")); + bus_options->set_icon(get_theme_icon("GuiTabMenu", "EditorIcons")); update_bus(); set_process(true); @@ -97,15 +97,15 @@ void EditorAudioBus::_notification(int p_what) { case NOTIFICATION_DRAW: { if (is_master) { - draw_style_box(get_stylebox("disabled", "Button"), Rect2(Vector2(), get_size())); + draw_style_box(get_theme_stylebox("disabled", "Button"), Rect2(Vector2(), get_size())); } else if (has_focus()) { - draw_style_box(get_stylebox("focus", "Button"), Rect2(Vector2(), get_size())); + draw_style_box(get_theme_stylebox("focus", "Button"), Rect2(Vector2(), get_size())); } else { - draw_style_box(get_stylebox("panel", "TabContainer"), Rect2(Vector2(), get_size())); + draw_style_box(get_theme_stylebox("panel", "TabContainer"), Rect2(Vector2(), get_size())); } if (get_index() != 0 && hovering_drop) { - Color accent = get_color("accent_color", "Editor"); + Color accent = get_theme_color("accent_color", "Editor"); accent.a *= 0.7; draw_rect(Rect2(Point2(), get_size()), accent, false); } @@ -168,20 +168,20 @@ void EditorAudioBus::_notification(int p_what) { case NOTIFICATION_THEME_CHANGED: { for (int i = 0; i < CHANNELS_MAX; i++) { - channel[i].vu_l->set_under_texture(get_icon("BusVuEmpty", "EditorIcons")); - channel[i].vu_l->set_progress_texture(get_icon("BusVuFull", "EditorIcons")); - channel[i].vu_r->set_under_texture(get_icon("BusVuEmpty", "EditorIcons")); - channel[i].vu_r->set_progress_texture(get_icon("BusVuFull", "EditorIcons")); + channel[i].vu_l->set_under_texture(get_theme_icon("BusVuEmpty", "EditorIcons")); + channel[i].vu_l->set_progress_texture(get_theme_icon("BusVuFull", "EditorIcons")); + channel[i].vu_r->set_under_texture(get_theme_icon("BusVuEmpty", "EditorIcons")); + channel[i].vu_r->set_progress_texture(get_theme_icon("BusVuFull", "EditorIcons")); channel[i].prev_active = true; } - disabled_vu = get_icon("BusVuFrozen", "EditorIcons"); + disabled_vu = get_theme_icon("BusVuFrozen", "EditorIcons"); - solo->set_icon(get_icon("AudioBusSolo", "EditorIcons")); - mute->set_icon(get_icon("AudioBusMute", "EditorIcons")); - bypass->set_icon(get_icon("AudioBusBypass", "EditorIcons")); + solo->set_icon(get_theme_icon("AudioBusSolo", "EditorIcons")); + mute->set_icon(get_theme_icon("AudioBusMute", "EditorIcons")); + bypass->set_icon(get_theme_icon("AudioBusBypass", "EditorIcons")); - bus_options->set_icon(get_icon("GuiTabMenu", "EditorIcons")); + bus_options->set_icon(get_theme_icon("GuiTabMenu", "EditorIcons")); } break; case NOTIFICATION_MOUSE_EXIT: case NOTIFICATION_DRAG_END: { @@ -586,7 +586,7 @@ Variant EditorAudioBus::get_drag_data(const Point2 &p_point) { Panel *p = memnew(Panel); c->add_child(p); p->set_modulate(Color(1, 1, 1, 0.7)); - p->add_style_override("panel", get_stylebox("focus", "Button")); + p->add_theme_style_override("panel", get_theme_stylebox("focus", "Button")); p->set_size(get_size()); p->set_position(-p_point); set_drag_preview(c); @@ -819,10 +819,10 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { Ref sbempty = memnew(StyleBoxEmpty); for (int i = 0; i < hbc->get_child_count(); i++) { Control *child = Object::cast_to(hbc->get_child(i)); - child->add_style_override("normal", sbempty); - child->add_style_override("hover", sbempty); - child->add_style_override("focus", sbempty); - child->add_style_override("pressed", sbempty); + child->add_theme_style_override("normal", sbempty); + child->add_theme_style_override("hover", sbempty); + child->add_theme_style_override("focus", sbempty); + child->add_theme_style_override("pressed", sbempty); } HSeparator *separator = memnew(HSeparator); @@ -854,7 +854,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { audio_value_preview_box->set_as_toplevel(true); Ref panel_style = memnew(StyleBoxFlat); panel_style->set_bg_color(Color(0.0f, 0.0f, 0.0f, 0.8f)); - audio_value_preview_box->add_style_override("panel", panel_style); + audio_value_preview_box->add_theme_style_override("panel", panel_style); audio_value_preview_box->set_mouse_filter(MOUSE_FILTER_PASS); audio_value_preview_box->hide(); @@ -953,10 +953,10 @@ void EditorAudioBusDrop::_notification(int p_what) { switch (p_what) { case NOTIFICATION_DRAW: { - draw_style_box(get_stylebox("normal", "Button"), Rect2(Vector2(), get_size())); + draw_style_box(get_theme_stylebox("normal", "Button"), Rect2(Vector2(), get_size())); if (hovering_drop) { - Color accent = get_color("accent_color", "Editor"); + Color accent = get_theme_color("accent_color", "Editor"); accent.a *= 0.7; draw_rect(Rect2(Point2(), get_size()), accent, false); } @@ -1035,7 +1035,7 @@ void EditorAudioBuses::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { - bus_scroll->add_style_override("bg", get_stylebox("bg", "Tree")); + bus_scroll->add_theme_style_override("bg", get_theme_stylebox("bg", "Tree")); } break; case NOTIFICATION_READY: { @@ -1423,7 +1423,7 @@ void EditorAudioMeterNotches::add_notch(float p_normalized_offset, float p_db_va Size2 EditorAudioMeterNotches::get_minimum_size() const { - Ref font = get_font("font", "Label"); + Ref font = get_theme_font("font", "Label"); float font_height = font->get_height(); float width = 0; @@ -1460,7 +1460,7 @@ void EditorAudioMeterNotches::_notification(int p_what) { void EditorAudioMeterNotches::_draw_audio_notches() { - Ref font = get_font("font", "Label"); + Ref font = get_theme_font("font", "Label"); float font_height = font->get_height(); for (int i = 0; i < notches.size(); i++) { diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp index 5c9fd675d4..a6a383ba58 100644 --- a/editor/editor_autoload_settings.cpp +++ b/editor/editor_autoload_settings.cpp @@ -452,10 +452,10 @@ void EditorAutoloadSettings::update_autoload() { item->set_editable(2, true); item->set_text(2, TTR("Enable")); item->set_checked(2, info.is_singleton); - item->add_button(3, get_icon("Load", "EditorIcons"), BUTTON_OPEN); - item->add_button(3, get_icon("MoveUp", "EditorIcons"), BUTTON_MOVE_UP); - item->add_button(3, get_icon("MoveDown", "EditorIcons"), BUTTON_MOVE_DOWN); - item->add_button(3, get_icon("Remove", "EditorIcons"), BUTTON_DELETE); + item->add_button(3, get_theme_icon("Load", "EditorIcons"), BUTTON_OPEN); + item->add_button(3, get_theme_icon("MoveUp", "EditorIcons"), BUTTON_MOVE_UP); + item->add_button(3, get_theme_icon("MoveDown", "EditorIcons"), BUTTON_MOVE_DOWN); + item->add_button(3, get_theme_icon("Remove", "EditorIcons"), BUTTON_DELETE); item->set_selectable(3, false); } diff --git a/editor/editor_dir_dialog.cpp b/editor/editor_dir_dialog.cpp index 3162bea2ff..cb87656382 100644 --- a/editor/editor_dir_dialog.cpp +++ b/editor/editor_dir_dialog.cpp @@ -44,7 +44,7 @@ void EditorDirDialog::_update_dir(TreeItem *p_item, EditorFileSystemDirectory *p String path = p_dir->get_path(); p_item->set_metadata(0, p_dir->get_path()); - p_item->set_icon(0, tree->get_icon("Folder", "EditorIcons")); + p_item->set_icon(0, tree->get_theme_icon("Folder", "EditorIcons")); if (!p_item->get_parent()) { p_item->set_text(0, "res://"); diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp index d572280d91..6e13ec7967 100644 --- a/editor/editor_feature_profile.cpp +++ b/editor/editor_feature_profile.cpp @@ -485,7 +485,7 @@ void EditorFeatureProfileManager::_fill_classes_from(TreeItem *p_parent, const S bool disabled_editor = edited->is_class_editor_disabled(p_class); bool disabled_properties = edited->has_class_properties_disabled(p_class); if (disabled) { - class_item->set_custom_color(0, class_list->get_color("disabled_font_color", "Editor")); + class_item->set_custom_color(0, class_list->get_theme_color("disabled_font_color", "Editor")); } else if (disabled_editor && disabled_properties) { text += " " + TTR("(Editor Disabled, Properties Disabled)"); } else if (disabled_properties) { diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index 3e45855207..fca59946ae 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -59,17 +59,17 @@ void EditorFileDialog::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { // update icons - mode_thumbnails->set_icon(item_list->get_icon("FileThumbnail", "EditorIcons")); - mode_list->set_icon(item_list->get_icon("FileList", "EditorIcons")); - dir_prev->set_icon(item_list->get_icon("Back", "EditorIcons")); - dir_next->set_icon(item_list->get_icon("Forward", "EditorIcons")); - dir_up->set_icon(item_list->get_icon("ArrowUp", "EditorIcons")); - refresh->set_icon(item_list->get_icon("Reload", "EditorIcons")); - favorite->set_icon(item_list->get_icon("Favorites", "EditorIcons")); - show_hidden->set_icon(item_list->get_icon("GuiVisibilityVisible", "EditorIcons")); - - fav_up->set_icon(item_list->get_icon("MoveUp", "EditorIcons")); - fav_down->set_icon(item_list->get_icon("MoveDown", "EditorIcons")); + mode_thumbnails->set_icon(item_list->get_theme_icon("FileThumbnail", "EditorIcons")); + mode_list->set_icon(item_list->get_theme_icon("FileList", "EditorIcons")); + dir_prev->set_icon(item_list->get_theme_icon("Back", "EditorIcons")); + dir_next->set_icon(item_list->get_theme_icon("Forward", "EditorIcons")); + dir_up->set_icon(item_list->get_theme_icon("ArrowUp", "EditorIcons")); + refresh->set_icon(item_list->get_theme_icon("Reload", "EditorIcons")); + favorite->set_icon(item_list->get_theme_icon("Favorites", "EditorIcons")); + show_hidden->set_icon(item_list->get_theme_icon("GuiVisibilityVisible", "EditorIcons")); + + fav_up->set_icon(item_list->get_theme_icon("MoveUp", "EditorIcons")); + fav_down->set_icon(item_list->get_theme_icon("MoveDown", "EditorIcons")); } else if (p_what == NOTIFICATION_PROCESS) { @@ -79,7 +79,7 @@ void EditorFileDialog::_notification(int p_what) { preview_wheel_index++; if (preview_wheel_index >= 8) preview_wheel_index = 0; - Ref frame = item_list->get_icon("Progress" + itos(preview_wheel_index + 1), "EditorIcons"); + Ref frame = item_list->get_theme_icon("Progress" + itos(preview_wheel_index + 1), "EditorIcons"); preview->set_texture(frame); preview_wheel_timeout = 0.1; } @@ -93,16 +93,16 @@ void EditorFileDialog::_notification(int p_what) { set_display_mode((DisplayMode)EditorSettings::get_singleton()->get("filesystem/file_dialog/display_mode").operator int()); // update icons - mode_thumbnails->set_icon(item_list->get_icon("FileThumbnail", "EditorIcons")); - mode_list->set_icon(item_list->get_icon("FileList", "EditorIcons")); - dir_prev->set_icon(item_list->get_icon("Back", "EditorIcons")); - dir_next->set_icon(item_list->get_icon("Forward", "EditorIcons")); - dir_up->set_icon(item_list->get_icon("ArrowUp", "EditorIcons")); - refresh->set_icon(item_list->get_icon("Reload", "EditorIcons")); - favorite->set_icon(item_list->get_icon("Favorites", "EditorIcons")); - - fav_up->set_icon(item_list->get_icon("MoveUp", "EditorIcons")); - fav_down->set_icon(item_list->get_icon("MoveDown", "EditorIcons")); + mode_thumbnails->set_icon(item_list->get_theme_icon("FileThumbnail", "EditorIcons")); + mode_list->set_icon(item_list->get_theme_icon("FileList", "EditorIcons")); + dir_prev->set_icon(item_list->get_theme_icon("Back", "EditorIcons")); + dir_next->set_icon(item_list->get_theme_icon("Forward", "EditorIcons")); + dir_up->set_icon(item_list->get_theme_icon("ArrowUp", "EditorIcons")); + refresh->set_icon(item_list->get_theme_icon("Reload", "EditorIcons")); + favorite->set_icon(item_list->get_theme_icon("Favorites", "EditorIcons")); + + fav_up->set_icon(item_list->get_theme_icon("MoveUp", "EditorIcons")); + fav_down->set_icon(item_list->get_theme_icon("MoveDown", "EditorIcons")); // DO NOT CALL UPDATE FILE LIST HERE, ALL HUNDREDS OF HIDDEN DIALOGS WILL RESPOND, CALL INVALIDATE INSTEAD invalidate(); } else if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { @@ -269,8 +269,8 @@ void EditorFileDialog::_post_popup() { _request_single_thumbnail(get_current_dir().plus_file(get_current_file())); if (is_visible()) { - Ref folder = item_list->get_icon("folder", "FileDialog"); - const Color folder_color = item_list->get_color("folder_icon_modulate", "FileDialog"); + Ref folder = item_list->get_theme_icon("folder", "FileDialog"); + const Color folder_color = item_list->get_theme_color("folder_icon_modulate", "FileDialog"); recent->clear(); bool res = access == ACCESS_RESOURCES; @@ -589,16 +589,16 @@ void EditorFileDialog::_item_list_item_rmb_selected(int p_item, const Vector2 &p } if (single_item_selected) { - item_menu->add_icon_item(item_list->get_icon("ActionCopy", "EditorIcons"), TTR("Copy Path"), ITEM_MENU_COPY_PATH); + item_menu->add_icon_item(item_list->get_theme_icon("ActionCopy", "EditorIcons"), TTR("Copy Path"), ITEM_MENU_COPY_PATH); } if (allow_delete) { - item_menu->add_icon_item(item_list->get_icon("Remove", "EditorIcons"), TTR("Delete"), ITEM_MENU_DELETE, KEY_DELETE); + item_menu->add_icon_item(item_list->get_theme_icon("Remove", "EditorIcons"), TTR("Delete"), ITEM_MENU_DELETE, KEY_DELETE); } if (single_item_selected) { item_menu->add_separator(); Dictionary item_meta = item_list->get_item_metadata(p_item); String item_text = item_meta["dir"] ? TTR("Open in File Manager") : TTR("Show in File Manager"); - item_menu->add_icon_item(item_list->get_icon("Filesystem", "EditorIcons"), item_text, ITEM_MENU_SHOW_IN_EXPLORER); + item_menu->add_icon_item(item_list->get_theme_icon("Filesystem", "EditorIcons"), item_text, ITEM_MENU_SHOW_IN_EXPLORER); } if (item_menu->get_item_count() > 0) { @@ -618,11 +618,11 @@ void EditorFileDialog::_item_list_rmb_clicked(const Vector2 &p_pos) { item_menu->set_size(Size2(1, 1)); if (can_create_dir) { - item_menu->add_icon_item(item_list->get_icon("folder", "FileDialog"), TTR("New Folder..."), ITEM_MENU_NEW_FOLDER, KEY_MASK_CMD | KEY_N); + item_menu->add_icon_item(item_list->get_theme_icon("folder", "FileDialog"), TTR("New Folder..."), ITEM_MENU_NEW_FOLDER, KEY_MASK_CMD | KEY_N); } - item_menu->add_icon_item(item_list->get_icon("Reload", "EditorIcons"), TTR("Refresh"), ITEM_MENU_REFRESH, KEY_F5); + item_menu->add_icon_item(item_list->get_theme_icon("Reload", "EditorIcons"), TTR("Refresh"), ITEM_MENU_REFRESH, KEY_F5); item_menu->add_separator(); - item_menu->add_icon_item(item_list->get_icon("Filesystem", "EditorIcons"), TTR("Open in File Manager"), ITEM_MENU_SHOW_IN_EXPLORER); + item_menu->add_icon_item(item_list->get_theme_icon("Filesystem", "EditorIcons"), TTR("Open in File Manager"), ITEM_MENU_SHOW_IN_EXPLORER); item_menu->set_position(item_list->get_global_position() + p_pos); item_menu->popup(); @@ -727,11 +727,11 @@ void EditorFileDialog::update_file_list() { item_list->set_fixed_icon_size(Size2(thumbnail_size, thumbnail_size)); if (thumbnail_size < 64) { - folder_thumbnail = item_list->get_icon("FolderMediumThumb", "EditorIcons"); - file_thumbnail = item_list->get_icon("FileMediumThumb", "EditorIcons"); + folder_thumbnail = item_list->get_theme_icon("FolderMediumThumb", "EditorIcons"); + file_thumbnail = item_list->get_theme_icon("FileMediumThumb", "EditorIcons"); } else { - folder_thumbnail = item_list->get_icon("FolderBigThumb", "EditorIcons"); - file_thumbnail = item_list->get_icon("FileBigThumb", "EditorIcons"); + folder_thumbnail = item_list->get_theme_icon("FolderBigThumb", "EditorIcons"); + file_thumbnail = item_list->get_theme_icon("FileBigThumb", "EditorIcons"); } preview_vb->hide(); @@ -751,8 +751,8 @@ void EditorFileDialog::update_file_list() { dir_access->list_dir_begin(); - Ref folder = item_list->get_icon("folder", "FileDialog"); - const Color folder_color = item_list->get_color("folder_icon_modulate", "FileDialog"); + Ref folder = item_list->get_theme_icon("folder", "FileDialog"); + const Color folder_color = item_list->get_theme_color("folder_icon_modulate", "FileDialog"); List files; List dirs; @@ -1227,8 +1227,8 @@ void EditorFileDialog::_update_favorites() { bool res = access == ACCESS_RESOURCES; String current = get_current_dir(); - Ref folder_icon = item_list->get_icon("Folder", "EditorIcons"); - const Color folder_color = item_list->get_color("folder_icon_modulate", "FileDialog"); + Ref folder_icon = item_list->get_theme_icon("Folder", "EditorIcons"); + const Color folder_color = item_list->get_theme_color("folder_icon_modulate", "FileDialog"); favorites->clear(); favorite->set_pressed(false); @@ -1737,7 +1737,7 @@ EditorFileDialog::~EditorFileDialog() { void EditorLineEditFileChooser::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) - button->set_icon(get_icon("Folder", "EditorIcons")); + button->set_icon(get_theme_icon("Folder", "EditorIcons")); } void EditorLineEditFileChooser::_bind_methods() { diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 96c507edc9..23121dd093 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -46,17 +46,17 @@ DocData *EditorHelp::doc = NULL; void EditorHelp::_init_colors() { - title_color = get_color("accent_color", "Editor"); - text_color = get_color("default_color", "RichTextLabel"); - headline_color = get_color("headline_color", "EditorHelp"); + title_color = get_theme_color("accent_color", "Editor"); + text_color = get_theme_color("default_color", "RichTextLabel"); + headline_color = get_theme_color("headline_color", "EditorHelp"); base_type_color = title_color.linear_interpolate(text_color, 0.5); comment_color = text_color * Color(1, 1, 1, 0.6); symbol_color = comment_color; value_color = text_color * Color(1, 1, 1, 0.6); qualifier_color = text_color * Color(1, 1, 1, 0.8); - type_color = get_color("accent_color", "Editor").linear_interpolate(text_color, 0.5); - class_desc->add_color_override("selection_color", get_color("accent_color", "Editor") * Color(1, 1, 1, 0.4)); - class_desc->add_constant_override("line_separation", Math::round(5 * EDSCALE)); + type_color = get_theme_color("accent_color", "Editor").linear_interpolate(text_color, 0.5); + class_desc->add_theme_color_override("selection_color", get_theme_color("accent_color", "Editor") * Color(1, 1, 1, 0.4)); + class_desc->add_theme_constant_override("line_separation", Math::round(5 * EDSCALE)); } void EditorHelp::_unhandled_key_input(const Ref &p_ev) { @@ -173,14 +173,14 @@ void EditorHelp::_class_desc_input(const Ref &p_input) { void EditorHelp::_class_desc_resized() { // Add extra horizontal margins for better readability. // The margins increase as the width of the editor help container increases. - Ref doc_code_font = get_font("doc_source", "EditorFonts"); + Ref doc_code_font = get_theme_font("doc_source", "EditorFonts"); real_t char_width = doc_code_font->get_char_size('x').width; const int display_margin = MAX(30 * EDSCALE, get_parent_anchorable_rect().size.width - char_width * 120 * EDSCALE) * 0.5; - Ref class_desc_stylebox = EditorNode::get_singleton()->get_theme_base()->get_stylebox("normal", "RichTextLabel")->duplicate(); + Ref class_desc_stylebox = EditorNode::get_singleton()->get_theme_base()->get_theme_stylebox("normal", "RichTextLabel")->duplicate(); class_desc_stylebox->set_default_margin(MARGIN_LEFT, display_margin); class_desc_stylebox->set_default_margin(MARGIN_RIGHT, display_margin); - class_desc->add_style_override("normal", class_desc_stylebox); + class_desc->add_theme_style_override("normal", class_desc_stylebox); } void EditorHelp::_add_type(const String &p_type, const String &p_enum) { @@ -197,8 +197,8 @@ void EditorHelp::_add_type(const String &p_type, const String &p_enum) { t = p_enum.get_slice(".", 0); } } - const Color text_color = get_color("default_color", "RichTextLabel"); - const Color type_color = get_color("accent_color", "Editor").linear_interpolate(text_color, 0.5); + const Color text_color = get_theme_color("default_color", "RichTextLabel"); + const Color type_color = get_theme_color("accent_color", "Editor").linear_interpolate(text_color, 0.5); class_desc->push_color(type_color); if (can_ref) { if (p_enum.empty()) { @@ -346,10 +346,10 @@ void EditorHelp::_update_doc() { DocData::ClassDoc cd = doc->class_list[edited_class]; //make a copy, so we can sort without worrying - Ref doc_font = get_font("doc", "EditorFonts"); - Ref doc_bold_font = get_font("doc_bold", "EditorFonts"); - Ref doc_title_font = get_font("doc_title", "EditorFonts"); - Ref doc_code_font = get_font("doc_source", "EditorFonts"); + Ref doc_font = get_theme_font("doc", "EditorFonts"); + Ref doc_bold_font = get_theme_font("doc_bold", "EditorFonts"); + Ref doc_title_font = get_theme_font("doc_title", "EditorFonts"); + Ref doc_code_font = get_theme_font("doc_source", "EditorFonts"); String link_color_text = title_color.to_html(false); // Class name @@ -1072,7 +1072,7 @@ void EditorHelp::_update_doc() { if (cd.properties[i].description.strip_edges() != String()) { _add_text(DTR(cd.properties[i].description)); } else { - class_desc->add_image(get_icon("Error", "EditorIcons")); + class_desc->add_image(get_theme_icon("Error", "EditorIcons")); class_desc->add_text(" "); class_desc->push_color(comment_color); class_desc->append_bbcode(TTR("There is currently no description for this property. Please help us by [color=$color][url=$url]contributing one[/url][/color]!").replace("$url", CONTRIBUTE_URL).replace("$color", link_color_text)); @@ -1125,7 +1125,7 @@ void EditorHelp::_update_doc() { if (methods_filtered[i].description.strip_edges() != String()) { _add_text(DTR(methods_filtered[i].description)); } else { - class_desc->add_image(get_icon("Error", "EditorIcons")); + class_desc->add_image(get_theme_icon("Error", "EditorIcons")); class_desc->add_text(" "); class_desc->push_color(comment_color); class_desc->append_bbcode(TTR("There is currently no description for this method. Please help us by [color=$color][url=$url]contributing one[/url][/color]!").replace("$url", CONTRIBUTE_URL).replace("$color", link_color_text)); @@ -1209,12 +1209,12 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) { DocData *doc = EditorHelp::get_doc_data(); String base_path; - Ref doc_font = p_rt->get_font("doc", "EditorFonts"); - Ref doc_bold_font = p_rt->get_font("doc_bold", "EditorFonts"); - Ref doc_code_font = p_rt->get_font("doc_source", "EditorFonts"); + Ref doc_font = p_rt->get_theme_font("doc", "EditorFonts"); + Ref doc_bold_font = p_rt->get_theme_font("doc_bold", "EditorFonts"); + Ref doc_code_font = p_rt->get_theme_font("doc_source", "EditorFonts"); - Color font_color_hl = p_rt->get_color("headline_color", "EditorHelp"); - Color accent_color = p_rt->get_color("accent_color", "Editor"); + Color font_color_hl = p_rt->get_theme_color("headline_color", "EditorHelp"); + Color accent_color = p_rt->get_theme_color("accent_color", "Editor"); Color link_color = accent_color.linear_interpolate(font_color_hl, 0.8); Color code_color = accent_color.linear_interpolate(font_color_hl, 0.6); @@ -1545,7 +1545,7 @@ EditorHelp::EditorHelp() { class_desc = memnew(RichTextLabel); add_child(class_desc); class_desc->set_v_size_flags(SIZE_EXPAND_FILL); - class_desc->add_color_override("selection_color", get_color("accent_color", "Editor") * Color(1, 1, 1, 0.4)); + class_desc->add_theme_color_override("selection_color", get_theme_color("accent_color", "Editor") * Color(1, 1, 1, 0.4)); class_desc->connect("meta_clicked", callable_mp(this, &EditorHelp::_class_desc_select)); class_desc->connect("gui_input", callable_mp(this, &EditorHelp::_class_desc_input)); @@ -1612,7 +1612,7 @@ void EditorHelpBit::_notification(int p_what) { switch (p_what) { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - rich_text->add_color_override("selection_color", get_color("accent_color", "Editor") * Color(1, 1, 1, 0.4)); + rich_text->add_theme_color_override("selection_color", get_theme_color("accent_color", "Editor") * Color(1, 1, 1, 0.4)); } break; default: break; } @@ -1629,7 +1629,7 @@ EditorHelpBit::EditorHelpBit() { rich_text = memnew(RichTextLabel); add_child(rich_text); rich_text->connect("meta_clicked", callable_mp(this, &EditorHelpBit::_meta_clicked)); - rich_text->add_color_override("selection_color", get_color("accent_color", "Editor") * Color(1, 1, 1, 0.4)); + rich_text->add_theme_color_override("selection_color", get_theme_color("accent_color", "Editor") * Color(1, 1, 1, 0.4)); rich_text->set_override_selected_font_color(false); set_custom_minimum_size(Size2(0, 70 * EDSCALE)); } @@ -1693,13 +1693,13 @@ void FindBar::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { - find_prev->set_icon(get_icon("MoveUp", "EditorIcons")); - find_next->set_icon(get_icon("MoveDown", "EditorIcons")); - hide_button->set_normal_texture(get_icon("Close", "EditorIcons")); - hide_button->set_hover_texture(get_icon("Close", "EditorIcons")); - hide_button->set_pressed_texture(get_icon("Close", "EditorIcons")); + find_prev->set_icon(get_theme_icon("MoveUp", "EditorIcons")); + find_next->set_icon(get_theme_icon("MoveDown", "EditorIcons")); + hide_button->set_normal_texture(get_theme_icon("Close", "EditorIcons")); + hide_button->set_hover_texture(get_theme_icon("Close", "EditorIcons")); + hide_button->set_pressed_texture(get_theme_icon("Close", "EditorIcons")); hide_button->set_custom_minimum_size(hide_button->get_normal_texture()->get_size()); - matches_label->add_color_override("font_color", results_count > 0 ? get_color("font_color", "Label") : get_color("error_color", "Editor")); + matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color("font_color", "Label") : get_theme_color("error_color", "Editor")); } break; case NOTIFICATION_VISIBILITY_CHANGED: { @@ -1780,7 +1780,7 @@ void FindBar::_update_matches_label() { } else { matches_label->show(); - matches_label->add_color_override("font_color", results_count > 0 ? get_color("font_color", "Label") : get_color("error_color", "Editor")); + matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color("font_color", "Label") : get_theme_color("error_color", "Editor")); matches_label->set_text(vformat(results_count == 1 ? TTR("%d match.") : TTR("%d matches."), results_count)); } } diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index 9a0a26fb0a..6fba5b1b4c 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -37,11 +37,11 @@ void EditorHelpSearch::_update_icons() { - search_box->set_right_icon(results_tree->get_icon("Search", "EditorIcons")); + search_box->set_right_icon(results_tree->get_theme_icon("Search", "EditorIcons")); search_box->set_clear_button_enabled(true); - search_box->add_icon_override("right_icon", results_tree->get_icon("Search", "EditorIcons")); - case_sensitive_button->set_icon(results_tree->get_icon("MatchCase", "EditorIcons")); - hierarchy_button->set_icon(results_tree->get_icon("ClassList", "EditorIcons")); + search_box->add_theme_icon_override("right_icon", results_tree->get_theme_icon("Search", "EditorIcons")); + case_sensitive_button->set_icon(results_tree->get_theme_icon("MatchCase", "EditorIcons")); + hierarchy_button->set_icon(results_tree->get_theme_icon("ClassList", "EditorIcons")); if (is_visible()) _update_results(); @@ -481,10 +481,10 @@ TreeItem *EditorHelpSearch::Runner::_create_class_hierarchy(const ClassMatch &p_ TreeItem *EditorHelpSearch::Runner::_create_class_item(TreeItem *p_parent, const DocData::ClassDoc *p_doc, bool p_gray) { Ref icon = empty_icon; - if (ui_service->has_icon(p_doc->name, "EditorIcons")) - icon = ui_service->get_icon(p_doc->name, "EditorIcons"); + if (ui_service->has_theme_icon(p_doc->name, "EditorIcons")) + icon = ui_service->get_theme_icon(p_doc->name, "EditorIcons"); else if (ClassDB::class_exists(p_doc->name) && ClassDB::is_parent_class(p_doc->name, "Object")) - icon = ui_service->get_icon("Object", "EditorIcons"); + icon = ui_service->get_theme_icon("Object", "EditorIcons"); String tooltip = p_doc->brief_description.strip_edges(); TreeItem *item = results_tree->create_item(p_parent); @@ -559,10 +559,10 @@ TreeItem *EditorHelpSearch::Runner::_create_member_item(TreeItem *p_parent, cons Ref icon; String text; if (search_flags & SEARCH_SHOW_HIERARCHY) { - icon = ui_service->get_icon(p_icon, "EditorIcons"); + icon = ui_service->get_theme_icon(p_icon, "EditorIcons"); text = p_name; } else { - icon = ui_service->get_icon(p_icon, "EditorIcons"); + icon = ui_service->get_theme_icon(p_icon, "EditorIcons"); /*// In flat mode, show the class icon. if (ui_service->has_icon(p_class_name, "EditorIcons")) icon = ui_service->get_icon(p_class_name, "EditorIcons"); @@ -600,6 +600,6 @@ EditorHelpSearch::Runner::Runner(Control *p_icon_service, Tree *p_results_tree, results_tree(p_results_tree), term((p_search_flags & SEARCH_CASE_SENSITIVE) == 0 ? p_term.strip_edges().to_lower() : p_term.strip_edges()), search_flags(p_search_flags), - empty_icon(ui_service->get_icon("ArrowRight", "EditorIcons")), - disabled_color(ui_service->get_color("disabled_font_color", "Editor")) { + empty_icon(ui_service->get_theme_icon("ArrowRight", "EditorIcons")), + disabled_color(ui_service->get_theme_color("disabled_font_color", "Editor")) { } diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index be3ee397e8..fd0b02621c 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -41,7 +41,7 @@ Size2 EditorProperty::get_minimum_size() const { Size2 ms; - Ref font = get_font("font", "Tree"); + Ref font = get_theme_font("font", "Tree"); ms.height = font->get_height(); for (int i = 0; i < get_child_count(); i++) { @@ -62,17 +62,17 @@ Size2 EditorProperty::get_minimum_size() const { } if (keying) { - Ref key = get_icon("Key", "EditorIcons"); - ms.width += key->get_width() + get_constant("hseparator", "Tree"); + Ref key = get_theme_icon("Key", "EditorIcons"); + ms.width += key->get_width() + get_theme_constant("hseparator", "Tree"); } if (checkable) { - Ref check = get_icon("checked", "CheckBox"); - ms.width += check->get_width() + get_constant("hseparation", "CheckBox") + get_constant("hseparator", "Tree"); + Ref check = get_theme_icon("checked", "CheckBox"); + ms.width += check->get_width() + get_theme_constant("hseparation", "CheckBox") + get_theme_constant("hseparator", "Tree"); } if (bottom_editor != NULL && bottom_editor->is_visible()) { - ms.height += get_constant("vseparation", "Tree"); + ms.height += get_theme_constant("vseparation", "Tree"); Size2 bems = bottom_editor->get_combined_minimum_size(); //bems.width += get_constant("item_margin", "Tree"); ms.height += bems.height; @@ -103,7 +103,7 @@ void EditorProperty::_notification(int p_what) { { int child_room = size.width * (1.0 - split_ratio); - Ref font = get_font("font", "Tree"); + Ref font = get_theme_font("font", "Tree"); int height = font->get_height(); bool no_children = true; @@ -136,19 +136,19 @@ void EditorProperty::_notification(int p_what) { int m = 0; //get_constant("item_margin", "Tree"); - bottom_rect = Rect2(m, rect.size.height + get_constant("vseparation", "Tree"), size.width - m, bottom_editor->get_combined_minimum_size().height); + bottom_rect = Rect2(m, rect.size.height + get_theme_constant("vseparation", "Tree"), size.width - m, bottom_editor->get_combined_minimum_size().height); } if (keying) { Ref key; if (use_keying_next()) { - key = get_icon("KeyNext", "EditorIcons"); + key = get_theme_icon("KeyNext", "EditorIcons"); } else { - key = get_icon("Key", "EditorIcons"); + key = get_theme_icon("Key", "EditorIcons"); } - rect.size.x -= key->get_width() + get_constant("hseparator", "Tree"); + rect.size.x -= key->get_width() + get_theme_constant("hseparator", "Tree"); if (no_children) { text_size -= key->get_width() + 4 * EDSCALE; @@ -180,8 +180,8 @@ void EditorProperty::_notification(int p_what) { } if (p_what == NOTIFICATION_DRAW) { - Ref font = get_font("font", "Tree"); - Color dark_color = get_color("dark_color_2", "Editor"); + Ref font = get_theme_font("font", "Tree"); + Color dark_color = get_theme_color("dark_color_2", "Editor"); Size2 size = get_size(); if (bottom_editor) { @@ -191,7 +191,7 @@ void EditorProperty::_notification(int p_what) { } if (selected) { - Ref sb = get_stylebox("selected", "Tree"); + Ref sb = get_theme_stylebox("selected", "Tree"); draw_style_box(sb, Rect2(Vector2(), size)); } @@ -204,9 +204,9 @@ void EditorProperty::_notification(int p_what) { Color color; if (draw_red) { - color = get_color("error_color", "Editor"); + color = get_theme_color("error_color", "Editor"); } else { - color = get_color("property_color", "Editor"); + color = get_theme_color("property_color", "Editor"); } if (label.find(".") != -1) { color.a = 0.5; //this should be un-hacked honestly, as it's used for editor overrides @@ -218,9 +218,9 @@ void EditorProperty::_notification(int p_what) { if (checkable) { Ref checkbox; if (checked) - checkbox = get_icon("GuiChecked", "EditorIcons"); + checkbox = get_theme_icon("GuiChecked", "EditorIcons"); else - checkbox = get_icon("GuiUnchecked", "EditorIcons"); + checkbox = get_theme_icon("GuiUnchecked", "EditorIcons"); Color color2(1, 1, 1); if (check_hover) { @@ -230,16 +230,16 @@ void EditorProperty::_notification(int p_what) { } check_rect = Rect2(ofs, ((size.height - checkbox->get_height()) / 2), checkbox->get_width(), checkbox->get_height()); draw_texture(checkbox, check_rect.position, color2); - ofs += get_constant("hseparator", "Tree") + checkbox->get_width() + get_constant("hseparation", "CheckBox"); + ofs += get_theme_constant("hseparator", "Tree") + checkbox->get_width() + get_theme_constant("hseparation", "CheckBox"); text_limit -= ofs; } else { check_rect = Rect2(); } if (can_revert) { - Ref reload_icon = get_icon("ReloadSmall", "EditorIcons"); - text_limit -= reload_icon->get_width() + get_constant("hseparator", "Tree") * 2; - revert_rect = Rect2(text_limit + get_constant("hseparator", "Tree"), (size.height - reload_icon->get_height()) / 2, reload_icon->get_width(), reload_icon->get_height()); + Ref reload_icon = get_theme_icon("ReloadSmall", "EditorIcons"); + text_limit -= reload_icon->get_width() + get_theme_constant("hseparator", "Tree") * 2; + revert_rect = Rect2(text_limit + get_theme_constant("hseparator", "Tree"), (size.height - reload_icon->get_height()) / 2, reload_icon->get_width(), reload_icon->get_height()); Color color2(1, 1, 1); if (revert_hover) { @@ -260,12 +260,12 @@ void EditorProperty::_notification(int p_what) { Ref key; if (use_keying_next()) { - key = get_icon("KeyNext", "EditorIcons"); + key = get_theme_icon("KeyNext", "EditorIcons"); } else { - key = get_icon("Key", "EditorIcons"); + key = get_theme_icon("Key", "EditorIcons"); } - ofs = size.width - key->get_width() - get_constant("hseparator", "Tree"); + ofs = size.width - key->get_width() - get_theme_constant("hseparator", "Tree"); Color color2(1, 1, 1); if (keying_hover) { @@ -776,7 +776,7 @@ Control *EditorProperty::make_custom_tooltip(const String &p_text) const { tooltip_text = p_text; EditorHelpBit *help_bit = memnew(EditorHelpBit); - help_bit->add_style_override("panel", get_stylebox("panel", "TooltipPanel")); + help_bit->add_theme_style_override("panel", get_theme_stylebox("panel", "TooltipPanel")); help_bit->get_rich_text()->set_fixed_size_to_width(360 * EDSCALE); PackedStringArray slices = p_text.split("::", false); @@ -987,9 +987,9 @@ void EditorInspectorCategory::_notification(int p_what) { if (p_what == NOTIFICATION_DRAW) { draw_rect(Rect2(Vector2(), get_size()), bg_color); - Ref font = get_font("font", "Tree"); + Ref font = get_theme_font("font", "Tree"); - int hs = get_constant("hseparation", "Tree"); + int hs = get_theme_constant("hseparation", "Tree"); int w = font->get_string_size(label).width; if (icon.is_valid()) { @@ -1003,7 +1003,7 @@ void EditorInspectorCategory::_notification(int p_what) { ofs += hs + icon->get_width(); } - Color color = get_color("font_color", "Tree"); + Color color = get_theme_color("font_color", "Tree"); draw_string(font, Point2(ofs, font->get_ascent() + (get_size().height - font->get_height()) / 2).floor(), label, color, get_size().width); } } @@ -1012,7 +1012,7 @@ Control *EditorInspectorCategory::make_custom_tooltip(const String &p_text) cons tooltip_text = p_text; EditorHelpBit *help_bit = memnew(EditorHelpBit); - help_bit->add_style_override("panel", get_stylebox("panel", "TooltipPanel")); + help_bit->add_theme_style_override("panel", get_theme_stylebox("panel", "TooltipPanel")); help_bit->get_rich_text()->set_fixed_size_to_width(360 * EDSCALE); PackedStringArray slices = p_text.split("::", false); @@ -1034,7 +1034,7 @@ Control *EditorInspectorCategory::make_custom_tooltip(const String &p_text) cons Size2 EditorInspectorCategory::get_minimum_size() const { - Ref font = get_font("font", "Tree"); + Ref font = get_theme_font("font", "Tree"); Size2 ms; ms.width = 1; @@ -1042,7 +1042,7 @@ Size2 EditorInspectorCategory::get_minimum_size() const { if (icon.is_valid()) { ms.height = MAX(icon->get_height(), ms.height); } - ms.height += get_constant("vseparation", "Tree"); + ms.height += get_theme_constant("vseparation", "Tree"); return ms; } @@ -1074,14 +1074,14 @@ void EditorInspectorSection::_notification(int p_what) { if (p_what == NOTIFICATION_SORT_CHILDREN) { - Ref font = get_font("font", "Tree"); + Ref font = get_theme_font("font", "Tree"); Ref arrow; if (foldable) { if (object->editor_is_section_unfolded(section)) { - arrow = get_icon("arrow", "Tree"); + arrow = get_theme_icon("arrow", "Tree"); } else { - arrow = get_icon("arrow_collapsed", "Tree"); + arrow = get_theme_icon("arrow_collapsed", "Tree"); } } @@ -1092,8 +1092,8 @@ void EditorInspectorSection::_notification(int p_what) { offset.y = MAX(offset.y, arrow->get_height()); } - offset.y += get_constant("vseparation", "Tree"); - offset.x += get_constant("inspector_margin", "Editor"); + offset.y += get_theme_constant("vseparation", "Tree"); + offset.x += get_theme_constant("inspector_margin", "Editor"); Rect2 rect(offset, size - offset); @@ -1120,24 +1120,24 @@ void EditorInspectorSection::_notification(int p_what) { if (foldable) { if (object->editor_is_section_unfolded(section)) { - arrow = get_icon("arrow", "Tree"); + arrow = get_theme_icon("arrow", "Tree"); } else { - arrow = get_icon("arrow_collapsed", "Tree"); + arrow = get_theme_icon("arrow_collapsed", "Tree"); } } - Ref font = get_font("font", "Tree"); + Ref font = get_theme_font("font", "Tree"); int h = font->get_height(); if (arrow.is_valid()) { h = MAX(h, arrow->get_height()); } - h += get_constant("vseparation", "Tree"); + h += get_theme_constant("vseparation", "Tree"); draw_rect(Rect2(Vector2(), Vector2(get_size().width, h)), bg_color); const int arrow_margin = 3; - Color color = get_color("font_color", "Tree"); + Color color = get_theme_color("font_color", "Tree"); draw_string(font, Point2(Math::round((16 + arrow_margin) * EDSCALE), font->get_ascent() + (h - font->get_height()) / 2).floor(), label, color, get_size().width); if (arrow.is_valid()) { @@ -1163,9 +1163,9 @@ Size2 EditorInspectorSection::get_minimum_size() const { ms.height = MAX(ms.height, minsize.height); } - Ref font = get_font("font", "Tree"); - ms.height += font->get_height() + get_constant("vseparation", "Tree"); - ms.width += get_constant("inspector_margin", "Editor"); + Ref font = get_theme_font("font", "Tree"); + ms.height += font->get_height() + get_theme_constant("vseparation", "Tree"); + ms.width += get_theme_constant("inspector_margin", "Editor"); return ms; } @@ -1201,7 +1201,7 @@ void EditorInspectorSection::_gui_input(const Ref &p_event) { Ref mb = p_event; if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { - Ref font = get_font("font", "Tree"); + Ref font = get_theme_font("font", "Tree"); if (mb->get_position().y > font->get_height()) { //clicked outside return; } @@ -1488,7 +1488,7 @@ void EditorInspector::update_tree() { item_path[""] = main_vbox; - Color sscolor = get_color("prop_subsection", "Editor"); + Color sscolor = get_theme_color("prop_subsection", "Editor"); for (List>::Element *E = valid_plugins.front(); E; E = E->next()) { Ref ped = E->get(); @@ -1540,7 +1540,7 @@ void EditorInspector::update_tree() { category->icon = EditorNode::get_singleton()->get_class_icon(type, "Object"); category->label = type; - category->bg_color = get_color("prop_category", "Editor"); + category->bg_color = get_theme_color("prop_category", "Editor"); if (use_doc_hints) { StringName type2 = p.name; if (!class_descr_cache.has(type2)) { @@ -1978,9 +1978,9 @@ void EditorInspector::set_sub_inspector(bool p_enable) { return; if (sub_inspector) { - add_style_override("bg", get_stylebox("sub_inspector_bg", "Editor")); + add_theme_style_override("bg", get_theme_stylebox("sub_inspector_bg", "Editor")); } else { - add_style_override("bg", get_stylebox("bg", "Tree")); + add_theme_style_override("bg", get_theme_stylebox("bg", "Tree")); } } @@ -2203,9 +2203,9 @@ void EditorInspector::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { if (sub_inspector) { - add_style_override("bg", get_stylebox("sub_inspector_bg", "Editor")); + add_theme_style_override("bg", get_theme_stylebox("sub_inspector_bg", "Editor")); } else { - add_style_override("bg", get_stylebox("bg", "Tree")); + add_theme_style_override("bg", get_theme_stylebox("bg", "Tree")); get_tree()->connect("node_removed", callable_mp(this, &EditorInspector::_node_removed)); } } @@ -2266,9 +2266,9 @@ void EditorInspector::_notification(int p_what) { if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { if (sub_inspector) { - add_style_override("bg", get_stylebox("sub_inspector_bg", "Editor")); + add_theme_style_override("bg", get_theme_stylebox("sub_inspector_bg", "Editor")); } else if (is_inside_tree()) { - add_style_override("bg", get_stylebox("bg", "Tree")); + add_theme_style_override("bg", get_theme_stylebox("bg", "Tree")); } update_tree(); @@ -2331,7 +2331,7 @@ EditorInspector::EditorInspector() { undo_redo = NULL; main_vbox = memnew(VBoxContainer); main_vbox->set_h_size_flags(SIZE_EXPAND_FILL); - main_vbox->add_constant_override("separation", 0); + main_vbox->add_theme_constant_override("separation", 0); add_child(main_vbox); set_enable_h_scroll(false); set_enable_v_scroll(true); diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp index 0e50a5e95c..91e53edeac 100644 --- a/editor/editor_log.cpp +++ b/editor/editor_log.cpp @@ -62,12 +62,12 @@ void EditorLog::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { //button->set_icon(get_icon("Console","EditorIcons")); - log->add_font_override("normal_font", get_font("output_source", "EditorFonts")); + log->add_theme_font_override("normal_font", get_theme_font("output_source", "EditorFonts")); } else if (p_what == NOTIFICATION_THEME_CHANGED) { - Ref df_output_code = get_font("output_source", "EditorFonts"); + Ref df_output_code = get_theme_font("output_source", "EditorFonts"); if (df_output_code.is_valid()) { if (log != NULL) { - log->add_font_override("normal_font", get_font("output_source", "EditorFonts")); + log->add_theme_font_override("normal_font", get_theme_font("output_source", "EditorFonts")); } } } @@ -101,22 +101,22 @@ void EditorLog::add_message(const String &p_msg, MessageType p_type) { case MSG_TYPE_STD: { } break; case MSG_TYPE_ERROR: { - log->push_color(get_color("error_color", "Editor")); - Ref icon = get_icon("Error", "EditorIcons"); + log->push_color(get_theme_color("error_color", "Editor")); + Ref icon = get_theme_icon("Error", "EditorIcons"); log->add_image(icon); log->add_text(" "); tool_button->set_icon(icon); } break; case MSG_TYPE_WARNING: { - log->push_color(get_color("warning_color", "Editor")); - Ref icon = get_icon("Warning", "EditorIcons"); + log->push_color(get_theme_color("warning_color", "Editor")); + Ref icon = get_theme_icon("Warning", "EditorIcons"); log->add_image(icon); log->add_text(" "); tool_button->set_icon(icon); } break; case MSG_TYPE_EDITOR: { // Distinguish editor messages from messages printed by the project - log->push_color(get_color("font_color", "Editor") * Color(1, 1, 1, 0.6)); + log->push_color(get_theme_color("font_color", "Editor") * Color(1, 1, 1, 0.6)); } break; } @@ -181,7 +181,7 @@ EditorLog::EditorLog() { current = Thread::get_caller_id(); - add_constant_override("separation", get_constant("separation", "VBoxContainer")); + add_theme_constant_override("separation", get_theme_constant("separation", "VBoxContainer")); EditorNode::get_undo_redo()->set_commit_notify_callback(_undo_redo_cbk, this); } diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index a053bc39f2..291f3dc319 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -185,7 +185,7 @@ void EditorNode::_update_scene_tabs() { } scene_tabs->clear_tabs(); - Ref script_icon = gui_base->get_icon("Script", "EditorIcons"); + Ref script_icon = gui_base->get_theme_icon("Script", "EditorIcons"); for (int i = 0; i < editor_data.get_edited_scene_count(); i++) { Node *type_node = editor_data.get_edited_scene_root(i); @@ -341,7 +341,7 @@ void EditorNode::_notification(int p_what) { // update the icon itself only when the spinner is visible if (EditorSettings::get_singleton()->get("interface/editor/show_update_spinner")) { - update_spinner->set_icon(gui_base->get_icon("Progress" + itos(update_spinner_step + 1), "EditorIcons")); + update_spinner->set_icon(gui_base->get_theme_icon("Progress" + itos(update_spinner_step + 1), "EditorIcons")); } } @@ -454,17 +454,17 @@ void EditorNode::_notification(int p_what) { theme_base->set_theme(theme); gui_base->set_theme(theme); - gui_base->add_style_override("panel", gui_base->get_stylebox("Background", "EditorStyles")); - scene_root_parent->add_style_override("panel", gui_base->get_stylebox("Content", "EditorStyles")); - bottom_panel->add_style_override("panel", gui_base->get_stylebox("panel", "TabContainer")); - scene_tabs->add_style_override("tab_fg", gui_base->get_stylebox("SceneTabFG", "EditorStyles")); - scene_tabs->add_style_override("tab_bg", gui_base->get_stylebox("SceneTabBG", "EditorStyles")); + gui_base->add_theme_style_override("panel", gui_base->get_theme_stylebox("Background", "EditorStyles")); + scene_root_parent->add_theme_style_override("panel", gui_base->get_theme_stylebox("Content", "EditorStyles")); + bottom_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox("panel", "TabContainer")); + scene_tabs->add_theme_style_override("tab_fg", gui_base->get_theme_stylebox("SceneTabFG", "EditorStyles")); + scene_tabs->add_theme_style_override("tab_bg", gui_base->get_theme_stylebox("SceneTabBG", "EditorStyles")); - file_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles")); - project_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles")); - debug_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles")); - settings_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles")); - help_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles")); + file_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox("MenuHover", "EditorStyles")); + project_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox("MenuHover", "EditorStyles")); + debug_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox("MenuHover", "EditorStyles")); + settings_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox("MenuHover", "EditorStyles")); + help_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox("MenuHover", "EditorStyles")); if (EDITOR_GET("interface/scene_tabs/resize_if_many_tabs")) { scene_tabs->set_min_width(int(EDITOR_GET("interface/scene_tabs/minimum_width")) * EDSCALE); @@ -477,7 +477,7 @@ void EditorNode::_notification(int p_what) { // debugger area if (EditorDebuggerNode::get_singleton()->is_visible()) - bottom_panel->add_style_override("panel", gui_base->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")); + bottom_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")); // update_icons for (int i = 0; i < singleton->main_editor_buttons.size(); i++) { @@ -488,36 +488,36 @@ void EditorNode::_notification(int p_what) { if (icon.is_valid()) { tb->set_icon(icon); - } else if (singleton->gui_base->has_icon(p_editor->get_name(), "EditorIcons")) { - tb->set_icon(singleton->gui_base->get_icon(p_editor->get_name(), "EditorIcons")); + } else if (singleton->gui_base->has_theme_icon(p_editor->get_name(), "EditorIcons")) { + tb->set_icon(singleton->gui_base->get_theme_icon(p_editor->get_name(), "EditorIcons")); } } _build_icon_type_cache(); - play_button->set_icon(gui_base->get_icon("MainPlay", "EditorIcons")); - play_scene_button->set_icon(gui_base->get_icon("PlayScene", "EditorIcons")); - play_custom_scene_button->set_icon(gui_base->get_icon("PlayCustom", "EditorIcons")); - pause_button->set_icon(gui_base->get_icon("Pause", "EditorIcons")); - stop_button->set_icon(gui_base->get_icon("Stop", "EditorIcons")); + play_button->set_icon(gui_base->get_theme_icon("MainPlay", "EditorIcons")); + play_scene_button->set_icon(gui_base->get_theme_icon("PlayScene", "EditorIcons")); + play_custom_scene_button->set_icon(gui_base->get_theme_icon("PlayCustom", "EditorIcons")); + pause_button->set_icon(gui_base->get_theme_icon("Pause", "EditorIcons")); + stop_button->set_icon(gui_base->get_theme_icon("Stop", "EditorIcons")); - prev_scene->set_icon(gui_base->get_icon("PrevScene", "EditorIcons")); - distraction_free->set_icon(gui_base->get_icon("DistractionFree", "EditorIcons")); - scene_tab_add->set_icon(gui_base->get_icon("Add", "EditorIcons")); + prev_scene->set_icon(gui_base->get_theme_icon("PrevScene", "EditorIcons")); + distraction_free->set_icon(gui_base->get_theme_icon("DistractionFree", "EditorIcons")); + scene_tab_add->set_icon(gui_base->get_theme_icon("Add", "EditorIcons")); - bottom_panel_raise->set_icon(gui_base->get_icon("ExpandBottomDock", "EditorIcons")); + bottom_panel_raise->set_icon(gui_base->get_theme_icon("ExpandBottomDock", "EditorIcons")); // clear_button->set_icon(gui_base->get_icon("Close", "EditorIcons")); don't have access to that node. needs to become a class property dock_tab_move_left->set_icon(theme->get_icon("Back", "EditorIcons")); dock_tab_move_right->set_icon(theme->get_icon("Forward", "EditorIcons")); PopupMenu *p = help_menu->get_popup(); - p->set_item_icon(p->get_item_index(HELP_SEARCH), gui_base->get_icon("HelpSearch", "EditorIcons")); - p->set_item_icon(p->get_item_index(HELP_DOCS), gui_base->get_icon("Instance", "EditorIcons")); - p->set_item_icon(p->get_item_index(HELP_QA), gui_base->get_icon("Instance", "EditorIcons")); - p->set_item_icon(p->get_item_index(HELP_ISSUES), gui_base->get_icon("Instance", "EditorIcons")); - p->set_item_icon(p->get_item_index(HELP_COMMUNITY), gui_base->get_icon("Instance", "EditorIcons")); - p->set_item_icon(p->get_item_index(HELP_ABOUT), gui_base->get_icon("Godot", "EditorIcons")); + p->set_item_icon(p->get_item_index(HELP_SEARCH), gui_base->get_theme_icon("HelpSearch", "EditorIcons")); + p->set_item_icon(p->get_item_index(HELP_DOCS), gui_base->get_theme_icon("Instance", "EditorIcons")); + p->set_item_icon(p->get_item_index(HELP_QA), gui_base->get_theme_icon("Instance", "EditorIcons")); + p->set_item_icon(p->get_item_index(HELP_ISSUES), gui_base->get_theme_icon("Instance", "EditorIcons")); + p->set_item_icon(p->get_item_index(HELP_COMMUNITY), gui_base->get_theme_icon("Instance", "EditorIcons")); + p->set_item_icon(p->get_item_index(HELP_ABOUT), gui_base->get_theme_icon("Godot", "EditorIcons")); _update_update_spinner(); } break; @@ -1976,11 +1976,11 @@ void EditorNode::_run(bool p_current, const String &p_custom) { } play_button->set_pressed(false); - play_button->set_icon(gui_base->get_icon("MainPlay", "EditorIcons")); + play_button->set_icon(gui_base->get_theme_icon("MainPlay", "EditorIcons")); play_scene_button->set_pressed(false); - play_scene_button->set_icon(gui_base->get_icon("PlayScene", "EditorIcons")); + play_scene_button->set_icon(gui_base->get_theme_icon("PlayScene", "EditorIcons")); play_custom_scene_button->set_pressed(false); - play_custom_scene_button->set_icon(gui_base->get_icon("PlayCustom", "EditorIcons")); + play_custom_scene_button->set_icon(gui_base->get_theme_icon("PlayCustom", "EditorIcons")); String main_scene; String run_filename; @@ -2063,14 +2063,14 @@ void EditorNode::_run(bool p_current, const String &p_custom) { emit_signal("play_pressed"); if (p_current) { play_scene_button->set_pressed(true); - play_scene_button->set_icon(gui_base->get_icon("Reload", "EditorIcons")); + play_scene_button->set_icon(gui_base->get_theme_icon("Reload", "EditorIcons")); } else if (p_custom != "") { run_custom_filename = p_custom; play_custom_scene_button->set_pressed(true); - play_custom_scene_button->set_icon(gui_base->get_icon("Reload", "EditorIcons")); + play_custom_scene_button->set_icon(gui_base->get_theme_icon("Reload", "EditorIcons")); } else { play_button->set_pressed(true); - play_button->set_icon(gui_base->get_icon("Reload", "EditorIcons")); + play_button->set_icon(gui_base->get_theme_icon("Reload", "EditorIcons")); } stop_button->set_disabled(false); @@ -2430,11 +2430,11 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { editor_run.stop(); run_custom_filename.clear(); play_button->set_pressed(false); - play_button->set_icon(gui_base->get_icon("MainPlay", "EditorIcons")); + play_button->set_icon(gui_base->get_theme_icon("MainPlay", "EditorIcons")); play_scene_button->set_pressed(false); - play_scene_button->set_icon(gui_base->get_icon("PlayScene", "EditorIcons")); + play_scene_button->set_icon(gui_base->get_theme_icon("PlayScene", "EditorIcons")); play_custom_scene_button->set_pressed(false); - play_custom_scene_button->set_icon(gui_base->get_icon("PlayCustom", "EditorIcons")); + play_custom_scene_button->set_icon(gui_base->get_theme_icon("PlayCustom", "EditorIcons")); stop_button->set_disabled(true); if (bool(EDITOR_GET("run/output/always_close_output_on_stop"))) { @@ -2890,8 +2890,8 @@ void EditorNode::add_editor_plugin(EditorPlugin *p_editor, bool p_config_changed if (icon.is_valid()) { tb->set_icon(icon); - } else if (singleton->gui_base->has_icon(p_editor->get_name(), "EditorIcons")) { - tb->set_icon(singleton->gui_base->get_icon(p_editor->get_name(), "EditorIcons")); + } else if (singleton->gui_base->has_theme_icon(p_editor->get_name(), "EditorIcons")) { + tb->set_icon(singleton->gui_base->get_theme_icon(p_editor->get_name(), "EditorIcons")); } tb->set_name(p_editor->get_name()); @@ -3559,7 +3559,7 @@ void EditorNode::add_io_error(const String &p_error) { void EditorNode::_load_error_notify(void *p_ud, const String &p_text) { EditorNode *en = (EditorNode *)p_ud; - en->load_errors->add_image(en->gui_base->get_icon("Error", "EditorIcons")); + en->load_errors->add_image(en->gui_base->get_theme_icon("Error", "EditorIcons")); en->load_errors->add_text(p_text + "\n"); en->load_error_dialog->popup_centered_ratio(0.5); } @@ -3752,11 +3752,11 @@ Ref EditorNode::get_object_icon(const Object *p_object, const String if (p_object->has_meta("_editor_icon")) return p_object->get_meta("_editor_icon"); - if (gui_base->has_icon(p_object->get_class(), "EditorIcons")) - return gui_base->get_icon(p_object->get_class(), "EditorIcons"); + if (gui_base->has_theme_icon(p_object->get_class(), "EditorIcons")) + return gui_base->get_theme_icon(p_object->get_class(), "EditorIcons"); if (p_fallback.length()) - return gui_base->get_icon(p_fallback, "EditorIcons"); + return gui_base->get_theme_icon(p_fallback, "EditorIcons"); return NULL; } @@ -3764,8 +3764,8 @@ Ref EditorNode::get_object_icon(const Object *p_object, const String Ref EditorNode::get_class_icon(const String &p_class, const String &p_fallback) const { ERR_FAIL_COND_V_MSG(p_class.empty(), NULL, "Class name cannot be empty."); - if (gui_base->has_icon(p_class, "EditorIcons")) { - return gui_base->get_icon(p_class, "EditorIcons"); + if (gui_base->has_theme_icon(p_class, "EditorIcons")) { + return gui_base->get_theme_icon(p_class, "EditorIcons"); } if (ScriptServer::is_global_class(p_class)) { @@ -3788,7 +3788,7 @@ Ref EditorNode::get_class_icon(const String &p_class, const String &p } if (icon.is_null()) { - icon = gui_base->get_icon(ScriptServer::get_global_class_base(p_class), "EditorIcons"); + icon = gui_base->get_theme_icon(ScriptServer::get_global_class_base(p_class), "EditorIcons"); } return icon; @@ -3806,8 +3806,8 @@ Ref EditorNode::get_class_icon(const String &p_class, const String &p } } - if (p_fallback.length() && gui_base->has_icon(p_fallback, "EditorIcons")) - return gui_base->get_icon(p_fallback, "EditorIcons"); + if (p_fallback.length() && gui_base->has_theme_icon(p_fallback, "EditorIcons")) + return gui_base->get_theme_icon(p_fallback, "EditorIcons"); return NULL; } @@ -3968,6 +3968,7 @@ void EditorNode::_dock_make_float() { Size2 dock_size = dock->get_size(); //remember size Point2 dock_screen_pos = dock->get_global_position() + get_tree()->get_root()->get_position(); + print_line("dock pos: " + dock->get_global_position() + " window pos: " + get_tree()->get_root()->get_position()); dock_slot[dock_popup_selected]->remove_child(dock); Window *window = memnew(Window); @@ -4116,7 +4117,7 @@ void EditorNode::_dock_select_draw() { Color used = Color(0.6, 0.6, 0.6, 0.8); Color used_selected = Color(0.8, 0.8, 0.8, 0.8); - Color tab_selected = theme_base->get_color("mono_color", "Editor"); + Color tab_selected = theme_base->get_theme_color("mono_color", "Editor"); Color unused = used; unused.a = 0.4; Color unusable = unused; @@ -4879,9 +4880,9 @@ void EditorNode::_bottom_panel_switch(bool p_enable, int p_idx) { bottom_panel_items[i].control->set_visible(i == p_idx); } if (EditorDebuggerNode::get_singleton() == bottom_panel_items[p_idx].control) { // this is the debug panel which uses tabs, so the top section should be smaller - bottom_panel->add_style_override("panel", gui_base->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")); + bottom_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")); } else { - bottom_panel->add_style_override("panel", gui_base->get_stylebox("panel", "TabContainer")); + bottom_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox("panel", "TabContainer")); } center_split->set_dragger_visibility(SplitContainer::DRAGGER_VISIBLE); center_split->set_collapsed(false); @@ -4891,7 +4892,7 @@ void EditorNode::_bottom_panel_switch(bool p_enable, int p_idx) { bottom_panel_raise->show(); } else { - bottom_panel->add_style_override("panel", gui_base->get_stylebox("panel", "TabContainer")); + bottom_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox("panel", "TabContainer")); bottom_panel_items[p_idx].button->set_pressed(false); bottom_panel_items[p_idx].control->set_visible(false); center_split->set_dragger_visibility(SplitContainer::DRAGGER_HIDDEN); @@ -4984,7 +4985,7 @@ Variant EditorNode::drag_resource(const Ref &p_res, Control *p_from) { { //todo make proper previews - Ref pic = gui_base->get_icon("FileBigThumb", "EditorIcons"); + Ref pic = gui_base->get_theme_icon("FileBigThumb", "EditorIcons"); Ref img = pic->get_data(); img = img->duplicate(); img->resize(48, 48); //meh @@ -5036,10 +5037,10 @@ Variant EditorNode::drag_files_and_dirs(const Vector &p_paths, Control * if (p_paths[i].ends_with("/")) { label->set_text(p_paths[i].substr(0, p_paths[i].length() - 1).get_file()); - icon->set_texture(gui_base->get_icon("Folder", "EditorIcons")); + icon->set_texture(gui_base->get_theme_icon("Folder", "EditorIcons")); } else { label->set_text(p_paths[i].get_file()); - icon->set_texture(gui_base->get_icon("File", "EditorIcons")); + icon->set_texture(gui_base->get_theme_icon("File", "EditorIcons")); } icon->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED); icon->set_size(Size2(16, 16)); @@ -5342,9 +5343,9 @@ void EditorNode::_update_video_driver_color() { // TODO: Probably should de-hardcode this and add to editor settings. if (video_driver->get_text() == "GLES2") { - video_driver->add_color_override("font_color", Color::hex(0x5586a4ff)); + video_driver->add_theme_color_override("font_color", Color::hex(0x5586a4ff)); } else if (video_driver->get_text() == "Vulkan") { - video_driver->add_color_override("font_color", theme_base->get_color("vulkan_color", "Editor")); + video_driver->add_theme_color_override("font_color", theme_base->get_theme_color("vulkan_color", "Editor")); } } @@ -5785,7 +5786,7 @@ EditorNode::EditorNode() { theme_base->set_theme(theme); gui_base->set_theme(theme); - gui_base->add_style_override("panel", gui_base->get_stylebox("Background", "EditorStyles")); + gui_base->add_theme_style_override("panel", gui_base->get_theme_stylebox("Background", "EditorStyles")); resource_preview = memnew(EditorResourcePreview); add_child(resource_preview); @@ -5800,7 +5801,7 @@ EditorNode::EditorNode() { main_vbox = memnew(VBoxContainer); gui_base->add_child(main_vbox); main_vbox->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 8); - main_vbox->add_constant_override("separation", 8 * EDSCALE); + main_vbox->add_theme_constant_override("separation", 8 * EDSCALE); menu_hb = memnew(HBoxContainer); main_vbox->add_child(menu_hb); @@ -5941,7 +5942,7 @@ EditorNode::EditorNode() { VBoxContainer *srt = memnew(VBoxContainer); srt->set_v_size_flags(Control::SIZE_EXPAND_FILL); top_split->add_child(srt); - srt->add_constant_override("separation", 0); + srt->add_theme_constant_override("separation", 0); tab_preview_panel = memnew(Panel); tab_preview_panel->set_size(Size2(100, 100) * EDSCALE); @@ -5956,8 +5957,8 @@ EditorNode::EditorNode() { tab_preview_panel->add_child(tab_preview); scene_tabs = memnew(Tabs); - scene_tabs->add_style_override("tab_fg", gui_base->get_stylebox("SceneTabFG", "EditorStyles")); - scene_tabs->add_style_override("tab_bg", gui_base->get_stylebox("SceneTabBG", "EditorStyles")); + scene_tabs->add_theme_style_override("tab_fg", gui_base->get_theme_stylebox("SceneTabFG", "EditorStyles")); + scene_tabs->add_theme_style_override("tab_bg", gui_base->get_theme_stylebox("SceneTabBG", "EditorStyles")); scene_tabs->set_select_with_rmb(true); scene_tabs->add_tab("unsaved"); scene_tabs->set_tab_align(Tabs::ALIGN_LEFT); @@ -5979,7 +5980,6 @@ EditorNode::EditorNode() { scene_tabs_context_menu = memnew(PopupMenu); tabbar_container->add_child(scene_tabs_context_menu); scene_tabs_context_menu->connect("id_pressed", callable_mp(this, &EditorNode::_menu_option)); - scene_tabs_context_menu->set_hide_on_window_lose_focus(true); srt->add_child(tabbar_container); tabbar_container->add_child(scene_tabs); @@ -5991,20 +5991,20 @@ EditorNode::EditorNode() { #endif distraction_free->set_tooltip(TTR("Toggle distraction-free mode.")); distraction_free->connect("pressed", callable_mp(this, &EditorNode::_toggle_distraction_free_mode)); - distraction_free->set_icon(gui_base->get_icon("DistractionFree", "EditorIcons")); + distraction_free->set_icon(gui_base->get_theme_icon("DistractionFree", "EditorIcons")); distraction_free->set_toggle_mode(true); scene_tab_add = memnew(ToolButton); tabbar_container->add_child(scene_tab_add); tabbar_container->add_child(distraction_free); scene_tab_add->set_tooltip(TTR("Add a new scene.")); - scene_tab_add->set_icon(gui_base->get_icon("Add", "EditorIcons")); - scene_tab_add->add_color_override("icon_color_normal", Color(0.6f, 0.6f, 0.6f, 0.8f)); + scene_tab_add->set_icon(gui_base->get_theme_icon("Add", "EditorIcons")); + scene_tab_add->add_theme_color_override("icon_color_normal", Color(0.6f, 0.6f, 0.6f, 0.8f)); scene_tab_add->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(FILE_NEW_SCENE)); scene_root_parent = memnew(PanelContainer); scene_root_parent->set_custom_minimum_size(Size2(0, 80) * EDSCALE); - scene_root_parent->add_style_override("panel", gui_base->get_stylebox("Content", "EditorStyles")); + scene_root_parent->add_theme_style_override("panel", gui_base->get_theme_stylebox("Content", "EditorStyles")); scene_root_parent->set_draw_behind_parent(true); srt->add_child(scene_root_parent); scene_root_parent->set_v_size_flags(Control::SIZE_EXPAND_FILL); @@ -6018,7 +6018,7 @@ EditorNode::EditorNode() { viewport = memnew(VBoxContainer); viewport->set_v_size_flags(Control::SIZE_EXPAND_FILL); - viewport->add_constant_override("separation", 0); + viewport->add_theme_constant_override("separation", 0); scene_root_parent->add_child(viewport); HBoxContainer *left_menu_hb = memnew(HBoxContainer); @@ -6028,11 +6028,11 @@ EditorNode::EditorNode() { file_menu->set_flat(false); file_menu->set_switch_on_hover(true); file_menu->set_text(TTR("Scene")); - file_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles")); + file_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox("MenuHover", "EditorStyles")); left_menu_hb->add_child(file_menu); prev_scene = memnew(ToolButton); - prev_scene->set_icon(gui_base->get_icon("PrevScene", "EditorIcons")); + prev_scene->set_icon(gui_base->get_theme_icon("PrevScene", "EditorIcons")); prev_scene->set_tooltip(TTR("Go to previously opened scene.")); prev_scene->set_disabled(true); prev_scene->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(FILE_OPEN_PREV)); @@ -6084,7 +6084,7 @@ EditorNode::EditorNode() { file_menu->set_tooltip(TTR("Operations with scene files.")); p = file_menu->get_popup(); - p->set_hide_on_window_lose_focus(true); + p->add_shortcut(ED_SHORTCUT("editor/new_scene", TTR("New Scene")), FILE_NEW_SCENE); p->add_shortcut(ED_SHORTCUT("editor/new_inherited_scene", TTR("New Inherited Scene...")), FILE_NEW_INHERITED_SCENE); p->add_shortcut(ED_SHORTCUT("editor/open_scene", TTR("Open Scene..."), KEY_MASK_CMD + KEY_O), FILE_OPEN_SCENE); @@ -6132,11 +6132,11 @@ EditorNode::EditorNode() { project_menu->set_switch_on_hover(true); project_menu->set_tooltip(TTR("Miscellaneous project or scene-wide tools.")); project_menu->set_text(TTR("Project")); - project_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles")); + project_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox("MenuHover", "EditorStyles")); left_menu_hb->add_child(project_menu); p = project_menu->get_popup(); - p->set_hide_on_window_lose_focus(true); + p->add_shortcut(ED_SHORTCUT("editor/project_settings", TTR("Project Settings...")), RUN_SETTINGS); p->connect("id_pressed", callable_mp(this, &EditorNode::_menu_option)); @@ -6182,19 +6182,20 @@ EditorNode::EditorNode() { debug_menu->set_flat(false); debug_menu->set_switch_on_hover(true); debug_menu->set_text(TTR("Debug")); - debug_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles")); + debug_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox("MenuHover", "EditorStyles")); left_menu_hb->add_child(debug_menu); + menu_hb->add_spacer(); settings_menu = memnew(MenuButton); settings_menu->set_flat(false); settings_menu->set_switch_on_hover(true); settings_menu->set_text(TTR("Editor")); - settings_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles")); + settings_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox("MenuHover", "EditorStyles")); left_menu_hb->add_child(settings_menu); p = settings_menu->get_popup(); - p->set_hide_on_window_lose_focus(true); + p->add_shortcut(ED_SHORTCUT("editor/editor_settings", TTR("Editor Settings...")), SETTINGS_PREFERENCES); p->add_separator(); @@ -6238,20 +6239,19 @@ EditorNode::EditorNode() { help_menu->set_flat(false); help_menu->set_switch_on_hover(true); help_menu->set_text(TTR("Help")); - help_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles")); + help_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox("MenuHover", "EditorStyles")); left_menu_hb->add_child(help_menu); p = help_menu->get_popup(); - p->set_hide_on_window_lose_focus(true); p->connect("id_pressed", callable_mp(this, &EditorNode::_menu_option)); - p->add_icon_shortcut(gui_base->get_icon("HelpSearch", "EditorIcons"), ED_SHORTCUT("editor/editor_help", TTR("Search"), KEY_MASK_SHIFT | KEY_F1), HELP_SEARCH); + p->add_icon_shortcut(gui_base->get_theme_icon("HelpSearch", "EditorIcons"), ED_SHORTCUT("editor/editor_help", TTR("Search"), KEY_MASK_SHIFT | KEY_F1), HELP_SEARCH); p->add_separator(); - p->add_icon_shortcut(gui_base->get_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/online_docs", TTR("Online Docs")), HELP_DOCS); - p->add_icon_shortcut(gui_base->get_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/q&a", TTR("Q&A")), HELP_QA); - p->add_icon_shortcut(gui_base->get_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/issue_tracker", TTR("Issue Tracker")), HELP_ISSUES); - p->add_icon_shortcut(gui_base->get_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/community", TTR("Community")), HELP_COMMUNITY); + p->add_icon_shortcut(gui_base->get_theme_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/online_docs", TTR("Online Docs")), HELP_DOCS); + p->add_icon_shortcut(gui_base->get_theme_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/q&a", TTR("Q&A")), HELP_QA); + p->add_icon_shortcut(gui_base->get_theme_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/issue_tracker", TTR("Issue Tracker")), HELP_ISSUES); + p->add_icon_shortcut(gui_base->get_theme_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/community", TTR("Community")), HELP_COMMUNITY); p->add_separator(); - p->add_icon_shortcut(gui_base->get_icon("Godot", "EditorIcons"), ED_SHORTCUT("editor/about", TTR("About")), HELP_ABOUT); + p->add_icon_shortcut(gui_base->get_theme_icon("Godot", "EditorIcons"), ED_SHORTCUT("editor/about", TTR("About")), HELP_ABOUT); HBoxContainer *play_hb = memnew(HBoxContainer); menu_hb->add_child(play_hb); @@ -6259,7 +6259,7 @@ EditorNode::EditorNode() { play_button = memnew(ToolButton); play_hb->add_child(play_button); play_button->set_toggle_mode(true); - play_button->set_icon(gui_base->get_icon("MainPlay", "EditorIcons")); + play_button->set_icon(gui_base->get_theme_icon("MainPlay", "EditorIcons")); play_button->set_focus_mode(Control::FOCUS_NONE); play_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(RUN_PLAY)); play_button->set_tooltip(TTR("Play the project.")); @@ -6271,7 +6271,7 @@ EditorNode::EditorNode() { pause_button = memnew(ToolButton); pause_button->set_toggle_mode(true); - pause_button->set_icon(gui_base->get_icon("Pause", "EditorIcons")); + pause_button->set_icon(gui_base->get_theme_icon("Pause", "EditorIcons")); pause_button->set_focus_mode(Control::FOCUS_NONE); pause_button->set_tooltip(TTR("Pause the scene execution for debugging.")); pause_button->set_disabled(true); @@ -6285,7 +6285,7 @@ EditorNode::EditorNode() { stop_button = memnew(ToolButton); play_hb->add_child(stop_button); stop_button->set_focus_mode(Control::FOCUS_NONE); - stop_button->set_icon(gui_base->get_icon("Stop", "EditorIcons")); + stop_button->set_icon(gui_base->get_theme_icon("Stop", "EditorIcons")); stop_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(RUN_STOP)); stop_button->set_tooltip(TTR("Stop the scene.")); stop_button->set_disabled(true); @@ -6303,7 +6303,7 @@ EditorNode::EditorNode() { play_hb->add_child(play_scene_button); play_scene_button->set_toggle_mode(true); play_scene_button->set_focus_mode(Control::FOCUS_NONE); - play_scene_button->set_icon(gui_base->get_icon("PlayScene", "EditorIcons")); + play_scene_button->set_icon(gui_base->get_theme_icon("PlayScene", "EditorIcons")); play_scene_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(RUN_PLAY_SCENE)); play_scene_button->set_tooltip(TTR("Play the edited scene.")); #ifdef OSX_ENABLED @@ -6316,7 +6316,7 @@ EditorNode::EditorNode() { play_hb->add_child(play_custom_scene_button); play_custom_scene_button->set_toggle_mode(true); play_custom_scene_button->set_focus_mode(Control::FOCUS_NONE); - play_custom_scene_button->set_icon(gui_base->get_icon("PlayCustom", "EditorIcons")); + play_custom_scene_button->set_icon(gui_base->get_theme_icon("PlayCustom", "EditorIcons")); play_custom_scene_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(RUN_PLAY_CUSTOM_SCENE)); play_custom_scene_button->set_tooltip(TTR("Play custom scene")); #ifdef OSX_ENABLED @@ -6333,7 +6333,7 @@ EditorNode::EditorNode() { video_driver->set_flat(true); video_driver->set_focus_mode(Control::FOCUS_NONE); video_driver->connect("item_selected", callable_mp(this, &EditorNode::_video_driver_selected)); - video_driver->add_font_override("font", gui_base->get_font("bold", "EditorFonts")); + video_driver->add_theme_font_override("font", gui_base->get_theme_font("bold", "EditorFonts")); // TODO re-enable when GLES2 is ported video_driver->set_disabled(true); right_menu_hb->add_child(video_driver); @@ -6375,7 +6375,7 @@ EditorNode::EditorNode() { update_spinner = memnew(MenuButton); update_spinner->set_tooltip(TTR("Spins when the editor window redraws.")); right_menu_hb->add_child(update_spinner); - update_spinner->set_icon(gui_base->get_icon("Progress1", "EditorIcons")); + update_spinner->set_icon(gui_base->get_theme_icon("Progress1", "EditorIcons")); update_spinner->get_popup()->connect("id_pressed", callable_mp(this, &EditorNode::_menu_option)); p = update_spinner->get_popup(); p->add_radio_check_item(TTR("Update Continuously"), SETTINGS_UPDATE_CONTINUOUSLY); @@ -6451,7 +6451,7 @@ EditorNode::EditorNode() { // Bottom panels bottom_panel = memnew(PanelContainer); - bottom_panel->add_style_override("panel", gui_base->get_stylebox("panel", "TabContainer")); + bottom_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox("panel", "TabContainer")); center_split->add_child(bottom_panel); center_split->set_dragger_visibility(SplitContainer::DRAGGER_HIDDEN); @@ -6473,7 +6473,7 @@ EditorNode::EditorNode() { bottom_panel_hb->add_child(version_label); bottom_panel_raise = memnew(ToolButton); - bottom_panel_raise->set_icon(gui_base->get_icon("ExpandBottomDock", "EditorIcons")); + bottom_panel_raise->set_icon(gui_base->get_theme_icon("ExpandBottomDock", "EditorIcons")); bottom_panel_raise->set_shortcut(ED_SHORTCUT("editor/bottom_panel_expand", TTR("Expand Bottom Panel"), KEY_MASK_SHIFT | KEY_F12)); @@ -6557,7 +6557,7 @@ EditorNode::EditorNode() { file_script->connect("file_selected", callable_mp(this, &EditorNode::_dialog_action)); file_menu->get_popup()->connect("id_pressed", callable_mp(this, &EditorNode::_menu_option)); - file_menu->connect("about_to_show", callable_mp(this, &EditorNode::_update_file_menu_opened)); + file_menu->connect("about_to_popup", callable_mp(this, &EditorNode::_update_file_menu_opened)); file_menu->get_popup()->connect("popup_hide", callable_mp(this, &EditorNode::_update_file_menu_closed)); settings_menu->get_popup()->connect("id_pressed", callable_mp(this, &EditorNode::_menu_option)); diff --git a/editor/editor_path.cpp b/editor/editor_path.cpp index 305dc03568..804ad62bbb 100644 --- a/editor/editor_path.cpp +++ b/editor/editor_path.cpp @@ -149,6 +149,6 @@ EditorPath::EditorPath(EditorHistory *p_history) { history = p_history; set_clip_text(true); set_text_align(ALIGN_LEFT); - get_popup()->connect("about_to_show", callable_mp(this, &EditorPath::_about_to_show)); + get_popup()->connect("about_to_popup", callable_mp(this, &EditorPath::_about_to_show)); get_popup()->connect("id_pressed", callable_mp(this, &EditorPath::_id_pressed)); } diff --git a/editor/editor_plugin_settings.cpp b/editor/editor_plugin_settings.cpp index 84fd144cd2..62a76786ae 100644 --- a/editor/editor_plugin_settings.cpp +++ b/editor/editor_plugin_settings.cpp @@ -142,7 +142,7 @@ void EditorPluginSettings::update_plugins() { bool is_active = EditorNode::get_singleton()->is_addon_plugin_enabled(d2); item->set_checked(3, is_active); item->set_editable(3, true); - item->add_button(4, get_icon("Edit", "EditorIcons"), BUTTON_PLUGIN_EDIT, false, TTR("Edit Plugin")); + item->add_button(4, get_theme_icon("Edit", "EditorIcons"), BUTTON_PLUGIN_EDIT, false, TTR("Edit Plugin")); } } } diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index dcafeaf8f5..af83e808fc 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -140,9 +140,9 @@ void EditorPropertyMultilineText::_notification(int p_what) { switch (p_what) { case NOTIFICATION_THEME_CHANGED: case NOTIFICATION_ENTER_TREE: { - Ref df = get_icon("DistractionFree", "EditorIcons"); + Ref df = get_theme_icon("DistractionFree", "EditorIcons"); open_big_text->set_icon(df); - Ref font = get_font("font", "Label"); + Ref font = get_theme_font("font", "Label"); text->set_custom_minimum_size(Vector2(0, font->get_height() * 6)); } break; @@ -278,7 +278,7 @@ void EditorPropertyPath::set_save_mode() { void EditorPropertyPath::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { - path_edit->set_icon(get_icon("Folder", "EditorIcons")); + path_edit->set_icon(get_theme_icon("Folder", "EditorIcons")); } } @@ -604,7 +604,7 @@ public: Vector tooltips; virtual Size2 get_minimum_size() const { - Ref font = get_font("font", "Label"); + Ref font = get_theme_font("font", "Label"); return Vector2(0, font->get_height() * 2); } @@ -646,7 +646,7 @@ public: int h = bsize * 2 + 1; int vofs = (rect.size.height - h) / 2; - Color color = get_color("highlight_color", "Editor"); + Color color = get_theme_color("highlight_color", "Editor"); for (int i = 0; i < 2; i++) { Point2 ofs(4, vofs); @@ -749,10 +749,10 @@ void EditorPropertyLayers::_button_pressed() { layers->set_item_checked(idx, grid->value & (1 << i)); } - Rect2 gp = button->get_global_rect(); + Rect2 gp = button->get_screen_rect(); layers->set_as_minsize(); - Vector2 popup_pos = gp.position - Vector2(layers->get_combined_minimum_size().x, 0); - layers->set_global_position(popup_pos); + Vector2 popup_pos = gp.position - Vector2(layers->get_contents_minimum_size().x, 0); + layers->set_position(popup_pos); layers->popup(); } @@ -920,7 +920,7 @@ void EditorPropertyEasing::_drag_easing(const Ref &p_ev) { } if (mb->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) { - preset->set_global_position(easing_draw->get_global_transform().xform(mb->get_position())); + preset->set_position(easing_draw->get_screen_transform().xform(mb->get_position())); preset->popup(); // Ensure the easing doesn't appear as being dragged @@ -976,13 +976,13 @@ void EditorPropertyEasing::_draw_easing() { float prev = 1.0; const float exp = get_edited_object()->get(get_edited_property()); - const Ref f = get_font("font", "Label"); - const Color font_color = get_color("font_color", "Label"); + const Ref f = get_theme_font("font", "Label"); + const Color font_color = get_theme_color("font_color", "Label"); Color line_color; if (dragging) { - line_color = get_color("accent_color", "Editor"); + line_color = get_theme_color("accent_color", "Editor"); } else { - line_color = get_color("font_color", "Label") * Color(1, 1, 1, 0.9); + line_color = get_theme_color("font_color", "Label") * Color(1, 1, 1, 0.9); } Vector lines; @@ -1058,15 +1058,15 @@ void EditorPropertyEasing::_notification(int p_what) { case NOTIFICATION_THEME_CHANGED: case NOTIFICATION_ENTER_TREE: { preset->clear(); - preset->add_icon_item(get_icon("CurveConstant", "EditorIcons"), "Zero", EASING_ZERO); - preset->add_icon_item(get_icon("CurveLinear", "EditorIcons"), "Linear", EASING_LINEAR); - preset->add_icon_item(get_icon("CurveIn", "EditorIcons"), "In", EASING_IN); - preset->add_icon_item(get_icon("CurveOut", "EditorIcons"), "Out", EASING_OUT); + preset->add_icon_item(get_theme_icon("CurveConstant", "EditorIcons"), "Zero", EASING_ZERO); + preset->add_icon_item(get_theme_icon("CurveLinear", "EditorIcons"), "Linear", EASING_LINEAR); + preset->add_icon_item(get_theme_icon("CurveIn", "EditorIcons"), "In", EASING_IN); + preset->add_icon_item(get_theme_icon("CurveOut", "EditorIcons"), "Out", EASING_OUT); if (full) { - preset->add_icon_item(get_icon("CurveInOut", "EditorIcons"), "In-Out", EASING_IN_OUT); - preset->add_icon_item(get_icon("CurveOutIn", "EditorIcons"), "Out-In", EASING_OUT_IN); + preset->add_icon_item(get_theme_icon("CurveInOut", "EditorIcons"), "In-Out", EASING_IN_OUT); + preset->add_icon_item(get_theme_icon("CurveOutIn", "EditorIcons"), "Out-In", EASING_OUT_IN); } - easing_draw->set_custom_minimum_size(Size2(0, get_font("font", "Label")->get_height() * 2)); + easing_draw->set_custom_minimum_size(Size2(0, get_theme_font("font", "Label")->get_height() * 2)); } break; } } @@ -1126,7 +1126,7 @@ void EditorPropertyVector2::update_property() { void EditorPropertyVector2::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { - Color base = get_color("accent_color", "Editor"); + Color base = get_theme_color("accent_color", "Editor"); for (int i = 0; i < 2; i++) { Color c = base; @@ -1208,7 +1208,7 @@ void EditorPropertyRect2::update_property() { } void EditorPropertyRect2::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { - Color base = get_color("accent_color", "Editor"); + Color base = get_theme_color("accent_color", "Editor"); for (int i = 0; i < 4; i++) { Color c = base; @@ -1288,7 +1288,7 @@ void EditorPropertyVector3::update_property() { } void EditorPropertyVector3::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { - Color base = get_color("accent_color", "Editor"); + Color base = get_theme_color("accent_color", "Editor"); for (int i = 0; i < 3; i++) { Color c = base; @@ -1368,7 +1368,7 @@ void EditorPropertyPlane::update_property() { } void EditorPropertyPlane::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { - Color base = get_color("accent_color", "Editor"); + Color base = get_theme_color("accent_color", "Editor"); for (int i = 0; i < 3; i++) { Color c = base; @@ -1450,7 +1450,7 @@ void EditorPropertyQuat::update_property() { } void EditorPropertyQuat::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { - Color base = get_color("accent_color", "Editor"); + Color base = get_theme_color("accent_color", "Editor"); for (int i = 0; i < 3; i++) { Color c = base; @@ -1537,7 +1537,7 @@ void EditorPropertyAABB::update_property() { } void EditorPropertyAABB::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { - Color base = get_color("accent_color", "Editor"); + Color base = get_theme_color("accent_color", "Editor"); for (int i = 0; i < 6; i++) { Color c = base; @@ -1611,7 +1611,7 @@ void EditorPropertyTransform2D::update_property() { } void EditorPropertyTransform2D::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { - Color base = get_color("accent_color", "Editor"); + Color base = get_theme_color("accent_color", "Editor"); for (int i = 0; i < 6; i++) { Color c = base; @@ -1690,7 +1690,7 @@ void EditorPropertyBasis::update_property() { } void EditorPropertyBasis::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { - Color base = get_color("accent_color", "Editor"); + Color base = get_theme_color("accent_color", "Editor"); for (int i = 0; i < 9; i++) { Color c = base; @@ -1775,7 +1775,7 @@ void EditorPropertyTransform::update_property() { } void EditorPropertyTransform::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { - Color base = get_color("accent_color", "Editor"); + Color base = get_theme_color("accent_color", "Editor"); for (int i = 0; i < 12; i++) { Color c = base; @@ -1983,7 +1983,7 @@ void EditorPropertyNodePath::setup(const NodePath &p_base_hint, Vector t = get_icon("Clear", "EditorIcons"); + Ref t = get_theme_icon("Clear", "EditorIcons"); clear->set_icon(t); } } @@ -2294,7 +2294,7 @@ void EditorPropertyResource::_resource_preview(const String &p_path, const Refset_margin(MARGIN_LEFT, assign->get_icon()->get_width() + assign->get_stylebox("normal")->get_default_margin(MARGIN_LEFT) + get_constant("hseparation", "Button")); + preview->set_margin(MARGIN_LEFT, assign->get_icon()->get_width() + assign->get_theme_stylebox("normal")->get_default_margin(MARGIN_LEFT) + get_theme_constant("hseparation", "Button")); if (type == "GradientTexture") { preview->set_stretch_mode(TextureRect::STRETCH_SCALE); assign->set_custom_minimum_size(Size2(1, 1)); @@ -2318,8 +2318,8 @@ void EditorPropertyResource::_update_menu_items() { menu->clear(); if (get_edited_property() == "script" && base_type == "Script" && Object::cast_to(get_edited_object())) { - menu->add_icon_item(get_icon("ScriptCreate", "EditorIcons"), TTR("New Script"), OBJ_MENU_NEW_SCRIPT); - menu->add_icon_item(get_icon("ScriptExtend", "EditorIcons"), TTR("Extend Script"), OBJ_MENU_EXTEND_SCRIPT); + menu->add_icon_item(get_theme_icon("ScriptCreate", "EditorIcons"), TTR("New Script"), OBJ_MENU_NEW_SCRIPT); + menu->add_icon_item(get_theme_icon("ScriptExtend", "EditorIcons"), TTR("Extend Script"), OBJ_MENU_EXTEND_SCRIPT); menu->add_separator(); } else if (base_type != "") { int idx = 0; @@ -2381,7 +2381,7 @@ void EditorPropertyResource::_update_menu_items() { inheritors_array.push_back(t); if (!icon.is_valid()) - icon = get_icon(has_icon(t, "EditorIcons") ? t : "Object", "EditorIcons"); + icon = get_theme_icon(has_theme_icon(t, "EditorIcons") ? t : "Object", "EditorIcons"); int id = TYPE_BASE_ID + idx; menu->add_icon_item(icon, vformat(TTR("New %s"), t), id); @@ -2394,14 +2394,14 @@ void EditorPropertyResource::_update_menu_items() { menu->add_separator(); } - menu->add_icon_item(get_icon("Load", "EditorIcons"), TTR("Load"), OBJ_MENU_LOAD); + menu->add_icon_item(get_theme_icon("Load", "EditorIcons"), TTR("Load"), OBJ_MENU_LOAD); if (!res.is_null()) { - menu->add_icon_item(get_icon("Edit", "EditorIcons"), TTR("Edit"), OBJ_MENU_EDIT); - menu->add_icon_item(get_icon("Clear", "EditorIcons"), TTR("Clear"), OBJ_MENU_CLEAR); - menu->add_icon_item(get_icon("Duplicate", "EditorIcons"), TTR("Make Unique"), OBJ_MENU_MAKE_UNIQUE); - menu->add_icon_item(get_icon("Save", "EditorIcons"), TTR("Save"), OBJ_MENU_SAVE); + menu->add_icon_item(get_theme_icon("Edit", "EditorIcons"), TTR("Edit"), OBJ_MENU_EDIT); + menu->add_icon_item(get_theme_icon("Clear", "EditorIcons"), TTR("Clear"), OBJ_MENU_CLEAR); + menu->add_icon_item(get_theme_icon("Duplicate", "EditorIcons"), TTR("Make Unique"), OBJ_MENU_MAKE_UNIQUE); + menu->add_icon_item(get_theme_icon("Save", "EditorIcons"), TTR("Save"), OBJ_MENU_SAVE); RES r = res; if (r.is_valid() && r->get_path().is_resource_file()) { menu->add_separator(); @@ -2445,12 +2445,12 @@ void EditorPropertyResource::_update_menu_items() { for (int i = 0; i < conversions.size(); i++) { String what = conversions[i]->converts_to(); Ref icon; - if (has_icon(what, "EditorIcons")) { + if (has_theme_icon(what, "EditorIcons")) { - icon = get_icon(what, "EditorIcons"); + icon = get_theme_icon(what, "EditorIcons"); } else { - icon = get_icon(what, "Resource"); + icon = get_theme_icon(what, "Resource"); } menu->add_icon_item(icon, vformat(TTR("Convert To %s"), what), CONVERT_BASE_ID + i); @@ -2462,11 +2462,11 @@ void EditorPropertyResource::_update_menu() { _update_menu_items(); - Rect2 gt = edit->get_global_rect(); + Rect2 gt = edit->get_screen_rect(); menu->set_as_minsize(); - int ms = menu->get_combined_minimum_size().width; + int ms = menu->get_contents_minimum_size().width; Vector2 popup_pos = gt.position + gt.size - Vector2(ms, 0); - menu->set_global_position(popup_pos); + menu->set_position(popup_pos); menu->popup(); } @@ -2490,10 +2490,10 @@ void EditorPropertyResource::_button_input(const Ref &p_event) { if (mb.is_valid()) { if (mb->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) { _update_menu_items(); - Vector2 pos = mb->get_global_position(); + Vector2 pos = get_screen_position() + mb->get_position(); //pos = assign->get_global_transform().xform(pos); menu->set_as_minsize(); - menu->set_global_position(pos); + menu->set_position(pos); menu->popup(); } } @@ -2663,7 +2663,7 @@ void EditorPropertyResource::setup(const String &p_base_type) { void EditorPropertyResource::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { - Ref t = get_icon("select_arrow", "Tree"); + Ref t = get_theme_icon("select_arrow", "Tree"); edit->set_icon(t); } @@ -2718,7 +2718,7 @@ void EditorPropertyResource::expand_all_folding() { void EditorPropertyResource::_button_draw() { if (dropping) { - Color color = get_color("accent_color", "Editor"); + Color color = get_theme_color("accent_color", "Editor"); assign->draw_rect(Rect2(Point2(), assign->get_size()), color, false); } } diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index c2a6aeb582..13eb2e19d6 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -184,9 +184,9 @@ void EditorPropertyArray::_change_type(Object *p_button, int p_index) { Button *button = Object::cast_to