diff options
author | Juan Linietsky <reduzio@gmail.com> | 2020-03-12 09:37:40 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2020-03-26 15:49:42 +0100 |
commit | 441f1a5fe9a3bf0e4e5dab578f793500b1ff6e3d (patch) | |
tree | 6421bcc3235e6fdcd726244ac7d455886e17734b /editor | |
parent | 543fb1c4dadd75914d595b089820aef42e691075 (diff) |
Popups are now windows also (broken!)
Diffstat (limited to 'editor')
106 files changed, 1823 insertions, 1865 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> 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> 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<Texture2D> close_icon = get_icon("Close", "EditorIcons"); + Ref<Texture2D> 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<Texture2D> point = get_icon("KeyValue", "EditorIcons"); + Ref<Texture2D> point = get_theme_icon("KeyValue", "EditorIcons"); for (Map<int, Color>::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<InputEvent> &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<Texture2D> interp_mode = get_icon("TrackContinuous", "EditorIcons"); - Ref<Texture2D> interp_type = get_icon("InterpRaw", "EditorIcons"); - Ref<Texture2D> loop_type = get_icon("InterpWrapClamp", "EditorIcons"); - Ref<Texture2D> remove_icon = get_icon("Remove", "EditorIcons"); - Ref<Texture2D> down_icon = get_icon("select_arrow", "Tree"); + Ref<Texture2D> interp_mode = get_theme_icon("TrackContinuous", "EditorIcons"); + Ref<Texture2D> interp_type = get_theme_icon("InterpRaw", "EditorIcons"); + Ref<Texture2D> loop_type = get_theme_icon("InterpWrapClamp", "EditorIcons"); + Ref<Texture2D> remove_icon = get_theme_icon("Remove", "EditorIcons"); + Ref<Texture2D> 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<Texture2D> hsize_icon = get_icon("Hsize", "EditorIcons"); + Ref<Texture2D> 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> font = get_font("font", "Label"); - Color color = get_color("font_color", "Label"); + Ref<Font> 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<Texture2D> hsize_icon = get_icon("Hsize", "EditorIcons"); + Ref<Texture2D> 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<Animation> &p_animation) { Size2 AnimationTimelineEdit::get_minimum_size() const { Size2 ms = add_track->get_minimum_size(); - Ref<Font> font = get_font("font", "Label"); + Ref<Font> 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> font = get_font("font", "Label"); - Color color = get_color("font_color", "Label"); + Ref<Font> font = get_theme_font("font", "Label"); + Color color = get_theme_color("font_color", "Label"); Ref<Texture2D> 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<Texture2D> check = animation->track_is_enabled(track) ? get_icon("checked", "CheckBox") : get_icon("unchecked", "CheckBox"); + Ref<Texture2D> 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<Texture2D> wrap_icon[2] = { - get_icon("InterpWrapClamp", "EditorIcons"), - get_icon("InterpWrapLoop", "EditorIcons"), + get_theme_icon("InterpWrapClamp", "EditorIcons"), + get_theme_icon("InterpWrapLoop", "EditorIcons"), }; Ref<Texture2D> 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<Texture2D> 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<Texture2D> down_icon = get_icon("select_arrow", "Tree"); + Ref<Texture2D> 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<Texture2D> bezier_icon = get_icon("EditBezier", "EditorIcons"); + Ref<Texture2D> 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<Texture2D> icon = get_icon("Remove", "EditorIcons"); + Ref<Texture2D> 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> font = get_font("font", "Label"); - Color color = get_color("font_color", "Label"); + Ref<Font> 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<Animation> &p_animati update(); Ref<Texture2D> 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<Texture2D> texture = get_icon("Object", "EditorIcons"); - Ref<Font> font = get_font("font", "Label"); - int separation = get_constant("vseparation", "ItemList"); + Ref<Texture2D> texture = get_theme_icon("Object", "EditorIcons"); + Ref<Font> 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<InputEvent> &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<InputEvent> &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<InputEvent> &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<InputEvent> &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<InputEvent> &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> font = get_font("font", "Label"); - int separation = get_constant("hseparation", "ItemList"); - Color color = get_color("font_color", "Label"); + Ref<Font> 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<Texture2D> &p_type, co Size2 AnimationTrackEditGroup::get_minimum_size() const { - Ref<Font> font = get_font("font", "Label"); - int separation = get_constant("vseparation", "ItemList"); + Ref<Font> 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<Texture2D> icon = get_icon("Node", "EditorIcons"); + Ref<Texture2D> 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<InputEvent> &p_event) { @@ -5266,10 +5266,10 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) { } String text; - Ref<Texture2D> icon = get_icon("Node", "EditorIcons"); + Ref<Texture2D> 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<Animation> 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<Texture2D> checked = get_icon("checked", "CheckBox"); + Ref<Texture2D> checked = get_theme_icon("checked", "CheckBox"); return checked->get_height(); } Rect2 AnimationTrackEditBool::get_key_rect(int p_index, float p_pixels_sec) { - Ref<Texture2D> checked = get_icon("checked", "CheckBox"); + Ref<Texture2D> 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<Texture2D> icon = get_icon(checked ? "checked" : "unchecked", "CheckBox"); + Ref<Texture2D> 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> font = get_font("font", "Label"); + Ref<Font> 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> font = get_font("font", "Label"); + Ref<Font> 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> font = get_font("font", "Label"); + Ref<Font> 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> font = get_font("font", "Label"); + Ref<Font> 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> font = get_font("font", "Label"); + Ref<Font> 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> font = get_font("font", "Label"); + Ref<Font> 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> font = get_font("font", "Label"); + Ref<Font> 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> font = get_font("font", "Label"); + Ref<Font> 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> font = get_font("font", "Label"); + Ref<Font> 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> font = get_font("font", "Label"); + Ref<Font> 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> font = get_font("font", "Label"); + Ref<Font> 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> font = get_font("font", "Label"); + Ref<Font> 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> font = get_font("font", "Label"); + Ref<Font> 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> font = get_font("font", "Label"); + Ref<Font> 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> font = get_font("font", "Label"); + Ref<Font> 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<Texture2D> volume_texture = get_icon("ColorTrackVu", "EditorIcons"); + Ref<Texture2D> 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<Texture2D> volume_texture = get_icon("ColorTrackVu", "EditorIcons"); + Ref<Texture2D> 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<Texture2D> volume_texture = get_icon("ColorTrackVu", "EditorIcons"); + Ref<Texture2D> 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<Texture2D> volume_texture = get_icon("ColorTrackVu", "EditorIcons"); + Ref<Texture2D> 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> font = get_font("font", "Label"); + Ref<Font> 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> font = get_font("font", "Label"); + Ref<Font> 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> font = get_font("font", "Label"); + Ref<Font> 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> font = get_font("font", "Label"); + Ref<Font> 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> font = get_font("font", "Label"); + Ref<Font> 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> font = get_font("font", "Label"); + Ref<Font> 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<InputEvent> &p_event) { Ref<InputEventMagnifyGesture> magnify_gesture = p_event; if (magnify_gesture.is_valid()) { - Ref<DynamicFont> font = text_editor->get_font("font"); + Ref<DynamicFont> 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<DynamicFont> font = text_editor->get_font("font"); // Reset source font size to default. + Ref<DynamicFont> 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<Texture2D> CodeTextEditor::_get_completion_icon(const ScriptCodeCompletionOp Ref<Texture2D> 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<DynamicFont> font = text_editor->get_font("font"); + Ref<DynamicFont> 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<Font> status_bar_font = get_font("status_source", "EditorFonts"); - error->add_font_override("font", status_bar_font); + Ref<Font> 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<Control>(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<InputEvent> &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<String, TreeItem *> &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<StyleBoxEmpty> 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<Texture> track_icon = get_icon("TrackColor", "EditorIcons"); + Ref<Texture> 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> font = get_font("font", "Label"); + Ref<Font> 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<StyleBox> graph_sb = get_stylebox("normal", "TextEdit"); - Ref<Font> graph_font = get_font("font", "TextEdit"); + Ref<StyleBox> graph_sb = get_theme_stylebox("normal", "TextEdit"); + Ref<Font> 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<Texture2D> folder = tree->get_icon("folder", "FileDialog"); + Ref<Texture2D> folder = tree->get_theme_icon("folder", "FileDialog"); bool broken = false; @@ -422,17 +422,17 @@ void DependencyRemoveDialog::_build_removed_dependency_tree(const Vector<Removed if (!tree_items.has(rd.dependency_folder)) { TreeItem *folder_item = owners->create_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> 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> 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 List<St il->set_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<String, Ref<Texture2D>> 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<Texture2D> generic_extension = tree->get_icon("Object", "EditorIcons"); + Ref<Texture2D> 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<String, TreeItem *> 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<StyleBoxEmpty> sbempty = memnew(StyleBoxEmpty); for (int i = 0; i < hbc->get_child_count(); i++) { Control *child = Object::cast_to<Control>(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<StyleBoxFlat> 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> font = get_font("font", "Label"); + Ref<Font> 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> font = get_font("font", "Label"); + Ref<Font> 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<Texture2D> frame = item_list->get_icon("Progress" + itos(preview_wheel_index + 1), "EditorIcons"); + Ref<Texture2D> 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<Texture2D> folder = item_list->get_icon("folder", "FileDialog"); - const Color folder_color = item_list->get_color("folder_icon_modulate", "FileDialog"); + Ref<Texture2D> 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<Texture2D> folder = item_list->get_icon("folder", "FileDialog"); - const Color folder_color = item_list->get_color("folder_icon_modulate", "FileDialog"); + Ref<Texture2D> folder = item_list->get_theme_icon("folder", "FileDialog"); + const Color folder_color = item_list->get_theme_color("folder_icon_modulate", "FileDialog"); List<String> files; List<String> dirs; @@ -1227,8 +1227,8 @@ void EditorFileDialog::_update_favorites() { bool res = access == ACCESS_RESOURCES; String current = get_current_dir(); - Ref<Texture2D> folder_icon = item_list->get_icon("Folder", "EditorIcons"); - const Color folder_color = item_list->get_color("folder_icon_modulate", "FileDialog"); + Ref<Texture2D> 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<InputEvent> &p_ev) { @@ -173,14 +173,14 @@ void EditorHelp::_class_desc_input(const Ref<InputEvent> &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<Font> doc_code_font = get_font("doc_source", "EditorFonts"); + Ref<Font> 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<StyleBox> class_desc_stylebox = EditorNode::get_singleton()->get_theme_base()->get_stylebox("normal", "RichTextLabel")->duplicate(); + Ref<StyleBox> 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<Font> doc_font = get_font("doc", "EditorFonts"); - Ref<Font> doc_bold_font = get_font("doc_bold", "EditorFonts"); - Ref<Font> doc_title_font = get_font("doc_title", "EditorFonts"); - Ref<Font> doc_code_font = get_font("doc_source", "EditorFonts"); + Ref<Font> doc_font = get_theme_font("doc", "EditorFonts"); + Ref<Font> doc_bold_font = get_theme_font("doc_bold", "EditorFonts"); + Ref<Font> doc_title_font = get_theme_font("doc_title", "EditorFonts"); + Ref<Font> 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<Font> doc_font = p_rt->get_font("doc", "EditorFonts"); - Ref<Font> doc_bold_font = p_rt->get_font("doc_bold", "EditorFonts"); - Ref<Font> doc_code_font = p_rt->get_font("doc_source", "EditorFonts"); + Ref<Font> doc_font = p_rt->get_theme_font("doc", "EditorFonts"); + Ref<Font> doc_bold_font = p_rt->get_theme_font("doc_bold", "EditorFonts"); + Ref<Font> 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<Texture2D> 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<Texture2D> 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> font = get_font("font", "Tree"); + Ref<Font> 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<Texture2D> key = get_icon("Key", "EditorIcons"); - ms.width += key->get_width() + get_constant("hseparator", "Tree"); + Ref<Texture2D> key = get_theme_icon("Key", "EditorIcons"); + ms.width += key->get_width() + get_theme_constant("hseparator", "Tree"); } if (checkable) { - Ref<Texture2D> check = get_icon("checked", "CheckBox"); - ms.width += check->get_width() + get_constant("hseparation", "CheckBox") + get_constant("hseparator", "Tree"); + Ref<Texture2D> 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> font = get_font("font", "Tree"); + Ref<Font> 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<Texture2D> 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> font = get_font("font", "Tree"); - Color dark_color = get_color("dark_color_2", "Editor"); + Ref<Font> 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<StyleBox> sb = get_stylebox("selected", "Tree"); + Ref<StyleBox> 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<Texture2D> 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<Texture2D> 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<Texture2D> 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<Texture2D> 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> font = get_font("font", "Tree"); + Ref<Font> 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> font = get_font("font", "Tree"); + Ref<Font> 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> font = get_font("font", "Tree"); + Ref<Font> font = get_theme_font("font", "Tree"); Ref<Texture2D> 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> font = get_font("font", "Tree"); + Ref<Font> 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> font = get_font("font", "Tree"); - ms.height += font->get_height() + get_constant("vseparation", "Tree"); - ms.width += get_constant("inspector_margin", "Editor"); + Ref<Font> 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<InputEvent> &p_event) { Ref<InputEventMouseButton> mb = p_event; if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { - Ref<Font> font = get_font("font", "Tree"); + Ref<Font> 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<Ref<EditorInspectorPlugin>>::Element *E = valid_plugins.front(); E; E = E->next()) { Ref<EditorInspectorPlugin> 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<DynamicFont> df_output_code = get_font("output_source", "EditorFonts"); + Ref<DynamicFont> 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<Texture2D> icon = get_icon("Error", "EditorIcons"); + log->push_color(get_theme_color("error_color", "Editor")); + Ref<Texture2D> 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<Texture2D> icon = get_icon("Warning", "EditorIcons"); + log->push_color(get_theme_color("warning_color", "Editor")); + Ref<Texture2D> 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<Texture2D> script_icon = gui_base->get_icon("Script", "EditorIcons"); + Ref<Texture2D> 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<Texture2D> 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<Texture2D> EditorNode::get_object_icon(const Object *p_object, const String Ref<Texture2D> 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<Texture2D> 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<Texture2D> 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<Resource> &p_res, Control *p_from) { { //todo make proper previews - Ref<ImageTexture> pic = gui_base->get_icon("FileBigThumb", "EditorIcons"); + Ref<ImageTexture> pic = gui_base->get_theme_icon("FileBigThumb", "EditorIcons"); Ref<Image> img = pic->get_data(); img = img->duplicate(); img->resize(48, 48); //meh @@ -5036,10 +5037,10 @@ Variant EditorNode::drag_files_and_dirs(const Vector<String> &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<Texture2D> df = get_icon("DistractionFree", "EditorIcons"); + Ref<Texture2D> df = get_theme_icon("DistractionFree", "EditorIcons"); open_big_text->set_icon(df); - Ref<Font> font = get_font("font", "Label"); + Ref<Font> 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<String> tooltips; virtual Size2 get_minimum_size() const { - Ref<Font> font = get_font("font", "Label"); + Ref<Font> 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<InputEvent> &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<Font> f = get_font("font", "Label"); - const Color font_color = get_color("font_color", "Label"); + const Ref<Font> 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<Point2> 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<StringNam void EditorPropertyNodePath::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { - Ref<Texture2D> t = get_icon("Clear", "EditorIcons"); + Ref<Texture2D> t = get_theme_icon("Clear", "EditorIcons"); clear->set_icon(t); } } @@ -2294,7 +2294,7 @@ void EditorPropertyResource::_resource_preview(const String &p_path, const Ref<T } if (p_preview.is_valid()) { - preview->set_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<Node>(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<Texture2D> 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<InputEvent> &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<Texture2D> t = get_icon("select_arrow", "Tree"); + Ref<Texture2D> 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<Button>(p_button); changing_type_idx = p_index; - Rect2 rect = button->get_global_rect(); + Rect2 rect = button->get_screen_rect(); change_type->set_as_minsize(); - change_type->set_global_position(rect.position + rect.size - Vector2(change_type->get_combined_minimum_size().x, 0)); + change_type->set_position(rect.position + rect.size - Vector2(change_type->get_contents_minimum_size().x, 0)); change_type->popup(); } @@ -373,13 +373,13 @@ void EditorPropertyArray::update_property() { if (is_untyped_array) { Button *edit = memnew(Button); - edit->set_icon(get_icon("Edit", "EditorIcons")); + edit->set_icon(get_theme_icon("Edit", "EditorIcons")); hb->add_child(edit); edit->connect("pressed", callable_mp(this, &EditorPropertyArray::_change_type), varray(edit, i + offset)); } else { Button *remove = memnew(Button); - remove->set_icon(get_icon("Remove", "EditorIcons")); + remove->set_icon(get_theme_icon("Remove", "EditorIcons")); remove->connect("pressed", callable_mp(this, &EditorPropertyArray::_remove_pressed), varray(i + offset)); hb->add_child(remove); } @@ -553,9 +553,9 @@ void EditorPropertyDictionary::_change_type(Object *p_button, int p_index) { Button *button = Object::cast_to<Button>(p_button); - Rect2 rect = button->get_global_rect(); + Rect2 rect = button->get_screen_rect(); change_type->set_as_minsize(); - change_type->set_global_position(rect.position + rect.size - Vector2(change_type->get_combined_minimum_size().x, 0)); + change_type->set_position(rect.position + rect.size - Vector2(change_type->get_contents_minimum_size().x, 0)); change_type->popup(); changing_type_idx = p_index; } @@ -909,9 +909,9 @@ void EditorPropertyDictionary::update_property() { for (int j = 0; j < 4; j++) { flat->set_default_margin(Margin(j), 2 * EDSCALE); } - flat->set_bg_color(get_color("prop_subsection", "Editor")); + flat->set_bg_color(get_theme_color("prop_subsection", "Editor")); - pc->add_style_override("panel", flat); + pc->add_theme_style_override("panel", flat); add_vbox = memnew(VBoxContainer); pc->add_child(add_vbox); } @@ -944,7 +944,7 @@ void EditorPropertyDictionary::update_property() { hb->add_child(prop); prop->set_h_size_flags(SIZE_EXPAND_FILL); Button *edit = memnew(Button); - edit->set_icon(get_icon("Edit", "EditorIcons")); + edit->set_icon(get_theme_icon("Edit", "EditorIcons")); hb->add_child(edit); edit->connect("pressed", callable_mp(this, &EditorPropertyDictionary::_change_type), varray(edit, change_index)); diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp index 98bc544478..398850f2d6 100644 --- a/editor/editor_resource_preview.cpp +++ b/editor/editor_resource_preview.cpp @@ -168,7 +168,7 @@ void EditorResourcePreview::_generate_preview(Ref<ImageTexture> &r_texture, Ref< } r_texture = generated; - int small_thumbnail_size = EditorNode::get_singleton()->get_theme_base()->get_icon("Object", "EditorIcons")->get_width(); // Kind of a workaround to retrieve the default icon size + int small_thumbnail_size = EditorNode::get_singleton()->get_theme_base()->get_theme_icon("Object", "EditorIcons")->get_width(); // Kind of a workaround to retrieve the default icon size small_thumbnail_size *= EDSCALE; if (preview_generators[i]->can_generate_small_preview()) { diff --git a/editor/editor_sectioned_inspector.cpp b/editor/editor_sectioned_inspector.cpp index fe28efedeb..2c895a3e9d 100644 --- a/editor/editor_sectioned_inspector.cpp +++ b/editor/editor_sectioned_inspector.cpp @@ -257,7 +257,7 @@ void SectionedInspector::update_category_list() { for (int i = 0; i < sc; i++) { TreeItem *parent = section_map[metasection]; - parent->set_custom_bg_color(0, get_color("prop_subsection", "Editor")); + parent->set_custom_bg_color(0, get_theme_color("prop_subsection", "Editor")); if (i > 0) { metasection += "/" + sectionarr[i]; @@ -309,7 +309,7 @@ SectionedInspector::SectionedInspector() : filter(memnew(SectionedInspectorFilter)), inspector(memnew(EditorInspector)), search_box(NULL) { - add_constant_override("autohide", 1); // Fixes the dragger always showing up + add_theme_constant_override("autohide", 1); // Fixes the dragger always showing up VBoxContainer *left_vb = memnew(VBoxContainer); left_vb->set_custom_minimum_size(Size2(190, 0) * EDSCALE); diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp index 58ec879915..11683c00e7 100644 --- a/editor/editor_spin_slider.cpp +++ b/editor/editor_spin_slider.cpp @@ -192,30 +192,30 @@ void EditorSpinSlider::_notification(int p_what) { // when it's edited. The LineEdit "focus" stylebox uses the "normal" stylebox's // default margins. Ref<StyleBoxFlat> stylebox = - EditorNode::get_singleton()->get_theme_base()->get_stylebox("normal", "LineEdit")->duplicate(); + EditorNode::get_singleton()->get_theme_base()->get_theme_stylebox("normal", "LineEdit")->duplicate(); // EditorSpinSliders with a label have more space on the left, so add an // higher margin to match the location where the text begins. // The margin values below were determined by empirical testing. stylebox->set_default_margin(MARGIN_LEFT, (get_label() != String() ? 23 : 16) * EDSCALE); - value_input->add_style_override("normal", stylebox); + value_input->add_theme_style_override("normal", stylebox); } if (p_what == NOTIFICATION_DRAW) { updown_offset = -1; - Ref<StyleBox> sb = get_stylebox("normal", "LineEdit"); + Ref<StyleBox> sb = get_theme_stylebox("normal", "LineEdit"); if (!flat) { draw_style_box(sb, Rect2(Vector2(), get_size())); } - Ref<Font> font = get_font("font", "LineEdit"); + Ref<Font> font = get_theme_font("font", "LineEdit"); int sep_base = 4 * EDSCALE; int sep = sep_base + sb->get_offset().x; //make it have the same margin on both sides, looks better int string_width = font->get_string_size(label).width; int number_width = get_size().width - sb->get_minimum_size().width - string_width - sep; - Ref<Texture2D> updown = get_icon("updown", "SpinBox"); + Ref<Texture2D> updown = get_theme_icon("updown", "SpinBox"); if (get_step() == 1) { number_width -= updown->get_width(); @@ -225,7 +225,7 @@ void EditorSpinSlider::_notification(int p_what) { int vofs = (get_size().height - font->get_height()) / 2 + font->get_ascent(); - Color fc = get_color("font_color", "LineEdit"); + Color fc = get_theme_color("font_color", "LineEdit"); Color lc; if (use_custom_label_color) { lc = custom_label_color; @@ -234,12 +234,12 @@ void EditorSpinSlider::_notification(int p_what) { } if (flat && label != String()) { - Color label_bg_color = get_color("dark_color_3", "Editor"); + Color label_bg_color = get_theme_color("dark_color_3", "Editor"); draw_rect(Rect2(Vector2(), Vector2(sb->get_offset().x * 2 + string_width, get_size().height)), label_bg_color); } if (has_focus()) { - Ref<StyleBox> focus = get_stylebox("focus", "LineEdit"); + Ref<StyleBox> focus = get_theme_stylebox("focus", "LineEdit"); draw_style_box(focus, Rect2(Vector2(), get_size())); } @@ -248,7 +248,7 @@ void EditorSpinSlider::_notification(int p_what) { draw_string(font, Vector2(Math::round(sb->get_offset().x + string_width + sep), vofs), numstr, fc, number_width); if (get_step() == 1) { - Ref<Texture2D> updown2 = get_icon("updown", "SpinBox"); + Ref<Texture2D> updown2 = get_theme_icon("updown", "SpinBox"); int updown_vofs = (get_size().height - updown2->get_height()) / 2; updown_offset = get_size().width - sb->get_margin(MARGIN_RIGHT) - updown2->get_width(); Color c(1, 1, 1); @@ -285,9 +285,9 @@ void EditorSpinSlider::_notification(int p_what) { if (display_grabber) { Ref<Texture2D> grabber_tex; if (mouse_over_grabber) { - grabber_tex = get_icon("grabber_highlight", "HSlider"); + grabber_tex = get_theme_icon("grabber_highlight", "HSlider"); } else { - grabber_tex = get_icon("grabber", "HSlider"); + grabber_tex = get_theme_icon("grabber", "HSlider"); } if (grabber->get_texture() != grabber_tex) { @@ -326,8 +326,8 @@ void EditorSpinSlider::_notification(int p_what) { Size2 EditorSpinSlider::get_minimum_size() const { - Ref<StyleBox> sb = get_stylebox("normal", "LineEdit"); - Ref<Font> font = get_font("font", "LineEdit"); + Ref<StyleBox> sb = get_theme_stylebox("normal", "LineEdit"); + Ref<Font> font = get_theme_font("font", "LineEdit"); Size2 ms = sb->get_minimum_size(); ms.height += font->get_height(); diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp index 151efc1f5e..61ec9c44c2 100644 --- a/editor/export_template_manager.cpp +++ b/editor/export_template_manager.cpp @@ -86,7 +86,7 @@ void ExportTemplateManager::_update_template_list() { current_hb->add_child(current); if (templates.has(current_version)) { - current->add_color_override("font_color", current->get_color("success_color", "Editor")); + current->add_theme_color_override("font_color", current->get_theme_color("success_color", "Editor")); // Only display a redownload button if it can be downloaded in the first place if (downloads_available) { @@ -103,7 +103,7 @@ void ExportTemplateManager::_update_template_list() { uninstall->connect("pressed", callable_mp(this, &ExportTemplateManager::_uninstall_template), varray(current_version)); } else { - current->add_color_override("font_color", current->get_color("error_color", "Editor")); + current->add_theme_color_override("font_color", current->get_theme_color("error_color", "Editor")); Button *redownload = memnew(Button); redownload->set_text(TTR("Download")); @@ -121,7 +121,7 @@ void ExportTemplateManager::_update_template_list() { HBoxContainer *hbc = memnew(HBoxContainer); Label *version = memnew(Label); - version->set_modulate(current->get_color("disabled_font_color", "Editor")); + version->set_modulate(current->get_theme_color("disabled_font_color", "Editor")); String text = E->get(); if (text == current_version) { text += " " + TTR("(Current)"); diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 019b1a73f9..e951259cc7 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -49,10 +49,10 @@ Ref<Texture2D> FileSystemDock::_get_tree_item_icon(EditorFileSystemDirectory *p_dir, int p_idx) { Ref<Texture2D> file_icon; if (!p_dir->get_file_import_is_valid(p_idx)) { - file_icon = get_icon("ImportFail", "EditorIcons"); + file_icon = get_theme_icon("ImportFail", "EditorIcons"); } else { String file_type = p_dir->get_file_type(p_idx); - file_icon = (has_icon(file_type, "EditorIcons")) ? get_icon(file_type, "EditorIcons") : get_icon("File", "EditorIcons"); + file_icon = (has_theme_icon(file_type, "EditorIcons")) ? get_theme_icon(file_type, "EditorIcons") : get_theme_icon("File", "EditorIcons"); } return file_icon; } @@ -67,8 +67,8 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory dname = "res://"; subdirectory_item->set_text(0, dname); - subdirectory_item->set_icon(0, get_icon("Folder", "EditorIcons")); - subdirectory_item->set_icon_modulate(0, get_color("folder_icon_modulate", "FileDialog")); + subdirectory_item->set_icon(0, get_theme_icon("Folder", "EditorIcons")); + subdirectory_item->set_icon_modulate(0, get_theme_color("folder_icon_modulate", "FileDialog")); subdirectory_item->set_selectable(0, true); String lpath = p_dir->get_path(); subdirectory_item->set_metadata(0, lpath); @@ -122,7 +122,7 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory file_item->set_as_cursor(0); } if (main_scene == file_metadata) { - file_item->set_custom_color(0, get_color("accent_color", "Editor")); + file_item->set_custom_color(0, get_theme_color("accent_color", "Editor")); } Array udata; udata.push_back(tree_update_id); @@ -188,7 +188,7 @@ void FileSystemDock::_update_tree(const Vector<String> &p_uncollapsed_paths, boo // Handles the favorites. TreeItem *favorites = tree->create_item(root); - favorites->set_icon(0, get_icon("Favorites", "EditorIcons")); + favorites->set_icon(0, get_theme_icon("Favorites", "EditorIcons")); favorites->set_text(0, TTR("Favorites:")); favorites->set_metadata(0, "Favorites"); favorites->set_collapsed(p_uncollapsed_paths.find("Favorites") < 0); @@ -199,8 +199,8 @@ void FileSystemDock::_update_tree(const Vector<String> &p_uncollapsed_paths, boo if (!fave.begins_with("res://")) continue; - Ref<Texture2D> folder_icon = get_icon("Folder", "EditorIcons"); - const Color folder_color = get_color("folder_icon_modulate", "FileDialog"); + Ref<Texture2D> folder_icon = get_theme_icon("Folder", "EditorIcons"); + const Color folder_color = get_theme_color("folder_icon_modulate", "FileDialog"); String text; Ref<Texture2D> icon; @@ -220,7 +220,7 @@ void FileSystemDock::_update_tree(const Vector<String> &p_uncollapsed_paths, boo if (dir) { icon = _get_tree_item_icon(dir, index); } else { - icon = get_icon("File", "EditorIcons"); + icon = get_theme_icon("File", "EditorIcons"); } color = Color(1, 1, 1); } @@ -307,20 +307,21 @@ void FileSystemDock::_notification(int p_what) { EditorResourcePreview::get_singleton()->connect("preview_invalidated", callable_mp(this, &FileSystemDock::_preview_invalidated)); String ei = "EditorIcons"; - button_reload->set_icon(get_icon("Reload", ei)); - button_toggle_display_mode->set_icon(get_icon("Panels2", ei)); + + button_reload->set_icon(get_theme_icon("Reload", ei)); + button_toggle_display_mode->set_icon(get_theme_icon("Panels2", ei)); button_file_list_display_mode->connect("pressed", callable_mp(this, &FileSystemDock::_toggle_file_display)); files->connect("item_activated", callable_mp(this, &FileSystemDock::_file_list_activate_file)); button_hist_next->connect("pressed", callable_mp(this, &FileSystemDock::_fw_history)); button_hist_prev->connect("pressed", callable_mp(this, &FileSystemDock::_bw_history)); - tree_search_box->set_right_icon(get_icon("Search", ei)); + tree_search_box->set_right_icon(get_theme_icon("Search", ei)); tree_search_box->set_clear_button_enabled(true); - file_list_search_box->set_right_icon(get_icon("Search", ei)); + file_list_search_box->set_right_icon(get_theme_icon("Search", ei)); file_list_search_box->set_clear_button_enabled(true); - button_hist_next->set_icon(get_icon("Forward", ei)); - button_hist_prev->set_icon(get_icon("Back", ei)); + button_hist_next->set_icon(get_theme_icon("Forward", ei)); + button_hist_prev->set_icon(get_theme_icon("Back", ei)); file_list_popup->connect("id_pressed", callable_mp(this, &FileSystemDock::_file_list_rmb_option)); tree_popup->connect("id_pressed", callable_mp(this, &FileSystemDock::_tree_rmb_option)); @@ -370,19 +371,19 @@ void FileSystemDock::_notification(int p_what) { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { // Update icons. String ei = "EditorIcons"; - button_reload->set_icon(get_icon("Reload", ei)); - button_toggle_display_mode->set_icon(get_icon("Panels2", ei)); - button_hist_next->set_icon(get_icon("Forward", ei)); - button_hist_prev->set_icon(get_icon("Back", ei)); + button_reload->set_icon(get_theme_icon("Reload", ei)); + button_toggle_display_mode->set_icon(get_theme_icon("Panels2", ei)); + button_hist_next->set_icon(get_theme_icon("Forward", ei)); + button_hist_prev->set_icon(get_theme_icon("Back", ei)); if (file_list_display_mode == FILE_LIST_DISPLAY_LIST) { - button_file_list_display_mode->set_icon(get_icon("FileThumbnail", "EditorIcons")); + button_file_list_display_mode->set_icon(get_theme_icon("FileThumbnail", "EditorIcons")); } else { - button_file_list_display_mode->set_icon(get_icon("FileList", "EditorIcons")); + button_file_list_display_mode->set_icon(get_theme_icon("FileList", "EditorIcons")); } - tree_search_box->set_right_icon(get_icon("Search", ei)); + tree_search_box->set_right_icon(get_theme_icon("Search", ei)); tree_search_box->set_clear_button_enabled(true); - file_list_search_box->set_right_icon(get_icon("Search", ei)); + file_list_search_box->set_right_icon(get_theme_icon("Search", ei)); file_list_search_box->set_clear_button_enabled(true); // Update always show folders. @@ -533,11 +534,11 @@ void FileSystemDock::_toggle_file_display() { void FileSystemDock::_set_file_display(bool p_active) { if (p_active) { file_list_display_mode = FILE_LIST_DISPLAY_LIST; - button_file_list_display_mode->set_icon(get_icon("FileThumbnail", "EditorIcons")); + button_file_list_display_mode->set_icon(get_theme_icon("FileThumbnail", "EditorIcons")); button_file_list_display_mode->set_tooltip(TTR("View items as a grid of thumbnails.")); } else { file_list_display_mode = FILE_LIST_DISPLAY_THUMBNAILS; - button_file_list_display_mode->set_icon(get_icon("FileList", "EditorIcons")); + button_file_list_display_mode->set_icon(get_theme_icon("FileList", "EditorIcons")); button_file_list_display_mode->set_tooltip(TTR("View items as a list.")); } @@ -629,13 +630,13 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) { files->set_fixed_icon_size(Size2(thumbnail_size, thumbnail_size)); if (thumbnail_size < 64) { - folder_thumbnail = get_icon("FolderMediumThumb", ei); - file_thumbnail = get_icon("FileMediumThumb", ei); - file_thumbnail_broken = get_icon("FileDeadMediumThumb", ei); + folder_thumbnail = get_theme_icon("FolderMediumThumb", ei); + file_thumbnail = get_theme_icon("FileMediumThumb", ei); + file_thumbnail_broken = get_theme_icon("FileDeadMediumThumb", ei); } else { - folder_thumbnail = get_icon("FolderBigThumb", ei); - file_thumbnail = get_icon("FileBigThumb", ei); - file_thumbnail_broken = get_icon("FileDeadBigThumb", ei); + folder_thumbnail = get_theme_icon("FolderBigThumb", ei); + file_thumbnail = get_theme_icon("FileBigThumb", ei); + file_thumbnail_broken = get_theme_icon("FileDeadBigThumb", ei); } } else { // No thumbnails. @@ -646,8 +647,8 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) { files->set_fixed_icon_size(Size2()); } - Ref<Texture2D> folder_icon = (use_thumbnails) ? folder_thumbnail : get_icon("folder", "FileDialog"); - const Color folder_color = get_color("folder_icon_modulate", "FileDialog"); + Ref<Texture2D> folder_icon = (use_thumbnails) ? folder_thumbnail : get_theme_icon("folder", "FileDialog"); + const Color folder_color = get_theme_color("folder_icon_modulate", "FileDialog"); // Build the FileInfo list. List<FileInfo> filelist; @@ -767,10 +768,10 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) { // Select the icons. if (!finfo->import_broken) { - type_icon = (has_icon(ftype, ei)) ? get_icon(ftype, ei) : get_icon(oi, ei); + type_icon = (has_theme_icon(ftype, ei)) ? get_theme_icon(ftype, ei) : get_theme_icon(oi, ei); big_icon = file_thumbnail; } else { - type_icon = get_icon("ImportFail", ei); + type_icon = get_theme_icon("ImportFail", ei); big_icon = file_thumbnail_broken; tooltip += "\n" + TTR("Status: Import of file failed. Please fix file and reimport manually."); } @@ -790,7 +791,7 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) { } if (fpath == main_scene) { - files->set_item_custom_fg_color(item_index, get_color("accent_color", "Editor")); + files->set_item_custom_fg_color(item_index, get_theme_color("accent_color", "Editor")); } // Generate the preview. @@ -2179,28 +2180,28 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<Str if (all_files) { if (all_files_scenes) { if (filenames.size() == 1) { - p_popup->add_icon_item(get_icon("Load", "EditorIcons"), TTR("Open Scene"), FILE_OPEN); - p_popup->add_icon_item(get_icon("CreateNewSceneFrom", "EditorIcons"), TTR("New Inherited Scene"), FILE_INHERIT); + p_popup->add_icon_item(get_theme_icon("Load", "EditorIcons"), TTR("Open Scene"), FILE_OPEN); + p_popup->add_icon_item(get_theme_icon("CreateNewSceneFrom", "EditorIcons"), TTR("New Inherited Scene"), FILE_INHERIT); if (ProjectSettings::get_singleton()->get("application/run/main_scene") != filenames[0]) { - p_popup->add_icon_item(get_icon("PlayScene", "EditorIcons"), TTR("Set As Main Scene"), FILE_MAIN_SCENE); + p_popup->add_icon_item(get_theme_icon("PlayScene", "EditorIcons"), TTR("Set As Main Scene"), FILE_MAIN_SCENE); } } else { - p_popup->add_icon_item(get_icon("Load", "EditorIcons"), TTR("Open Scenes"), FILE_OPEN); + p_popup->add_icon_item(get_theme_icon("Load", "EditorIcons"), TTR("Open Scenes"), FILE_OPEN); } - p_popup->add_icon_item(get_icon("Instance", "EditorIcons"), TTR("Instance"), FILE_INSTANCE); + p_popup->add_icon_item(get_theme_icon("Instance", "EditorIcons"), TTR("Instance"), FILE_INSTANCE); p_popup->add_separator(); } else if (filenames.size() == 1) { - p_popup->add_icon_item(get_icon("Load", "EditorIcons"), TTR("Open"), FILE_OPEN); + p_popup->add_icon_item(get_theme_icon("Load", "EditorIcons"), TTR("Open"), FILE_OPEN); p_popup->add_separator(); } } if (p_paths.size() >= 1) { if (!all_favorites) { - p_popup->add_icon_item(get_icon("Favorites", "EditorIcons"), TTR("Add to Favorites"), FILE_ADD_FAVORITE); + p_popup->add_icon_item(get_theme_icon("Favorites", "EditorIcons"), TTR("Add to Favorites"), FILE_ADD_FAVORITE); } if (!all_not_favorites) { - p_popup->add_icon_item(get_icon("NonFavorite", "EditorIcons"), TTR("Remove from Favorites"), FILE_REMOVE_FAVORITE); + p_popup->add_icon_item(get_theme_icon("NonFavorite", "EditorIcons"), TTR("Remove from Favorites"), FILE_REMOVE_FAVORITE); } p_popup->add_separator(); } @@ -2213,36 +2214,36 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<Str } } else if (all_folders && foldernames.size() > 0) { - p_popup->add_icon_item(get_icon("Load", "EditorIcons"), TTR("Open"), FILE_OPEN); + p_popup->add_icon_item(get_theme_icon("Load", "EditorIcons"), TTR("Open"), FILE_OPEN); p_popup->add_separator(); } if (p_paths.size() == 1) { - p_popup->add_icon_item(get_icon("ActionCopy", "EditorIcons"), TTR("Copy Path"), FILE_COPY_PATH); + p_popup->add_icon_item(get_theme_icon("ActionCopy", "EditorIcons"), TTR("Copy Path"), FILE_COPY_PATH); if (p_paths[0] != "res://") { - p_popup->add_icon_item(get_icon("Rename", "EditorIcons"), TTR("Rename..."), FILE_RENAME); - p_popup->add_icon_item(get_icon("Duplicate", "EditorIcons"), TTR("Duplicate..."), FILE_DUPLICATE); + p_popup->add_icon_item(get_theme_icon("Rename", "EditorIcons"), TTR("Rename..."), FILE_RENAME); + p_popup->add_icon_item(get_theme_icon("Duplicate", "EditorIcons"), TTR("Duplicate..."), FILE_DUPLICATE); } } if (p_paths.size() > 1 || p_paths[0] != "res://") { - p_popup->add_icon_item(get_icon("MoveUp", "EditorIcons"), TTR("Move To..."), FILE_MOVE); - p_popup->add_icon_item(get_icon("Remove", "EditorIcons"), TTR("Delete"), FILE_REMOVE); + p_popup->add_icon_item(get_theme_icon("MoveUp", "EditorIcons"), TTR("Move To..."), FILE_MOVE); + p_popup->add_icon_item(get_theme_icon("Remove", "EditorIcons"), TTR("Delete"), FILE_REMOVE); } if (p_paths.size() == 1) { p_popup->add_separator(); if (p_display_path_dependent_options) { - p_popup->add_icon_item(get_icon("Folder", "EditorIcons"), TTR("New Folder..."), FILE_NEW_FOLDER); - p_popup->add_icon_item(get_icon("PackedScene", "EditorIcons"), TTR("New Scene..."), FILE_NEW_SCENE); - p_popup->add_icon_item(get_icon("Script", "EditorIcons"), TTR("New Script..."), FILE_NEW_SCRIPT); - p_popup->add_icon_item(get_icon("Object", "EditorIcons"), TTR("New Resource..."), FILE_NEW_RESOURCE); + p_popup->add_icon_item(get_theme_icon("Folder", "EditorIcons"), TTR("New Folder..."), FILE_NEW_FOLDER); + p_popup->add_icon_item(get_theme_icon("PackedScene", "EditorIcons"), TTR("New Scene..."), FILE_NEW_SCENE); + p_popup->add_icon_item(get_theme_icon("Script", "EditorIcons"), TTR("New Script..."), FILE_NEW_SCRIPT); + p_popup->add_icon_item(get_theme_icon("Object", "EditorIcons"), TTR("New Resource..."), FILE_NEW_RESOURCE); p_popup->add_separator(); } String fpath = p_paths[0]; String item_text = fpath.ends_with("/") ? TTR("Open in File Manager") : TTR("Show in File Manager"); - p_popup->add_icon_item(get_icon("Filesystem", "EditorIcons"), item_text, FILE_SHOW_IN_EXPLORER); + p_popup->add_icon_item(get_theme_icon("Filesystem", "EditorIcons"), item_text, FILE_SHOW_IN_EXPLORER); } } @@ -2252,8 +2253,8 @@ void FileSystemDock::_tree_rmb_select(const Vector2 &p_pos) { if (paths.size() == 1) { if (paths[0].ends_with("/")) { - tree_popup->add_icon_item(get_icon("GuiTreeArrowDown", "EditorIcons"), TTR("Expand All"), FOLDER_EXPAND_ALL); - tree_popup->add_icon_item(get_icon("GuiTreeArrowRight", "EditorIcons"), TTR("Collapse All"), FOLDER_COLLAPSE_ALL); + tree_popup->add_icon_item(get_theme_icon("GuiTreeArrowDown", "EditorIcons"), TTR("Expand All"), FOLDER_EXPAND_ALL); + tree_popup->add_icon_item(get_theme_icon("GuiTreeArrowRight", "EditorIcons"), TTR("Collapse All"), FOLDER_COLLAPSE_ALL); tree_popup->add_separator(); } } @@ -2273,10 +2274,10 @@ void FileSystemDock::_tree_rmb_empty(const Vector2 &p_pos) { path = "res://"; tree_popup->clear(); tree_popup->set_size(Size2(1, 1)); - tree_popup->add_icon_item(get_icon("Folder", "EditorIcons"), TTR("New Folder..."), FILE_NEW_FOLDER); - tree_popup->add_icon_item(get_icon("PackedScene", "EditorIcons"), TTR("New Scene..."), FILE_NEW_SCENE); - tree_popup->add_icon_item(get_icon("Script", "EditorIcons"), TTR("New Script..."), FILE_NEW_SCRIPT); - tree_popup->add_icon_item(get_icon("Object", "EditorIcons"), TTR("New Resource..."), FILE_NEW_RESOURCE); + tree_popup->add_icon_item(get_theme_icon("Folder", "EditorIcons"), TTR("New Folder..."), FILE_NEW_FOLDER); + tree_popup->add_icon_item(get_theme_icon("PackedScene", "EditorIcons"), TTR("New Scene..."), FILE_NEW_SCENE); + tree_popup->add_icon_item(get_theme_icon("Script", "EditorIcons"), TTR("New Script..."), FILE_NEW_SCRIPT); + tree_popup->add_icon_item(get_theme_icon("Object", "EditorIcons"), TTR("New Resource..."), FILE_NEW_RESOURCE); tree_popup->set_position(tree->get_global_position() + p_pos); tree_popup->popup(); } @@ -2316,12 +2317,12 @@ void FileSystemDock::_file_list_rmb_pressed(const Vector2 &p_pos) { file_list_popup->clear(); file_list_popup->set_size(Size2(1, 1)); - file_list_popup->add_icon_item(get_icon("Folder", "EditorIcons"), TTR("New Folder..."), FILE_NEW_FOLDER); - file_list_popup->add_icon_item(get_icon("PackedScene", "EditorIcons"), TTR("New Scene..."), FILE_NEW_SCENE); - file_list_popup->add_icon_item(get_icon("Script", "EditorIcons"), TTR("New Script..."), FILE_NEW_SCRIPT); - file_list_popup->add_icon_item(get_icon("Object", "EditorIcons"), TTR("New Resource..."), FILE_NEW_RESOURCE); + file_list_popup->add_icon_item(get_theme_icon("Folder", "EditorIcons"), TTR("New Folder..."), FILE_NEW_FOLDER); + file_list_popup->add_icon_item(get_theme_icon("PackedScene", "EditorIcons"), TTR("New Scene..."), FILE_NEW_SCENE); + file_list_popup->add_icon_item(get_theme_icon("Script", "EditorIcons"), TTR("New Script..."), FILE_NEW_SCRIPT); + file_list_popup->add_icon_item(get_theme_icon("Object", "EditorIcons"), TTR("New Resource..."), FILE_NEW_RESOURCE); file_list_popup->add_separator(); - file_list_popup->add_icon_item(get_icon("Filesystem", "EditorIcons"), TTR("Open in File Manager"), FILE_SHOW_IN_EXPLORER); + file_list_popup->add_icon_item(get_theme_icon("Filesystem", "EditorIcons"), TTR("Open in File Manager"), FILE_SHOW_IN_EXPLORER); file_list_popup->set_position(files->get_global_position() + p_pos); file_list_popup->popup(); } @@ -2493,7 +2494,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) { add_child(top_vbc); HBoxContainer *toolbar_hbc = memnew(HBoxContainer); - toolbar_hbc->add_constant_override("separation", 0); + toolbar_hbc->add_theme_constant_override("separation", 0); top_vbc->add_child(toolbar_hbc); button_hist_prev = memnew(ToolButton); @@ -2530,7 +2531,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) { toolbar_hbc->add_child(button_toggle_display_mode); HBoxContainer *toolbar2_hbc = memnew(HBoxContainer); - toolbar2_hbc->add_constant_override("separation", 0); + toolbar2_hbc->add_theme_constant_override("separation", 0); top_vbc->add_child(toolbar2_hbc); tree_search_box = memnew(LineEdit); @@ -2540,11 +2541,11 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) { toolbar2_hbc->add_child(tree_search_box); file_list_popup = memnew(PopupMenu); - file_list_popup->set_hide_on_window_lose_focus(true); + add_child(file_list_popup); tree_popup = memnew(PopupMenu); - tree_popup->set_hide_on_window_lose_focus(true); + add_child(tree_popup); split_box = memnew(VSplitContainer); diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index 83c5263dda..61afc9115f 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -577,7 +577,7 @@ FindInFilesPanel::FindInFilesPanel() { hbc->add_child(find_label); _search_text_label = memnew(Label); - _search_text_label->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("source", "EditorFonts")); + _search_text_label->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font("source", "EditorFonts")); hbc->add_child(_search_text_label); _progress_bar = memnew(ProgressBar); @@ -605,7 +605,7 @@ FindInFilesPanel::FindInFilesPanel() { } _results_display = memnew(Tree); - _results_display->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("source", "EditorFonts")); + _results_display->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font("source", "EditorFonts")); _results_display->set_v_size_flags(SIZE_EXPAND_FILL); _results_display->connect("item_selected", callable_mp(this, &FindInFilesPanel::_on_result_selected)); _results_display->connect("item_edited", callable_mp(this, &FindInFilesPanel::_on_item_edited)); @@ -735,7 +735,7 @@ void FindInFilesPanel::_on_result_found(String fpath, int line_number, int begin item->set_text(text_index, item_text); item->set_custom_draw(text_index, this, "_draw_result_text"); - Ref<Font> font = _results_display->get_font("font"); + Ref<Font> font = _results_display->get_theme_font("font"); float raw_text_width = font->get_string_size(text).x; float item_text_width = font->get_string_size(item_text).x; @@ -781,11 +781,11 @@ void FindInFilesPanel::_on_item_edited() { TreeItem *item = _results_display->get_selected(); if (item->is_checked(0)) { - item->set_custom_color(1, _results_display->get_color("font_color")); + item->set_custom_color(1, _results_display->get_theme_color("font_color")); } else { // Grey out - Color color = _results_display->get_color("font_color"); + Color color = _results_display->get_theme_color("font_color"); color.a /= 2.0; item->set_custom_color(1, color); } diff --git a/editor/groups_editor.cpp b/editor/groups_editor.cpp index 530a95b280..686ca869a6 100644 --- a/editor/groups_editor.cpp +++ b/editor/groups_editor.cpp @@ -94,7 +94,7 @@ void GroupDialog::_load_nodes(Node *p_current) { if (!_can_edit(p_current, selected_group)) { node->set_selectable(0, false); - node->set_custom_color(0, groups->get_color("disabled_font_color", "Editor")); + node->set_custom_color(0, groups->get_theme_color("disabled_font_color", "Editor")); } } @@ -204,7 +204,7 @@ void GroupDialog::_add_group(String p_name) { TreeItem *new_group = groups->create_item(groups_root); new_group->set_text(0, name); - new_group->add_button(0, groups->get_icon("Remove", "EditorIcons"), 0); + new_group->add_button(0, groups->get_theme_icon("Remove", "EditorIcons"), 0); new_group->set_editable(0, true); new_group->select(0); groups->ensure_cursor_is_visible(); @@ -361,12 +361,12 @@ void GroupDialog::_delete_group_item(const String &p_name) { void GroupDialog::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { - add_button->set_icon(groups->get_icon("Forward", "EditorIcons")); - remove_button->set_icon(groups->get_icon("Back", "EditorIcons")); + add_button->set_icon(groups->get_theme_icon("Forward", "EditorIcons")); + remove_button->set_icon(groups->get_theme_icon("Back", "EditorIcons")); - add_filter->set_right_icon(groups->get_icon("Search", "EditorIcons")); + add_filter->set_right_icon(groups->get_theme_icon("Search", "EditorIcons")); add_filter->set_clear_button_enabled(true); - remove_filter->set_right_icon(groups->get_icon("Search", "EditorIcons")); + remove_filter->set_right_icon(groups->get_theme_icon("Search", "EditorIcons")); remove_filter->set_clear_button_enabled(true); } break; } @@ -426,7 +426,7 @@ GroupDialog::GroupDialog() { groups->set_allow_reselect(true); groups->set_allow_rmb_select(true); groups->set_v_size_flags(Control::SIZE_EXPAND_FILL); - groups->add_constant_override("draw_guides", 1); + groups->add_theme_constant_override("draw_guides", 1); groups->connect("item_selected", callable_mp(this, &GroupDialog::_group_selected)); groups->connect("button_pressed", callable_mp(this, &GroupDialog::_delete_group_pressed)); groups->connect("item_edited", callable_mp(this, &GroupDialog::_group_renamed)); @@ -459,10 +459,10 @@ GroupDialog::GroupDialog() { nodes_to_add->set_hide_folding(true); nodes_to_add->set_select_mode(Tree::SELECT_MULTI); nodes_to_add->set_v_size_flags(Control::SIZE_EXPAND_FILL); - nodes_to_add->add_constant_override("draw_guides", 1); + nodes_to_add->add_theme_constant_override("draw_guides", 1); HBoxContainer *add_filter_hbc = memnew(HBoxContainer); - add_filter_hbc->add_constant_override("separate", 0); + add_filter_hbc->add_theme_constant_override("separate", 0); vbc_add->add_child(add_filter_hbc); add_filter = memnew(LineEdit); @@ -505,10 +505,10 @@ GroupDialog::GroupDialog() { nodes_to_remove->set_hide_root(true); nodes_to_remove->set_hide_folding(true); nodes_to_remove->set_select_mode(Tree::SELECT_MULTI); - nodes_to_remove->add_constant_override("draw_guides", 1); + nodes_to_remove->add_theme_constant_override("draw_guides", 1); HBoxContainer *remove_filter_hbc = memnew(HBoxContainer); - remove_filter_hbc->add_constant_override("separate", 0); + remove_filter_hbc->add_theme_constant_override("separate", 0); vbc_remove->add_child(remove_filter_hbc); remove_filter = memnew(LineEdit); @@ -637,7 +637,7 @@ void GroupsEditor::update_tree() { TreeItem *item = tree->create_item(root); item->set_text(0, gi.name); if (can_be_deleted) { - item->add_button(0, get_icon("Remove", "EditorIcons"), 0); + item->add_button(0, get_theme_icon("Remove", "EditorIcons"), 0); } else { item->set_selectable(0, false); } @@ -694,8 +694,8 @@ GroupsEditor::GroupsEditor() { tree->set_v_size_flags(Control::SIZE_EXPAND_FILL); vbc->add_child(tree); tree->connect("button_pressed", callable_mp(this, &GroupsEditor::_remove_group)); - tree->add_constant_override("draw_guides", 1); - add_constant_override("separation", 3 * EDSCALE); + tree->add_theme_constant_override("draw_guides", 1); + add_theme_constant_override("separation", 3 * EDSCALE); } GroupsEditor::~GroupsEditor() { diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp index 2c59949994..23be42aaea 100644 --- a/editor/import_dock.cpp +++ b/editor/import_dock.cpp @@ -492,13 +492,13 @@ void ImportDock::_notification(int p_what) { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - imported->add_style_override("normal", get_stylebox("normal", "LineEdit")); + imported->add_theme_style_override("normal", get_theme_stylebox("normal", "LineEdit")); } break; case NOTIFICATION_ENTER_TREE: { import_opts->edit(params); - label_warning->add_color_override("font_color", get_color("warning_color", "Editor")); + label_warning->add_theme_color_override("font_color", get_theme_color("warning_color", "Editor")); } break; } } @@ -526,7 +526,7 @@ ImportDock::ImportDock() { set_name("Import"); imported = memnew(Label); - imported->add_style_override("normal", EditorNode::get_singleton()->get_gui_base()->get_stylebox("normal", "LineEdit")); + imported->add_theme_style_override("normal", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("normal", "LineEdit")); imported->set_clip_text(true); add_child(imported); HBoxContainer *hb = memnew(HBoxContainer); diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp index f18d14c3c8..916ebd27ab 100644 --- a/editor/inspector_dock.cpp +++ b/editor/inspector_dock.cpp @@ -214,7 +214,7 @@ void InspectorDock::_prepare_history() { history_menu->get_popup()->clear(); - Ref<Texture2D> base_icon = get_icon("Object", "EditorIcons"); + Ref<Texture2D> base_icon = get_theme_icon("Object", "EditorIcons"); Set<ObjectID> already; for (int i = editor_history->get_history_len() - 1; i >= history_to; i--) { @@ -328,15 +328,15 @@ void InspectorDock::_notification(int p_what) { switch (p_what) { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { set_theme(editor->get_gui_base()->get_theme()); - resource_new_button->set_icon(get_icon("New", "EditorIcons")); - resource_load_button->set_icon(get_icon("Load", "EditorIcons")); - resource_save_button->set_icon(get_icon("Save", "EditorIcons")); - backward_button->set_icon(get_icon("Back", "EditorIcons")); - forward_button->set_icon(get_icon("Forward", "EditorIcons")); - history_menu->set_icon(get_icon("History", "EditorIcons")); - object_menu->set_icon(get_icon("Tools", "EditorIcons")); - warning->set_icon(get_icon("NodeWarning", "EditorIcons")); - warning->add_color_override("font_color", get_color("warning_color", "Editor")); + resource_new_button->set_icon(get_theme_icon("New", "EditorIcons")); + resource_load_button->set_icon(get_theme_icon("Load", "EditorIcons")); + resource_save_button->set_icon(get_theme_icon("Save", "EditorIcons")); + backward_button->set_icon(get_theme_icon("Back", "EditorIcons")); + forward_button->set_icon(get_theme_icon("Forward", "EditorIcons")); + history_menu->set_icon(get_theme_icon("History", "EditorIcons")); + object_menu->set_icon(get_theme_icon("Tools", "EditorIcons")); + warning->set_icon(get_theme_icon("NodeWarning", "EditorIcons")); + warning->add_theme_color_override("font_color", get_theme_color("warning_color", "Editor")); } break; } } @@ -435,7 +435,7 @@ void InspectorDock::update(Object *p_object) { p->add_separator(); p->add_shortcut(ED_SHORTCUT("property_editor/make_subresources_unique", TTR("Make Sub-Resources Unique")), OBJECT_UNIQUE_RESOURCES); p->add_separator(); - p->add_icon_shortcut(get_icon("HelpSearch", "EditorIcons"), ED_SHORTCUT("property_editor/open_help", TTR("Open in Help")), OBJECT_REQUEST_HELP); + p->add_icon_shortcut(get_theme_icon("HelpSearch", "EditorIcons"), ED_SHORTCUT("property_editor/open_help", TTR("Open in Help")), OBJECT_REQUEST_HELP); } List<MethodInfo> methods; @@ -496,21 +496,21 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) { resource_new_button = memnew(ToolButton); resource_new_button->set_tooltip(TTR("Create a new resource in memory and edit it.")); - resource_new_button->set_icon(get_icon("New", "EditorIcons")); + resource_new_button->set_icon(get_theme_icon("New", "EditorIcons")); general_options_hb->add_child(resource_new_button); resource_new_button->connect("pressed", callable_mp(this, &InspectorDock::_new_resource)); resource_new_button->set_focus_mode(Control::FOCUS_NONE); resource_load_button = memnew(ToolButton); resource_load_button->set_tooltip(TTR("Load an existing resource from disk and edit it.")); - resource_load_button->set_icon(get_icon("Load", "EditorIcons")); + resource_load_button->set_icon(get_theme_icon("Load", "EditorIcons")); general_options_hb->add_child(resource_load_button); resource_load_button->connect("pressed", callable_mp(this, &InspectorDock::_open_resource_selector)); resource_load_button->set_focus_mode(Control::FOCUS_NONE); resource_save_button = memnew(MenuButton); resource_save_button->set_tooltip(TTR("Save the currently edited resource.")); - resource_save_button->set_icon(get_icon("Save", "EditorIcons")); + resource_save_button->set_icon(get_theme_icon("Save", "EditorIcons")); general_options_hb->add_child(resource_save_button); resource_save_button->get_popup()->add_item(TTR("Save"), RESOURCE_SAVE); resource_save_button->get_popup()->add_item(TTR("Save As..."), RESOURCE_SAVE_AS); @@ -522,7 +522,7 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) { backward_button = memnew(ToolButton); general_options_hb->add_child(backward_button); - backward_button->set_icon(get_icon("Back", "EditorIcons")); + backward_button->set_icon(get_theme_icon("Back", "EditorIcons")); backward_button->set_flat(true); backward_button->set_tooltip(TTR("Go to the previous edited object in history.")); backward_button->set_disabled(true); @@ -530,7 +530,7 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) { forward_button = memnew(ToolButton); general_options_hb->add_child(forward_button); - forward_button->set_icon(get_icon("Forward", "EditorIcons")); + forward_button->set_icon(get_theme_icon("Forward", "EditorIcons")); forward_button->set_flat(true); forward_button->set_tooltip(TTR("Go to the next edited object in history.")); forward_button->set_disabled(true); @@ -538,9 +538,9 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) { history_menu = memnew(MenuButton); history_menu->set_tooltip(TTR("History of recently edited objects.")); - history_menu->set_icon(get_icon("History", "EditorIcons")); + history_menu->set_icon(get_theme_icon("History", "EditorIcons")); general_options_hb->add_child(history_menu); - history_menu->connect("about_to_show", callable_mp(this, &InspectorDock::_prepare_history)); + history_menu->connect("about_to_popup", callable_mp(this, &InspectorDock::_prepare_history)); history_menu->get_popup()->connect("id_pressed", callable_mp(this, &InspectorDock::_select_history)); HBoxContainer *node_info_hb = memnew(HBoxContainer); @@ -551,7 +551,7 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) { node_info_hb->add_child(editor_path); object_menu = memnew(MenuButton); - object_menu->set_icon(get_icon("Tools", "EditorIcons")); + object_menu->set_icon(get_theme_icon("Tools", "EditorIcons")); node_info_hb->add_child(object_menu); object_menu->set_tooltip(TTR("Object properties.")); object_menu->get_popup()->connect("id_pressed", callable_mp(this, &InspectorDock::_menu_option)); @@ -564,15 +564,15 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) { search = memnew(LineEdit); search->set_h_size_flags(Control::SIZE_EXPAND_FILL); search->set_placeholder(TTR("Filter properties")); - search->set_right_icon(get_icon("Search", "EditorIcons")); + search->set_right_icon(get_theme_icon("Search", "EditorIcons")); search->set_clear_button_enabled(true); add_child(search); warning = memnew(Button); add_child(warning); warning->set_text(TTR("Changes may be lost!")); - warning->set_icon(get_icon("NodeWarning", "EditorIcons")); - warning->add_color_override("font_color", get_color("warning_color", "Editor")); + warning->set_icon(get_theme_icon("NodeWarning", "EditorIcons")); + warning->add_theme_color_override("font_color", get_theme_color("warning_color", "Editor")); warning->set_clip_text(true); warning->hide(); warning->connect("pressed", callable_mp(this, &InspectorDock::_warning_pressed)); diff --git a/editor/node_dock.cpp b/editor/node_dock.cpp index 3013406152..0c511e4819 100644 --- a/editor/node_dock.cpp +++ b/editor/node_dock.cpp @@ -55,8 +55,8 @@ void NodeDock::_bind_methods() { void NodeDock::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { - connections_button->set_icon(get_icon("Signals", "EditorIcons")); - groups_button->set_icon(get_icon("Groups", "EditorIcons")); + connections_button->set_icon(get_theme_icon("Signals", "EditorIcons")); + groups_button->set_icon(get_theme_icon("Groups", "EditorIcons")); } } diff --git a/editor/pane_drag.cpp b/editor/pane_drag.cpp index b143f86ada..ce90fa94dc 100644 --- a/editor/pane_drag.cpp +++ b/editor/pane_drag.cpp @@ -45,7 +45,7 @@ void PaneDrag::_notification(int p_what) { case NOTIFICATION_DRAW: { - Ref<Texture2D> icon = mouse_over ? get_icon("PaneDragHover", "EditorIcons") : get_icon("PaneDrag", "EditorIcons"); + Ref<Texture2D> icon = mouse_over ? get_theme_icon("PaneDragHover", "EditorIcons") : get_theme_icon("PaneDrag", "EditorIcons"); if (!icon.is_null()) icon->draw(get_canvas_item(), Point2(0, 0)); @@ -62,7 +62,7 @@ void PaneDrag::_notification(int p_what) { } Size2 PaneDrag::get_minimum_size() const { - Ref<Texture2D> icon = get_icon("PaneDrag", "EditorIcons"); + Ref<Texture2D> icon = get_theme_icon("PaneDrag", "EditorIcons"); if (!icon.is_null()) return icon->get_size(); return Size2(); diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp index 2b696b1575..e3e9eae31a 100644 --- a/editor/plugins/abstract_polygon_2d_editor.cpp +++ b/editor/plugins/abstract_polygon_2d_editor.cpp @@ -204,9 +204,9 @@ void AbstractPolygon2DEditor::_notification(int p_what) { disable_polygon_editing(false, String()); - button_create->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveCreate", "EditorIcons")); - button_edit->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveEdit", "EditorIcons")); - button_delete->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveDelete", "EditorIcons")); + button_create->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("CurveCreate", "EditorIcons")); + button_edit->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("CurveEdit", "EditorIcons")); + button_delete->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("CurveDelete", "EditorIcons")); button_edit->set_pressed(true); get_tree()->connect("node_removed", callable_mp(this, &AbstractPolygon2DEditor::_node_removed)); @@ -573,7 +573,7 @@ void AbstractPolygon2DEditor::forward_canvas_draw_over_viewport(Control *p_overl Transform2D xform = canvas_item_editor->get_canvas_transform() * _get_node()->get_global_transform(); // All polygon points are sharp, so use the sharp handle icon - const Ref<Texture2D> handle = get_icon("EditorPathSharpHandle", "EditorIcons"); + const Ref<Texture2D> handle = get_theme_icon("EditorPathSharpHandle", "EditorIcons"); const Vertex active_point = get_active_point(); const int n_polygons = _get_polygon_count(); @@ -651,7 +651,7 @@ void AbstractPolygon2DEditor::forward_canvas_draw_over_viewport(Control *p_overl p_overlay->draw_texture(handle, point - handle->get_size() * 0.5, modulate); if (vertex == hover_point) { - Ref<Font> font = get_font("font", "Label"); + Ref<Font> font = get_theme_font("font", "Label"); String num = String::num(vertex.vertex); Size2 num_size = font->get_string_size(num); p_overlay->draw_string(font, point - num_size * 0.5, num, Color(1.0, 1.0, 1.0, 0.5)); @@ -661,7 +661,7 @@ void AbstractPolygon2DEditor::forward_canvas_draw_over_viewport(Control *p_overl if (edge_point.valid()) { - Ref<Texture2D> add_handle = get_icon("EditorHandleAdd", "EditorIcons"); + Ref<Texture2D> add_handle = get_theme_icon("EditorHandleAdd", "EditorIcons"); p_overlay->draw_texture(add_handle, edge_point.pos - add_handle->get_size() * 0.5); } } diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp index 232f9f9521..86c43ea9ab 100644 --- a/editor/plugins/animation_blend_space_1d_editor.cpp +++ b/editor/plugins/animation_blend_space_1d_editor.cpp @@ -73,7 +73,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven ap->get_animation_list(&names); for (List<StringName>::Element *E = names.front(); E; E = E->next()) { - animations_menu->add_icon_item(get_icon("Animation", "EditorIcons"), E->get()); + animations_menu->add_icon_item(get_theme_icon("Animation", "EditorIcons"), E->get()); animations_to_add.push_back(E->get()); } } @@ -97,7 +97,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven menu->add_separator(); menu->add_item(TTR("Load..."), MENU_LOAD_FILE); - menu->set_global_position(blend_space_draw->get_global_transform().xform(mb->get_position())); + menu->set_position(blend_space_draw->get_screen_transform().xform(mb->get_position())); menu->popup(); add_point_pos = (mb->get_position() / blend_space_draw->get_size()).x; @@ -197,18 +197,18 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven void AnimationNodeBlendSpace1DEditor::_blend_space_draw() { - Color linecolor = get_color("font_color", "Label"); + Color linecolor = get_theme_color("font_color", "Label"); Color linecolor_soft = linecolor; linecolor_soft.a *= 0.5; - Ref<Font> font = get_font("font", "Label"); - Ref<Texture2D> icon = get_icon("KeyValue", "EditorIcons"); - Ref<Texture2D> icon_selected = get_icon("KeySelected", "EditorIcons"); + Ref<Font> font = get_theme_font("font", "Label"); + Ref<Texture2D> icon = get_theme_icon("KeyValue", "EditorIcons"); + Ref<Texture2D> icon_selected = get_theme_icon("KeySelected", "EditorIcons"); Size2 s = blend_space_draw->get_size(); if (blend_space_draw->has_focus()) { - Color color = get_color("accent_color", "Editor"); + Color color = get_theme_color("accent_color", "Editor"); blend_space_draw->draw_rect(Rect2(Point2(), s), color, false); } @@ -280,7 +280,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_draw() { { Color color; if (tool_blend->is_pressed()) { - color = get_color("accent_color", "Editor"); + color = get_theme_color("accent_color", "Editor"); } else { color = linecolor; color.a *= 0.5; @@ -532,15 +532,15 @@ void AnimationNodeBlendSpace1DEditor::_open_editor() { void AnimationNodeBlendSpace1DEditor::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { - error_panel->add_style_override("panel", get_stylebox("bg", "Tree")); - error_label->add_color_override("font_color", get_color("error_color", "Editor")); - panel->add_style_override("panel", get_stylebox("bg", "Tree")); - tool_blend->set_icon(get_icon("EditPivot", "EditorIcons")); - tool_select->set_icon(get_icon("ToolSelect", "EditorIcons")); - tool_create->set_icon(get_icon("EditKey", "EditorIcons")); - tool_erase->set_icon(get_icon("Remove", "EditorIcons")); - snap->set_icon(get_icon("SnapGrid", "EditorIcons")); - open_editor->set_icon(get_icon("Edit", "EditorIcons")); + error_panel->add_theme_style_override("panel", get_theme_stylebox("bg", "Tree")); + error_label->add_theme_color_override("font_color", get_theme_color("error_color", "Editor")); + panel->add_theme_style_override("panel", get_theme_stylebox("bg", "Tree")); + tool_blend->set_icon(get_theme_icon("EditPivot", "EditorIcons")); + tool_select->set_icon(get_theme_icon("ToolSelect", "EditorIcons")); + tool_create->set_icon(get_theme_icon("EditKey", "EditorIcons")); + tool_erase->set_icon(get_theme_icon("Remove", "EditorIcons")); + snap->set_icon(get_theme_icon("SnapGrid", "EditorIcons")); + open_editor->set_icon(get_theme_icon("Edit", "EditorIcons")); } if (p_what == NOTIFICATION_PROCESS) { diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index d95b667f41..843beacfd6 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -100,7 +100,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven List<StringName> names; ap->get_animation_list(&names); for (List<StringName>::Element *E = names.front(); E; E = E->next()) { - animations_menu->add_icon_item(get_icon("Animation", "EditorIcons"), E->get()); + animations_menu->add_icon_item(get_theme_icon("Animation", "EditorIcons"), E->get()); animations_to_add.push_back(E->get()); } } @@ -124,7 +124,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven menu->add_separator(); menu->add_item(TTR("Load..."), MENU_LOAD_FILE); - menu->set_global_position(blend_space_draw->get_global_transform().xform(mb->get_position())); + menu->set_position(blend_space_draw->get_screen_transform().xform(mb->get_position())); menu->popup(); add_point_pos = (mb->get_position() / blend_space_draw->get_size()); add_point_pos.y = 1.0 - add_point_pos.y; @@ -406,17 +406,17 @@ void AnimationNodeBlendSpace2DEditor::_tool_switch(int p_tool) { void AnimationNodeBlendSpace2DEditor::_blend_space_draw() { - Color linecolor = get_color("font_color", "Label"); + Color linecolor = get_theme_color("font_color", "Label"); Color linecolor_soft = linecolor; linecolor_soft.a *= 0.5; - Ref<Font> font = get_font("font", "Label"); - Ref<Texture2D> icon = get_icon("KeyValue", "EditorIcons"); - Ref<Texture2D> icon_selected = get_icon("KeySelected", "EditorIcons"); + Ref<Font> font = get_theme_font("font", "Label"); + Ref<Texture2D> icon = get_theme_icon("KeyValue", "EditorIcons"); + Ref<Texture2D> icon_selected = get_theme_icon("KeySelected", "EditorIcons"); Size2 s = blend_space_draw->get_size(); if (blend_space_draw->has_focus()) { - Color color = get_color("accent_color", "Editor"); + Color color = get_theme_color("accent_color", "Editor"); blend_space_draw->draw_rect(Rect2(Point2(), s), color, false); } blend_space_draw->draw_line(Point2(1, 0), Point2(1, s.height - 1), linecolor); @@ -502,7 +502,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_draw() { Color color; if (i == selected_triangle) { - color = get_color("accent_color", "Editor"); + color = get_theme_color("accent_color", "Editor"); color.a *= 0.5; } else { color = linecolor; @@ -563,7 +563,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_draw() { { Color color; if (tool_blend->is_pressed()) { - color = get_color("accent_color", "Editor"); + color = get_theme_color("accent_color", "Editor"); } else { color = linecolor; color.a *= 0.5; @@ -754,21 +754,21 @@ void AnimationNodeBlendSpace2DEditor::_edit_point_pos(double) { void AnimationNodeBlendSpace2DEditor::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { - error_panel->add_style_override("panel", get_stylebox("bg", "Tree")); - error_label->add_color_override("font_color", get_color("error_color", "Editor")); - panel->add_style_override("panel", get_stylebox("bg", "Tree")); - tool_blend->set_icon(get_icon("EditPivot", "EditorIcons")); - tool_select->set_icon(get_icon("ToolSelect", "EditorIcons")); - tool_create->set_icon(get_icon("EditKey", "EditorIcons")); - tool_triangle->set_icon(get_icon("ToolTriangle", "EditorIcons")); - tool_erase->set_icon(get_icon("Remove", "EditorIcons")); - snap->set_icon(get_icon("SnapGrid", "EditorIcons")); - open_editor->set_icon(get_icon("Edit", "EditorIcons")); - auto_triangles->set_icon(get_icon("AutoTriangle", "EditorIcons")); + error_panel->add_theme_style_override("panel", get_theme_stylebox("bg", "Tree")); + error_label->add_theme_color_override("font_color", get_theme_color("error_color", "Editor")); + panel->add_theme_style_override("panel", get_theme_stylebox("bg", "Tree")); + tool_blend->set_icon(get_theme_icon("EditPivot", "EditorIcons")); + tool_select->set_icon(get_theme_icon("ToolSelect", "EditorIcons")); + tool_create->set_icon(get_theme_icon("EditKey", "EditorIcons")); + tool_triangle->set_icon(get_theme_icon("ToolTriangle", "EditorIcons")); + tool_erase->set_icon(get_theme_icon("Remove", "EditorIcons")); + snap->set_icon(get_theme_icon("SnapGrid", "EditorIcons")); + open_editor->set_icon(get_theme_icon("Edit", "EditorIcons")); + auto_triangles->set_icon(get_theme_icon("AutoTriangle", "EditorIcons")); interpolation->clear(); - interpolation->add_icon_item(get_icon("TrackContinuous", "EditorIcons"), "", 0); - interpolation->add_icon_item(get_icon("TrackDiscrete", "EditorIcons"), "", 1); - interpolation->add_icon_item(get_icon("TrackCapture", "EditorIcons"), "", 2); + interpolation->add_icon_item(get_theme_icon("TrackContinuous", "EditorIcons"), "", 0); + interpolation->add_icon_item(get_theme_icon("TrackDiscrete", "EditorIcons"), "", 1); + interpolation->add_icon_item(get_theme_icon("TrackCapture", "EditorIcons"), "", 2); } if (p_what == NOTIFICATION_PROCESS) { diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index ddf996b94c..03b48f1c15 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -145,7 +145,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() { name->set_text(E->get()); name->set_expand_to_text_length(true); node->add_child(name); - node->set_slot(0, false, 0, Color(), true, 0, get_color("font_color", "Label")); + node->set_slot(0, false, 0, Color(), true, 0, get_theme_color("font_color", "Label")); name->connect("text_entered", callable_mp(this, &AnimationNodeBlendTreeEditor::_node_renamed), varray(agnode)); name->connect("focus_exited", callable_mp(this, &AnimationNodeBlendTreeEditor::_node_renamed_focus_out), varray(name, agnode), CONNECT_DEFERRED); base = 1; @@ -157,7 +157,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() { Label *in_name = memnew(Label); node->add_child(in_name); in_name->set_text(agnode->get_input_name(i)); - node->set_slot(base + i, true, 0, get_color("font_color", "Label"), false, 0, Color()); + node->set_slot(base + i, true, 0, get_theme_color("font_color", "Label"), false, 0, Color()); } List<PropertyInfo> pinfo; @@ -185,7 +185,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() { node->add_child(memnew(HSeparator)); Button *open_in_editor = memnew(Button); open_in_editor->set_text(TTR("Open Editor")); - open_in_editor->set_icon(get_icon("Edit", "EditorIcons")); + open_in_editor->set_icon(get_theme_icon("Edit", "EditorIcons")); node->add_child(open_in_editor); open_in_editor->connect("pressed", callable_mp(this, &AnimationNodeBlendTreeEditor::_open_in_editor), varray(E->get()), CONNECT_DEFERRED); open_in_editor->set_h_size_flags(SIZE_SHRINK_CENTER); @@ -196,7 +196,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() { node->add_child(memnew(HSeparator)); Button *edit_filters = memnew(Button); edit_filters->set_text(TTR("Edit Filters")); - edit_filters->set_icon(get_icon("AnimationFilter", "EditorIcons")); + edit_filters->set_icon(get_theme_icon("AnimationFilter", "EditorIcons")); node->add_child(edit_filters); edit_filters->connect("pressed", callable_mp(this, &AnimationNodeBlendTreeEditor::_edit_filters), varray(E->get()), CONNECT_DEFERRED); edit_filters->set_h_size_flags(SIZE_SHRINK_CENTER); @@ -207,7 +207,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() { MenuButton *mb = memnew(MenuButton); mb->set_text(anim->get_animation()); - mb->set_icon(get_icon("Animation", "EditorIcons")); + mb->set_icon(get_theme_icon("Animation", "EditorIcons")); Array options; node->add_child(memnew(HSeparator)); @@ -242,16 +242,16 @@ void AnimationNodeBlendTreeEditor::_update_graph() { } if (EditorSettings::get_singleton()->get("interface/theme/use_graph_node_headers")) { - Ref<StyleBoxFlat> sb = node->get_stylebox("frame", "GraphNode"); + Ref<StyleBoxFlat> sb = node->get_theme_stylebox("frame", "GraphNode"); Color c = sb->get_border_color(); Color mono_color = ((c.r + c.g + c.b) / 3) < 0.7 ? Color(1.0, 1.0, 1.0) : Color(0.0, 0.0, 0.0); mono_color.a = 0.85; c = mono_color; - node->add_color_override("title_color", c); + node->add_theme_color_override("title_color", c); c.a = 0.7; - node->add_color_override("close_color", c); - node->add_color_override("resizer_color", c); + node->add_theme_color_override("close_color", c); + node->add_theme_color_override("resizer_color", c); } } @@ -643,7 +643,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano ti->set_text(0, F->get()); ti->set_selectable(0, false); ti->set_editable(0, false); - ti->set_icon(0, get_icon("BoneAttachment", "EditorIcons")); + ti->set_icon(0, get_theme_icon("BoneAttachment", "EditorIcons")); } else { ti = parenthood[accum]; } @@ -654,7 +654,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano ti->set_cell_mode(0, TreeItem::CELL_MODE_CHECK); ti->set_text(0, concat); ti->set_checked(0, anode->is_path_filtered(path)); - ti->set_icon(0, get_icon("BoneAttachment", "EditorIcons")); + ti->set_icon(0, get_theme_icon("BoneAttachment", "EditorIcons")); ti->set_metadata(0, path); } else { @@ -718,8 +718,8 @@ void AnimationNodeBlendTreeEditor::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { - error_panel->add_style_override("panel", get_stylebox("bg", "Tree")); - error_label->add_color_override("font_color", get_color("error_color", "Editor")); + error_panel->add_theme_style_override("panel", get_theme_stylebox("bg", "Tree")); + error_label->add_theme_color_override("font_color", get_theme_color("error_color", "Editor")); if (p_what == NOTIFICATION_THEME_CHANGED && is_visible_in_tree()) _update_graph(); @@ -931,7 +931,7 @@ AnimationNodeBlendTreeEditor::AnimationNodeBlendTreeEditor() { add_node->set_text(TTR("Add Node...")); graph->get_zoom_hbox()->move_child(add_node, 0); add_node->get_popup()->connect("id_pressed", callable_mp(this, &AnimationNodeBlendTreeEditor::_add_node)); - add_node->connect("about_to_show", callable_mp(this, &AnimationNodeBlendTreeEditor::_update_options_menu)); + add_node->connect("about_to_popup", callable_mp(this, &AnimationNodeBlendTreeEditor::_update_options_menu)); add_options.push_back(AddOption("Animation", "AnimationNodeAnimation")); add_options.push_back(AddOption("OneShot", "AnimationNodeOneShot")); diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 71e6529254..4b75f09cf5 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -105,33 +105,33 @@ void AnimationPlayerEditor::_notification(int p_what) { get_tree()->connect("node_removed", callable_mp(this, &AnimationPlayerEditor::_node_removed)); - add_style_override("panel", editor->get_gui_base()->get_stylebox("panel", "Panel")); + add_theme_style_override("panel", editor->get_gui_base()->get_theme_stylebox("panel", "Panel")); } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - add_style_override("panel", editor->get_gui_base()->get_stylebox("panel", "Panel")); + add_theme_style_override("panel", editor->get_gui_base()->get_theme_stylebox("panel", "Panel")); } break; case NOTIFICATION_THEME_CHANGED: { - autoplay->set_icon(get_icon("AutoPlay", "EditorIcons")); + autoplay->set_icon(get_theme_icon("AutoPlay", "EditorIcons")); - play->set_icon(get_icon("PlayStart", "EditorIcons")); - play_from->set_icon(get_icon("Play", "EditorIcons")); - play_bw->set_icon(get_icon("PlayStartBackwards", "EditorIcons")); - play_bw_from->set_icon(get_icon("PlayBackwards", "EditorIcons")); + play->set_icon(get_theme_icon("PlayStart", "EditorIcons")); + play_from->set_icon(get_theme_icon("Play", "EditorIcons")); + play_bw->set_icon(get_theme_icon("PlayStartBackwards", "EditorIcons")); + play_bw_from->set_icon(get_theme_icon("PlayBackwards", "EditorIcons")); - autoplay_icon = get_icon("AutoPlay", "EditorIcons"); - stop->set_icon(get_icon("Stop", "EditorIcons")); + autoplay_icon = get_theme_icon("AutoPlay", "EditorIcons"); + stop->set_icon(get_theme_icon("Stop", "EditorIcons")); - onion_toggle->set_icon(get_icon("Onion", "EditorIcons")); - onion_skinning->set_icon(get_icon("GuiTabMenu", "EditorIcons")); + onion_toggle->set_icon(get_theme_icon("Onion", "EditorIcons")); + onion_skinning->set_icon(get_theme_icon("GuiTabMenu", "EditorIcons")); - pin->set_icon(get_icon("Pin", "EditorIcons")); + pin->set_icon(get_theme_icon("Pin", "EditorIcons")); - tool_anim->add_style_override("normal", get_stylebox("normal", "Button")); - track_editor->get_edit_menu()->add_style_override("normal", get_stylebox("normal", "Button")); + tool_anim->add_theme_style_override("normal", get_theme_stylebox("normal", "Button")); + track_editor->get_edit_menu()->add_theme_style_override("normal", get_theme_stylebox("normal", "Button")); -#define ITEM_ICON(m_item, m_icon) tool_anim->get_popup()->set_item_icon(tool_anim->get_popup()->get_item_index(m_item), get_icon(m_icon, "EditorIcons")) +#define ITEM_ICON(m_item, m_icon) tool_anim->get_popup()->set_item_icon(tool_anim->get_popup()->get_item_index(m_item), get_theme_icon(m_icon, "EditorIcons")) ITEM_ICON(TOOL_NEW_ANIM, "New"); ITEM_ICON(TOOL_LOAD_ANIM, "Load"); diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index 6ec619e058..ea7a97982c 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -97,7 +97,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv List<StringName> names; ap->get_animation_list(&names); for (List<StringName>::Element *E = names.front(); E; E = E->next()) { - animations_menu->add_icon_item(get_icon("Animation", "EditorIcons"), E->get()); + animations_menu->add_icon_item(get_theme_icon("Animation", "EditorIcons"), E->get()); animations_to_add.push_back(E->get()); } } @@ -121,7 +121,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv menu->add_separator(); menu->add_item(TTR("Load..."), MENU_LOAD_FILE); - menu->set_global_position(state_machine_draw->get_global_transform().xform(mb->get_position())); + menu->set_position(state_machine_draw->get_screen_transform().xform(mb->get_position())); menu->popup(); add_node_pos = mb->get_position() / EDSCALE + state_machine->get_graph_offset(); } @@ -149,7 +149,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv if (node_rects[i].name.has_point(mb->get_position())) { //edit name - Ref<StyleBox> line_sb = get_stylebox("normal", "LineEdit"); + Ref<StyleBox> line_sb = get_theme_stylebox("normal", "LineEdit"); Rect2 edit_rect = node_rects[i].name; edit_rect.position -= line_sb->get_offset(); @@ -504,9 +504,9 @@ void AnimationNodeStateMachineEditor::_add_animation_type(int p_index) { void AnimationNodeStateMachineEditor::_connection_draw(const Vector2 &p_from, const Vector2 &p_to, AnimationNodeStateMachineTransition::SwitchMode p_mode, bool p_enabled, bool p_selected, bool p_travel, bool p_auto_advance) { - Color linecolor = get_color("font_color", "Label"); + Color linecolor = get_theme_color("font_color", "Label"); Color icon_color(1, 1, 1); - Color accent = get_color("accent_color", "Editor"); + Color accent = get_theme_color("accent_color", "Editor"); if (!p_enabled) { linecolor.a *= 0.2; @@ -515,12 +515,12 @@ void AnimationNodeStateMachineEditor::_connection_draw(const Vector2 &p_from, co } Ref<Texture2D> icons[6] = { - get_icon("TransitionImmediateBig", "EditorIcons"), - get_icon("TransitionSyncBig", "EditorIcons"), - get_icon("TransitionEndBig", "EditorIcons"), - get_icon("TransitionImmediateAutoBig", "EditorIcons"), - get_icon("TransitionSyncAutoBig", "EditorIcons"), - get_icon("TransitionEndAutoBig", "EditorIcons") + get_theme_icon("TransitionImmediateBig", "EditorIcons"), + get_theme_icon("TransitionSyncBig", "EditorIcons"), + get_theme_icon("TransitionEndBig", "EditorIcons"), + get_theme_icon("TransitionImmediateAutoBig", "EditorIcons"), + get_theme_icon("TransitionSyncAutoBig", "EditorIcons"), + get_theme_icon("TransitionEndAutoBig", "EditorIcons") }; if (p_selected) { @@ -573,18 +573,18 @@ void AnimationNodeStateMachineEditor::_state_machine_draw() { Ref<AnimationNodeStateMachinePlayback> playback = AnimationTreeEditor::get_singleton()->get_tree()->get(AnimationTreeEditor::get_singleton()->get_base_path() + "playback"); - Ref<StyleBox> style = get_stylebox("state_machine_frame", "GraphNode"); - Ref<StyleBox> style_selected = get_stylebox("state_machine_selectedframe", "GraphNode"); + Ref<StyleBox> style = get_theme_stylebox("state_machine_frame", "GraphNode"); + Ref<StyleBox> style_selected = get_theme_stylebox("state_machine_selectedframe", "GraphNode"); - Ref<Font> font = get_font("title_font", "GraphNode"); - Color font_color = get_color("title_color", "GraphNode"); - Ref<Texture2D> play = get_icon("Play", "EditorIcons"); - Ref<Texture2D> auto_play = get_icon("AutoPlay", "EditorIcons"); - Ref<Texture2D> edit = get_icon("Edit", "EditorIcons"); - Color accent = get_color("accent_color", "Editor"); - Color linecolor = get_color("font_color", "Label"); + Ref<Font> font = get_theme_font("title_font", "GraphNode"); + Color font_color = get_theme_color("title_color", "GraphNode"); + Ref<Texture2D> play = get_theme_icon("Play", "EditorIcons"); + Ref<Texture2D> auto_play = get_theme_icon("AutoPlay", "EditorIcons"); + Ref<Texture2D> edit = get_theme_icon("Edit", "EditorIcons"); + Color accent = get_theme_color("accent_color", "Editor"); + Color linecolor = get_theme_color("font_color", "Label"); linecolor.a *= 0.3; - Ref<StyleBox> playing_overlay = get_stylebox("position", "GraphNode"); + Ref<StyleBox> playing_overlay = get_theme_stylebox("position", "GraphNode"); bool playing = false; StringName current; @@ -686,7 +686,7 @@ void AnimationNodeStateMachineEditor::_state_machine_draw() { _connection_draw(from, to, AnimationNodeStateMachineTransition::SwitchMode(transition_mode->get_selected()), true, false, false, false); } - Ref<Texture2D> tr_reference_icon = get_icon("TransitionImmediateBig", "EditorIcons"); + Ref<Texture2D> tr_reference_icon = get_theme_icon("TransitionImmediateBig", "EditorIcons"); float tr_bidi_offset = int(tr_reference_icon->get_height() * 0.8); //draw transition lines @@ -879,7 +879,7 @@ void AnimationNodeStateMachineEditor::_state_machine_pos_draw() { float pos = CLAMP(play_pos, 0, len); float c = pos / len; - Color fg = get_color("font_color", "Label"); + Color fg = get_theme_color("font_color", "Label"); Color bg = fg; bg.a *= 0.3; @@ -905,26 +905,26 @@ void AnimationNodeStateMachineEditor::_update_graph() { void AnimationNodeStateMachineEditor::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { - error_panel->add_style_override("panel", get_stylebox("bg", "Tree")); - error_label->add_color_override("font_color", get_color("error_color", "Editor")); - panel->add_style_override("panel", get_stylebox("bg", "Tree")); + error_panel->add_theme_style_override("panel", get_theme_stylebox("bg", "Tree")); + error_label->add_theme_color_override("font_color", get_theme_color("error_color", "Editor")); + panel->add_theme_style_override("panel", get_theme_stylebox("bg", "Tree")); - tool_select->set_icon(get_icon("ToolSelect", "EditorIcons")); - tool_create->set_icon(get_icon("ToolAddNode", "EditorIcons")); - tool_connect->set_icon(get_icon("ToolConnect", "EditorIcons")); + tool_select->set_icon(get_theme_icon("ToolSelect", "EditorIcons")); + tool_create->set_icon(get_theme_icon("ToolAddNode", "EditorIcons")); + tool_connect->set_icon(get_theme_icon("ToolConnect", "EditorIcons")); transition_mode->clear(); - transition_mode->add_icon_item(get_icon("TransitionImmediate", "EditorIcons"), TTR("Immediate")); - transition_mode->add_icon_item(get_icon("TransitionSync", "EditorIcons"), TTR("Sync")); - transition_mode->add_icon_item(get_icon("TransitionEnd", "EditorIcons"), TTR("At End")); + transition_mode->add_icon_item(get_theme_icon("TransitionImmediate", "EditorIcons"), TTR("Immediate")); + transition_mode->add_icon_item(get_theme_icon("TransitionSync", "EditorIcons"), TTR("Sync")); + transition_mode->add_icon_item(get_theme_icon("TransitionEnd", "EditorIcons"), TTR("At End")); - tool_erase->set_icon(get_icon("Remove", "EditorIcons")); - tool_autoplay->set_icon(get_icon("AutoPlay", "EditorIcons")); - tool_end->set_icon(get_icon("AutoEnd", "EditorIcons")); + tool_erase->set_icon(get_theme_icon("Remove", "EditorIcons")); + tool_autoplay->set_icon(get_theme_icon("AutoPlay", "EditorIcons")); + tool_end->set_icon(get_theme_icon("AutoEnd", "EditorIcons")); play_mode->clear(); - play_mode->add_icon_item(get_icon("PlayTravel", "EditorIcons"), TTR("Travel")); - play_mode->add_icon_item(get_icon("Play", "EditorIcons"), TTR("Immediate")); + play_mode->add_icon_item(get_theme_icon("PlayTravel", "EditorIcons"), TTR("Travel")); + play_mode->add_icon_item(get_theme_icon("Play", "EditorIcons"), TTR("Immediate")); } if (p_what == NOTIFICATION_PROCESS) { diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index a3bfa5e0ea..3b104e34b2 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -62,10 +62,10 @@ void EditorAssetLibraryItem::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - icon->set_normal_texture(get_icon("ProjectIconLoading", "EditorIcons")); - category->add_color_override("font_color", Color(0.5, 0.5, 0.5)); - author->add_color_override("font_color", Color(0.5, 0.5, 0.5)); - price->add_color_override("font_color", Color(0.5, 0.5, 0.5)); + icon->set_normal_texture(get_theme_icon("ProjectIconLoading", "EditorIcons")); + category->add_theme_color_override("font_color", Color(0.5, 0.5, 0.5)); + author->add_theme_color_override("font_color", Color(0.5, 0.5, 0.5)); + price->add_theme_color_override("font_color", Color(0.5, 0.5, 0.5)); } } @@ -99,11 +99,11 @@ EditorAssetLibraryItem::EditorAssetLibraryItem() { border->set_default_margin(MARGIN_RIGHT, 5 * EDSCALE); border->set_default_margin(MARGIN_BOTTOM, 5 * EDSCALE); border->set_default_margin(MARGIN_TOP, 5 * EDSCALE); - add_style_override("panel", border); + add_theme_style_override("panel", border); HBoxContainer *hb = memnew(HBoxContainer); // Add some spacing to visually separate the icon from the asset details. - hb->add_constant_override("separation", 15 * EDSCALE); + hb->add_theme_constant_override("separation", 15 * EDSCALE); add_child(hb); icon = memnew(TextureButton); @@ -156,7 +156,7 @@ void EditorAssetLibraryItemDescription::set_image(int p_type, int p_index, const for (int i = 0; i < preview_images.size(); i++) { if (preview_images[i].id == p_index) { if (preview_images[i].is_video) { - Ref<Image> overlay = previews->get_icon("PlayOverlay", "EditorIcons")->get_data(); + Ref<Image> overlay = previews->get_theme_icon("PlayOverlay", "EditorIcons")->get_data(); Ref<Image> thumbnail = p_image->get_data(); thumbnail = thumbnail->duplicate(); Point2 overlay_pos = Point2((thumbnail->get_width() - overlay->get_width()) / 2, (thumbnail->get_height() - overlay->get_height()) / 2); @@ -198,7 +198,7 @@ void EditorAssetLibraryItemDescription::set_image(int p_type, int p_index, const void EditorAssetLibraryItemDescription::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { - previews_bg->add_style_override("panel", previews->get_stylebox("normal", "TextEdit")); + previews_bg->add_theme_style_override("panel", previews->get_theme_stylebox("normal", "TextEdit")); } break; } } @@ -256,12 +256,12 @@ void EditorAssetLibraryItemDescription::add_preview(int p_id, bool p_video, cons preview.is_video = p_video; preview.button = memnew(Button); preview.button->set_flat(true); - preview.button->set_icon(previews->get_icon("ThumbnailWait", "EditorIcons")); + preview.button->set_icon(previews->get_theme_icon("ThumbnailWait", "EditorIcons")); preview.button->set_toggle_mode(true); preview.button->connect("pressed", callable_mp(this, &EditorAssetLibraryItemDescription::_preview_click), varray(p_id)); preview_hb->add_child(preview.button); if (!p_video) { - preview.image = previews->get_icon("ThumbnailWait", "EditorIcons"); + preview.image = previews->get_theme_icon("ThumbnailWait", "EditorIcons"); } preview_images.push_back(preview); if (preview_images.size() == 1 && !p_video) { @@ -275,7 +275,7 @@ EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() { add_child(hbox); VBoxContainer *desc_vbox = memnew(VBoxContainer); hbox->add_child(desc_vbox); - hbox->add_constant_override("separation", 15 * EDSCALE); + hbox->add_theme_constant_override("separation", 15 * EDSCALE); item = memnew(EditorAssetLibraryItem); @@ -286,11 +286,11 @@ EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() { desc_vbox->add_child(description); description->set_v_size_flags(Control::SIZE_EXPAND_FILL); description->connect("meta_clicked", callable_mp(this, &EditorAssetLibraryItemDescription::_link_click)); - description->add_constant_override("line_separation", Math::round(5 * EDSCALE)); + description->add_theme_constant_override("line_separation", Math::round(5 * EDSCALE)); VBoxContainer *previews_vbox = memnew(VBoxContainer); hbox->add_child(previews_vbox); - previews_vbox->add_constant_override("separation", 15 * EDSCALE); + previews_vbox->add_theme_constant_override("separation", 15 * EDSCALE); previews_vbox->set_v_size_flags(Control::SIZE_EXPAND_FILL); preview = memnew(TextureRect); @@ -393,7 +393,7 @@ void EditorAssetLibraryItemDownload::configure(const String &p_title, int p_asse icon->set_texture(p_preview); asset_id = p_asset_id; if (!p_preview.is_valid()) - icon->set_texture(get_icon("FileBrokenBigThumb", "EditorIcons")); + icon->set_texture(get_theme_icon("FileBrokenBigThumb", "EditorIcons")); host = p_download_url; sha256 = p_sha256_hash; _make_request(); @@ -406,8 +406,8 @@ void EditorAssetLibraryItemDownload::_notification(int p_what) { // FIXME: The editor crashes if 'NOTICATION_THEME_CHANGED' is used. case NOTIFICATION_ENTER_TREE: { - add_style_override("panel", get_stylebox("panel", "TabContainer")); - dismiss->set_normal_texture(get_icon("Close", "EditorIcons")); + add_theme_style_override("panel", get_theme_stylebox("panel", "TabContainer")); + dismiss->set_normal_texture(get_theme_icon("Close", "EditorIcons")); } break; case NOTIFICATION_PROCESS: { @@ -525,7 +525,7 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() { status = memnew(Label(TTR("Idle"))); vb->add_child(status); - status->add_color_override("font_color", Color(0.5, 0.5, 0.5)); + status->add_theme_color_override("font_color", Color(0.5, 0.5, 0.5)); progress = memnew(ProgressBar); vb->add_child(progress); @@ -571,8 +571,8 @@ void EditorAssetLibrary::_notification(int p_what) { case NOTIFICATION_READY: { - error_tr->set_texture(get_icon("Error", "EditorIcons")); - filter->set_right_icon(get_icon("Search", "EditorIcons")); + error_tr->set_texture(get_theme_icon("Error", "EditorIcons")); + filter->set_right_icon(get_theme_icon("Search", "EditorIcons")); filter->set_clear_button_enabled(true); error_label->raise(); @@ -602,10 +602,10 @@ void EditorAssetLibrary::_notification(int p_what) { } break; case NOTIFICATION_THEME_CHANGED: { - library_scroll_bg->add_style_override("panel", get_stylebox("bg", "Tree")); - downloads_scroll->add_style_override("bg", get_stylebox("bg", "Tree")); - error_tr->set_texture(get_icon("Error", "EditorIcons")); - filter->set_right_icon(get_icon("Search", "EditorIcons")); + library_scroll_bg->add_theme_style_override("panel", get_theme_stylebox("bg", "Tree")); + downloads_scroll->add_theme_style_override("bg", get_theme_stylebox("bg", "Tree")); + error_tr->set_texture(get_theme_icon("Error", "EditorIcons")); + filter->set_right_icon(get_theme_icon("Search", "EditorIcons")); filter->set_clear_button_enabled(true); } break; } @@ -774,7 +774,7 @@ void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PackedB } if (!image_set && final) { - obj->call("set_image", image_queue[p_queue_id].image_type, image_queue[p_queue_id].image_index, get_icon("FileBrokenBigThumb", "EditorIcons")); + obj->call("set_image", image_queue[p_queue_id].image_type, image_queue[p_queue_id].image_index, get_theme_icon("FileBrokenBigThumb", "EditorIcons")); } } } @@ -819,7 +819,7 @@ void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, cons WARN_PRINT("Error getting image file from URL: " + image_queue[p_queue_id].image_url); Object *obj = ObjectDB::get_instance(image_queue[p_queue_id].target); if (obj) { - obj->call("set_image", image_queue[p_queue_id].image_type, image_queue[p_queue_id].image_index, get_icon("FileBrokenBigThumb", "EditorIcons")); + obj->call("set_image", image_queue[p_queue_id].image_type, image_queue[p_queue_id].image_index, get_theme_icon("FileBrokenBigThumb", "EditorIcons")); } } @@ -976,7 +976,7 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int to = p_page_count; hbc->add_spacer(); - hbc->add_constant_override("separation", 5 * EDSCALE); + hbc->add_theme_constant_override("separation", 5 * EDSCALE); Button *first = memnew(Button); first->set_text(TTR("First")); @@ -1191,8 +1191,8 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const asset_items = memnew(GridContainer); asset_items->set_columns(2); - asset_items->add_constant_override("hseparation", 10 * EDSCALE); - asset_items->add_constant_override("vseparation", 10 * EDSCALE); + asset_items->add_theme_constant_override("hseparation", 10 * EDSCALE); + asset_items->add_theme_constant_override("vseparation", 10 * EDSCALE); library_vb->add_child(asset_items); @@ -1353,7 +1353,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { HBoxContainer *search_hb = memnew(HBoxContainer); library_main->add_child(search_hb); - library_main->add_constant_override("separation", 10 * EDSCALE); + library_main->add_theme_constant_override("separation", 10 * EDSCALE); filter = memnew(LineEdit); search_hb->add_child(filter); @@ -1452,7 +1452,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { PanelContainer *library_vb_border = memnew(PanelContainer); library_scroll->add_child(library_vb_border); - library_vb_border->add_style_override("panel", border2); + library_vb_border->add_theme_style_override("panel", border2); library_vb_border->set_h_size_flags(Control::SIZE_EXPAND_FILL); library_vb = memnew(VBoxContainer); @@ -1474,8 +1474,8 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { asset_items = memnew(GridContainer); asset_items->set_columns(2); - asset_items->add_constant_override("hseparation", 10 * EDSCALE); - asset_items->add_constant_override("vseparation", 10 * EDSCALE); + asset_items->add_theme_constant_override("hseparation", 10 * EDSCALE); + asset_items->add_theme_constant_override("vseparation", 10 * EDSCALE); library_vb->add_child(asset_items); @@ -1489,12 +1489,12 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { last_queue_id = 0; - library_vb->add_constant_override("separation", 20 * EDSCALE); + library_vb->add_theme_constant_override("separation", 20 * EDSCALE); error_hb = memnew(HBoxContainer); library_main->add_child(error_hb); error_label = memnew(Label); - error_label->add_color_override("color", get_color("error_color", "Editor")); + error_label->add_theme_color_override("color", get_theme_color("error_color", "Editor")); error_hb->add_child(error_label); error_tr = memnew(TextureRect); error_tr->set_v_size_flags(Control::SIZE_SHRINK_CENTER); diff --git a/editor/plugins/audio_stream_editor_plugin.cpp b/editor/plugins/audio_stream_editor_plugin.cpp index 7a1722c73b..6cffda49d0 100644 --- a/editor/plugins/audio_stream_editor_plugin.cpp +++ b/editor/plugins/audio_stream_editor_plugin.cpp @@ -43,10 +43,10 @@ void AudioStreamEditor::_notification(int p_what) { } if (p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_ENTER_TREE) { - _play_button->set_icon(get_icon("MainPlay", "EditorIcons")); - _stop_button->set_icon(get_icon("Stop", "EditorIcons")); - _preview->set_frame_color(get_color("dark_color_2", "Editor")); - set_frame_color(get_color("dark_color_1", "Editor")); + _play_button->set_icon(get_theme_icon("MainPlay", "EditorIcons")); + _stop_button->set_icon(get_theme_icon("Stop", "EditorIcons")); + _preview->set_frame_color(get_theme_color("dark_color_2", "Editor")); + set_frame_color(get_theme_color("dark_color_1", "Editor")); _indicator->update(); _preview->update(); @@ -87,7 +87,7 @@ void AudioStreamEditor::_draw_preview() { } Vector<Color> color; - color.push_back(get_color("contrast_color_2", "Editor")); + color.push_back(get_theme_color("contrast_color_2", "Editor")); VS::get_singleton()->canvas_item_add_multiline(_preview->get_canvas_item(), lines, color); } @@ -110,11 +110,11 @@ void AudioStreamEditor::_play() { if (_player->is_playing()) { _player->stop(); - _play_button->set_icon(get_icon("MainPlay", "EditorIcons")); + _play_button->set_icon(get_theme_icon("MainPlay", "EditorIcons")); set_process(false); } else { _player->play(_current); - _play_button->set_icon(get_icon("Pause", "EditorIcons")); + _play_button->set_icon(get_theme_icon("Pause", "EditorIcons")); set_process(true); } } @@ -122,7 +122,7 @@ void AudioStreamEditor::_play() { void AudioStreamEditor::_stop() { _player->stop(); - _play_button->set_icon(get_icon("MainPlay", "EditorIcons")); + _play_button->set_icon(get_theme_icon("MainPlay", "EditorIcons")); _current = 0; _indicator->update(); set_process(false); @@ -130,7 +130,7 @@ void AudioStreamEditor::_stop() { void AudioStreamEditor::_on_finished() { - _play_button->set_icon(get_icon("MainPlay", "EditorIcons")); + _play_button->set_icon(get_theme_icon("MainPlay", "EditorIcons")); if (_current == _player->get_stream()->get_length()) { _current = 0; _indicator->update(); @@ -146,7 +146,7 @@ void AudioStreamEditor::_draw_indicator() { Rect2 rect = _preview->get_rect(); float len = stream->get_length(); float ofs_x = _current / len * rect.size.width; - _indicator->draw_line(Point2(ofs_x, 0), Point2(ofs_x, rect.size.height), get_color("accent_color", "Editor"), 1); + _indicator->draw_line(Point2(ofs_x, 0), Point2(ofs_x, rect.size.height), get_theme_color("accent_color", "Editor"), 1); _current_label->set_text(String::num(_current, 2).pad_decimals(2) + " /"); } @@ -225,7 +225,7 @@ AudioStreamEditor::AudioStreamEditor() { _preview->add_child(_indicator); HBoxContainer *hbox = memnew(HBoxContainer); - hbox->add_constant_override("separation", 0); + hbox->add_theme_constant_override("separation", 0); vbox->add_child(hbox); _play_button = memnew(ToolButton); @@ -241,12 +241,12 @@ AudioStreamEditor::AudioStreamEditor() { _current_label = memnew(Label); _current_label->set_align(Label::ALIGN_RIGHT); _current_label->set_h_size_flags(SIZE_EXPAND_FILL); - _current_label->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts")); + _current_label->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font("status_source", "EditorFonts")); _current_label->set_modulate(Color(1, 1, 1, 0.5)); hbox->add_child(_current_label); _duration_label = memnew(Label); - _duration_label->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("status_source", "EditorFonts")); + _duration_label->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font("status_source", "EditorFonts")); hbox->add_child(_duration_label); } diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 686a26ce68..1ad0df5224 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -2284,7 +2284,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) { } selection_menu_additive_selection = b->get_shift(); - selection_menu->set_global_position(b->get_global_position()); + selection_menu->set_position(get_screen_transform().xform(b->get_position())); selection_menu->popup(); return true; } @@ -2588,9 +2588,9 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) { } void CanvasItemEditor::_draw_text_at_position(Point2 p_position, String p_string, Margin p_side) { - Color color = get_color("font_color", "Editor"); + Color color = get_theme_color("font_color", "Editor"); color.a = 0.8; - Ref<Font> font = get_font("font", "Label"); + Ref<Font> font = get_theme_font("font", "Label"); Size2 text_size = font->get_string_size(p_string); switch (p_side) { case MARGIN_LEFT: @@ -2626,7 +2626,7 @@ void CanvasItemEditor::_draw_percentage_at_position(float p_value, Point2 p_posi void CanvasItemEditor::_draw_focus() { // Draw the focus around the base viewport if (viewport->has_focus()) { - get_stylebox("Focus", "EditorStyles")->draw(viewport->get_canvas_item(), Rect2(Point2(), viewport->get_size())); + get_theme_stylebox("Focus", "EditorStyles")->draw(viewport->get_canvas_item(), Rect2(Point2(), viewport->get_size())); } } @@ -2657,18 +2657,18 @@ void CanvasItemEditor::_draw_guides() { } // Dragged guide - Color text_color = get_color("font_color", "Editor"); + Color text_color = get_theme_color("font_color", "Editor"); text_color.a = 0.5; if (drag_type == DRAG_DOUBLE_GUIDE || drag_type == DRAG_V_GUIDE) { String str = vformat("%d px", Math::round(xform.affine_inverse().xform(dragged_guide_pos).x)); - Ref<Font> font = get_font("font", "Label"); + Ref<Font> font = get_theme_font("font", "Label"); Size2 text_size = font->get_string_size(str); viewport->draw_string(font, Point2(dragged_guide_pos.x + 10, RULER_WIDTH + text_size.y / 2 + 10), str, text_color); viewport->draw_line(Point2(dragged_guide_pos.x, 0), Point2(dragged_guide_pos.x, viewport->get_size().y), guide_color, Math::round(EDSCALE)); } if (drag_type == DRAG_DOUBLE_GUIDE || drag_type == DRAG_H_GUIDE) { String str = vformat("%d px", Math::round(xform.affine_inverse().xform(dragged_guide_pos).y)); - Ref<Font> font = get_font("font", "Label"); + Ref<Font> font = get_theme_font("font", "Label"); Size2 text_size = font->get_string_size(str); viewport->draw_string(font, Point2(RULER_WIDTH + 10, dragged_guide_pos.y + text_size.y / 2 + 10), str, text_color); viewport->draw_line(Point2(0, dragged_guide_pos.y), Point2(viewport->get_size().x, dragged_guide_pos.y), guide_color, Math::round(EDSCALE)); @@ -2690,11 +2690,11 @@ void CanvasItemEditor::_draw_smart_snapping() { } void CanvasItemEditor::_draw_rulers() { - Color bg_color = get_color("dark_color_2", "Editor"); - Color graduation_color = get_color("font_color", "Editor").linear_interpolate(bg_color, 0.5); - Color font_color = get_color("font_color", "Editor"); + Color bg_color = get_theme_color("dark_color_2", "Editor"); + Color graduation_color = get_theme_color("font_color", "Editor").linear_interpolate(bg_color, 0.5); + Color font_color = get_theme_color("font_color", "Editor"); font_color.a = 0.8; - Ref<Font> font = get_font("rulers", "EditorFonts"); + Ref<Font> font = get_theme_font("rulers", "EditorFonts"); // The rule transform Transform2D ruler_transform = Transform2D(); @@ -2856,7 +2856,7 @@ void CanvasItemEditor::_draw_ruler_tool() { return; if (ruler_tool_active) { - Color ruler_primary_color = get_color("accent_color", "Editor"); + Color ruler_primary_color = get_theme_color("accent_color", "Editor"); Color ruler_secondary_color = ruler_primary_color; ruler_secondary_color.a = 0.5; @@ -2873,8 +2873,8 @@ void CanvasItemEditor::_draw_ruler_tool() { viewport->draw_line(corner, end, ruler_secondary_color, Math::round(EDSCALE)); } - Ref<Font> font = get_font("bold", "EditorFonts"); - Color font_color = get_color("font_color", "Editor"); + Ref<Font> font = get_theme_font("bold", "EditorFonts"); + Color font_color = get_theme_color("font_color", "Editor"); Color font_secondary_color = font_color; font_secondary_color.a = 0.5; float text_height = font->get_height(); @@ -2974,8 +2974,8 @@ void CanvasItemEditor::_draw_ruler_tool() { } else { if (grid_snap_active) { - Ref<Texture2D> position_icon = get_icon("EditorPosition", "EditorIcons"); - viewport->draw_texture(get_icon("EditorPosition", "EditorIcons"), (ruler_tool_origin - view_offset) * zoom - position_icon->get_size() / 2); + Ref<Texture2D> position_icon = get_theme_icon("EditorPosition", "EditorIcons"); + viewport->draw_texture(get_theme_icon("EditorPosition", "EditorIcons"), (ruler_tool_origin - view_offset) * zoom - position_icon->get_size() / 2); } } } @@ -3187,9 +3187,9 @@ void CanvasItemEditor::_draw_control_helpers(Control *control) { } void CanvasItemEditor::_draw_selection() { - Ref<Texture2D> pivot_icon = get_icon("EditorPivot", "EditorIcons"); - Ref<Texture2D> position_icon = get_icon("EditorPosition", "EditorIcons"); - Ref<Texture2D> previous_position_icon = get_icon("EditorPositionPrevious", "EditorIcons"); + Ref<Texture2D> pivot_icon = get_theme_icon("EditorPivot", "EditorIcons"); + Ref<Texture2D> position_icon = get_theme_icon("EditorPosition", "EditorIcons"); + Ref<Texture2D> previous_position_icon = get_theme_icon("EditorPositionPrevious", "EditorIcons"); RID ci = viewport->get_canvas_item(); @@ -3312,16 +3312,16 @@ void CanvasItemEditor::_draw_selection() { points.push_back(Vector2(move_factor.x * EDSCALE, -5 * EDSCALE)); points.push_back(Vector2((move_factor.x + 10) * EDSCALE, 0)); - viewport->draw_colored_polygon(points, get_color("axis_x_color", "Editor")); - viewport->draw_line(Point2(), Point2(move_factor.x * EDSCALE, 0), get_color("axis_x_color", "Editor"), Math::round(EDSCALE)); + viewport->draw_colored_polygon(points, get_theme_color("axis_x_color", "Editor")); + viewport->draw_line(Point2(), Point2(move_factor.x * EDSCALE, 0), get_theme_color("axis_x_color", "Editor"), Math::round(EDSCALE)); points.clear(); points.push_back(Vector2(5 * EDSCALE, move_factor.y * EDSCALE)); points.push_back(Vector2(-5 * EDSCALE, move_factor.y * EDSCALE)); points.push_back(Vector2(0, (move_factor.y + 10) * EDSCALE)); - viewport->draw_colored_polygon(points, get_color("axis_y_color", "Editor")); - viewport->draw_line(Point2(), Point2(0, move_factor.y * EDSCALE), get_color("axis_y_color", "Editor"), Math::round(EDSCALE)); + viewport->draw_colored_polygon(points, get_theme_color("axis_y_color", "Editor")); + viewport->draw_line(Point2(), Point2(0, move_factor.y * EDSCALE), get_theme_color("axis_y_color", "Editor"), Math::round(EDSCALE)); viewport->draw_set_transform_matrix(viewport->get_transform()); } @@ -3351,12 +3351,12 @@ void CanvasItemEditor::_draw_selection() { viewport->draw_set_transform_matrix(simple_xform); Rect2 x_handle_rect = Rect2(scale_factor.x * EDSCALE, -5 * EDSCALE, 10 * EDSCALE, 10 * EDSCALE); - viewport->draw_rect(x_handle_rect, get_color("axis_x_color", "Editor")); - viewport->draw_line(Point2(), Point2(scale_factor.x * EDSCALE, 0), get_color("axis_x_color", "Editor"), Math::round(EDSCALE)); + viewport->draw_rect(x_handle_rect, get_theme_color("axis_x_color", "Editor")); + viewport->draw_line(Point2(), Point2(scale_factor.x * EDSCALE, 0), get_theme_color("axis_x_color", "Editor"), Math::round(EDSCALE)); Rect2 y_handle_rect = Rect2(-5 * EDSCALE, scale_factor.y * EDSCALE, 10 * EDSCALE, 10 * EDSCALE); - viewport->draw_rect(y_handle_rect, get_color("axis_y_color", "Editor")); - viewport->draw_line(Point2(), Point2(0, scale_factor.y * EDSCALE), get_color("axis_y_color", "Editor"), Math::round(EDSCALE)); + viewport->draw_rect(y_handle_rect, get_theme_color("axis_y_color", "Editor")); + viewport->draw_line(Point2(), Point2(0, scale_factor.y * EDSCALE), get_theme_color("axis_y_color", "Editor"), Math::round(EDSCALE)); viewport->draw_set_transform_matrix(viewport->get_transform()); } @@ -3371,11 +3371,11 @@ void CanvasItemEditor::_draw_selection() { viewport->draw_rect( Rect2(bsfrom, bsto - bsfrom), - get_color("box_selection_fill_color", "Editor")); + get_theme_color("box_selection_fill_color", "Editor")); viewport->draw_rect( Rect2(bsfrom, bsto - bsfrom), - get_color("box_selection_stroke_color", "Editor"), + get_theme_color("box_selection_stroke_color", "Editor"), false, Math::round(EDSCALE)); } @@ -3385,7 +3385,7 @@ void CanvasItemEditor::_draw_selection() { viewport->draw_line( transform.xform(drag_rotation_center), transform.xform(drag_to), - get_color("accent_color", "Editor") * Color(1, 1, 1, 0.6), + get_theme_color("accent_color", "Editor") * Color(1, 1, 1, 0.6), Math::round(2 * EDSCALE)); } } @@ -3435,8 +3435,8 @@ void CanvasItemEditor::_draw_axis() { if (show_origin) { - _draw_straight_line(Point2(), Point2(1, 0), get_color("axis_x_color", "Editor") * Color(1, 1, 1, 0.75)); - _draw_straight_line(Point2(), Point2(0, 1), get_color("axis_y_color", "Editor") * Color(1, 1, 1, 0.75)); + _draw_straight_line(Point2(), Point2(1, 0), get_theme_color("axis_x_color", "Editor") * Color(1, 1, 1, 0.75)); + _draw_straight_line(Point2(), Point2(0, 1), get_theme_color("axis_y_color", "Editor") * Color(1, 1, 1, 0.75)); } if (show_viewport) { @@ -3547,7 +3547,7 @@ void CanvasItemEditor::_draw_invisible_nodes_positions(Node *p_node, const Trans Transform2D xform = transform * canvas_xform * parent_xform; // Draw the node's position - Ref<Texture2D> position_icon = get_icon("EditorPositionUnselected", "EditorIcons"); + Ref<Texture2D> position_icon = get_theme_icon("EditorPositionUnselected", "EditorIcons"); Transform2D unscaled_transform = (xform * canvas_item->get_transform().affine_inverse() * canvas_item->_edit_get_transform()).orthonormalized(); Transform2D simple_xform = viewport->get_transform() * unscaled_transform; viewport->draw_set_transform_matrix(simple_xform); @@ -3564,7 +3564,7 @@ void CanvasItemEditor::_draw_hover() { Ref<Texture2D> node_icon = hovering_results[i].icon; String node_name = hovering_results[i].name; - Ref<Font> font = get_font("font", "Label"); + Ref<Font> font = get_theme_font("font", "Label"); Size2 node_name_size = font->get_string_size(node_name); Size2 item_size = Size2(node_icon->get_size().x + 4 + node_name_size.x, MAX(node_icon->get_size().y, node_name_size.y - 3)); @@ -3615,13 +3615,13 @@ void CanvasItemEditor::_draw_locks_and_groups(Node *p_node, const Transform2D &p if (canvas_item) { float offset = 0; - Ref<Texture2D> lock = get_icon("LockViewport", "EditorIcons"); + Ref<Texture2D> lock = get_theme_icon("LockViewport", "EditorIcons"); if (p_node->has_meta("_edit_lock_") && show_edit_locks) { lock->draw(viewport_canvas_item, (transform * canvas_xform * parent_xform).xform(Point2(0, 0)) + Point2(offset, 0)); offset += lock->get_size().x; } - Ref<Texture2D> group = get_icon("GroupViewport", "EditorIcons"); + Ref<Texture2D> group = get_theme_icon("GroupViewport", "EditorIcons"); if (canvas_item->has_meta("_edit_group_") && show_edit_locks) { group->draw(viewport_canvas_item, (transform * canvas_xform * parent_xform).xform(Point2(0, 0)) + Point2(offset, 0)); //offset += group->get_size().x; @@ -3893,7 +3893,7 @@ void CanvasItemEditor::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - select_sb->set_texture(get_icon("EditorRect2D", "EditorIcons")); + select_sb->set_texture(get_theme_icon("EditorRect2D", "EditorIcons")); for (int i = 0; i < 4; i++) { select_sb->set_margin_size(Margin(i), 4); select_sb->set_default_margin(Margin(i), 4); @@ -3906,7 +3906,7 @@ void CanvasItemEditor::_notification(int p_what) { } else if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { - select_sb->set_texture(get_icon("EditorRect2D", "EditorIcons")); + select_sb->set_texture(get_theme_icon("EditorRect2D", "EditorIcons")); } if (p_what == NOTIFICATION_EXIT_TREE) { @@ -3915,85 +3915,85 @@ void CanvasItemEditor::_notification(int p_what) { } if (p_what == NOTIFICATION_ENTER_TREE || p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { - select_button->set_icon(get_icon("ToolSelect", "EditorIcons")); - list_select_button->set_icon(get_icon("ListSelect", "EditorIcons")); - move_button->set_icon(get_icon("ToolMove", "EditorIcons")); - scale_button->set_icon(get_icon("ToolScale", "EditorIcons")); - rotate_button->set_icon(get_icon("ToolRotate", "EditorIcons")); - smart_snap_button->set_icon(get_icon("Snap", "EditorIcons")); - grid_snap_button->set_icon(get_icon("SnapGrid", "EditorIcons")); - snap_config_menu->set_icon(get_icon("GuiTabMenu", "EditorIcons")); - skeleton_menu->set_icon(get_icon("Bone", "EditorIcons")); - override_camera_button->set_icon(get_icon("Camera2D", "EditorIcons")); - pan_button->set_icon(get_icon("ToolPan", "EditorIcons")); - ruler_button->set_icon(get_icon("Ruler", "EditorIcons")); - pivot_button->set_icon(get_icon("EditPivot", "EditorIcons")); - select_handle = get_icon("EditorHandle", "EditorIcons"); - anchor_handle = get_icon("EditorControlAnchor", "EditorIcons"); - lock_button->set_icon(get_icon("Lock", "EditorIcons")); - unlock_button->set_icon(get_icon("Unlock", "EditorIcons")); - group_button->set_icon(get_icon("Group", "EditorIcons")); - ungroup_button->set_icon(get_icon("Ungroup", "EditorIcons")); - key_loc_button->set_icon(get_icon("KeyPosition", "EditorIcons")); - key_rot_button->set_icon(get_icon("KeyRotation", "EditorIcons")); - key_scale_button->set_icon(get_icon("KeyScale", "EditorIcons")); - key_insert_button->set_icon(get_icon("Key", "EditorIcons")); - key_auto_insert_button->set_icon(get_icon("AutoKey", "EditorIcons")); - animation_menu->set_icon(get_icon("GuiTabMenu", "EditorIcons")); - - zoom_minus->set_icon(get_icon("ZoomLess", "EditorIcons")); - zoom_plus->set_icon(get_icon("ZoomMore", "EditorIcons")); - - presets_menu->set_icon(get_icon("ControlLayout", "EditorIcons")); + select_button->set_icon(get_theme_icon("ToolSelect", "EditorIcons")); + list_select_button->set_icon(get_theme_icon("ListSelect", "EditorIcons")); + move_button->set_icon(get_theme_icon("ToolMove", "EditorIcons")); + scale_button->set_icon(get_theme_icon("ToolScale", "EditorIcons")); + rotate_button->set_icon(get_theme_icon("ToolRotate", "EditorIcons")); + smart_snap_button->set_icon(get_theme_icon("Snap", "EditorIcons")); + grid_snap_button->set_icon(get_theme_icon("SnapGrid", "EditorIcons")); + snap_config_menu->set_icon(get_theme_icon("GuiTabMenu", "EditorIcons")); + skeleton_menu->set_icon(get_theme_icon("Bone", "EditorIcons")); + override_camera_button->set_icon(get_theme_icon("Camera2D", "EditorIcons")); + pan_button->set_icon(get_theme_icon("ToolPan", "EditorIcons")); + ruler_button->set_icon(get_theme_icon("Ruler", "EditorIcons")); + pivot_button->set_icon(get_theme_icon("EditPivot", "EditorIcons")); + select_handle = get_theme_icon("EditorHandle", "EditorIcons"); + anchor_handle = get_theme_icon("EditorControlAnchor", "EditorIcons"); + lock_button->set_icon(get_theme_icon("Lock", "EditorIcons")); + unlock_button->set_icon(get_theme_icon("Unlock", "EditorIcons")); + group_button->set_icon(get_theme_icon("Group", "EditorIcons")); + ungroup_button->set_icon(get_theme_icon("Ungroup", "EditorIcons")); + key_loc_button->set_icon(get_theme_icon("KeyPosition", "EditorIcons")); + key_rot_button->set_icon(get_theme_icon("KeyRotation", "EditorIcons")); + key_scale_button->set_icon(get_theme_icon("KeyScale", "EditorIcons")); + key_insert_button->set_icon(get_theme_icon("Key", "EditorIcons")); + key_auto_insert_button->set_icon(get_theme_icon("AutoKey", "EditorIcons")); + animation_menu->set_icon(get_theme_icon("GuiTabMenu", "EditorIcons")); + + zoom_minus->set_icon(get_theme_icon("ZoomLess", "EditorIcons")); + zoom_plus->set_icon(get_theme_icon("ZoomMore", "EditorIcons")); + + presets_menu->set_icon(get_theme_icon("ControlLayout", "EditorIcons")); PopupMenu *p = presets_menu->get_popup(); p->clear(); - p->add_icon_item(get_icon("ControlAlignTopLeft", "EditorIcons"), TTR("Top Left"), ANCHORS_AND_MARGINS_PRESET_TOP_LEFT); - p->add_icon_item(get_icon("ControlAlignTopRight", "EditorIcons"), TTR("Top Right"), ANCHORS_AND_MARGINS_PRESET_TOP_RIGHT); - p->add_icon_item(get_icon("ControlAlignBottomRight", "EditorIcons"), TTR("Bottom Right"), ANCHORS_AND_MARGINS_PRESET_BOTTOM_RIGHT); - p->add_icon_item(get_icon("ControlAlignBottomLeft", "EditorIcons"), TTR("Bottom Left"), ANCHORS_AND_MARGINS_PRESET_BOTTOM_LEFT); + p->add_icon_item(get_theme_icon("ControlAlignTopLeft", "EditorIcons"), TTR("Top Left"), ANCHORS_AND_MARGINS_PRESET_TOP_LEFT); + p->add_icon_item(get_theme_icon("ControlAlignTopRight", "EditorIcons"), TTR("Top Right"), ANCHORS_AND_MARGINS_PRESET_TOP_RIGHT); + p->add_icon_item(get_theme_icon("ControlAlignBottomRight", "EditorIcons"), TTR("Bottom Right"), ANCHORS_AND_MARGINS_PRESET_BOTTOM_RIGHT); + p->add_icon_item(get_theme_icon("ControlAlignBottomLeft", "EditorIcons"), TTR("Bottom Left"), ANCHORS_AND_MARGINS_PRESET_BOTTOM_LEFT); p->add_separator(); - p->add_icon_item(get_icon("ControlAlignLeftCenter", "EditorIcons"), TTR("Center Left"), ANCHORS_AND_MARGINS_PRESET_CENTER_LEFT); - p->add_icon_item(get_icon("ControlAlignTopCenter", "EditorIcons"), TTR("Center Top"), ANCHORS_AND_MARGINS_PRESET_CENTER_TOP); - p->add_icon_item(get_icon("ControlAlignRightCenter", "EditorIcons"), TTR("Center Right"), ANCHORS_AND_MARGINS_PRESET_CENTER_RIGHT); - p->add_icon_item(get_icon("ControlAlignBottomCenter", "EditorIcons"), TTR("Center Bottom"), ANCHORS_AND_MARGINS_PRESET_CENTER_BOTTOM); - p->add_icon_item(get_icon("ControlAlignCenter", "EditorIcons"), TTR("Center"), ANCHORS_AND_MARGINS_PRESET_CENTER); + p->add_icon_item(get_theme_icon("ControlAlignLeftCenter", "EditorIcons"), TTR("Center Left"), ANCHORS_AND_MARGINS_PRESET_CENTER_LEFT); + p->add_icon_item(get_theme_icon("ControlAlignTopCenter", "EditorIcons"), TTR("Center Top"), ANCHORS_AND_MARGINS_PRESET_CENTER_TOP); + p->add_icon_item(get_theme_icon("ControlAlignRightCenter", "EditorIcons"), TTR("Center Right"), ANCHORS_AND_MARGINS_PRESET_CENTER_RIGHT); + p->add_icon_item(get_theme_icon("ControlAlignBottomCenter", "EditorIcons"), TTR("Center Bottom"), ANCHORS_AND_MARGINS_PRESET_CENTER_BOTTOM); + p->add_icon_item(get_theme_icon("ControlAlignCenter", "EditorIcons"), TTR("Center"), ANCHORS_AND_MARGINS_PRESET_CENTER); p->add_separator(); - p->add_icon_item(get_icon("ControlAlignLeftWide", "EditorIcons"), TTR("Left Wide"), ANCHORS_AND_MARGINS_PRESET_LEFT_WIDE); - p->add_icon_item(get_icon("ControlAlignTopWide", "EditorIcons"), TTR("Top Wide"), ANCHORS_AND_MARGINS_PRESET_TOP_WIDE); - p->add_icon_item(get_icon("ControlAlignRightWide", "EditorIcons"), TTR("Right Wide"), ANCHORS_AND_MARGINS_PRESET_RIGHT_WIDE); - p->add_icon_item(get_icon("ControlAlignBottomWide", "EditorIcons"), TTR("Bottom Wide"), ANCHORS_AND_MARGINS_PRESET_BOTTOM_WIDE); - p->add_icon_item(get_icon("ControlVcenterWide", "EditorIcons"), TTR("VCenter Wide"), ANCHORS_AND_MARGINS_PRESET_VCENTER_WIDE); - p->add_icon_item(get_icon("ControlHcenterWide", "EditorIcons"), TTR("HCenter Wide"), ANCHORS_AND_MARGINS_PRESET_HCENTER_WIDE); + p->add_icon_item(get_theme_icon("ControlAlignLeftWide", "EditorIcons"), TTR("Left Wide"), ANCHORS_AND_MARGINS_PRESET_LEFT_WIDE); + p->add_icon_item(get_theme_icon("ControlAlignTopWide", "EditorIcons"), TTR("Top Wide"), ANCHORS_AND_MARGINS_PRESET_TOP_WIDE); + p->add_icon_item(get_theme_icon("ControlAlignRightWide", "EditorIcons"), TTR("Right Wide"), ANCHORS_AND_MARGINS_PRESET_RIGHT_WIDE); + p->add_icon_item(get_theme_icon("ControlAlignBottomWide", "EditorIcons"), TTR("Bottom Wide"), ANCHORS_AND_MARGINS_PRESET_BOTTOM_WIDE); + p->add_icon_item(get_theme_icon("ControlVcenterWide", "EditorIcons"), TTR("VCenter Wide"), ANCHORS_AND_MARGINS_PRESET_VCENTER_WIDE); + p->add_icon_item(get_theme_icon("ControlHcenterWide", "EditorIcons"), TTR("HCenter Wide"), ANCHORS_AND_MARGINS_PRESET_HCENTER_WIDE); p->add_separator(); - p->add_icon_item(get_icon("ControlAlignWide", "EditorIcons"), TTR("Full Rect"), ANCHORS_AND_MARGINS_PRESET_WIDE); - p->add_icon_item(get_icon("Anchor", "EditorIcons"), TTR("Keep Ratio"), ANCHORS_AND_MARGINS_PRESET_KEEP_RATIO); + p->add_icon_item(get_theme_icon("ControlAlignWide", "EditorIcons"), TTR("Full Rect"), ANCHORS_AND_MARGINS_PRESET_WIDE); + p->add_icon_item(get_theme_icon("Anchor", "EditorIcons"), TTR("Keep Ratio"), ANCHORS_AND_MARGINS_PRESET_KEEP_RATIO); p->add_separator(); p->add_submenu_item(TTR("Anchors only"), "Anchors"); - p->set_item_icon(21, get_icon("Anchor", "EditorIcons")); + p->set_item_icon(21, get_theme_icon("Anchor", "EditorIcons")); anchors_popup->clear(); - anchors_popup->add_icon_item(get_icon("ControlAlignTopLeft", "EditorIcons"), TTR("Top Left"), ANCHORS_PRESET_TOP_LEFT); - anchors_popup->add_icon_item(get_icon("ControlAlignTopRight", "EditorIcons"), TTR("Top Right"), ANCHORS_PRESET_TOP_RIGHT); - anchors_popup->add_icon_item(get_icon("ControlAlignBottomRight", "EditorIcons"), TTR("Bottom Right"), ANCHORS_PRESET_BOTTOM_RIGHT); - anchors_popup->add_icon_item(get_icon("ControlAlignBottomLeft", "EditorIcons"), TTR("Bottom Left"), ANCHORS_PRESET_BOTTOM_LEFT); + anchors_popup->add_icon_item(get_theme_icon("ControlAlignTopLeft", "EditorIcons"), TTR("Top Left"), ANCHORS_PRESET_TOP_LEFT); + anchors_popup->add_icon_item(get_theme_icon("ControlAlignTopRight", "EditorIcons"), TTR("Top Right"), ANCHORS_PRESET_TOP_RIGHT); + anchors_popup->add_icon_item(get_theme_icon("ControlAlignBottomRight", "EditorIcons"), TTR("Bottom Right"), ANCHORS_PRESET_BOTTOM_RIGHT); + anchors_popup->add_icon_item(get_theme_icon("ControlAlignBottomLeft", "EditorIcons"), TTR("Bottom Left"), ANCHORS_PRESET_BOTTOM_LEFT); anchors_popup->add_separator(); - anchors_popup->add_icon_item(get_icon("ControlAlignLeftCenter", "EditorIcons"), TTR("Center Left"), ANCHORS_PRESET_CENTER_LEFT); - anchors_popup->add_icon_item(get_icon("ControlAlignTopCenter", "EditorIcons"), TTR("Center Top"), ANCHORS_PRESET_CENTER_TOP); - anchors_popup->add_icon_item(get_icon("ControlAlignRightCenter", "EditorIcons"), TTR("Center Right"), ANCHORS_PRESET_CENTER_RIGHT); - anchors_popup->add_icon_item(get_icon("ControlAlignBottomCenter", "EditorIcons"), TTR("Center Bottom"), ANCHORS_PRESET_CENTER_BOTTOM); - anchors_popup->add_icon_item(get_icon("ControlAlignCenter", "EditorIcons"), TTR("Center"), ANCHORS_PRESET_CENTER); + anchors_popup->add_icon_item(get_theme_icon("ControlAlignLeftCenter", "EditorIcons"), TTR("Center Left"), ANCHORS_PRESET_CENTER_LEFT); + anchors_popup->add_icon_item(get_theme_icon("ControlAlignTopCenter", "EditorIcons"), TTR("Center Top"), ANCHORS_PRESET_CENTER_TOP); + anchors_popup->add_icon_item(get_theme_icon("ControlAlignRightCenter", "EditorIcons"), TTR("Center Right"), ANCHORS_PRESET_CENTER_RIGHT); + anchors_popup->add_icon_item(get_theme_icon("ControlAlignBottomCenter", "EditorIcons"), TTR("Center Bottom"), ANCHORS_PRESET_CENTER_BOTTOM); + anchors_popup->add_icon_item(get_theme_icon("ControlAlignCenter", "EditorIcons"), TTR("Center"), ANCHORS_PRESET_CENTER); anchors_popup->add_separator(); - anchors_popup->add_icon_item(get_icon("ControlAlignLeftWide", "EditorIcons"), TTR("Left Wide"), ANCHORS_PRESET_LEFT_WIDE); - anchors_popup->add_icon_item(get_icon("ControlAlignTopWide", "EditorIcons"), TTR("Top Wide"), ANCHORS_PRESET_TOP_WIDE); - anchors_popup->add_icon_item(get_icon("ControlAlignRightWide", "EditorIcons"), TTR("Right Wide"), ANCHORS_PRESET_RIGHT_WIDE); - anchors_popup->add_icon_item(get_icon("ControlAlignBottomWide", "EditorIcons"), TTR("Bottom Wide"), ANCHORS_PRESET_BOTTOM_WIDE); - anchors_popup->add_icon_item(get_icon("ControlVcenterWide", "EditorIcons"), TTR("VCenter Wide"), ANCHORS_PRESET_VCENTER_WIDE); - anchors_popup->add_icon_item(get_icon("ControlHcenterWide", "EditorIcons"), TTR("HCenter Wide"), ANCHORS_PRESET_HCENTER_WIDE); + anchors_popup->add_icon_item(get_theme_icon("ControlAlignLeftWide", "EditorIcons"), TTR("Left Wide"), ANCHORS_PRESET_LEFT_WIDE); + anchors_popup->add_icon_item(get_theme_icon("ControlAlignTopWide", "EditorIcons"), TTR("Top Wide"), ANCHORS_PRESET_TOP_WIDE); + anchors_popup->add_icon_item(get_theme_icon("ControlAlignRightWide", "EditorIcons"), TTR("Right Wide"), ANCHORS_PRESET_RIGHT_WIDE); + anchors_popup->add_icon_item(get_theme_icon("ControlAlignBottomWide", "EditorIcons"), TTR("Bottom Wide"), ANCHORS_PRESET_BOTTOM_WIDE); + anchors_popup->add_icon_item(get_theme_icon("ControlVcenterWide", "EditorIcons"), TTR("VCenter Wide"), ANCHORS_PRESET_VCENTER_WIDE); + anchors_popup->add_icon_item(get_theme_icon("ControlHcenterWide", "EditorIcons"), TTR("HCenter Wide"), ANCHORS_PRESET_HCENTER_WIDE); anchors_popup->add_separator(); - anchors_popup->add_icon_item(get_icon("ControlAlignWide", "EditorIcons"), TTR("Full Rect"), ANCHORS_PRESET_WIDE); + anchors_popup->add_icon_item(get_theme_icon("ControlAlignWide", "EditorIcons"), TTR("Full Rect"), ANCHORS_PRESET_WIDE); - anchor_mode_button->set_icon(get_icon("Anchor", "EditorIcons")); + anchor_mode_button->set_icon(get_theme_icon("Anchor", "EditorIcons")); } if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { @@ -5445,7 +5445,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { zoom_hb = memnew(HBoxContainer); // Bring the zoom percentage closer to the zoom buttons - zoom_hb->add_constant_override("separation", Math::round(-8 * EDSCALE)); + zoom_hb->add_theme_constant_override("separation", Math::round(-8 * EDSCALE)); controls_vb->add_child(zoom_hb); viewport = memnew(CanvasItemEditorViewport(p_editor, this)); @@ -5462,7 +5462,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { info_overlay->set_margin(MARGIN_LEFT, 10); info_overlay->set_margin(MARGIN_BOTTOM, -15); info_overlay->set_v_grow_direction(Control::GROW_DIRECTION_BEGIN); - info_overlay->add_constant_override("separation", 10); + info_overlay->add_theme_constant_override("separation", 10); viewport_scrollable->add_child(info_overlay); Theme *info_overlay_theme = memnew(Theme); @@ -5477,8 +5477,8 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { warning_child_of_container = memnew(Label); warning_child_of_container->hide(); warning_child_of_container->set_text(TTR("Warning: Children of a container get their position and size determined only by their parent.")); - warning_child_of_container->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("warning_color", "Editor")); - warning_child_of_container->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("main", "EditorFonts")); + warning_child_of_container->add_theme_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_theme_color("warning_color", "Editor")); + warning_child_of_container->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font("main", "EditorFonts")); add_control_to_info_overlay(warning_child_of_container); h_scroll = memnew(HScrollBar); @@ -5783,7 +5783,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { selection_menu = memnew(PopupMenu); add_child(selection_menu); - selection_menu->set_custom_minimum_size(Vector2(100, 0)); + selection_menu->set_min_size(Vector2(100, 0)); selection_menu->connect("id_pressed", callable_mp(this, &CanvasItemEditor::_selection_result_pressed)); selection_menu->connect("popup_hide", callable_mp(this, &CanvasItemEditor::_selection_menu_hide)); @@ -6233,7 +6233,7 @@ void CanvasItemEditorViewport::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { connect("mouse_exited", callable_mp(this, &CanvasItemEditorViewport::_on_mouse_exit)); - label->add_color_override("font_color", get_color("warning_color", "Editor")); + label->add_theme_color_override("font_color", get_theme_color("warning_color", "Editor")); } break; case NOTIFICATION_EXIT_TREE: { disconnect("mouse_exited", callable_mp(this, &CanvasItemEditorViewport::_on_mouse_exit)); @@ -6293,17 +6293,17 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte } label = memnew(Label); - label->add_color_override("font_color_shadow", Color(0, 0, 0, 1)); - label->add_constant_override("shadow_as_outline", 1 * EDSCALE); + label->add_theme_color_override("font_color_shadow", Color(0, 0, 0, 1)); + label->add_theme_constant_override("shadow_as_outline", 1 * EDSCALE); label->hide(); canvas_item_editor->get_controls_container()->add_child(label); label_desc = memnew(Label); label_desc->set_text(TTR("Drag & drop + Shift : Add node as sibling\nDrag & drop + Alt : Change node type")); - label_desc->add_color_override("font_color", Color(0.6f, 0.6f, 0.6f, 1)); - label_desc->add_color_override("font_color_shadow", Color(0.2f, 0.2f, 0.2f, 1)); - label_desc->add_constant_override("shadow_as_outline", 1 * EDSCALE); - label_desc->add_constant_override("line_spacing", 0); + label_desc->add_theme_color_override("font_color", Color(0.6f, 0.6f, 0.6f, 1)); + label_desc->add_theme_color_override("font_color_shadow", Color(0.2f, 0.2f, 0.2f, 1)); + label_desc->add_theme_constant_override("shadow_as_outline", 1 * EDSCALE); + label_desc->add_theme_constant_override("line_spacing", 0); label_desc->hide(); canvas_item_editor->get_controls_container()->add_child(label_desc); diff --git a/editor/plugins/collision_polygon_editor_plugin.cpp b/editor/plugins/collision_polygon_editor_plugin.cpp index 32a9a307f4..93295e6ab5 100644 --- a/editor/plugins/collision_polygon_editor_plugin.cpp +++ b/editor/plugins/collision_polygon_editor_plugin.cpp @@ -44,8 +44,8 @@ void Polygon3DEditor::_notification(int p_what) { case NOTIFICATION_READY: { - button_create->set_icon(get_icon("Edit", "EditorIcons")); - button_edit->set_icon(get_icon("MovePoint", "EditorIcons")); + button_create->set_icon(get_theme_icon("Edit", "EditorIcons")); + button_edit->set_icon(get_theme_icon("MovePoint", "EditorIcons")); button_edit->set_pressed(true); get_tree()->connect("node_removed", callable_mp(this, &Polygon3DEditor::_node_removed)); @@ -556,7 +556,7 @@ Polygon3DEditor::Polygon3DEditor(EditorNode *p_editor) { handle_material->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); handle_material->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); handle_material->set_flag(StandardMaterial3D::FLAG_SRGB_VERTEX_COLOR, true); - Ref<Texture2D> handle = editor->get_gui_base()->get_icon("Editor3DHandle", "EditorIcons"); + Ref<Texture2D> handle = editor->get_gui_base()->get_theme_icon("Editor3DHandle", "EditorIcons"); handle_material->set_point_size(handle->get_width()); handle_material->set_texture(StandardMaterial3D::TEXTURE_ALBEDO, handle); diff --git a/editor/plugins/collision_shape_2d_editor_plugin.cpp b/editor/plugins/collision_shape_2d_editor_plugin.cpp index 01b4a61a85..709ff91fc0 100644 --- a/editor/plugins/collision_shape_2d_editor_plugin.cpp +++ b/editor/plugins/collision_shape_2d_editor_plugin.cpp @@ -435,7 +435,7 @@ void CollisionShape2DEditor::forward_canvas_draw_over_viewport(Control *p_overla Transform2D gt = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); - Ref<Texture2D> h = get_icon("EditorHandle", "EditorIcons"); + Ref<Texture2D> h = get_theme_icon("EditorHandle", "EditorIcons"); Vector2 size = h->get_size() * 0.5; handles.clear(); diff --git a/editor/plugins/cpu_particles_2d_editor_plugin.cpp b/editor/plugins/cpu_particles_2d_editor_plugin.cpp index 317fd581be..25b8fb8bcb 100644 --- a/editor/plugins/cpu_particles_2d_editor_plugin.cpp +++ b/editor/plugins/cpu_particles_2d_editor_plugin.cpp @@ -241,7 +241,7 @@ void CPUParticles2DEditorPlugin::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { menu->get_popup()->connect("id_pressed", callable_mp(this, &CPUParticles2DEditorPlugin::_menu_callback)); - menu->set_icon(menu->get_popup()->get_icon("Particles2D", "EditorIcons")); + menu->set_icon(epoints->get_theme_icon("Particles2D", "EditorIcons")); file->connect("file_selected", callable_mp(this, &CPUParticles2DEditorPlugin::_file_selected)); } } diff --git a/editor/plugins/cpu_particles_editor_plugin.cpp b/editor/plugins/cpu_particles_editor_plugin.cpp index 2161041ee6..1388b9ca10 100644 --- a/editor/plugins/cpu_particles_editor_plugin.cpp +++ b/editor/plugins/cpu_particles_editor_plugin.cpp @@ -43,7 +43,7 @@ void CPUParticlesEditor::_node_removed(Node *p_node) { void CPUParticlesEditor::_notification(int p_notification) { if (p_notification == NOTIFICATION_ENTER_TREE) { - options->set_icon(options->get_popup()->get_icon("CPUParticles", "EditorIcons")); + options->set_icon(get_theme_icon("CPUParticles", "EditorIcons")); } } diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index 2724da0a85..0fd8ea4fb5 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -511,7 +511,7 @@ void CurveEditor::set_hover_point_index(int index) { } void CurveEditor::update_view_transform() { - Ref<Font> font = get_font("font", "Label"); + Ref<Font> font = get_theme_font("font", "Label"); const real_t margin = font->get_height() + 2 * EDSCALE; float min_y = 0; @@ -626,7 +626,7 @@ void CurveEditor::_draw() { // Background Vector2 view_size = get_rect().size; - draw_style_box(get_stylebox("bg", "Tree"), Rect2(Point2(), view_size)); + draw_style_box(get_theme_stylebox("bg", "Tree"), Rect2(Point2(), view_size)); // Grid @@ -635,8 +635,8 @@ void CurveEditor::_draw() { Vector2 min_edge = get_world_pos(Vector2(0, view_size.y)); Vector2 max_edge = get_world_pos(Vector2(view_size.x, 0)); - const Color grid_color0 = get_color("mono_color", "Editor") * Color(1, 1, 1, 0.15); - const Color grid_color1 = get_color("mono_color", "Editor") * Color(1, 1, 1, 0.07); + const Color grid_color0 = get_theme_color("mono_color", "Editor") * Color(1, 1, 1, 0.15); + const Color grid_color1 = get_theme_color("mono_color", "Editor") * Color(1, 1, 1, 0.07); draw_line(Vector2(min_edge.x, curve.get_min_value()), Vector2(max_edge.x, curve.get_min_value()), grid_color0); draw_line(Vector2(max_edge.x, curve.get_max_value()), Vector2(min_edge.x, curve.get_max_value()), grid_color0); draw_line(Vector2(0, min_edge.y), Vector2(0, max_edge.y), grid_color0); @@ -656,9 +656,9 @@ void CurveEditor::_draw() { draw_set_transform_matrix(Transform2D()); - Ref<Font> font = get_font("font", "Label"); + Ref<Font> font = get_theme_font("font", "Label"); float font_height = font->get_height(); - Color text_color = get_color("font_color", "Editor"); + Color text_color = get_theme_color("font_color", "Editor"); { // X axis @@ -686,7 +686,7 @@ void CurveEditor::_draw() { if (_selected_point >= 0) { - const Color tangent_color = get_color("accent_color", "Editor"); + const Color tangent_color = get_theme_color("accent_color", "Editor"); int i = _selected_point; Vector2 pos = curve.get_point_position(i); @@ -708,8 +708,8 @@ void CurveEditor::_draw() { draw_set_transform_matrix(_world_to_view); - const Color line_color = get_color("font_color", "Editor"); - const Color edge_line_color = get_color("highlight_color", "Editor"); + const Color line_color = get_theme_color("font_color", "Editor"); + const Color edge_line_color = get_theme_color("highlight_color", "Editor"); CanvasItemPlotCurve plot_func(*this, line_color, edge_line_color); plot_curve_accurate(curve, 4.f / view_size.x, plot_func); @@ -718,8 +718,8 @@ void CurveEditor::_draw() { draw_set_transform_matrix(Transform2D()); - const Color point_color = get_color("font_color", "Editor"); - const Color selected_point_color = get_color("accent_color", "Editor"); + const Color point_color = get_theme_color("font_color", "Editor"); + const Color selected_point_color = get_theme_color("accent_color", "Editor"); for (int i = 0; i < curve.get_point_count(); ++i) { Vector2 pos = curve.get_point_position(i); diff --git a/editor/plugins/debugger_editor_plugin.cpp b/editor/plugins/debugger_editor_plugin.cpp index c4069ac2ab..566ff378c3 100644 --- a/editor/plugins/debugger_editor_plugin.cpp +++ b/editor/plugins/debugger_editor_plugin.cpp @@ -54,7 +54,6 @@ DebuggerEditorPlugin::DebuggerEditorPlugin(EditorNode *p_editor, MenuButton *p_d // Main editor debug menu. debug_menu = p_debug_menu; PopupMenu *p = debug_menu->get_popup(); - p->set_hide_on_window_lose_focus(true); p->set_hide_on_checkable_item_selection(false); p->add_check_shortcut(ED_SHORTCUT("editor/deploy_with_remote_debug", TTR("Deploy with Remote Debug")), RUN_DEPLOY_REMOTE_DEBUG); p->set_item_tooltip(p->get_item_count() - 1, TTR("When exporting or deploying, the resulting executable will attempt to connect to the IP of this computer in order to be debugged.")); diff --git a/editor/plugins/gi_probe_editor_plugin.cpp b/editor/plugins/gi_probe_editor_plugin.cpp index 88a824cc24..908a32fdb6 100644 --- a/editor/plugins/gi_probe_editor_plugin.cpp +++ b/editor/plugins/gi_probe_editor_plugin.cpp @@ -87,16 +87,16 @@ void GIProbeEditorPlugin::_notification(int p_what) { Color color; if (size_mb <= 16.0 + CMP_EPSILON) { // Fast. - color = bake_info->get_color("success_color", "Editor"); + color = bake_info->get_theme_color("success_color", "Editor"); } else if (size_mb <= 64.0 + CMP_EPSILON) { // Medium. - color = bake_info->get_color("warning_color", "Editor"); + color = bake_info->get_theme_color("warning_color", "Editor"); } else { // Slow. - color = bake_info->get_color("error_color", "Editor"); + color = bake_info->get_theme_color("error_color", "Editor"); } + bake_info->add_theme_color_override("font_color", color); - bake_info->add_color_override("font_color", color); bake_info->set_text(text); } } @@ -153,7 +153,7 @@ GIProbeEditorPlugin::GIProbeEditorPlugin(EditorNode *p_node) { bake_hb->set_h_size_flags(Control::SIZE_EXPAND_FILL); bake_hb->hide(); bake = memnew(ToolButton); - bake->set_icon(editor->get_gui_base()->get_icon("Bake", "EditorIcons")); + bake->set_icon(editor->get_gui_base()->get_theme_icon("Bake", "EditorIcons")); bake->set_text(TTR("Bake GI Probe")); bake->connect("pressed", callable_mp(this, &GIProbeEditorPlugin::_bake)); bake_hb->add_child(bake); diff --git a/editor/plugins/item_list_editor_plugin.cpp b/editor/plugins/item_list_editor_plugin.cpp index ba640883c7..9ae4d2ae9d 100644 --- a/editor/plugins/item_list_editor_plugin.cpp +++ b/editor/plugins/item_list_editor_plugin.cpp @@ -264,8 +264,8 @@ void ItemListEditor::_notification(int p_notification) { if (p_notification == NOTIFICATION_ENTER_TREE || p_notification == NOTIFICATION_THEME_CHANGED) { - add_button->set_icon(get_icon("Add", "EditorIcons")); - del_button->set_icon(get_icon("Remove", "EditorIcons")); + add_button->set_icon(get_theme_icon("Add", "EditorIcons")); + del_button->set_icon(get_theme_icon("Remove", "EditorIcons")); } else if (p_notification == NOTIFICATION_READY) { get_tree()->connect("node_removed", callable_mp(this, &ItemListEditor::_node_removed)); diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp index a13a594d95..74588d4439 100644 --- a/editor/plugins/material_editor_plugin.cpp +++ b/editor/plugins/material_editor_plugin.cpp @@ -44,15 +44,15 @@ void MaterialEditor::_notification(int p_what) { if (first_enter) { //it's in propertyeditor so.. could be moved around - light_1_switch->set_normal_texture(get_icon("MaterialPreviewLight1", "EditorIcons")); - light_1_switch->set_pressed_texture(get_icon("MaterialPreviewLight1Off", "EditorIcons")); - light_2_switch->set_normal_texture(get_icon("MaterialPreviewLight2", "EditorIcons")); - light_2_switch->set_pressed_texture(get_icon("MaterialPreviewLight2Off", "EditorIcons")); + light_1_switch->set_normal_texture(get_theme_icon("MaterialPreviewLight1", "EditorIcons")); + light_1_switch->set_pressed_texture(get_theme_icon("MaterialPreviewLight1Off", "EditorIcons")); + light_2_switch->set_normal_texture(get_theme_icon("MaterialPreviewLight2", "EditorIcons")); + light_2_switch->set_pressed_texture(get_theme_icon("MaterialPreviewLight2Off", "EditorIcons")); - sphere_switch->set_normal_texture(get_icon("MaterialPreviewSphereOff", "EditorIcons")); - sphere_switch->set_pressed_texture(get_icon("MaterialPreviewSphere", "EditorIcons")); - box_switch->set_normal_texture(get_icon("MaterialPreviewCubeOff", "EditorIcons")); - box_switch->set_pressed_texture(get_icon("MaterialPreviewCube", "EditorIcons")); + sphere_switch->set_normal_texture(get_theme_icon("MaterialPreviewSphereOff", "EditorIcons")); + sphere_switch->set_pressed_texture(get_theme_icon("MaterialPreviewSphere", "EditorIcons")); + box_switch->set_normal_texture(get_theme_icon("MaterialPreviewCubeOff", "EditorIcons")); + box_switch->set_pressed_texture(get_theme_icon("MaterialPreviewCube", "EditorIcons")); first_enter = false; } @@ -60,7 +60,7 @@ void MaterialEditor::_notification(int p_what) { if (p_what == NOTIFICATION_DRAW) { - Ref<Texture2D> checkerboard = get_icon("Checkerboard", "EditorIcons"); + Ref<Texture2D> checkerboard = get_theme_icon("Checkerboard", "EditorIcons"); Size2 size = get_size(); draw_texture_rect(checkerboard, Rect2(Point2(), size), true); diff --git a/editor/plugins/mesh_editor_plugin.cpp b/editor/plugins/mesh_editor_plugin.cpp index c921ca46cd..352997d6fa 100644 --- a/editor/plugins/mesh_editor_plugin.cpp +++ b/editor/plugins/mesh_editor_plugin.cpp @@ -57,10 +57,10 @@ void MeshEditor::_notification(int p_what) { if (first_enter) { //it's in propertyeditor so. could be moved around - light_1_switch->set_normal_texture(get_icon("MaterialPreviewLight1", "EditorIcons")); - light_1_switch->set_pressed_texture(get_icon("MaterialPreviewLight1Off", "EditorIcons")); - light_2_switch->set_normal_texture(get_icon("MaterialPreviewLight2", "EditorIcons")); - light_2_switch->set_pressed_texture(get_icon("MaterialPreviewLight2Off", "EditorIcons")); + light_1_switch->set_normal_texture(get_theme_icon("MaterialPreviewLight1", "EditorIcons")); + light_1_switch->set_pressed_texture(get_theme_icon("MaterialPreviewLight1Off", "EditorIcons")); + light_2_switch->set_normal_texture(get_theme_icon("MaterialPreviewLight2", "EditorIcons")); + light_2_switch->set_pressed_texture(get_theme_icon("MaterialPreviewLight2Off", "EditorIcons")); first_enter = false; } } diff --git a/editor/plugins/mesh_instance_editor_plugin.cpp b/editor/plugins/mesh_instance_editor_plugin.cpp index c0a083bf1d..3fdda36177 100644 --- a/editor/plugins/mesh_instance_editor_plugin.cpp +++ b/editor/plugins/mesh_instance_editor_plugin.cpp @@ -444,7 +444,7 @@ MeshInstanceEditor::MeshInstanceEditor() { SpatialEditor::get_singleton()->add_control_to_menu_panel(options); options->set_text(TTR("Mesh")); - options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("MeshInstance", "EditorIcons")); + options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("MeshInstance", "EditorIcons")); options->get_popup()->add_item(TTR("Create Trimesh Static Body"), MENU_OPTION_CREATE_STATIC_TRIMESH_BODY); options->get_popup()->set_item_tooltip(options->get_popup()->get_item_count() - 1, TTR("Creates a StaticBody and assigns a polygon-based collision shape to it automatically.\nThis is the most accurate (but slowest) option for collision detection.")); diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp index 918d35554d..32099c1364 100644 --- a/editor/plugins/mesh_library_editor_plugin.cpp +++ b/editor/plugins/mesh_library_editor_plugin.cpp @@ -270,7 +270,7 @@ MeshLibraryEditor::MeshLibraryEditor(EditorNode *p_editor) { SpatialEditor::get_singleton()->add_control_to_menu_panel(menu); menu->set_position(Point2(1, 1)); menu->set_text(TTR("Mesh Library")); - menu->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("MeshLibrary", "EditorIcons")); + menu->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("MeshLibrary", "EditorIcons")); menu->get_popup()->add_item(TTR("Add Item"), MENU_OPTION_ADD_ITEM); menu->get_popup()->add_item(TTR("Remove Selected Item"), MENU_OPTION_REMOVE_ITEM); menu->get_popup()->add_separator(); diff --git a/editor/plugins/multimesh_editor_plugin.cpp b/editor/plugins/multimesh_editor_plugin.cpp index 3e5c10c461..dcae59bbe8 100644 --- a/editor/plugins/multimesh_editor_plugin.cpp +++ b/editor/plugins/multimesh_editor_plugin.cpp @@ -287,7 +287,7 @@ MultiMeshEditor::MultiMeshEditor() { SpatialEditor::get_singleton()->add_control_to_menu_panel(options); options->set_text("MultiMesh"); - options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("MultiMeshInstance", "EditorIcons")); + options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("MultiMeshInstance", "EditorIcons")); options->get_popup()->add_item(TTR("Populate Surface")); options->get_popup()->connect("id_pressed", callable_mp(this, &MultiMeshEditor::_menu_option)); diff --git a/editor/plugins/particles_2d_editor_plugin.cpp b/editor/plugins/particles_2d_editor_plugin.cpp index fdf1fb43bf..744424a3fa 100644 --- a/editor/plugins/particles_2d_editor_plugin.cpp +++ b/editor/plugins/particles_2d_editor_plugin.cpp @@ -350,7 +350,7 @@ void Particles2DEditorPlugin::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { menu->get_popup()->connect("id_pressed", callable_mp(this, &Particles2DEditorPlugin::_menu_callback)); - menu->set_icon(menu->get_popup()->get_icon("Particles2D", "EditorIcons")); + menu->set_icon(menu->get_theme_icon("Particles2D", "EditorIcons")); file->connect("file_selected", callable_mp(this, &Particles2DEditorPlugin::_file_selected)); } } diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp index 9dfbe54911..63acf7cfb6 100644 --- a/editor/plugins/particles_editor_plugin.cpp +++ b/editor/plugins/particles_editor_plugin.cpp @@ -244,7 +244,7 @@ void ParticlesEditor::_node_removed(Node *p_node) { void ParticlesEditor::_notification(int p_notification) { if (p_notification == NOTIFICATION_ENTER_TREE) { - options->set_icon(options->get_popup()->get_icon("Particles", "EditorIcons")); + options->set_icon(options->get_popup()->get_theme_icon("Particles", "EditorIcons")); get_tree()->connect("node_removed", callable_mp(this, &ParticlesEditor::_node_removed)); } } diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp index 165df6b500..75c5fcb994 100644 --- a/editor/plugins/path_2d_editor_plugin.cpp +++ b/editor/plugins/path_2d_editor_plugin.cpp @@ -373,12 +373,12 @@ void Path2DEditor::forward_canvas_draw_over_viewport(Control *p_overlay) { Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); - const Ref<Texture2D> path_sharp_handle = get_icon("EditorPathSharpHandle", "EditorIcons"); - const Ref<Texture2D> path_smooth_handle = get_icon("EditorPathSmoothHandle", "EditorIcons"); + const Ref<Texture2D> path_sharp_handle = get_theme_icon("EditorPathSharpHandle", "EditorIcons"); + const Ref<Texture2D> path_smooth_handle = get_theme_icon("EditorPathSmoothHandle", "EditorIcons"); // Both handle icons must be of the same size const Size2 handle_size = path_sharp_handle->get_size(); - const Ref<Texture2D> curve_handle = get_icon("EditorCurveHandle", "EditorIcons"); + const Ref<Texture2D> curve_handle = get_theme_icon("EditorCurveHandle", "EditorIcons"); const Size2 curve_handle_size = curve_handle->get_size(); Ref<Curve2D> curve = node->get_curve(); @@ -420,7 +420,7 @@ void Path2DEditor::forward_canvas_draw_over_viewport(Control *p_overlay) { } if (on_edge) { - Ref<Texture2D> add_handle = get_icon("EditorHandleAdd", "EditorIcons"); + Ref<Texture2D> add_handle = get_theme_icon("EditorHandleAdd", "EditorIcons"); p_overlay->draw_texture(add_handle, edge_point - add_handle->get_size() * 0.5); } } @@ -548,35 +548,35 @@ Path2DEditor::Path2DEditor(EditorNode *p_editor) { sep = memnew(VSeparator); base_hb->add_child(sep); curve_edit = memnew(ToolButton); - curve_edit->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveEdit", "EditorIcons")); + curve_edit->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("CurveEdit", "EditorIcons")); curve_edit->set_toggle_mode(true); curve_edit->set_focus_mode(Control::FOCUS_NONE); curve_edit->set_tooltip(TTR("Select Points") + "\n" + TTR("Shift+Drag: Select Control Points") + "\n" + keycode_get_string(KEY_MASK_CMD) + TTR("Click: Add Point") + "\n" + TTR("Left Click: Split Segment (in curve)") + "\n" + TTR("Right Click: Delete Point")); curve_edit->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected), varray(MODE_EDIT)); base_hb->add_child(curve_edit); curve_edit_curve = memnew(ToolButton); - curve_edit_curve->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveCurve", "EditorIcons")); + curve_edit_curve->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("CurveCurve", "EditorIcons")); curve_edit_curve->set_toggle_mode(true); curve_edit_curve->set_focus_mode(Control::FOCUS_NONE); curve_edit_curve->set_tooltip(TTR("Select Control Points (Shift+Drag)")); curve_edit_curve->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected), varray(MODE_EDIT_CURVE)); base_hb->add_child(curve_edit_curve); curve_create = memnew(ToolButton); - curve_create->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveCreate", "EditorIcons")); + curve_create->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("CurveCreate", "EditorIcons")); curve_create->set_toggle_mode(true); curve_create->set_focus_mode(Control::FOCUS_NONE); curve_create->set_tooltip(TTR("Add Point (in empty space)")); curve_create->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected), varray(MODE_CREATE)); base_hb->add_child(curve_create); curve_del = memnew(ToolButton); - curve_del->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveDelete", "EditorIcons")); + curve_del->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("CurveDelete", "EditorIcons")); curve_del->set_toggle_mode(true); curve_del->set_focus_mode(Control::FOCUS_NONE); curve_del->set_tooltip(TTR("Delete Point")); curve_del->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected), varray(MODE_DELETE)); base_hb->add_child(curve_del); curve_close = memnew(ToolButton); - curve_close->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveClose", "EditorIcons")); + curve_close->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("CurveClose", "EditorIcons")); curve_close->set_focus_mode(Control::FOCUS_NONE); curve_close->set_tooltip(TTR("Close Curve")); curve_close->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected), varray(ACTION_CLOSE)); diff --git a/editor/plugins/path_editor_plugin.cpp b/editor/plugins/path_editor_plugin.cpp index 42b1045666..b6842be76c 100644 --- a/editor/plugins/path_editor_plugin.cpp +++ b/editor/plugins/path_editor_plugin.cpp @@ -571,28 +571,28 @@ PathEditorPlugin::PathEditorPlugin(EditorNode *p_node) { sep->hide(); SpatialEditor::get_singleton()->add_control_to_menu_panel(sep); curve_edit = memnew(ToolButton); - curve_edit->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveEdit", "EditorIcons")); + curve_edit->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("CurveEdit", "EditorIcons")); curve_edit->set_toggle_mode(true); curve_edit->hide(); curve_edit->set_focus_mode(Control::FOCUS_NONE); curve_edit->set_tooltip(TTR("Select Points") + "\n" + TTR("Shift+Drag: Select Control Points") + "\n" + keycode_get_string(KEY_MASK_CMD) + TTR("Click: Add Point") + "\n" + TTR("Right Click: Delete Point")); SpatialEditor::get_singleton()->add_control_to_menu_panel(curve_edit); curve_create = memnew(ToolButton); - curve_create->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveCreate", "EditorIcons")); + curve_create->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("CurveCreate", "EditorIcons")); curve_create->set_toggle_mode(true); curve_create->hide(); curve_create->set_focus_mode(Control::FOCUS_NONE); curve_create->set_tooltip(TTR("Add Point (in empty space)") + "\n" + TTR("Split Segment (in curve)")); SpatialEditor::get_singleton()->add_control_to_menu_panel(curve_create); curve_del = memnew(ToolButton); - curve_del->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveDelete", "EditorIcons")); + curve_del->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("CurveDelete", "EditorIcons")); curve_del->set_toggle_mode(true); curve_del->hide(); curve_del->set_focus_mode(Control::FOCUS_NONE); curve_del->set_tooltip(TTR("Delete Point")); SpatialEditor::get_singleton()->add_control_to_menu_panel(curve_del); curve_close = memnew(ToolButton); - curve_close->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveClose", "EditorIcons")); + curve_close->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("CurveClose", "EditorIcons")); curve_close->hide(); curve_close->set_focus_mode(Control::FOCUS_NONE); curve_close->set_tooltip(TTR("Close Curve")); diff --git a/editor/plugins/physical_bone_plugin.cpp b/editor/plugins/physical_bone_plugin.cpp index e0d48afeef..ec29310029 100644 --- a/editor/plugins/physical_bone_plugin.cpp +++ b/editor/plugins/physical_bone_plugin.cpp @@ -61,7 +61,7 @@ PhysicalBoneEditor::PhysicalBoneEditor(EditorNode *p_editor) : spatial_editor_hb->add_child(button_transform_joint); button_transform_joint->set_text(TTR("Move Joint")); - button_transform_joint->set_icon(SpatialEditor::get_singleton()->get_icon("PhysicalBone", "EditorIcons")); + button_transform_joint->set_icon(SpatialEditor::get_singleton()->get_theme_icon("PhysicalBone", "EditorIcons")); button_transform_joint->set_toggle_mode(true); button_transform_joint->connect("toggled", callable_mp(this, &PhysicalBoneEditor::_on_toggle_button_transform_joint)); diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index f020007bd0..5a94c95dd7 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -70,28 +70,28 @@ void Polygon2DEditor::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { - uv_edit_draw->add_style_override("panel", get_stylebox("bg", "Tree")); - bone_scroll->add_style_override("bg", get_stylebox("bg", "Tree")); + uv_edit_draw->add_theme_style_override("panel", get_theme_stylebox("bg", "Tree")); + bone_scroll->add_theme_style_override("bg", get_theme_stylebox("bg", "Tree")); } break; case NOTIFICATION_READY: { - button_uv->set_icon(get_icon("Uv", "EditorIcons")); + button_uv->set_icon(get_theme_icon("Uv", "EditorIcons")); - uv_button[UV_MODE_CREATE]->set_icon(get_icon("Edit", "EditorIcons")); - uv_button[UV_MODE_CREATE_INTERNAL]->set_icon(get_icon("EditInternal", "EditorIcons")); - uv_button[UV_MODE_REMOVE_INTERNAL]->set_icon(get_icon("RemoveInternal", "EditorIcons")); - uv_button[UV_MODE_EDIT_POINT]->set_icon(get_icon("ToolSelect", "EditorIcons")); - uv_button[UV_MODE_MOVE]->set_icon(get_icon("ToolMove", "EditorIcons")); - uv_button[UV_MODE_ROTATE]->set_icon(get_icon("ToolRotate", "EditorIcons")); - uv_button[UV_MODE_SCALE]->set_icon(get_icon("ToolScale", "EditorIcons")); - uv_button[UV_MODE_ADD_POLYGON]->set_icon(get_icon("Edit", "EditorIcons")); - uv_button[UV_MODE_REMOVE_POLYGON]->set_icon(get_icon("Close", "EditorIcons")); - uv_button[UV_MODE_PAINT_WEIGHT]->set_icon(get_icon("PaintVertex", "EditorIcons")); - uv_button[UV_MODE_CLEAR_WEIGHT]->set_icon(get_icon("UnpaintVertex", "EditorIcons")); + uv_button[UV_MODE_CREATE]->set_icon(get_theme_icon("Edit", "EditorIcons")); + uv_button[UV_MODE_CREATE_INTERNAL]->set_icon(get_theme_icon("EditInternal", "EditorIcons")); + uv_button[UV_MODE_REMOVE_INTERNAL]->set_icon(get_theme_icon("RemoveInternal", "EditorIcons")); + uv_button[UV_MODE_EDIT_POINT]->set_icon(get_theme_icon("ToolSelect", "EditorIcons")); + uv_button[UV_MODE_MOVE]->set_icon(get_theme_icon("ToolMove", "EditorIcons")); + uv_button[UV_MODE_ROTATE]->set_icon(get_theme_icon("ToolRotate", "EditorIcons")); + uv_button[UV_MODE_SCALE]->set_icon(get_theme_icon("ToolScale", "EditorIcons")); + uv_button[UV_MODE_ADD_POLYGON]->set_icon(get_theme_icon("Edit", "EditorIcons")); + uv_button[UV_MODE_REMOVE_POLYGON]->set_icon(get_theme_icon("Close", "EditorIcons")); + uv_button[UV_MODE_PAINT_WEIGHT]->set_icon(get_theme_icon("PaintVertex", "EditorIcons")); + uv_button[UV_MODE_CLEAR_WEIGHT]->set_icon(get_theme_icon("UnpaintVertex", "EditorIcons")); - b_snap_grid->set_icon(get_icon("Grid", "EditorIcons")); - b_snap_enable->set_icon(get_icon("SnapGrid", "EditorIcons")); - uv_icon_zoom->set_texture(get_icon("Zoom", "EditorIcons")); + b_snap_grid->set_icon(get_theme_icon("Grid", "EditorIcons")); + b_snap_enable->set_icon(get_theme_icon("SnapGrid", "EditorIcons")); + uv_icon_zoom->set_texture(get_theme_icon("Zoom", "EditorIcons")); uv_vscroll->set_anchors_and_margins_preset(PRESET_RIGHT_WIDE); uv_hscroll->set_anchors_and_margins_preset(PRESET_BOTTOM_WIDE); @@ -1050,7 +1050,7 @@ void Polygon2DEditor::_uv_draw() { } // All UV points are sharp, so use the sharp handle icon - Ref<Texture2D> handle = get_icon("EditorPathSharpHandle", "EditorIcons"); + Ref<Texture2D> handle = get_theme_icon("EditorPathSharpHandle", "EditorIcons"); Color poly_line_color = Color(0.9, 0.5, 0.5); if (polygons.size() || polygon_create.size()) { diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp index 041d4196d4..8def56f968 100644 --- a/editor/plugins/resource_preloader_editor_plugin.cpp +++ b/editor/plugins/resource_preloader_editor_plugin.cpp @@ -41,7 +41,7 @@ void ResourcePreloaderEditor::_gui_input(Ref<InputEvent> p_event) { void ResourcePreloaderEditor::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - load->set_icon(get_icon("Folder", "EditorIcons")); + load->set_icon(get_theme_icon("Folder", "EditorIcons")); } if (p_what == NOTIFICATION_READY) { @@ -215,11 +215,11 @@ void ResourcePreloaderEditor::_update_library() { ti->set_selectable(1, false); if (type == "PackedScene") { - ti->add_button(1, get_icon("InstanceOptions", "EditorIcons"), BUTTON_OPEN_SCENE, false, TTR("Open in Editor")); + ti->add_button(1, get_theme_icon("InstanceOptions", "EditorIcons"), BUTTON_OPEN_SCENE, false, TTR("Open in Editor")); } else { - ti->add_button(1, get_icon("Load", "EditorIcons"), BUTTON_EDIT_RESOURCE, false, TTR("Open in Editor")); + ti->add_button(1, get_theme_icon("Load", "EditorIcons"), BUTTON_EDIT_RESOURCE, false, TTR("Open in Editor")); } - ti->add_button(1, get_icon("Remove", "EditorIcons"), BUTTON_REMOVE, false, TTR("Remove")); + ti->add_button(1, get_theme_icon("Remove", "EditorIcons"), BUTTON_REMOVE, false, TTR("Remove")); } //player->add_resource("default",resource); diff --git a/editor/plugins/root_motion_editor_plugin.cpp b/editor/plugins/root_motion_editor_plugin.cpp index daea2eec6b..0f803218ea 100644 --- a/editor/plugins/root_motion_editor_plugin.cpp +++ b/editor/plugins/root_motion_editor_plugin.cpp @@ -152,7 +152,7 @@ void EditorPropertyRootMotion::_node_assign() { ti->set_text(0, F->get()); ti->set_selectable(0, true); ti->set_editable(0, false); - ti->set_icon(0, get_icon("BoneAttachment", "EditorIcons")); + ti->set_icon(0, get_theme_icon("BoneAttachment", "EditorIcons")); ti->set_metadata(0, accum); } else { ti = parenthood[accum]; @@ -161,7 +161,7 @@ void EditorPropertyRootMotion::_node_assign() { ti->set_selectable(0, true); ti->set_text(0, concat); - ti->set_icon(0, get_icon("BoneAttachment", "EditorIcons")); + ti->set_icon(0, get_theme_icon("BoneAttachment", "EditorIcons")); ti->set_metadata(0, path); if (path == current) { ti->select(0); @@ -242,7 +242,7 @@ void EditorPropertyRootMotion::setup(const NodePath &p_base_hint) { void EditorPropertyRootMotion::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { - Ref<Texture2D> t = get_icon("Clear", "EditorIcons"); + Ref<Texture2D> t = get_theme_icon("Clear", "EditorIcons"); clear->set_icon(t); } } diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 009d270fcd..67b3745e0d 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -217,7 +217,7 @@ void ScriptEditorQuickOpen::_notification(int p_what) { [[fallthrough]]; }; case NOTIFICATION_VISIBILITY_CHANGED: { - search_box->set_right_icon(search_options->get_icon("Search", "EditorIcons")); + search_box->set_right_icon(search_options->get_theme_icon("Search", "EditorIcons")); } break; case NOTIFICATION_EXIT_TREE: { disconnect("confirmed", callable_mp(this, &ScriptEditorQuickOpen::_confirmed)); @@ -247,7 +247,7 @@ ScriptEditorQuickOpen::ScriptEditorQuickOpen() { search_options->connect("item_activated", callable_mp(this, &ScriptEditorQuickOpen::_confirmed)); search_options->set_hide_root(true); search_options->set_hide_folding(true); - search_options->add_constant_override("draw_guides", 1); + search_options->add_theme_constant_override("draw_guides", 1); } ///////////////////////////////// @@ -429,7 +429,7 @@ void ScriptEditor::_go_to_tab(int p_idx) { if (Object::cast_to<ScriptEditorBase>(c)) { script_name_label->set_text(Object::cast_to<ScriptEditorBase>(c)->get_name()); - script_icon->set_texture(Object::cast_to<ScriptEditorBase>(c)->get_icon()); + script_icon->set_texture(Object::cast_to<ScriptEditorBase>(c)->get_theme_icon()); if (is_visible_in_tree()) Object::cast_to<ScriptEditorBase>(c)->ensure_focus(); @@ -443,7 +443,7 @@ void ScriptEditor::_go_to_tab(int p_idx) { if (Object::cast_to<EditorHelp>(c)) { script_name_label->set_text(Object::cast_to<EditorHelp>(c)->get_class()); - script_icon->set_texture(get_icon("Help", "EditorIcons")); + script_icon->set_texture(get_theme_icon("Help", "EditorIcons")); if (is_visible_in_tree()) Object::cast_to<EditorHelp>(c)->set_focused(); } @@ -1396,19 +1396,19 @@ void ScriptEditor::_notification(int p_what) { } case NOTIFICATION_THEME_CHANGED: { - help_search->set_icon(get_icon("HelpSearch", "EditorIcons")); - site_search->set_icon(get_icon("Instance", "EditorIcons")); - request_docs->set_icon(get_icon("Issue", "EditorIcons")); + help_search->set_icon(get_theme_icon("HelpSearch", "EditorIcons")); + site_search->set_icon(get_theme_icon("Instance", "EditorIcons")); + request_docs->set_icon(get_theme_icon("Issue", "EditorIcons")); - script_forward->set_icon(get_icon("Forward", "EditorIcons")); - script_back->set_icon(get_icon("Back", "EditorIcons")); + script_forward->set_icon(get_theme_icon("Forward", "EditorIcons")); + script_back->set_icon(get_theme_icon("Back", "EditorIcons")); - members_overview_alphabeta_sort_button->set_icon(get_icon("Sort", "EditorIcons")); + members_overview_alphabeta_sort_button->set_icon(get_theme_icon("Sort", "EditorIcons")); - filter_scripts->set_right_icon(get_icon("Search", "EditorIcons")); - filter_methods->set_right_icon(get_icon("Search", "EditorIcons")); + filter_scripts->set_right_icon(get_theme_icon("Search", "EditorIcons")); + filter_methods->set_right_icon(get_theme_icon("Search", "EditorIcons")); - filename->add_style_override("normal", editor->get_gui_base()->get_stylebox("normal", "LineEdit")); + filename->add_theme_style_override("normal", editor->get_gui_base()->get_theme_stylebox("normal", "LineEdit")); recent_scripts->set_as_minsize(); } break; @@ -1718,8 +1718,8 @@ void ScriptEditor::_update_script_colors() { bool highlight_current = EditorSettings::get_singleton()->get("text_editor/script_list/highlight_current_script"); int hist_size = EditorSettings::get_singleton()->get("text_editor/script_list/script_temperature_history_size"); - Color hot_color = get_color("accent_color", "Editor"); - Color cold_color = get_color("font_color", "Editor"); + Color hot_color = get_theme_color("accent_color", "Editor"); + Color cold_color = get_theme_color("font_color", "Editor"); for (int i = 0; i < script_list->get_item_count(); i++) { @@ -1776,7 +1776,7 @@ void ScriptEditor::_update_script_names() { ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i)); if (se) { - Ref<Texture2D> icon = se->get_icon(); + Ref<Texture2D> icon = se->get_theme_icon(); String path = se->get_edited_resource()->get_path(); bool built_in = !path.is_resource_file(); String name; @@ -1837,7 +1837,7 @@ void ScriptEditor::_update_script_names() { if (eh) { String name = eh->get_class(); - Ref<Texture2D> icon = get_icon("Help", "EditorIcons"); + Ref<Texture2D> icon = get_theme_icon("Help", "EditorIcons"); String tooltip = vformat(TTR("%s Class Reference"), name); _ScriptEditorItemData sd; @@ -2347,12 +2347,12 @@ Variant ScriptEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) { ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(cur_node); if (se) { preview_name = se->get_name(); - preview_icon = se->get_icon(); + preview_icon = se->get_theme_icon(); } EditorHelp *eh = Object::cast_to<EditorHelp>(cur_node); if (eh) { preview_name = eh->get_class(); - preview_icon = get_icon("Help", "EditorIcons"); + preview_icon = get_theme_icon("Help", "EditorIcons"); } if (!preview_icon.is_null()) { @@ -3112,7 +3112,6 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { context_menu = memnew(PopupMenu); add_child(context_menu); context_menu->connect("id_pressed", callable_mp(this, &ScriptEditor::_menu_option)); - context_menu->set_hide_on_window_lose_focus(true); overview_vbox = memnew(VBoxContainer); overview_vbox->set_custom_minimum_size(Size2(0, 90)); @@ -3125,7 +3124,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { filename = memnew(Label); filename->set_clip_text(true); filename->set_h_size_flags(SIZE_EXPAND_FILL); - filename->add_style_override("normal", EditorNode::get_singleton()->get_gui_base()->get_stylebox("normal", "LineEdit")); + filename->add_theme_style_override("normal", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("normal", "LineEdit")); buttons_hbox->add_child(filename); members_overview_alphabeta_sort_button = memnew(ToolButton); @@ -3173,7 +3172,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { menu_hb->add_child(file_menu); file_menu->set_text(TTR("File")); file_menu->set_switch_on_hover(true); - file_menu->get_popup()->set_hide_on_window_lose_focus(true); + file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/new", TTR("New Script...")), FILE_NEW); file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/new_textfile", TTR("New Text File...")), FILE_NEW_TEXTFILE); file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/open", TTR("Open...")), FILE_OPEN); @@ -3230,7 +3229,6 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { menu_hb->add_child(script_search_menu); script_search_menu->set_text(TTR("Search")); script_search_menu->set_switch_on_hover(true); - script_search_menu->get_popup()->set_hide_on_window_lose_focus(true); script_search_menu->get_popup()->connect("id_pressed", callable_mp(this, &ScriptEditor::_menu_option)); MenuButton *debug_menu = memnew(MenuButton); @@ -3367,8 +3365,8 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { ScriptServer::edit_request_func = _open_script_request; - add_style_override("panel", editor->get_gui_base()->get_stylebox("ScriptEditorPanel", "EditorStyles")); - tab_container->add_style_override("panel", editor->get_gui_base()->get_stylebox("ScriptEditor", "EditorStyles")); + add_theme_style_override("panel", editor->get_gui_base()->get_theme_stylebox("ScriptEditorPanel", "EditorStyles")); + tab_container->add_theme_style_override("panel", editor->get_gui_base()->get_theme_stylebox("ScriptEditor", "EditorStyles")); } ScriptEditor::~ScriptEditor() { diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index 81f9595264..ec598f0b42 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -92,7 +92,7 @@ public: virtual void set_edited_resource(const RES &p_res) = 0; virtual void reload_text() = 0; virtual String get_name() = 0; - virtual Ref<Texture2D> get_icon() = 0; + virtual Ref<Texture2D> get_theme_icon() = 0; virtual bool is_unsaved() = 0; virtual Variant get_edit_state() = 0; virtual void set_edit_state(const Variant &p_state) = 0; diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 801a2c54ad..2e95bb92f4 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -66,7 +66,7 @@ void ConnectionInfoDialog::popup_connections(String p_method, Vector<Node *> p_n node_item->set_text(1, connection.signal.get_name()); Control *p = Object::cast_to<Control>(get_parent()); - node_item->set_icon(1, p->get_icon("Slot", "EditorIcons")); + node_item->set_icon(1, p->get_theme_icon("Slot", "EditorIcons")); node_item->set_selectable(1, false); node_item->set_editable(1, false); @@ -230,36 +230,36 @@ void ScriptTextEditor::_load_theme_settings() { Color comment_color = EDITOR_GET("text_editor/highlighting/comment_color"); Color string_color = EDITOR_GET("text_editor/highlighting/string_color"); - text_edit->add_color_override("background_color", background_color); - text_edit->add_color_override("completion_background_color", completion_background_color); - text_edit->add_color_override("completion_selected_color", completion_selected_color); - text_edit->add_color_override("completion_existing_color", completion_existing_color); - text_edit->add_color_override("completion_scroll_color", completion_scroll_color); - text_edit->add_color_override("completion_font_color", completion_font_color); - text_edit->add_color_override("font_color", text_color); - text_edit->add_color_override("line_number_color", line_number_color); - text_edit->add_color_override("safe_line_number_color", safe_line_number_color); - text_edit->add_color_override("caret_color", caret_color); - text_edit->add_color_override("caret_background_color", caret_background_color); - text_edit->add_color_override("font_color_selected", text_selected_color); - text_edit->add_color_override("selection_color", selection_color); - text_edit->add_color_override("brace_mismatch_color", brace_mismatch_color); - text_edit->add_color_override("current_line_color", current_line_color); - text_edit->add_color_override("line_length_guideline_color", line_length_guideline_color); - text_edit->add_color_override("word_highlighted_color", word_highlighted_color); - text_edit->add_color_override("number_color", number_color); - text_edit->add_color_override("function_color", function_color); - text_edit->add_color_override("member_variable_color", member_variable_color); - text_edit->add_color_override("bookmark_color", bookmark_color); - text_edit->add_color_override("breakpoint_color", breakpoint_color); - text_edit->add_color_override("executing_line_color", executing_line_color); - text_edit->add_color_override("mark_color", mark_color); - text_edit->add_color_override("code_folding_color", code_folding_color); - text_edit->add_color_override("search_result_color", search_result_color); - text_edit->add_color_override("search_result_border_color", search_result_border_color); - text_edit->add_color_override("symbol_color", symbol_color); - - text_edit->add_constant_override("line_spacing", EDITOR_DEF("text_editor/theme/line_spacing", 6)); + text_edit->add_theme_color_override("background_color", background_color); + text_edit->add_theme_color_override("completion_background_color", completion_background_color); + text_edit->add_theme_color_override("completion_selected_color", completion_selected_color); + text_edit->add_theme_color_override("completion_existing_color", completion_existing_color); + text_edit->add_theme_color_override("completion_scroll_color", completion_scroll_color); + text_edit->add_theme_color_override("completion_font_color", completion_font_color); + text_edit->add_theme_color_override("font_color", text_color); + text_edit->add_theme_color_override("line_number_color", line_number_color); + text_edit->add_theme_color_override("safe_line_number_color", safe_line_number_color); + text_edit->add_theme_color_override("caret_color", caret_color); + text_edit->add_theme_color_override("caret_background_color", caret_background_color); + text_edit->add_theme_color_override("font_color_selected", text_selected_color); + text_edit->add_theme_color_override("selection_color", selection_color); + text_edit->add_theme_color_override("brace_mismatch_color", brace_mismatch_color); + text_edit->add_theme_color_override("current_line_color", current_line_color); + text_edit->add_theme_color_override("line_length_guideline_color", line_length_guideline_color); + text_edit->add_theme_color_override("word_highlighted_color", word_highlighted_color); + text_edit->add_theme_color_override("number_color", number_color); + text_edit->add_theme_color_override("function_color", function_color); + text_edit->add_theme_color_override("member_variable_color", member_variable_color); + text_edit->add_theme_color_override("bookmark_color", bookmark_color); + text_edit->add_theme_color_override("breakpoint_color", breakpoint_color); + text_edit->add_theme_color_override("executing_line_color", executing_line_color); + text_edit->add_theme_color_override("mark_color", mark_color); + text_edit->add_theme_color_override("code_folding_color", code_folding_color); + text_edit->add_theme_color_override("search_result_color", search_result_color); + text_edit->add_theme_color_override("search_result_border_color", search_result_border_color); + text_edit->add_theme_color_override("symbol_color", symbol_color); + + text_edit->add_theme_constant_override("line_spacing", EDITOR_DEF("text_editor/theme/line_spacing", 6)); colors_cache.symbol_color = symbol_color; colors_cache.keyword_color = keyword_color; @@ -556,10 +556,10 @@ String ScriptTextEditor::get_name() { return name; } -Ref<Texture2D> ScriptTextEditor::get_icon() { +Ref<Texture2D> ScriptTextEditor::get_theme_icon() { - if (get_parent_control() && get_parent_control()->has_icon(script->get_class(), "EditorIcons")) { - return get_parent_control()->get_icon(script->get_class(), "EditorIcons"); + if (get_parent_control() && get_parent_control()->has_theme_icon(script->get_class(), "EditorIcons")) { + return get_parent_control()->get_theme_icon(script->get_class(), "EditorIcons"); } return Ref<Texture2D>(); @@ -615,7 +615,7 @@ void ScriptTextEditor::_validate_script() { String target_path = base == connection.callable.get_object() ? base_path : base_path + "/" + base->get_path_to(Object::cast_to<Node>(connection.callable.get_object())); warnings_panel->push_cell(); - warnings_panel->push_color(warnings_panel->get_color("warning_color", "Editor")); + warnings_panel->push_color(warnings_panel->get_theme_color("warning_color", "Editor")); warnings_panel->add_text(vformat(TTR("Missing connected method '%s' for signal '%s' from node '%s' to node '%s'."), connection.callable.get_method(), connection.signal.get_name(), source_path, target_path)); warnings_panel->pop(); // Color. warnings_panel->pop(); // Cell. @@ -635,7 +635,7 @@ void ScriptTextEditor::_validate_script() { warnings_panel->push_cell(); warnings_panel->push_meta(w.line - 1); - warnings_panel->push_color(warnings_panel->get_color("warning_color", "Editor")); + warnings_panel->push_color(warnings_panel->get_theme_color("warning_color", "Editor")); warnings_panel->add_text(TTR("Line") + " " + itos(w.line)); warnings_panel->add_text(" (" + w.string_code + "):"); warnings_panel->pop(); // Color. @@ -822,7 +822,7 @@ void ScriptTextEditor::_code_complete_scripts(void *p_ud, const String &p_code, void ScriptTextEditor::_code_complete_script(const String &p_code, List<ScriptCodeCompletionOption> *r_options, bool &r_force) { - if (color_panel->is_visible_in_tree()) return; + if (color_panel->is_visible()) return; Node *base = get_tree()->get_edited_scene_root(); if (base) { base = _find_node_for_script(base, base, script); @@ -1047,7 +1047,7 @@ void ScriptTextEditor::_update_connected_methods() { String name = functions[j].get_slice(":", 0); if (name == connection.callable.get_method()) { line = functions[j].get_slice(":", 1).to_int(); - text_edit->set_line_info_icon(line - 1, get_parent_control()->get_icon("Slot", "EditorIcons"), connection.callable.get_method()); + text_edit->set_line_info_icon(line - 1, get_parent_control()->get_theme_icon("Slot", "EditorIcons"), connection.callable.get_method()); methods_found.insert(connection.callable.get_method()); break; } @@ -1780,7 +1780,7 @@ ScriptTextEditor::ScriptTextEditor() { code_editor = memnew(CodeTextEditor); editor_box->add_child(code_editor); - code_editor->add_constant_override("separation", 2); + code_editor->add_theme_constant_override("separation", 2); code_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE); code_editor->connect("validate_script", callable_mp(this, &ScriptTextEditor::_validate_script)); code_editor->connect("load_theme_settings", callable_mp(this, &ScriptTextEditor::_load_theme_settings)); @@ -1818,7 +1818,6 @@ ScriptTextEditor::ScriptTextEditor() { context_menu = memnew(PopupMenu); add_child(context_menu); context_menu->connect("id_pressed", callable_mp(this, &ScriptTextEditor::_edit_option)); - context_menu->set_hide_on_window_lose_focus(true); color_panel = memnew(PopupPanel); add_child(color_panel); @@ -1839,7 +1838,7 @@ ScriptTextEditor::ScriptTextEditor() { edit_menu = memnew(MenuButton); edit_menu->set_text(TTR("Edit")); edit_menu->set_switch_on_hover(true); - edit_menu->get_popup()->set_hide_on_window_lose_focus(true); + edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/undo"), EDIT_UNDO); edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/redo"), EDIT_REDO); edit_menu->get_popup()->add_separator(); @@ -1890,7 +1889,7 @@ ScriptTextEditor::ScriptTextEditor() { edit_hb->add_child(search_menu); search_menu->set_text(TTR("Search")); search_menu->set_switch_on_hover(true); - search_menu->get_popup()->set_hide_on_window_lose_focus(true); + search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find"), SEARCH_FIND); search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_next"), SEARCH_FIND_NEXT); search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_previous"), SEARCH_FIND_PREV); @@ -1919,7 +1918,7 @@ ScriptTextEditor::ScriptTextEditor() { goto_menu->get_popup()->add_child(bookmarks_menu); goto_menu->get_popup()->add_submenu_item(TTR("Bookmarks"), "Bookmarks"); _update_bookmark_list(); - bookmarks_menu->connect("about_to_show", callable_mp(this, &ScriptTextEditor::_update_bookmark_list)); + bookmarks_menu->connect("about_to_popup", callable_mp(this, &ScriptTextEditor::_update_bookmark_list)); bookmarks_menu->connect("index_pressed", callable_mp(this, &ScriptTextEditor::_bookmark_item_pressed)); breakpoints_menu = memnew(PopupMenu); @@ -1927,7 +1926,7 @@ ScriptTextEditor::ScriptTextEditor() { goto_menu->get_popup()->add_child(breakpoints_menu); goto_menu->get_popup()->add_submenu_item(TTR("Breakpoints"), "Breakpoints"); _update_breakpoint_list(); - breakpoints_menu->connect("about_to_show", callable_mp(this, &ScriptTextEditor::_update_breakpoint_list)); + breakpoints_menu->connect("about_to_popup", callable_mp(this, &ScriptTextEditor::_update_breakpoint_list)); breakpoints_menu->connect("index_pressed", callable_mp(this, &ScriptTextEditor::_breakpoint_item_pressed)); quick_open = memnew(ScriptEditorQuickOpen); diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h index d2f0b310e6..51ce30c831 100644 --- a/editor/plugins/script_text_editor.h +++ b/editor/plugins/script_text_editor.h @@ -201,7 +201,7 @@ public: virtual Vector<String> get_functions(); virtual void reload_text(); virtual String get_name(); - virtual Ref<Texture2D> get_icon(); + virtual Ref<Texture2D> get_theme_icon(); virtual bool is_unsaved(); virtual Variant get_edit_state(); virtual void set_edit_state(const Variant &p_state); diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index 87ed3cd49f..c38bb09567 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -117,33 +117,33 @@ void ShaderTextEditor::_load_theme_settings() { Color keyword_color = EDITOR_GET("text_editor/highlighting/keyword_color"); Color comment_color = EDITOR_GET("text_editor/highlighting/comment_color"); - get_text_edit()->add_color_override("background_color", background_color); - get_text_edit()->add_color_override("completion_background_color", completion_background_color); - get_text_edit()->add_color_override("completion_selected_color", completion_selected_color); - get_text_edit()->add_color_override("completion_existing_color", completion_existing_color); - get_text_edit()->add_color_override("completion_scroll_color", completion_scroll_color); - get_text_edit()->add_color_override("completion_font_color", completion_font_color); - get_text_edit()->add_color_override("font_color", text_color); - get_text_edit()->add_color_override("line_number_color", line_number_color); - get_text_edit()->add_color_override("caret_color", caret_color); - get_text_edit()->add_color_override("caret_background_color", caret_background_color); - get_text_edit()->add_color_override("font_color_selected", text_selected_color); - get_text_edit()->add_color_override("selection_color", selection_color); - get_text_edit()->add_color_override("brace_mismatch_color", brace_mismatch_color); - get_text_edit()->add_color_override("current_line_color", current_line_color); - get_text_edit()->add_color_override("line_length_guideline_color", line_length_guideline_color); - get_text_edit()->add_color_override("word_highlighted_color", word_highlighted_color); - get_text_edit()->add_color_override("number_color", number_color); - get_text_edit()->add_color_override("function_color", function_color); - get_text_edit()->add_color_override("member_variable_color", member_variable_color); - get_text_edit()->add_color_override("mark_color", mark_color); - get_text_edit()->add_color_override("bookmark_color", bookmark_color); - get_text_edit()->add_color_override("breakpoint_color", breakpoint_color); - get_text_edit()->add_color_override("executing_line_color", executing_line_color); - get_text_edit()->add_color_override("code_folding_color", code_folding_color); - get_text_edit()->add_color_override("search_result_color", search_result_color); - get_text_edit()->add_color_override("search_result_border_color", search_result_border_color); - get_text_edit()->add_color_override("symbol_color", symbol_color); + get_text_edit()->add_theme_color_override("background_color", background_color); + get_text_edit()->add_theme_color_override("completion_background_color", completion_background_color); + get_text_edit()->add_theme_color_override("completion_selected_color", completion_selected_color); + get_text_edit()->add_theme_color_override("completion_existing_color", completion_existing_color); + get_text_edit()->add_theme_color_override("completion_scroll_color", completion_scroll_color); + get_text_edit()->add_theme_color_override("completion_font_color", completion_font_color); + get_text_edit()->add_theme_color_override("font_color", text_color); + get_text_edit()->add_theme_color_override("line_number_color", line_number_color); + get_text_edit()->add_theme_color_override("caret_color", caret_color); + get_text_edit()->add_theme_color_override("caret_background_color", caret_background_color); + get_text_edit()->add_theme_color_override("font_color_selected", text_selected_color); + get_text_edit()->add_theme_color_override("selection_color", selection_color); + get_text_edit()->add_theme_color_override("brace_mismatch_color", brace_mismatch_color); + get_text_edit()->add_theme_color_override("current_line_color", current_line_color); + get_text_edit()->add_theme_color_override("line_length_guideline_color", line_length_guideline_color); + get_text_edit()->add_theme_color_override("word_highlighted_color", word_highlighted_color); + get_text_edit()->add_theme_color_override("number_color", number_color); + get_text_edit()->add_theme_color_override("function_color", function_color); + get_text_edit()->add_theme_color_override("member_variable_color", member_variable_color); + get_text_edit()->add_theme_color_override("mark_color", mark_color); + get_text_edit()->add_theme_color_override("bookmark_color", bookmark_color); + get_text_edit()->add_theme_color_override("breakpoint_color", breakpoint_color); + get_text_edit()->add_theme_color_override("executing_line_color", executing_line_color); + get_text_edit()->add_theme_color_override("code_folding_color", code_folding_color); + get_text_edit()->add_theme_color_override("search_result_color", search_result_color); + get_text_edit()->add_theme_color_override("search_result_border_color", search_result_border_color); + get_text_edit()->add_theme_color_override("symbol_color", symbol_color); List<String> keywords; ShaderLanguage::get_keyword_list(&keywords); @@ -377,7 +377,7 @@ void ShaderEditor::_editor_settings_changed() { shader_editor->get_text_edit()->set_highlight_current_line(EditorSettings::get_singleton()->get("text_editor/highlighting/highlight_current_line")); shader_editor->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink")); shader_editor->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink_speed")); - shader_editor->get_text_edit()->add_constant_override("line_spacing", EditorSettings::get_singleton()->get("text_editor/theme/line_spacing")); + shader_editor->get_text_edit()->add_theme_constant_override("line_spacing", EditorSettings::get_singleton()->get("text_editor/theme/line_spacing")); shader_editor->get_text_edit()->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/cursor/block_caret")); shader_editor->get_text_edit()->set_smooth_scroll_enabled(EditorSettings::get_singleton()->get("text_editor/navigation/smooth_scrolling")); shader_editor->get_text_edit()->set_v_scroll_speed(EditorSettings::get_singleton()->get("text_editor/navigation/v_scroll_speed")); @@ -596,7 +596,7 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) { shader_editor = memnew(ShaderTextEditor); shader_editor->set_v_size_flags(SIZE_EXPAND_FILL); - shader_editor->add_constant_override("separation", 0); + shader_editor->add_theme_constant_override("separation", 0); shader_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE); shader_editor->connect("script_changed", callable_mp(this, &ShaderEditor::apply_shaders)); @@ -615,7 +615,6 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) { context_menu = memnew(PopupMenu); add_child(context_menu); context_menu->connect("id_pressed", callable_mp(this, &ShaderEditor::_menu_option)); - context_menu->set_hide_on_window_lose_focus(true); VBoxContainer *main_container = memnew(VBoxContainer); HBoxContainer *hbc = memnew(HBoxContainer); @@ -623,7 +622,7 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) { edit_menu = memnew(MenuButton); edit_menu->set_text(TTR("Edit")); edit_menu->set_switch_on_hover(true); - edit_menu->get_popup()->set_hide_on_window_lose_focus(true); + edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/undo"), EDIT_UNDO); edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/redo"), EDIT_REDO); edit_menu->get_popup()->add_separator(); @@ -647,7 +646,7 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) { search_menu = memnew(MenuButton); search_menu->set_text(TTR("Search")); search_menu->set_switch_on_hover(true); - search_menu->get_popup()->set_hide_on_window_lose_focus(true); + search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find"), SEARCH_FIND); search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_next"), SEARCH_FIND_NEXT); search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_previous"), SEARCH_FIND_PREV); @@ -667,13 +666,13 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) { goto_menu->get_popup()->add_child(bookmarks_menu); goto_menu->get_popup()->add_submenu_item(TTR("Bookmarks"), "Bookmarks"); _update_bookmark_list(); - bookmarks_menu->connect("about_to_show", callable_mp(this, &ShaderEditor::_update_bookmark_list)); + bookmarks_menu->connect("about_to_popup", callable_mp(this, &ShaderEditor::_update_bookmark_list)); bookmarks_menu->connect("index_pressed", callable_mp(this, &ShaderEditor::_bookmark_item_pressed)); help_menu = memnew(MenuButton); help_menu->set_text(TTR("Help")); help_menu->set_switch_on_hover(true); - help_menu->get_popup()->add_icon_item(p_node->get_gui_base()->get_icon("Instance", "EditorIcons"), TTR("Online Docs"), HELP_DOCS); + help_menu->get_popup()->add_icon_item(p_node->get_gui_base()->get_theme_icon("Instance", "EditorIcons"), TTR("Online Docs"), HELP_DOCS); help_menu->get_popup()->connect("id_pressed", callable_mp(this, &ShaderEditor::_menu_option)); add_child(main_container); @@ -682,7 +681,7 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) { hbc->add_child(edit_menu); hbc->add_child(goto_menu); hbc->add_child(help_menu); - hbc->add_style_override("panel", p_node->get_gui_base()->get_stylebox("ScriptEditorPanel", "EditorStyles")); + hbc->add_theme_style_override("panel", p_node->get_gui_base()->get_theme_stylebox("ScriptEditorPanel", "EditorStyles")); main_container->add_child(shader_editor); goto_line_dialog = memnew(GotoLineDialog); diff --git a/editor/plugins/skeleton_2d_editor_plugin.cpp b/editor/plugins/skeleton_2d_editor_plugin.cpp index a5dc40e3c9..96b2e56538 100644 --- a/editor/plugins/skeleton_2d_editor_plugin.cpp +++ b/editor/plugins/skeleton_2d_editor_plugin.cpp @@ -101,7 +101,7 @@ Skeleton2DEditor::Skeleton2DEditor() { CanvasItemEditor::get_singleton()->add_control_to_menu_panel(options); options->set_text(TTR("Skeleton2D")); - options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Skeleton2D", "EditorIcons")); + options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("Skeleton2D", "EditorIcons")); options->get_popup()->add_item(TTR("Make Rest Pose (From Bones)"), MENU_OPTION_MAKE_REST); options->get_popup()->add_separator(); diff --git a/editor/plugins/skeleton_editor_plugin.cpp b/editor/plugins/skeleton_editor_plugin.cpp index 07bd6a0e41..ac9980b79f 100644 --- a/editor/plugins/skeleton_editor_plugin.cpp +++ b/editor/plugins/skeleton_editor_plugin.cpp @@ -158,7 +158,7 @@ SkeletonEditor::SkeletonEditor() { SpatialEditor::get_singleton()->add_control_to_menu_panel(options); options->set_text(TTR("Skeleton")); - options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Skeleton", "EditorIcons")); + options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("Skeleton", "EditorIcons")); options->get_popup()->add_item(TTR("Create physical skeleton"), MENU_OPTION_CREATE_PHYSICAL_SKELETON); diff --git a/editor/plugins/skeleton_ik_editor_plugin.cpp b/editor/plugins/skeleton_ik_editor_plugin.cpp index 418e10a0f0..8b120e9543 100644 --- a/editor/plugins/skeleton_ik_editor_plugin.cpp +++ b/editor/plugins/skeleton_ik_editor_plugin.cpp @@ -84,7 +84,7 @@ SkeletonIKEditorPlugin::SkeletonIKEditorPlugin(EditorNode *p_node) { editor = p_node; play_btn = memnew(Button); - play_btn->set_icon(editor->get_gui_base()->get_icon("Play", "EditorIcons")); + play_btn->set_icon(editor->get_gui_base()->get_theme_icon("Play", "EditorIcons")); play_btn->set_text(TTR("Play IK")); play_btn->set_toggle_mode(true); play_btn->hide(); diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 09980e0d5c..286125d31b 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -89,9 +89,9 @@ void ViewportRotationControl::_notification(int p_what) { axis_menu_options.push_back(SpatialEditorViewport::VIEW_REAR); axis_colors.clear(); - axis_colors.push_back(get_color("axis_x_color", "Editor")); - axis_colors.push_back(get_color("axis_y_color", "Editor")); - axis_colors.push_back(get_color("axis_z_color", "Editor")); + axis_colors.push_back(get_theme_color("axis_x_color", "Editor")); + axis_colors.push_back(get_theme_color("axis_y_color", "Editor")); + axis_colors.push_back(get_theme_color("axis_z_color", "Editor")); update(); if (!is_connected("mouse_exited", callable_mp(this, &ViewportRotationControl::_on_mouse_exited))) { @@ -140,7 +140,7 @@ void ViewportRotationControl::_draw_axis(const Axis2D &p_axis) { if (front) { String axis_name = direction == 0 ? "X" : (direction == 1 ? "Y" : "Z"); draw_circle(p_axis.screen_point, AXIS_CIRCLE_RADIUS, c); - draw_char(get_font("rotation_control", "EditorFonts"), p_axis.screen_point + Vector2i(-4, 5) * EDSCALE, axis_name, "", Color(0.3, 0.3, 0.3)); + draw_char(get_theme_font("rotation_control", "EditorFonts"), p_axis.screen_point + Vector2i(-4, 5) * EDSCALE, axis_name, "", Color(0.3, 0.3, 0.3)); } else { draw_circle(p_axis.screen_point, AXIS_CIRCLE_RADIUS * (0.55 + (0.2 * (1.0 + p_axis.z_axis))), c); } @@ -1091,7 +1091,7 @@ void SpatialEditorViewport::_list_select(Ref<InputEventMouseButton> b) { selection_menu->set_item_tooltip(i, String(spat->get_name()) + "\nType: " + spat->get_class() + "\nPath: " + node_path); } - selection_menu->set_global_position(b->get_global_position()); + selection_menu->set_position(get_screen_transform().xform(b->get_position())); selection_menu->popup(); } } @@ -2367,7 +2367,7 @@ void SpatialEditorViewport::_notification(int p_what) { if (p_what == NOTIFICATION_READY) { // The crosshair icon doesn't depend on the editor theme. - crosshair->set_texture(get_icon("Crosshair", "EditorIcons")); + crosshair->set_texture(get_theme_icon("Crosshair", "EditorIcons")); // Set the anchors and margins after changing the icon to ensure it's centered correctly. crosshair->set_anchors_and_margins_preset(PRESET_CENTER); } @@ -2555,25 +2555,25 @@ void SpatialEditorViewport::_notification(int p_what) { if (p_what == NOTIFICATION_THEME_CHANGED) { - view_menu->set_icon(get_icon("GuiTabMenu", "EditorIcons")); - preview_camera->set_icon(get_icon("Camera", "EditorIcons")); + view_menu->set_icon(get_theme_icon("GuiTabMenu", "EditorIcons")); + preview_camera->set_icon(get_theme_icon("Camera", "EditorIcons")); - view_menu->add_style_override("normal", editor->get_gui_base()->get_stylebox("Information3dViewport", "EditorStyles")); - view_menu->add_style_override("hover", editor->get_gui_base()->get_stylebox("Information3dViewport", "EditorStyles")); - view_menu->add_style_override("pressed", editor->get_gui_base()->get_stylebox("Information3dViewport", "EditorStyles")); - view_menu->add_style_override("focus", editor->get_gui_base()->get_stylebox("Information3dViewport", "EditorStyles")); - view_menu->add_style_override("disabled", editor->get_gui_base()->get_stylebox("Information3dViewport", "EditorStyles")); + view_menu->add_theme_style_override("normal", editor->get_gui_base()->get_theme_stylebox("Information3dViewport", "EditorStyles")); + view_menu->add_theme_style_override("hover", editor->get_gui_base()->get_theme_stylebox("Information3dViewport", "EditorStyles")); + view_menu->add_theme_style_override("pressed", editor->get_gui_base()->get_theme_stylebox("Information3dViewport", "EditorStyles")); + view_menu->add_theme_style_override("focus", editor->get_gui_base()->get_theme_stylebox("Information3dViewport", "EditorStyles")); + view_menu->add_theme_style_override("disabled", editor->get_gui_base()->get_theme_stylebox("Information3dViewport", "EditorStyles")); - preview_camera->add_style_override("normal", editor->get_gui_base()->get_stylebox("Information3dViewport", "EditorStyles")); - preview_camera->add_style_override("hover", editor->get_gui_base()->get_stylebox("Information3dViewport", "EditorStyles")); - preview_camera->add_style_override("pressed", editor->get_gui_base()->get_stylebox("Information3dViewport", "EditorStyles")); - preview_camera->add_style_override("focus", editor->get_gui_base()->get_stylebox("Information3dViewport", "EditorStyles")); - preview_camera->add_style_override("disabled", editor->get_gui_base()->get_stylebox("Information3dViewport", "EditorStyles")); + preview_camera->add_theme_style_override("normal", editor->get_gui_base()->get_theme_stylebox("Information3dViewport", "EditorStyles")); + preview_camera->add_theme_style_override("hover", editor->get_gui_base()->get_theme_stylebox("Information3dViewport", "EditorStyles")); + preview_camera->add_theme_style_override("pressed", editor->get_gui_base()->get_theme_stylebox("Information3dViewport", "EditorStyles")); + preview_camera->add_theme_style_override("focus", editor->get_gui_base()->get_theme_stylebox("Information3dViewport", "EditorStyles")); + preview_camera->add_theme_style_override("disabled", editor->get_gui_base()->get_theme_stylebox("Information3dViewport", "EditorStyles")); - info_label->add_style_override("normal", editor->get_gui_base()->get_stylebox("Information3dViewport", "EditorStyles")); - fps_label->add_style_override("normal", editor->get_gui_base()->get_stylebox("Information3dViewport", "EditorStyles")); - cinema_label->add_style_override("normal", editor->get_gui_base()->get_stylebox("Information3dViewport", "EditorStyles")); - locked_label->add_style_override("normal", editor->get_gui_base()->get_stylebox("Information3dViewport", "EditorStyles")); + info_label->add_theme_style_override("normal", editor->get_gui_base()->get_theme_stylebox("Information3dViewport", "EditorStyles")); + fps_label->add_theme_style_override("normal", editor->get_gui_base()->get_theme_stylebox("Information3dViewport", "EditorStyles")); + cinema_label->add_theme_style_override("normal", editor->get_gui_base()->get_theme_stylebox("Information3dViewport", "EditorStyles")); + locked_label->add_theme_style_override("normal", editor->get_gui_base()->get_theme_stylebox("Information3dViewport", "EditorStyles")); } } @@ -2613,7 +2613,7 @@ void SpatialEditorViewport::_draw() { if (surface->has_focus()) { Size2 size = surface->get_size(); Rect2 r = Rect2(Point2(), size); - get_stylebox("Focus", "EditorStyles")->draw(surface->get_canvas_item(), r); + get_theme_stylebox("Focus", "EditorStyles")->draw(surface->get_canvas_item(), r); } if (cursor.region_select) { @@ -2621,11 +2621,11 @@ void SpatialEditorViewport::_draw() { surface->draw_rect( selection_rect, - get_color("box_selection_fill_color", "Editor")); + get_theme_color("box_selection_fill_color", "Editor")); surface->draw_rect( selection_rect, - get_color("box_selection_stroke_color", "Editor"), + get_theme_color("box_selection_stroke_color", "Editor"), false, Math::round(EDSCALE)); } @@ -2633,7 +2633,7 @@ void SpatialEditorViewport::_draw() { RID ci = surface->get_canvas_item(); if (message_time > 0) { - Ref<Font> font = get_font("font", "Label"); + Ref<Font> font = get_theme_font("font", "Label"); Point2 msgpos = Point2(5, get_size().y - 20); font->draw(ci, msgpos + Point2(1, 1), message, Color(0, 0, 0, 0.8)); font->draw(ci, msgpos + Point2(-1, -1), message, Color(0, 0, 0, 0.8)); @@ -2647,7 +2647,7 @@ void SpatialEditorViewport::_draw() { ci, _edit.mouse_pos, center, - get_color("accent_color", "Editor") * Color(1, 1, 1, 0.6), + get_theme_color("accent_color", "Editor") * Color(1, 1, 1, 0.6), Math::round(2 * EDSCALE)); } if (previewing) { @@ -2698,7 +2698,7 @@ void SpatialEditorViewport::_draw() { if (logscale_t < 0.25) logscale_t = 0.25 * Math::exp(4.0 * logscale_t - 1.0); - draw_indicator_bar(*surface, 1.0 - logscale_t, get_icon("ViewportSpeed", "EditorIcons")); + draw_indicator_bar(*surface, 1.0 - logscale_t, get_theme_icon("ViewportSpeed", "EditorIcons")); } } else { @@ -2716,7 +2716,7 @@ void SpatialEditorViewport::_draw() { if (logscale_t < 0.25) logscale_t = 0.25 * Math::exp(4.0 * logscale_t - 1.0); - draw_indicator_bar(*surface, logscale_t, get_icon("ViewportZoom", "EditorIcons")); + draw_indicator_bar(*surface, logscale_t, get_theme_icon("ViewportZoom", "EditorIcons")); } } } @@ -4037,7 +4037,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed selection_menu = memnew(PopupMenu); add_child(selection_menu); - selection_menu->set_custom_minimum_size(Size2(100, 0) * EDSCALE); + selection_menu->set_min_size(Size2(100, 0) * EDSCALE); selection_menu->connect("id_pressed", callable_mp(this, &SpatialEditorViewport::_selection_result_pressed)); selection_menu->connect("popup_hide", callable_mp(this, &SpatialEditorViewport::_selection_menu_hide)); @@ -4063,8 +4063,8 @@ void SpatialEditorViewportContainer::_gui_input(const Ref<InputEvent> &p_event) if (mb->is_pressed()) { Vector2 size = get_size(); - int h_sep = get_constant("separation", "HSplitContainer"); - int v_sep = get_constant("separation", "VSplitContainer"); + int h_sep = get_theme_constant("separation", "HSplitContainer"); + int v_sep = get_theme_constant("separation", "VSplitContainer"); int mid_w = size.width * ratio_h; int mid_h = size.height * ratio_v; @@ -4114,8 +4114,8 @@ void SpatialEditorViewportContainer::_gui_input(const Ref<InputEvent> &p_event) if (view == VIEW_USE_3_VIEWPORTS || view == VIEW_USE_3_VIEWPORTS_ALT || view == VIEW_USE_4_VIEWPORTS) { Vector2 size = get_size(); - int h_sep = get_constant("separation", "HSplitContainer"); - int v_sep = get_constant("separation", "VSplitContainer"); + int h_sep = get_theme_constant("separation", "HSplitContainer"); + int v_sep = get_theme_constant("separation", "VSplitContainer"); int mid_w = size.width * ratio_h; int mid_h = size.height * ratio_v; @@ -4157,18 +4157,18 @@ void SpatialEditorViewportContainer::_notification(int p_what) { if (p_what == NOTIFICATION_DRAW && mouseover) { - Ref<Texture2D> h_grabber = get_icon("grabber", "HSplitContainer"); - Ref<Texture2D> v_grabber = get_icon("grabber", "VSplitContainer"); + Ref<Texture2D> h_grabber = get_theme_icon("grabber", "HSplitContainer"); + Ref<Texture2D> v_grabber = get_theme_icon("grabber", "VSplitContainer"); - Ref<Texture2D> hdiag_grabber = get_icon("GuiViewportHdiagsplitter", "EditorIcons"); - Ref<Texture2D> vdiag_grabber = get_icon("GuiViewportVdiagsplitter", "EditorIcons"); - Ref<Texture2D> vh_grabber = get_icon("GuiViewportVhsplitter", "EditorIcons"); + Ref<Texture2D> hdiag_grabber = get_theme_icon("GuiViewportHdiagsplitter", "EditorIcons"); + Ref<Texture2D> vdiag_grabber = get_theme_icon("GuiViewportVdiagsplitter", "EditorIcons"); + Ref<Texture2D> vh_grabber = get_theme_icon("GuiViewportVhsplitter", "EditorIcons"); Vector2 size = get_size(); - int h_sep = get_constant("separation", "HSplitContainer"); + int h_sep = get_theme_constant("separation", "HSplitContainer"); - int v_sep = get_constant("separation", "VSplitContainer"); + int v_sep = get_theme_constant("separation", "VSplitContainer"); int mid_w = size.width * ratio_h; int mid_h = size.height * ratio_v; @@ -4262,9 +4262,9 @@ void SpatialEditorViewportContainer::_notification(int p_what) { } return; } - int h_sep = get_constant("separation", "HSplitContainer"); + int h_sep = get_theme_constant("separation", "HSplitContainer"); - int v_sep = get_constant("separation", "VSplitContainer"); + int v_sep = get_theme_constant("separation", "VSplitContainer"); int mid_w = size.width * ratio_h; int mid_h = size.height * ratio_v; @@ -4801,13 +4801,13 @@ void SpatialEditor::_menu_gizmo_toggled(int p_option) { const int state = gizmos_menu->get_item_state(idx); switch (state) { case EditorSpatialGizmoPlugin::VISIBLE: - gizmos_menu->set_item_icon(idx, view_menu->get_popup()->get_icon("visibility_visible")); + gizmos_menu->set_item_icon(idx, view_menu->get_popup()->get_theme_icon("visibility_visible")); break; case EditorSpatialGizmoPlugin::ON_TOP: - gizmos_menu->set_item_icon(idx, view_menu->get_popup()->get_icon("visibility_xray")); + gizmos_menu->set_item_icon(idx, view_menu->get_popup()->get_theme_icon("visibility_xray")); break; case EditorSpatialGizmoPlugin::HIDDEN: - gizmos_menu->set_item_icon(idx, view_menu->get_popup()->get_icon("visibility_hidden")); + gizmos_menu->set_item_icon(idx, view_menu->get_popup()->get_theme_icon("visibility_hidden")); break; } @@ -5102,13 +5102,13 @@ void SpatialEditor::_init_indicators() { Color origin_color; switch (i) { case 0: - origin_color = get_color("axis_x_color", "Editor"); + origin_color = get_theme_color("axis_x_color", "Editor"); break; case 1: - origin_color = get_color("axis_y_color", "Editor"); + origin_color = get_theme_color("axis_y_color", "Editor"); break; case 2: - origin_color = get_color("axis_z_color", "Editor"); + origin_color = get_theme_color("axis_z_color", "Editor"); break; default: origin_color = Color(); @@ -5153,13 +5153,13 @@ void SpatialEditor::_init_indicators() { Color col; switch (i) { case 0: - col = get_color("axis_x_color", "Editor"); + col = get_theme_color("axis_x_color", "Editor"); break; case 1: - col = get_color("axis_y_color", "Editor"); + col = get_theme_color("axis_y_color", "Editor"); break; case 2: - col = get_color("axis_z_color", "Editor"); + col = get_theme_color("axis_z_color", "Editor"); break; default: col = Color(); @@ -5431,13 +5431,13 @@ void SpatialEditor::_update_gizmos_menu() { const int idx = gizmos_menu->get_item_index(i); switch (plugin_state) { case EditorSpatialGizmoPlugin::VISIBLE: - gizmos_menu->set_item_icon(idx, gizmos_menu->get_icon("visibility_visible")); + gizmos_menu->set_item_icon(idx, gizmos_menu->get_theme_icon("visibility_visible")); break; case EditorSpatialGizmoPlugin::ON_TOP: - gizmos_menu->set_item_icon(idx, gizmos_menu->get_icon("visibility_xray")); + gizmos_menu->set_item_icon(idx, gizmos_menu->get_theme_icon("visibility_xray")); break; case EditorSpatialGizmoPlugin::HIDDEN: - gizmos_menu->set_item_icon(idx, gizmos_menu->get_icon("visibility_hidden")); + gizmos_menu->set_item_icon(idx, gizmos_menu->get_theme_icon("visibility_hidden")); break; } } @@ -5450,13 +5450,13 @@ void SpatialEditor::_update_gizmos_menu_theme() { const int idx = gizmos_menu->get_item_index(i); switch (plugin_state) { case EditorSpatialGizmoPlugin::VISIBLE: - gizmos_menu->set_item_icon(idx, gizmos_menu->get_icon("visibility_visible")); + gizmos_menu->set_item_icon(idx, gizmos_menu->get_theme_icon("visibility_visible")); break; case EditorSpatialGizmoPlugin::ON_TOP: - gizmos_menu->set_item_icon(idx, gizmos_menu->get_icon("visibility_xray")); + gizmos_menu->set_item_icon(idx, gizmos_menu->get_theme_icon("visibility_xray")); break; case EditorSpatialGizmoPlugin::HIDDEN: - gizmos_menu->set_item_icon(idx, gizmos_menu->get_icon("visibility_hidden")); + gizmos_menu->set_item_icon(idx, gizmos_menu->get_theme_icon("visibility_hidden")); break; } } @@ -5727,26 +5727,26 @@ void SpatialEditor::_notification(int p_what) { if (p_what == NOTIFICATION_READY) { - tool_button[SpatialEditor::TOOL_MODE_SELECT]->set_icon(get_icon("ToolSelect", "EditorIcons")); - tool_button[SpatialEditor::TOOL_MODE_MOVE]->set_icon(get_icon("ToolMove", "EditorIcons")); - tool_button[SpatialEditor::TOOL_MODE_ROTATE]->set_icon(get_icon("ToolRotate", "EditorIcons")); - tool_button[SpatialEditor::TOOL_MODE_SCALE]->set_icon(get_icon("ToolScale", "EditorIcons")); - tool_button[SpatialEditor::TOOL_MODE_LIST_SELECT]->set_icon(get_icon("ListSelect", "EditorIcons")); - tool_button[SpatialEditor::TOOL_LOCK_SELECTED]->set_icon(get_icon("Lock", "EditorIcons")); - tool_button[SpatialEditor::TOOL_UNLOCK_SELECTED]->set_icon(get_icon("Unlock", "EditorIcons")); - tool_button[SpatialEditor::TOOL_GROUP_SELECTED]->set_icon(get_icon("Group", "EditorIcons")); - tool_button[SpatialEditor::TOOL_UNGROUP_SELECTED]->set_icon(get_icon("Ungroup", "EditorIcons")); - - tool_option_button[SpatialEditor::TOOL_OPT_LOCAL_COORDS]->set_icon(get_icon("Object", "EditorIcons")); - tool_option_button[SpatialEditor::TOOL_OPT_USE_SNAP]->set_icon(get_icon("Snap", "EditorIcons")); - tool_option_button[SpatialEditor::TOOL_OPT_OVERRIDE_CAMERA]->set_icon(get_icon("Camera", "EditorIcons")); - - view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_1_VIEWPORT), get_icon("Panels1", "EditorIcons")); - view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS), get_icon("Panels2", "EditorIcons")); - view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS_ALT), get_icon("Panels2Alt", "EditorIcons")); - view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS), get_icon("Panels3", "EditorIcons")); - view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS_ALT), get_icon("Panels3Alt", "EditorIcons")); - view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_4_VIEWPORTS), get_icon("Panels4", "EditorIcons")); + tool_button[SpatialEditor::TOOL_MODE_SELECT]->set_icon(get_theme_icon("ToolSelect", "EditorIcons")); + tool_button[SpatialEditor::TOOL_MODE_MOVE]->set_icon(get_theme_icon("ToolMove", "EditorIcons")); + tool_button[SpatialEditor::TOOL_MODE_ROTATE]->set_icon(get_theme_icon("ToolRotate", "EditorIcons")); + tool_button[SpatialEditor::TOOL_MODE_SCALE]->set_icon(get_theme_icon("ToolScale", "EditorIcons")); + tool_button[SpatialEditor::TOOL_MODE_LIST_SELECT]->set_icon(get_theme_icon("ListSelect", "EditorIcons")); + tool_button[SpatialEditor::TOOL_LOCK_SELECTED]->set_icon(get_theme_icon("Lock", "EditorIcons")); + tool_button[SpatialEditor::TOOL_UNLOCK_SELECTED]->set_icon(get_theme_icon("Unlock", "EditorIcons")); + tool_button[SpatialEditor::TOOL_GROUP_SELECTED]->set_icon(get_theme_icon("Group", "EditorIcons")); + tool_button[SpatialEditor::TOOL_UNGROUP_SELECTED]->set_icon(get_theme_icon("Ungroup", "EditorIcons")); + + tool_option_button[SpatialEditor::TOOL_OPT_LOCAL_COORDS]->set_icon(get_theme_icon("Object", "EditorIcons")); + tool_option_button[SpatialEditor::TOOL_OPT_USE_SNAP]->set_icon(get_theme_icon("Snap", "EditorIcons")); + tool_option_button[SpatialEditor::TOOL_OPT_OVERRIDE_CAMERA]->set_icon(get_theme_icon("Camera", "EditorIcons")); + + view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_1_VIEWPORT), get_theme_icon("Panels1", "EditorIcons")); + view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS), get_theme_icon("Panels2", "EditorIcons")); + view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS_ALT), get_theme_icon("Panels2Alt", "EditorIcons")); + view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS), get_theme_icon("Panels3", "EditorIcons")); + view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS_ALT), get_theme_icon("Panels3Alt", "EditorIcons")); + view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_4_VIEWPORTS), get_theme_icon("Panels4", "EditorIcons")); _menu_item_pressed(MENU_VIEW_USE_1_VIEWPORT); @@ -5769,25 +5769,25 @@ void SpatialEditor::_notification(int p_what) { _finish_indicators(); } else if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { - tool_button[SpatialEditor::TOOL_MODE_SELECT]->set_icon(get_icon("ToolSelect", "EditorIcons")); - tool_button[SpatialEditor::TOOL_MODE_MOVE]->set_icon(get_icon("ToolMove", "EditorIcons")); - tool_button[SpatialEditor::TOOL_MODE_ROTATE]->set_icon(get_icon("ToolRotate", "EditorIcons")); - tool_button[SpatialEditor::TOOL_MODE_SCALE]->set_icon(get_icon("ToolScale", "EditorIcons")); - tool_button[SpatialEditor::TOOL_MODE_LIST_SELECT]->set_icon(get_icon("ListSelect", "EditorIcons")); - tool_button[SpatialEditor::TOOL_LOCK_SELECTED]->set_icon(get_icon("Lock", "EditorIcons")); - tool_button[SpatialEditor::TOOL_UNLOCK_SELECTED]->set_icon(get_icon("Unlock", "EditorIcons")); - tool_button[SpatialEditor::TOOL_GROUP_SELECTED]->set_icon(get_icon("Group", "EditorIcons")); - tool_button[SpatialEditor::TOOL_UNGROUP_SELECTED]->set_icon(get_icon("Ungroup", "EditorIcons")); - - tool_option_button[SpatialEditor::TOOL_OPT_LOCAL_COORDS]->set_icon(get_icon("Object", "EditorIcons")); - tool_option_button[SpatialEditor::TOOL_OPT_USE_SNAP]->set_icon(get_icon("Snap", "EditorIcons")); - - view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_1_VIEWPORT), get_icon("Panels1", "EditorIcons")); - view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS), get_icon("Panels2", "EditorIcons")); - view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS_ALT), get_icon("Panels2Alt", "EditorIcons")); - view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS), get_icon("Panels3", "EditorIcons")); - view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS_ALT), get_icon("Panels3Alt", "EditorIcons")); - view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_4_VIEWPORTS), get_icon("Panels4", "EditorIcons")); + tool_button[SpatialEditor::TOOL_MODE_SELECT]->set_icon(get_theme_icon("ToolSelect", "EditorIcons")); + tool_button[SpatialEditor::TOOL_MODE_MOVE]->set_icon(get_theme_icon("ToolMove", "EditorIcons")); + tool_button[SpatialEditor::TOOL_MODE_ROTATE]->set_icon(get_theme_icon("ToolRotate", "EditorIcons")); + tool_button[SpatialEditor::TOOL_MODE_SCALE]->set_icon(get_theme_icon("ToolScale", "EditorIcons")); + tool_button[SpatialEditor::TOOL_MODE_LIST_SELECT]->set_icon(get_theme_icon("ListSelect", "EditorIcons")); + tool_button[SpatialEditor::TOOL_LOCK_SELECTED]->set_icon(get_theme_icon("Lock", "EditorIcons")); + tool_button[SpatialEditor::TOOL_UNLOCK_SELECTED]->set_icon(get_theme_icon("Unlock", "EditorIcons")); + tool_button[SpatialEditor::TOOL_GROUP_SELECTED]->set_icon(get_theme_icon("Group", "EditorIcons")); + tool_button[SpatialEditor::TOOL_UNGROUP_SELECTED]->set_icon(get_theme_icon("Ungroup", "EditorIcons")); + + tool_option_button[SpatialEditor::TOOL_OPT_LOCAL_COORDS]->set_icon(get_theme_icon("Object", "EditorIcons")); + tool_option_button[SpatialEditor::TOOL_OPT_USE_SNAP]->set_icon(get_theme_icon("Snap", "EditorIcons")); + + view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_1_VIEWPORT), get_theme_icon("Panels1", "EditorIcons")); + view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS), get_theme_icon("Panels2", "EditorIcons")); + view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS_ALT), get_theme_icon("Panels2Alt", "EditorIcons")); + view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS), get_theme_icon("Panels3", "EditorIcons")); + view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS_ALT), get_theme_icon("Panels3Alt", "EditorIcons")); + view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_4_VIEWPORTS), get_theme_icon("Panels4", "EditorIcons")); // Update grid color by rebuilding grid. _finish_grid(); @@ -6560,7 +6560,7 @@ void EditorSpatialGizmoPlugin::create_handle_material(const String &p_name, bool handle_material->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); handle_material->set_flag(StandardMaterial3D::FLAG_USE_POINT_SIZE, true); - Ref<Texture2D> handle_t = SpatialEditor::get_singleton()->get_icon("Editor3DHandle", "EditorIcons"); + Ref<Texture2D> handle_t = SpatialEditor::get_singleton()->get_theme_icon("Editor3DHandle", "EditorIcons"); handle_material->set_point_size(handle_t->get_width()); handle_material->set_texture(StandardMaterial3D::TEXTURE_ALBEDO, handle_t); handle_material->set_albedo(Color(1, 1, 1)); diff --git a/editor/plugins/sprite_editor_plugin.cpp b/editor/plugins/sprite_editor_plugin.cpp index 1d6e6558ba..251957eaa5 100644 --- a/editor/plugins/sprite_editor_plugin.cpp +++ b/editor/plugins/sprite_editor_plugin.cpp @@ -514,7 +514,7 @@ SpriteEditor::SpriteEditor() { CanvasItemEditor::get_singleton()->add_control_to_menu_panel(options); options->set_text(TTR("Sprite")); - options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Sprite", "EditorIcons")); + options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("Sprite", "EditorIcons")); options->get_popup()->add_item(TTR("Convert to Mesh2D"), MENU_OPTION_CONVERT_TO_MESH_2D); options->get_popup()->add_item(TTR("Convert to Polygon2D"), MENU_OPTION_CONVERT_TO_POLYGON_2D); diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index 12a0a3a83d..776b80d73b 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -81,7 +81,7 @@ void SpriteFramesEditor::_sheet_preview_draw() { return; } - Color accent = get_color("accent_color", "Editor"); + Color accent = get_theme_color("accent_color", "Editor"); for (Set<int>::Element *E = frames_selected.front(); E; E = E->next()) { int idx = E->get(); @@ -223,24 +223,24 @@ void SpriteFramesEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { - load->set_icon(get_icon("Load", "EditorIcons")); - load_sheet->set_icon(get_icon("SpriteSheet", "EditorIcons")); - copy->set_icon(get_icon("ActionCopy", "EditorIcons")); - paste->set_icon(get_icon("ActionPaste", "EditorIcons")); - empty->set_icon(get_icon("InsertBefore", "EditorIcons")); - empty2->set_icon(get_icon("InsertAfter", "EditorIcons")); - move_up->set_icon(get_icon("MoveLeft", "EditorIcons")); - move_down->set_icon(get_icon("MoveRight", "EditorIcons")); - _delete->set_icon(get_icon("Remove", "EditorIcons")); - new_anim->set_icon(get_icon("New", "EditorIcons")); - remove_anim->set_icon(get_icon("Remove", "EditorIcons")); + load->set_icon(get_theme_icon("Load", "EditorIcons")); + load_sheet->set_icon(get_theme_icon("SpriteSheet", "EditorIcons")); + copy->set_icon(get_theme_icon("ActionCopy", "EditorIcons")); + paste->set_icon(get_theme_icon("ActionPaste", "EditorIcons")); + empty->set_icon(get_theme_icon("InsertBefore", "EditorIcons")); + empty2->set_icon(get_theme_icon("InsertAfter", "EditorIcons")); + move_up->set_icon(get_theme_icon("MoveLeft", "EditorIcons")); + move_down->set_icon(get_theme_icon("MoveRight", "EditorIcons")); + _delete->set_icon(get_theme_icon("Remove", "EditorIcons")); + new_anim->set_icon(get_theme_icon("New", "EditorIcons")); + remove_anim->set_icon(get_theme_icon("Remove", "EditorIcons")); [[fallthrough]]; } case NOTIFICATION_THEME_CHANGED: { - splite_sheet_scroll->add_style_override("bg", get_stylebox("bg", "Tree")); + splite_sheet_scroll->add_theme_style_override("bg", get_theme_stylebox("bg", "Tree")); } break; case NOTIFICATION_READY: { - add_constant_override("autohide", 1); // Fixes the dragger always showing up. + add_theme_constant_override("autohide", 1); // Fixes the dragger always showing up. } break; } } diff --git a/editor/plugins/style_box_editor_plugin.cpp b/editor/plugins/style_box_editor_plugin.cpp index a92194da17..41db0308c2 100644 --- a/editor/plugins/style_box_editor_plugin.cpp +++ b/editor/plugins/style_box_editor_plugin.cpp @@ -57,7 +57,7 @@ void StyleBoxPreview::edit(const Ref<StyleBox> &p_stylebox) { stylebox->disconnect("changed", callable_mp(this, &StyleBoxPreview::_sb_changed)); stylebox = p_stylebox; if (p_stylebox.is_valid()) { - preview->add_style_override("panel", stylebox); + preview->add_theme_style_override("panel", stylebox); stylebox->connect("changed", callable_mp(this, &StyleBoxPreview::_sb_changed)); } _sb_changed(); diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp index 35f23ccf1d..aa86c48af1 100644 --- a/editor/plugins/text_editor.cpp +++ b/editor/plugins/text_editor.cpp @@ -51,10 +51,10 @@ void TextEditor::set_syntax_highlighter(SyntaxHighlighter *p_highlighter) { // so to remove all colours we need to set and unset them here. if (p_highlighter == NULL) { // standard TextEdit *text_edit = code_editor->get_text_edit(); - text_edit->add_color_override("number_color", colors_cache.font_color); - text_edit->add_color_override("function_color", colors_cache.font_color); - text_edit->add_color_override("number_color", colors_cache.font_color); - text_edit->add_color_override("member_variable_color", colors_cache.font_color); + text_edit->add_theme_color_override("number_color", colors_cache.font_color); + text_edit->add_theme_color_override("function_color", colors_cache.font_color); + text_edit->add_theme_color_override("number_color", colors_cache.font_color); + text_edit->add_theme_color_override("member_variable_color", colors_cache.font_color); } else { _load_theme_settings(); } @@ -107,35 +107,35 @@ void TextEditor::_load_theme_settings() { Color comment_color = EDITOR_GET("text_editor/highlighting/comment_color"); Color string_color = EDITOR_GET("text_editor/highlighting/string_color"); - text_edit->add_color_override("background_color", background_color); - text_edit->add_color_override("completion_background_color", completion_background_color); - text_edit->add_color_override("completion_selected_color", completion_selected_color); - text_edit->add_color_override("completion_existing_color", completion_existing_color); - text_edit->add_color_override("completion_scroll_color", completion_scroll_color); - text_edit->add_color_override("completion_font_color", completion_font_color); - text_edit->add_color_override("font_color", text_color); - text_edit->add_color_override("line_number_color", line_number_color); - text_edit->add_color_override("caret_color", caret_color); - text_edit->add_color_override("caret_background_color", caret_background_color); - text_edit->add_color_override("font_color_selected", text_selected_color); - text_edit->add_color_override("selection_color", selection_color); - text_edit->add_color_override("brace_mismatch_color", brace_mismatch_color); - text_edit->add_color_override("current_line_color", current_line_color); - text_edit->add_color_override("line_length_guideline_color", line_length_guideline_color); - text_edit->add_color_override("word_highlighted_color", word_highlighted_color); - text_edit->add_color_override("number_color", number_color); - text_edit->add_color_override("function_color", function_color); - text_edit->add_color_override("member_variable_color", member_variable_color); - text_edit->add_color_override("breakpoint_color", breakpoint_color); - text_edit->add_color_override("executing_line_color", executing_line_color); - text_edit->add_color_override("mark_color", mark_color); - text_edit->add_color_override("bookmark_color", bookmark_color); - text_edit->add_color_override("code_folding_color", code_folding_color); - text_edit->add_color_override("search_result_color", search_result_color); - text_edit->add_color_override("search_result_border_color", search_result_border_color); - text_edit->add_color_override("symbol_color", symbol_color); - - text_edit->add_constant_override("line_spacing", EDITOR_DEF("text_editor/theme/line_spacing", 6)); + text_edit->add_theme_color_override("background_color", background_color); + text_edit->add_theme_color_override("completion_background_color", completion_background_color); + text_edit->add_theme_color_override("completion_selected_color", completion_selected_color); + text_edit->add_theme_color_override("completion_existing_color", completion_existing_color); + text_edit->add_theme_color_override("completion_scroll_color", completion_scroll_color); + text_edit->add_theme_color_override("completion_font_color", completion_font_color); + text_edit->add_theme_color_override("font_color", text_color); + text_edit->add_theme_color_override("line_number_color", line_number_color); + text_edit->add_theme_color_override("caret_color", caret_color); + text_edit->add_theme_color_override("caret_background_color", caret_background_color); + text_edit->add_theme_color_override("font_color_selected", text_selected_color); + text_edit->add_theme_color_override("selection_color", selection_color); + text_edit->add_theme_color_override("brace_mismatch_color", brace_mismatch_color); + text_edit->add_theme_color_override("current_line_color", current_line_color); + text_edit->add_theme_color_override("line_length_guideline_color", line_length_guideline_color); + text_edit->add_theme_color_override("word_highlighted_color", word_highlighted_color); + text_edit->add_theme_color_override("number_color", number_color); + text_edit->add_theme_color_override("function_color", function_color); + text_edit->add_theme_color_override("member_variable_color", member_variable_color); + text_edit->add_theme_color_override("breakpoint_color", breakpoint_color); + text_edit->add_theme_color_override("executing_line_color", executing_line_color); + text_edit->add_theme_color_override("mark_color", mark_color); + text_edit->add_theme_color_override("bookmark_color", bookmark_color); + text_edit->add_theme_color_override("code_folding_color", code_folding_color); + text_edit->add_theme_color_override("search_result_color", search_result_color); + text_edit->add_theme_color_override("search_result_border_color", search_result_border_color); + text_edit->add_theme_color_override("symbol_color", symbol_color); + + text_edit->add_theme_constant_override("line_spacing", EDITOR_DEF("text_editor/theme/line_spacing", 6)); colors_cache.font_color = text_color; colors_cache.symbol_color = symbol_color; @@ -163,7 +163,7 @@ String TextEditor::get_name() { return name; } -Ref<Texture2D> TextEditor::get_icon() { +Ref<Texture2D> TextEditor::get_theme_icon() { return EditorNode::get_singleton()->get_object_icon(text_file.operator->(), ""); } @@ -624,7 +624,7 @@ void TextEditor::_make_context_menu(bool p_selection, bool p_can_fold, bool p_is TextEditor::TextEditor() { code_editor = memnew(CodeTextEditor); add_child(code_editor); - code_editor->add_constant_override("separation", 0); + code_editor->add_theme_constant_override("separation", 0); code_editor->connect("load_theme_settings", callable_mp(this, &TextEditor::_load_theme_settings)); code_editor->connect("validate_script", callable_mp(this, &TextEditor::_validate_script)); code_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE); @@ -716,7 +716,7 @@ TextEditor::TextEditor() { goto_menu->get_popup()->add_child(bookmarks_menu); goto_menu->get_popup()->add_submenu_item(TTR("Bookmarks"), "Bookmarks"); _update_bookmark_list(); - bookmarks_menu->connect("about_to_show", callable_mp(this, &TextEditor::_update_bookmark_list)); + bookmarks_menu->connect("about_to_popup", callable_mp(this, &TextEditor::_update_bookmark_list)); bookmarks_menu->connect("index_pressed", callable_mp(this, &TextEditor::_bookmark_item_pressed)); goto_line_dialog = memnew(GotoLineDialog); diff --git a/editor/plugins/text_editor.h b/editor/plugins/text_editor.h index c80052e7ba..b41e11c3aa 100644 --- a/editor/plugins/text_editor.h +++ b/editor/plugins/text_editor.h @@ -121,7 +121,7 @@ public: virtual void set_syntax_highlighter(SyntaxHighlighter *p_highlighter); virtual String get_name(); - virtual Ref<Texture2D> get_icon(); + virtual Ref<Texture2D> get_theme_icon(); virtual RES get_edited_resource() const; virtual void set_edited_resource(const RES &p_res); void set_edited_file(const Ref<TextFile> &p_file); diff --git a/editor/plugins/texture_editor_plugin.cpp b/editor/plugins/texture_editor_plugin.cpp index 60f9bb5dc1..3f76854571 100644 --- a/editor/plugins/texture_editor_plugin.cpp +++ b/editor/plugins/texture_editor_plugin.cpp @@ -46,7 +46,7 @@ void TextureEditor::_notification(int p_what) { if (p_what == NOTIFICATION_DRAW) { - Ref<Texture2D> checkerboard = get_icon("Checkerboard", "EditorIcons"); + Ref<Texture2D> checkerboard = get_theme_icon("Checkerboard", "EditorIcons"); Size2 size = get_size(); draw_texture_rect(checkerboard, Rect2(Point2(), size), true); @@ -79,7 +79,7 @@ void TextureEditor::_notification(int p_what) { draw_texture_rect(texture, Rect2(ofs_x, ofs_y, tex_width, tex_height)); - Ref<Font> font = get_font("font", "Label"); + Ref<Font> font = get_theme_font("font", "Label"); String format; if (Object::cast_to<ImageTexture>(*texture)) { diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index 6d5a40ed85..2186c7d5c3 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -43,7 +43,7 @@ void draw_margin_line(Control *edit_draw, Vector2 from, Vector2 to) { Vector2 line = (to - from).normalized() * 10; while ((to - from).length_squared() > 200) { - edit_draw->draw_line(from, from + line, EditorNode::get_singleton()->get_theme_base()->get_color("mono_color", "Editor"), 2); + edit_draw->draw_line(from, from + line, EditorNode::get_singleton()->get_theme_base()->get_theme_color("mono_color", "Editor"), 2); from += line * 2; } } @@ -134,7 +134,7 @@ void TextureRegionEditor::_region_draw() { } } - Ref<Texture2D> select_handle = get_icon("EditorHandle", "EditorIcons"); + Ref<Texture2D> select_handle = get_theme_icon("EditorHandle", "EditorIcons"); Rect2 scroll_rect(Point2(), base_tex->get_size()); @@ -150,7 +150,7 @@ void TextureRegionEditor::_region_draw() { mtx.basis_xform(raw_endpoints[2]), mtx.basis_xform(raw_endpoints[3]) }; - Color color = get_color("mono_color", "Editor"); + Color color = get_theme_color("mono_color", "Editor"); for (int i = 0; i < 4; i++) { int prev = (i + 3) % 4; @@ -741,12 +741,12 @@ void TextureRegionEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { - edit_draw->add_style_override("panel", get_stylebox("bg", "Tree")); + edit_draw->add_theme_style_override("panel", get_theme_stylebox("bg", "Tree")); } break; case NOTIFICATION_READY: { - zoom_out->set_icon(get_icon("ZoomLess", "EditorIcons")); - zoom_reset->set_icon(get_icon("ZoomReset", "EditorIcons")); - zoom_in->set_icon(get_icon("ZoomMore", "EditorIcons")); + zoom_out->set_icon(get_theme_icon("ZoomLess", "EditorIcons")); + zoom_reset->set_icon(get_theme_icon("ZoomReset", "EditorIcons")); + zoom_in->set_icon(get_theme_icon("ZoomMore", "EditorIcons")); vscroll->set_anchors_and_margins_preset(PRESET_RIGHT_WIDE); hscroll->set_anchors_and_margins_preset(PRESET_BOTTOM_WIDE); diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index aa5caf6658..b246b611fd 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -592,7 +592,7 @@ void ThemeEditor::_notification(int p_what) { } } break; case NOTIFICATION_THEME_CHANGED: { - theme_menu->set_icon(get_icon("Theme", "EditorIcons")); + theme_menu->set_icon(get_theme_icon("Theme", "EditorIcons")); } break; } } @@ -645,10 +645,10 @@ ThemeEditor::ThemeEditor() { main_container = memnew(MarginContainer); root_container->add_child(main_container); - main_container->add_constant_override("margin_right", 4 * EDSCALE); - main_container->add_constant_override("margin_top", 4 * EDSCALE); - main_container->add_constant_override("margin_left", 4 * EDSCALE); - main_container->add_constant_override("margin_bottom", 4 * EDSCALE); + main_container->add_theme_constant_override("margin_right", 4 * EDSCALE); + main_container->add_theme_constant_override("margin_top", 4 * EDSCALE); + main_container->add_theme_constant_override("margin_left", 4 * EDSCALE); + main_container->add_theme_constant_override("margin_bottom", 4 * EDSCALE); HBoxContainer *main_hb = memnew(HBoxContainer); main_container->add_child(main_hb); @@ -656,7 +656,7 @@ ThemeEditor::ThemeEditor() { VBoxContainer *first_vb = memnew(VBoxContainer); main_hb->add_child(first_vb); first_vb->set_h_size_flags(SIZE_EXPAND_FILL); - first_vb->add_constant_override("separation", 10 * EDSCALE); + first_vb->add_theme_constant_override("separation", 10 * EDSCALE); first_vb->add_child(memnew(Label("Label"))); @@ -716,7 +716,7 @@ ThemeEditor::ThemeEditor() { VBoxContainer *second_vb = memnew(VBoxContainer); second_vb->set_h_size_flags(SIZE_EXPAND_FILL); main_hb->add_child(second_vb); - second_vb->add_constant_override("separation", 10 * EDSCALE); + second_vb->add_theme_constant_override("separation", 10 * EDSCALE); LineEdit *le = memnew(LineEdit); le->set_text("LineEdit"); second_vb->add_child(le); @@ -756,7 +756,7 @@ ThemeEditor::ThemeEditor() { VBoxContainer *third_vb = memnew(VBoxContainer); third_vb->set_h_size_flags(SIZE_EXPAND_FILL); - third_vb->add_constant_override("separation", 10 * EDSCALE); + third_vb->add_theme_constant_override("separation", 10 * EDSCALE); main_hb->add_child(third_vb); TabContainer *tc = memnew(TabContainer); @@ -776,7 +776,7 @@ ThemeEditor::ThemeEditor() { Tree *test_tree = memnew(Tree); third_vb->add_child(test_tree); test_tree->set_custom_minimum_size(Size2(0, 175) * EDSCALE); - test_tree->add_constant_override("draw_relationship_lines", 1); + test_tree->add_theme_constant_override("draw_relationship_lines", 1); TreeItem *item = test_tree->create_item(); item->set_text(0, "Tree"); @@ -802,7 +802,7 @@ ThemeEditor::ThemeEditor() { item->set_text(0, TTR("Has,Many,Options")); item->set_range(0, 2); - main_hb->add_constant_override("separation", 20 * EDSCALE); + main_hb->add_theme_constant_override("separation", 20 * EDSCALE); //////// @@ -846,7 +846,7 @@ ThemeEditor::ThemeEditor() { name_menu->set_text(".."); name_hbc->add_child(name_menu); - name_menu->get_popup()->connect("about_to_show", callable_mp(this, &ThemeEditor::_name_menu_about_to_show)); + name_menu->get_popup()->connect("about_to_popup", callable_mp(this, &ThemeEditor::_name_menu_about_to_show)); name_menu->get_popup()->connect("id_pressed", callable_mp(this, &ThemeEditor::_name_menu_cbk)); type_select_label = memnew(Label); diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 20bab12edf..83dc84a0c2 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -60,24 +60,24 @@ void TileMapEditor::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { - paint_button->set_icon(get_icon("Edit", "EditorIcons")); - bucket_fill_button->set_icon(get_icon("Bucket", "EditorIcons")); - picker_button->set_icon(get_icon("ColorPick", "EditorIcons")); - select_button->set_icon(get_icon("ActionCopy", "EditorIcons")); - - rotate_left_button->set_icon(get_icon("RotateLeft", "EditorIcons")); - rotate_right_button->set_icon(get_icon("RotateRight", "EditorIcons")); - flip_horizontal_button->set_icon(get_icon("MirrorX", "EditorIcons")); - flip_vertical_button->set_icon(get_icon("MirrorY", "EditorIcons")); - clear_transform_button->set_icon(get_icon("Clear", "EditorIcons")); - - search_box->set_right_icon(get_icon("Search", "EditorIcons")); + paint_button->set_icon(get_theme_icon("Edit", "EditorIcons")); + bucket_fill_button->set_icon(get_theme_icon("Bucket", "EditorIcons")); + picker_button->set_icon(get_theme_icon("ColorPick", "EditorIcons")); + select_button->set_icon(get_theme_icon("ActionCopy", "EditorIcons")); + + rotate_left_button->set_icon(get_theme_icon("RotateLeft", "EditorIcons")); + rotate_right_button->set_icon(get_theme_icon("RotateRight", "EditorIcons")); + flip_horizontal_button->set_icon(get_theme_icon("MirrorX", "EditorIcons")); + flip_vertical_button->set_icon(get_theme_icon("MirrorY", "EditorIcons")); + clear_transform_button->set_icon(get_theme_icon("Clear", "EditorIcons")); + + search_box->set_right_icon(get_theme_icon("Search", "EditorIcons")); search_box->set_clear_button_enabled(true); PopupMenu *p = options->get_popup(); - p->set_item_icon(p->get_item_index(OPTION_CUT), get_icon("ActionCut", "EditorIcons")); - p->set_item_icon(p->get_item_index(OPTION_COPY), get_icon("Duplicate", "EditorIcons")); - p->set_item_icon(p->get_item_index(OPTION_ERASE_SELECTION), get_icon("Remove", "EditorIcons")); + p->set_item_icon(p->get_item_index(OPTION_CUT), get_theme_icon("ActionCut", "EditorIcons")); + p->set_item_icon(p->get_item_index(OPTION_COPY), get_theme_icon("Duplicate", "EditorIcons")); + p->set_item_icon(p->get_item_index(OPTION_ERASE_SELECTION), get_theme_icon("Remove", "EditorIcons")); } break; } @@ -421,7 +421,7 @@ void TileMapEditor::_update_palette() { bool show_tile_ids = bool(EDITOR_DEF("editors/tile_map/show_tile_ids", false)); bool sort_by_name = bool(EDITOR_DEF("editors/tile_map/sort_tiles_by_name", true)); - palette->add_constant_override("hseparation", hseparation * EDSCALE); + palette->add_theme_constant_override("hseparation", hseparation * EDSCALE); palette->set_fixed_icon_size(Size2(min_size, min_size)); palette->set_fixed_column_width(min_size * MAX(size_slider->get_value(), 1)); @@ -1960,7 +1960,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { palette->set_icon_mode(ItemList::ICON_MODE_TOP); palette->set_max_text_lines(2); palette->set_select_mode(ItemList::SELECT_MULTI); - palette->add_constant_override("vseparation", 8 * EDSCALE); + palette->add_theme_constant_override("vseparation", 8 * EDSCALE); palette->connect("item_selected", callable_mp(this, &TileMapEditor::_palette_selected)); palette->connect("multi_selected", callable_mp(this, &TileMapEditor::_palette_multi_selected)); palette_container->add_child(palette); @@ -2031,7 +2031,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { tile_info = memnew(Label); tile_info->set_modulate(Color(1, 1, 1, 0.8)); tile_info->set_mouse_filter(MOUSE_FILTER_IGNORE); - tile_info->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("main", "EditorFonts")); + tile_info->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font("main", "EditorFonts")); // The tile info is only displayed after a tile has been hovered. tile_info->hide(); CanvasItemEditor::get_singleton()->add_control_to_info_overlay(tile_info); @@ -2039,7 +2039,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { // Menu. options = memnew(MenuButton); options->set_text("TileMap"); - options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("TileMap", "EditorIcons")); + options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("TileMap", "EditorIcons")); options->set_process_unhandled_key_input(false); toolbar_right->add_child(options); diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index da0697106c..5d13b834cf 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -284,47 +284,47 @@ void TileSetEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_READY: { - add_constant_override("autohide", 1); // Fixes the dragger always showing up. + add_theme_constant_override("autohide", 1); // Fixes the dragger always showing up. } break; case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { - tileset_toolbar_buttons[TOOL_TILESET_ADD_TEXTURE]->set_icon(get_icon("ToolAddNode", "EditorIcons")); - tileset_toolbar_buttons[TOOL_TILESET_REMOVE_TEXTURE]->set_icon(get_icon("Remove", "EditorIcons")); - tileset_toolbar_tools->set_icon(get_icon("Tools", "EditorIcons")); - - tool_workspacemode[WORKSPACE_EDIT]->set_icon(get_icon("Edit", "EditorIcons")); - tool_workspacemode[WORKSPACE_CREATE_SINGLE]->set_icon(get_icon("AddSingleTile", "EditorIcons")); - tool_workspacemode[WORKSPACE_CREATE_AUTOTILE]->set_icon(get_icon("AddAutotile", "EditorIcons")); - tool_workspacemode[WORKSPACE_CREATE_ATLAS]->set_icon(get_icon("AddAtlasTile", "EditorIcons")); - - tools[TOOL_SELECT]->set_icon(get_icon("ToolSelect", "EditorIcons")); - tools[BITMASK_COPY]->set_icon(get_icon("Duplicate", "EditorIcons")); - tools[BITMASK_PASTE]->set_icon(get_icon("Override", "EditorIcons")); - tools[BITMASK_CLEAR]->set_icon(get_icon("Clear", "EditorIcons")); - tools[SHAPE_NEW_POLYGON]->set_icon(get_icon("CollisionPolygon2D", "EditorIcons")); - tools[SHAPE_NEW_RECTANGLE]->set_icon(get_icon("CollisionShape2D", "EditorIcons")); - tools[SELECT_PREVIOUS]->set_icon(get_icon("ArrowLeft", "EditorIcons")); - tools[SELECT_NEXT]->set_icon(get_icon("ArrowRight", "EditorIcons")); - tools[SHAPE_DELETE]->set_icon(get_icon("Remove", "EditorIcons")); - tools[SHAPE_KEEP_INSIDE_TILE]->set_icon(get_icon("Snap", "EditorIcons")); - tools[TOOL_GRID_SNAP]->set_icon(get_icon("SnapGrid", "EditorIcons")); - tools[ZOOM_OUT]->set_icon(get_icon("ZoomLess", "EditorIcons")); - tools[ZOOM_1]->set_icon(get_icon("ZoomReset", "EditorIcons")); - tools[ZOOM_IN]->set_icon(get_icon("ZoomMore", "EditorIcons")); - tools[VISIBLE_INFO]->set_icon(get_icon("InformationSign", "EditorIcons")); + tileset_toolbar_buttons[TOOL_TILESET_ADD_TEXTURE]->set_icon(get_theme_icon("ToolAddNode", "EditorIcons")); + tileset_toolbar_buttons[TOOL_TILESET_REMOVE_TEXTURE]->set_icon(get_theme_icon("Remove", "EditorIcons")); + tileset_toolbar_tools->set_icon(get_theme_icon("Tools", "EditorIcons")); + + tool_workspacemode[WORKSPACE_EDIT]->set_icon(get_theme_icon("Edit", "EditorIcons")); + tool_workspacemode[WORKSPACE_CREATE_SINGLE]->set_icon(get_theme_icon("AddSingleTile", "EditorIcons")); + tool_workspacemode[WORKSPACE_CREATE_AUTOTILE]->set_icon(get_theme_icon("AddAutotile", "EditorIcons")); + tool_workspacemode[WORKSPACE_CREATE_ATLAS]->set_icon(get_theme_icon("AddAtlasTile", "EditorIcons")); + + tools[TOOL_SELECT]->set_icon(get_theme_icon("ToolSelect", "EditorIcons")); + tools[BITMASK_COPY]->set_icon(get_theme_icon("Duplicate", "EditorIcons")); + tools[BITMASK_PASTE]->set_icon(get_theme_icon("Override", "EditorIcons")); + tools[BITMASK_CLEAR]->set_icon(get_theme_icon("Clear", "EditorIcons")); + tools[SHAPE_NEW_POLYGON]->set_icon(get_theme_icon("CollisionPolygon2D", "EditorIcons")); + tools[SHAPE_NEW_RECTANGLE]->set_icon(get_theme_icon("CollisionShape2D", "EditorIcons")); + tools[SELECT_PREVIOUS]->set_icon(get_theme_icon("ArrowLeft", "EditorIcons")); + tools[SELECT_NEXT]->set_icon(get_theme_icon("ArrowRight", "EditorIcons")); + tools[SHAPE_DELETE]->set_icon(get_theme_icon("Remove", "EditorIcons")); + tools[SHAPE_KEEP_INSIDE_TILE]->set_icon(get_theme_icon("Snap", "EditorIcons")); + tools[TOOL_GRID_SNAP]->set_icon(get_theme_icon("SnapGrid", "EditorIcons")); + tools[ZOOM_OUT]->set_icon(get_theme_icon("ZoomLess", "EditorIcons")); + tools[ZOOM_1]->set_icon(get_theme_icon("ZoomReset", "EditorIcons")); + tools[ZOOM_IN]->set_icon(get_theme_icon("ZoomMore", "EditorIcons")); + tools[VISIBLE_INFO]->set_icon(get_theme_icon("InformationSign", "EditorIcons")); _update_toggle_shape_button(); - tool_editmode[EDITMODE_REGION]->set_icon(get_icon("RegionEdit", "EditorIcons")); - tool_editmode[EDITMODE_COLLISION]->set_icon(get_icon("StaticBody2D", "EditorIcons")); - tool_editmode[EDITMODE_OCCLUSION]->set_icon(get_icon("LightOccluder2D", "EditorIcons")); - tool_editmode[EDITMODE_NAVIGATION]->set_icon(get_icon("Navigation2D", "EditorIcons")); - tool_editmode[EDITMODE_BITMASK]->set_icon(get_icon("PackedDataContainer", "EditorIcons")); - tool_editmode[EDITMODE_PRIORITY]->set_icon(get_icon("MaterialPreviewLight1", "EditorIcons")); - tool_editmode[EDITMODE_ICON]->set_icon(get_icon("LargeTexture", "EditorIcons")); - tool_editmode[EDITMODE_Z_INDEX]->set_icon(get_icon("Sort", "EditorIcons")); + tool_editmode[EDITMODE_REGION]->set_icon(get_theme_icon("RegionEdit", "EditorIcons")); + tool_editmode[EDITMODE_COLLISION]->set_icon(get_theme_icon("StaticBody2D", "EditorIcons")); + tool_editmode[EDITMODE_OCCLUSION]->set_icon(get_theme_icon("LightOccluder2D", "EditorIcons")); + tool_editmode[EDITMODE_NAVIGATION]->set_icon(get_theme_icon("Navigation2D", "EditorIcons")); + tool_editmode[EDITMODE_BITMASK]->set_icon(get_theme_icon("PackedDataContainer", "EditorIcons")); + tool_editmode[EDITMODE_PRIORITY]->set_icon(get_theme_icon("MaterialPreviewLight1", "EditorIcons")); + tool_editmode[EDITMODE_ICON]->set_icon(get_theme_icon("LargeTexture", "EditorIcons")); + tool_editmode[EDITMODE_Z_INDEX]->set_icon(get_theme_icon("Sort", "EditorIcons")); - scroll->add_style_override("bg", get_stylebox("bg", "Tree")); + scroll->add_theme_style_override("bg", get_theme_stylebox("bg", "Tree")); } break; } } @@ -1153,7 +1153,7 @@ void TileSetEditor::_on_workspace_overlay_draw() { else if (tileset->tile_get_tile_mode(t_id) == TileSet::ATLAS_TILE) c = COLOR_ATLAS; String tile_id_name = String::num(t_id, 0) + ": " + tileset->tile_get_name(t_id); - Ref<Font> font = get_font("font", "Label"); + Ref<Font> font = get_theme_font("font", "Label"); region.set_size(font->get_string_size(tile_id_name)); workspace_overlay->draw_rect(region, c); region.position.y += region.size.y - 2; @@ -1167,7 +1167,7 @@ void TileSetEditor::_on_workspace_overlay_draw() { if (t_id < 0) return; - Ref<Texture2D> handle = get_icon("EditorHandle", "EditorIcons"); + Ref<Texture2D> handle = get_theme_icon("EditorHandle", "EditorIcons"); if (draw_handles) { for (int i = 0; i < current_shape.size(); i++) { workspace_overlay->draw_texture(handle, current_shape[i] * workspace->get_scale().x - handle->get_size() * 0.5); @@ -2019,10 +2019,10 @@ void TileSetEditor::_update_toggle_shape_button() { separator_shape_toggle->hide(); tools[SHAPE_TOGGLE_TYPE]->hide(); } else if (concave.is_valid()) { - tools[SHAPE_TOGGLE_TYPE]->set_icon(get_icon("ConvexPolygonShape2D", "EditorIcons")); + tools[SHAPE_TOGGLE_TYPE]->set_icon(get_theme_icon("ConvexPolygonShape2D", "EditorIcons")); tools[SHAPE_TOGGLE_TYPE]->set_text(TTR("Make Convex")); } else if (convex.is_valid()) { - tools[SHAPE_TOGGLE_TYPE]->set_icon(get_icon("ConcavePolygonShape2D", "EditorIcons")); + tools[SHAPE_TOGGLE_TYPE]->set_icon(get_theme_icon("ConcavePolygonShape2D", "EditorIcons")); tools[SHAPE_TOGGLE_TYPE]->set_text(TTR("Make Concave")); } else { // Shouldn't happen diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp index fbd8d3dede..3998a3233b 100644 --- a/editor/plugins/version_control_editor_plugin.cpp +++ b/editor/plugins/version_control_editor_plugin.cpp @@ -217,12 +217,12 @@ void VersionControlEditorPlugin::_stage_selected() { if (file_entry->is_checked(0)) { EditorVCSInterface::get_singleton()->stage_file(file_entry->get_metadata(0)); - file_entry->set_icon_modulate(0, EditorNode::get_singleton()->get_gui_base()->get_color("success_color", "Editor")); + file_entry->set_icon_modulate(0, EditorNode::get_singleton()->get_gui_base()->get_theme_color("success_color", "Editor")); staged_files_count++; } else { EditorVCSInterface::get_singleton()->unstage_file(file_entry->get_metadata(0)); - file_entry->set_icon_modulate(0, EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor")); + file_entry->set_icon_modulate(0, EditorNode::get_singleton()->get_gui_base()->get_theme_color("error_color", "Editor")); } file_entry = file_entry->get_next(); @@ -248,7 +248,7 @@ void VersionControlEditorPlugin::_stage_all() { while (file_entry) { EditorVCSInterface::get_singleton()->stage_file(file_entry->get_metadata(0)); - file_entry->set_icon_modulate(0, EditorNode::get_singleton()->get_gui_base()->get_color("success_color", "Editor")); + file_entry->set_icon_modulate(0, EditorNode::get_singleton()->get_gui_base()->get_theme_color("success_color", "Editor")); file_entry->set_checked(0, true); staged_files_count++; @@ -275,20 +275,20 @@ void VersionControlEditorPlugin::_display_file_diff(String p_file_path) { diff_file_name->set_text(p_file_path); diff->clear(); - diff->push_font(EditorNode::get_singleton()->get_gui_base()->get_font("source", "EditorFonts")); + diff->push_font(EditorNode::get_singleton()->get_gui_base()->get_theme_font("source", "EditorFonts")); for (int i = 0; i < diff_content.size(); i++) { Dictionary line_result = diff_content[i]; if (line_result["status"] == "+") { - diff->push_color(EditorNode::get_singleton()->get_gui_base()->get_color("success_color", "Editor")); + diff->push_color(EditorNode::get_singleton()->get_gui_base()->get_theme_color("success_color", "Editor")); } else if (line_result["status"] == "-") { - diff->push_color(EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor")); + diff->push_color(EditorNode::get_singleton()->get_gui_base()->get_theme_color("error_color", "Editor")); } else { - diff->push_color(EditorNode::get_singleton()->get_gui_base()->get_color("font_color", "Label")); + diff->push_color(EditorNode::get_singleton()->get_gui_base()->get_theme_color("font_color", "Label")); } diff->add_text((String)line_result["content"]); @@ -408,7 +408,6 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { staged_files_count = 0; version_control_actions = memnew(PopupMenu); - version_control_actions->set_v_size_flags(BoxContainer::SIZE_SHRINK_CENTER); set_up_dialog = memnew(AcceptDialog); set_up_dialog->set_title(TTR("Set Up Version Control")); @@ -446,9 +445,6 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { set_up_init_button->connect("pressed", callable_mp(this, &VersionControlEditorPlugin::_initialize_vcs)); set_up_vbc->add_child(set_up_init_button); - version_control_actions->set_v_size_flags(PopupMenu::SIZE_EXPAND_FILL); - version_control_actions->set_h_size_flags(PopupMenu::SIZE_EXPAND_FILL); - version_commit_dock = memnew(VBoxContainer); version_commit_dock->set_visible(false); @@ -470,7 +466,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { refresh_button = memnew(Button); refresh_button->set_tooltip(TTR("Detect new changes")); refresh_button->set_text(TTR("Refresh")); - refresh_button->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Reload", "EditorIcons")); + refresh_button->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("Reload", "EditorIcons")); refresh_button->connect("pressed", callable_mp(this, &VersionControlEditorPlugin::_refresh_stage_area)); stage_tools->add_child(refresh_button); @@ -495,11 +491,11 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { change_type_to_strings[CHANGE_TYPE_DELETED] = TTR("Deleted"); change_type_to_strings[CHANGE_TYPE_TYPECHANGE] = TTR("Typechange"); - change_type_to_color[CHANGE_TYPE_NEW] = EditorNode::get_singleton()->get_gui_base()->get_color("success_color", "Editor"); - change_type_to_color[CHANGE_TYPE_MODIFIED] = EditorNode::get_singleton()->get_gui_base()->get_color("warning_color", "Editor"); - change_type_to_color[CHANGE_TYPE_RENAMED] = EditorNode::get_singleton()->get_gui_base()->get_color("disabled_font_color", "Editor"); - change_type_to_color[CHANGE_TYPE_DELETED] = EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor"); - change_type_to_color[CHANGE_TYPE_TYPECHANGE] = EditorNode::get_singleton()->get_gui_base()->get_color("font_color", "Editor"); + change_type_to_color[CHANGE_TYPE_NEW] = EditorNode::get_singleton()->get_gui_base()->get_theme_color("success_color", "Editor"); + change_type_to_color[CHANGE_TYPE_MODIFIED] = EditorNode::get_singleton()->get_gui_base()->get_theme_color("warning_color", "Editor"); + change_type_to_color[CHANGE_TYPE_RENAMED] = EditorNode::get_singleton()->get_gui_base()->get_theme_color("disabled_font_color", "Editor"); + change_type_to_color[CHANGE_TYPE_DELETED] = EditorNode::get_singleton()->get_gui_base()->get_theme_color("error_color", "Editor"); + change_type_to_color[CHANGE_TYPE_TYPECHANGE] = EditorNode::get_singleton()->get_gui_base()->get_theme_color("font_color", "Editor"); stage_buttons = memnew(HSplitContainer); stage_buttons->set_dragger_visibility(SplitContainer::DRAGGER_HIDDEN_COLLAPSED); @@ -562,7 +558,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { diff_refresh_button = memnew(Button); diff_refresh_button->set_tooltip(TTR("Detect changes in file diff")); - diff_refresh_button->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Reload", "EditorIcons")); + diff_refresh_button->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("Reload", "EditorIcons")); diff_refresh_button->connect("pressed", callable_mp(this, &VersionControlEditorPlugin::_refresh_file_diff)); diff_hbc->add_child(diff_refresh_button); diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index d4db16641a..36f81b21ba 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -313,8 +313,8 @@ void VisualShaderEditor::_update_options_menu() { bool is_first_item = true; - Color unsupported_color = get_color("error_color", "Editor"); - Color supported_color = get_color("warning_color", "Editor"); + Color unsupported_color = get_theme_color("error_color", "Editor"); + Color supported_color = get_theme_color("warning_color", "Editor"); static bool low_driver = ProjectSettings::get_singleton()->get("rendering/quality/driver/driver_name") == "GLES2"; @@ -386,22 +386,22 @@ void VisualShaderEditor::_update_options_menu() { } switch (options[i].return_type) { case VisualShaderNode::PORT_TYPE_SCALAR: - item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_icon("float", "EditorIcons")); + item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_theme_icon("float", "EditorIcons")); break; case VisualShaderNode::PORT_TYPE_SCALAR_INT: - item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_icon("int", "EditorIcons")); + item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_theme_icon("int", "EditorIcons")); break; case VisualShaderNode::PORT_TYPE_VECTOR: - item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_icon("Vector3", "EditorIcons")); + item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_theme_icon("Vector3", "EditorIcons")); break; case VisualShaderNode::PORT_TYPE_BOOLEAN: - item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_icon("bool", "EditorIcons")); + item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_theme_icon("bool", "EditorIcons")); break; case VisualShaderNode::PORT_TYPE_TRANSFORM: - item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_icon("Transform", "EditorIcons")); + item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_theme_icon("Transform", "EditorIcons")); break; case VisualShaderNode::PORT_TYPE_SAMPLER: - item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_icon("ImageTexture", "EditorIcons")); + item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_theme_icon("ImageTexture", "EditorIcons")); break; default: break; @@ -421,7 +421,7 @@ void VisualShaderEditor::_draw_color_over_button(Object *obj, Color p_color) { if (!button) return; - Ref<StyleBox> normal = get_stylebox("normal", "Button"); + Ref<StyleBox> normal = get_theme_stylebox("normal", "Button"); button->draw_rect(Rect2(normal->get_offset(), button->get_size() - normal->get_minimum_size()), p_color); } @@ -437,7 +437,7 @@ static Ref<StyleBoxEmpty> make_empty_stylebox(float p_margin_left = -1, float p_ void VisualShaderEditor::_update_created_node(GraphNode *node) { if (EditorSettings::get_singleton()->get("interface/theme/use_graph_node_headers")) { - Ref<StyleBoxFlat> sb = node->get_stylebox("frame", "GraphNode"); + Ref<StyleBoxFlat> sb = node->get_theme_stylebox("frame", "GraphNode"); Color c = sb->get_border_color(); Color ic; Color mono_color; @@ -451,10 +451,10 @@ void VisualShaderEditor::_update_created_node(GraphNode *node) { mono_color.a = 0.85; c = mono_color; - node->add_color_override("title_color", c); + node->add_theme_color_override("title_color", c); c.a = 0.7; - node->add_color_override("close_color", c); - node->add_color_override("resizer_color", ic); + node->add_theme_color_override("close_color", c); + node->add_theme_color_override("resizer_color", ic); } } @@ -642,7 +642,7 @@ void VisualShaderEditor::_update_graph() { } HBoxContainer *hb = memnew(HBoxContainer); - hb->add_constant_override("separation", 7 * EDSCALE); + hb->add_theme_constant_override("separation", 7 * EDSCALE); Variant default_value; @@ -706,7 +706,7 @@ void VisualShaderEditor::_update_graph() { name_box->connect("focus_exited", callable_mp(this, &VisualShaderEditor::_port_name_focus_out), varray(name_box, nodes[n_i], i, false)); Button *remove_btn = memnew(Button); - remove_btn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Remove", "EditorIcons")); + remove_btn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("Remove", "EditorIcons")); remove_btn->set_tooltip(TTR("Remove") + " " + name_left); remove_btn->connect("pressed", callable_mp(this, &VisualShaderEditor::_remove_input_port), varray(nodes[n_i], i), CONNECT_DEFERRED); hb->add_child(remove_btn); @@ -714,15 +714,15 @@ void VisualShaderEditor::_update_graph() { Label *label = memnew(Label); label->set_text(name_left); - label->add_style_override("normal", label_style); //more compact + label->add_theme_style_override("normal", label_style); //more compact hb->add_child(label); if (vsnode->get_input_port_default_hint(i) != "" && !port_left_used) { Label *hint_label = memnew(Label); hint_label->set_text("[" + vsnode->get_input_port_default_hint(i) + "]"); - hint_label->add_color_override("font_color", get_color("font_color_readonly", "TextEdit")); - hint_label->add_style_override("normal", label_style); + hint_label->add_theme_color_override("font_color", get_theme_color("font_color_readonly", "TextEdit")); + hint_label->add_theme_style_override("normal", label_style); hb->add_child(hint_label); } } @@ -735,7 +735,7 @@ void VisualShaderEditor::_update_graph() { if (valid_right) { if (is_group) { Button *remove_btn = memnew(Button); - remove_btn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Remove", "EditorIcons")); + remove_btn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("Remove", "EditorIcons")); remove_btn->set_tooltip(TTR("Remove") + " " + name_left); remove_btn->connect("pressed", callable_mp(this, &VisualShaderEditor::_remove_output_port), varray(nodes[n_i], i), CONNECT_DEFERRED); hb->add_child(remove_btn); @@ -761,7 +761,7 @@ void VisualShaderEditor::_update_graph() { } else { Label *label = memnew(Label); label->set_text(name_right); - label->add_style_override("normal", label_style); //more compact + label->add_theme_style_override("normal", label_style); //more compact hb->add_child(label); } } @@ -770,8 +770,8 @@ void VisualShaderEditor::_update_graph() { if (valid_right && edit_type->get_selected() == VisualShader::TYPE_FRAGMENT && port_right != VisualShaderNode::PORT_TYPE_TRANSFORM && port_right != VisualShaderNode::PORT_TYPE_SAMPLER) { TextureButton *preview = memnew(TextureButton); preview->set_toggle_mode(true); - preview->set_normal_texture(get_icon("GuiVisibilityHidden", "EditorIcons")); - preview->set_pressed_texture(get_icon("GuiVisibilityVisible", "EditorIcons")); + preview->set_normal_texture(get_theme_icon("GuiVisibilityHidden", "EditorIcons")); + preview->set_pressed_texture(get_theme_icon("GuiVisibilityVisible", "EditorIcons")); preview->set_v_size_flags(SIZE_SHRINK_CENTER); if (vsnode->get_output_port_for_preview() == i) { @@ -816,7 +816,7 @@ void VisualShaderEditor::_update_graph() { String error = vsnode->get_warning(visual_shader->get_mode(), type); if (error != String()) { Label *error_label = memnew(Label); - error_label->add_color_override("font_color", get_color("error_color", "Editor")); + error_label->add_theme_color_override("font_color", get_theme_color("error_color", "Editor")); error_label->set_text(error); node->add_child(error_label); } @@ -834,16 +834,16 @@ void VisualShaderEditor::_update_graph() { Color symbol_color = EDITOR_GET("text_editor/highlighting/symbol_color"); expression_box->set_syntax_coloring(true); - expression_box->add_color_override("background_color", background_color); + expression_box->add_theme_color_override("background_color", background_color); for (List<String>::Element *E = keyword_list.front(); E; E = E->next()) { expression_box->add_keyword_color(E->get(), keyword_color); } - expression_box->add_font_override("font", get_font("expression", "EditorFonts")); - expression_box->add_color_override("font_color", text_color); - expression_box->add_color_override("symbol_color", symbol_color); + expression_box->add_theme_font_override("font", get_theme_font("expression", "EditorFonts")); + expression_box->add_theme_color_override("font_color", text_color); + expression_box->add_theme_color_override("symbol_color", symbol_color); expression_box->add_color_region("/*", "*/", comment_color, false); expression_box->add_color_region("//", "", comment_color, false); @@ -1273,7 +1273,7 @@ void VisualShaderEditor::_edit_port_default_input(Object *p_button, int p_node, Button *button = Object::cast_to<Button>(p_button); ERR_FAIL_COND(!button); Variant value = vsn->get_input_port_default_value(p_port); - property_editor->set_global_position(button->get_global_position() + Vector2(0, button->get_size().height)); + property_editor->set_position(button->get_screen_position() + Vector2(0, button->get_size().height)); property_editor->edit(NULL, "", value.get_type(), value, 0, ""); property_editor->popup(); editing_node = p_node; @@ -1704,14 +1704,14 @@ void VisualShaderEditor::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { - highend_label->set_modulate(get_color("vulkan_color", "Editor")); + highend_label->set_modulate(get_theme_color("vulkan_color", "Editor")); - error_panel->add_style_override("panel", get_stylebox("bg", "Tree")); - error_label->add_color_override("font_color", get_color("error_color", "Editor")); + error_panel->add_theme_style_override("panel", get_theme_stylebox("bg", "Tree")); + error_label->add_theme_color_override("font_color", get_theme_color("error_color", "Editor")); - node_filter->set_right_icon(Control::get_icon("Search", "EditorIcons")); + node_filter->set_right_icon(Control::get_theme_icon("Search", "EditorIcons")); - preview_shader->set_icon(Control::get_icon("Shader", "EditorIcons")); + preview_shader->set_icon(Control::get_theme_icon("Shader", "EditorIcons")); { Color background_color = EDITOR_GET("text_editor/highlighting/background_color"); @@ -1720,24 +1720,24 @@ void VisualShaderEditor::_notification(int p_what) { Color comment_color = EDITOR_GET("text_editor/highlighting/comment_color"); Color symbol_color = EDITOR_GET("text_editor/highlighting/symbol_color"); - preview_text->add_color_override("background_color", background_color); + preview_text->add_theme_color_override("background_color", background_color); for (List<String>::Element *E = keyword_list.front(); E; E = E->next()) { preview_text->add_keyword_color(E->get(), keyword_color); } - preview_text->add_font_override("font", get_font("expression", "EditorFonts")); - preview_text->add_color_override("font_color", text_color); - preview_text->add_color_override("symbol_color", symbol_color); + preview_text->add_theme_font_override("font", get_theme_font("expression", "EditorFonts")); + preview_text->add_theme_color_override("font_color", text_color); + preview_text->add_theme_color_override("symbol_color", symbol_color); preview_text->add_color_region("/*", "*/", comment_color, false); preview_text->add_color_region("//", "", comment_color, false); - error_text->add_font_override("font", get_font("status_source", "EditorFonts")); - error_text->add_color_override("font_color", get_color("error_color", "Editor")); + error_text->add_theme_font_override("font", get_theme_font("status_source", "EditorFonts")); + error_text->add_theme_color_override("font_color", get_theme_color("error_color", "Editor")); } - tools->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Tools", "EditorIcons")); + tools->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("Tools", "EditorIcons")); if (p_what == NOTIFICATION_THEME_CHANGED && is_visible_in_tree()) _update_graph(); @@ -2980,12 +2980,12 @@ public: void setup(const Ref<VisualShaderNodeInput> &p_input) { input = p_input; Ref<Texture2D> type_icon[6] = { - EditorNode::get_singleton()->get_gui_base()->get_icon("float", "EditorIcons"), - EditorNode::get_singleton()->get_gui_base()->get_icon("int", "EditorIcons"), - EditorNode::get_singleton()->get_gui_base()->get_icon("Vector3", "EditorIcons"), - EditorNode::get_singleton()->get_gui_base()->get_icon("bool", "EditorIcons"), - EditorNode::get_singleton()->get_gui_base()->get_icon("Transform", "EditorIcons"), - EditorNode::get_singleton()->get_gui_base()->get_icon("ImageTexture", "EditorIcons"), + EditorNode::get_singleton()->get_gui_base()->get_theme_icon("float", "EditorIcons"), + EditorNode::get_singleton()->get_gui_base()->get_theme_icon("int", "EditorIcons"), + EditorNode::get_singleton()->get_gui_base()->get_theme_icon("Vector3", "EditorIcons"), + EditorNode::get_singleton()->get_gui_base()->get_theme_icon("bool", "EditorIcons"), + EditorNode::get_singleton()->get_gui_base()->get_theme_icon("Transform", "EditorIcons"), + EditorNode::get_singleton()->get_gui_base()->get_theme_icon("ImageTexture", "EditorIcons"), }; add_item("[None]"); diff --git a/editor/progress_dialog.cpp b/editor/progress_dialog.cpp index 74438bb95d..859718cba4 100644 --- a/editor/progress_dialog.cpp +++ b/editor/progress_dialog.cpp @@ -138,16 +138,6 @@ void BackgroundProgress::end_task(const String &p_task) { ProgressDialog *ProgressDialog::singleton = NULL; void ProgressDialog::_notification(int p_what) { - - switch (p_what) { - - case NOTIFICATION_DRAW: { - - Ref<StyleBox> style = get_stylebox("panel", "PopupMenu"); - draw_style_box(style, Rect2(Point2(), get_size())); - - } break; - } } void ProgressDialog::_popup() { @@ -155,15 +145,15 @@ void ProgressDialog::_popup() { Size2 ms = main->get_combined_minimum_size(); ms.width = MAX(500 * EDSCALE, ms.width); - Ref<StyleBox> style = get_stylebox("panel", "PopupMenu"); + Ref<StyleBox> style = main->get_theme_stylebox("panel", "PopupMenu"); ms += style->get_minimum_size(); main->set_margin(MARGIN_LEFT, style->get_margin(MARGIN_LEFT)); main->set_margin(MARGIN_RIGHT, -style->get_margin(MARGIN_RIGHT)); main->set_margin(MARGIN_TOP, style->get_margin(MARGIN_TOP)); main->set_margin(MARGIN_BOTTOM, -style->get_margin(MARGIN_BOTTOM)); - raise(); - popup_centered_size(ms); + //raise(); + popup_centered(ms); } void ProgressDialog::add_task(const String &p_task, const String &p_label, int p_steps, bool p_can_cancel) { diff --git a/editor/progress_dialog.h b/editor/progress_dialog.h index e01c7d802b..82f479ae9d 100644 --- a/editor/progress_dialog.h +++ b/editor/progress_dialog.h @@ -68,9 +68,9 @@ public: BackgroundProgress() {} }; -class ProgressDialog : public Popup { +class ProgressDialog : public PopupPanel { - GDCLASS(ProgressDialog, Popup); + GDCLASS(ProgressDialog, PopupPanel); struct Task { String task; diff --git a/editor/project_export.cpp b/editor/project_export.cpp index 30f4111524..39c24519c0 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -49,11 +49,11 @@ #include "servers/display_server.h" void ProjectExportDialog::_theme_changed() { - duplicate_preset->set_icon(presets->get_icon("Duplicate", "EditorIcons")); - delete_preset->set_icon(presets->get_icon("Remove", "EditorIcons")); + duplicate_preset->set_icon(presets->get_theme_icon("Duplicate", "EditorIcons")); + delete_preset->set_icon(presets->get_theme_icon("Remove", "EditorIcons")); Control *panel = custom_feature_display->get_parent_control(); if (panel) - panel->add_style_override("panel", patches->get_stylebox("bg", "Tree")); + panel->add_theme_style_override("panel", patches->get_theme_stylebox("bg", "Tree")); } void ProjectExportDialog::_notification(int p_what) { @@ -64,10 +64,10 @@ void ProjectExportDialog::_notification(int p_what) { } } break; case NOTIFICATION_READY: { - duplicate_preset->set_icon(presets->get_icon("Duplicate", "EditorIcons")); - delete_preset->set_icon(presets->get_icon("Remove", "EditorIcons")); + duplicate_preset->set_icon(presets->get_theme_icon("Duplicate", "EditorIcons")); + delete_preset->set_icon(presets->get_theme_icon("Remove", "EditorIcons")); connect("confirmed", callable_mp(this, &ProjectExportDialog::_export_pck_zip)); - custom_feature_display->get_parent_control()->add_style_override("panel", patches->get_stylebox("bg", "Tree")); + custom_feature_display->get_parent_control()->add_theme_style_override("panel", patches->get_theme_stylebox("bg", "Tree")); } break; } } @@ -250,8 +250,8 @@ void ProjectExportDialog::_edit_preset(int p_index) { patch->set_checked(0, true); patch->set_tooltip(0, patchlist[i]); patch->set_metadata(0, i); - patch->add_button(0, presets->get_icon("Remove", "EditorIcons"), 0); - patch->add_button(0, presets->get_icon("folder", "FileDialog"), 1); + patch->add_button(0, presets->get_theme_icon("Remove", "EditorIcons"), 0); + patch->add_button(0, presets->get_theme_icon("folder", "FileDialog"), 1); } TreeItem *patch_add = patches->create_item(patch_root); @@ -261,7 +261,7 @@ void ProjectExportDialog::_edit_preset(int p_index) { else patch_add->set_text(0, TTR("Add previous patches...")); - patch_add->add_button(0, presets->get_icon("folder", "FileDialog"), 1); + patch_add->add_button(0, presets->get_theme_icon("folder", "FileDialog"), 1); _fill_resource_tree(); @@ -819,7 +819,7 @@ void ProjectExportDialog::_fill_resource_tree() { bool ProjectExportDialog::_fill_tree(EditorFileSystemDirectory *p_dir, TreeItem *p_item, Ref<EditorExportPreset> ¤t, bool p_only_scenes) { - p_item->set_icon(0, presets->get_icon("folder", "FileDialog")); + p_item->set_icon(0, presets->get_theme_icon("folder", "FileDialog")); p_item->set_text(0, p_dir->get_name() + "/"); bool used = false; @@ -1229,7 +1229,7 @@ ProjectExportDialog::ProjectExportDialog() { script_key->connect("text_changed", callable_mp(this, &ProjectExportDialog::_script_encryption_key_changed)); script_key_error = memnew(Label); script_key_error->set_text("- " + TTR("Invalid Encryption Key (must be 64 characters long)")); - script_key_error->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor")); + script_key_error->add_theme_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_theme_color("error_color", "Editor")); script_vb->add_margin_child(TTR("Script Encryption Key (256-bits as hex):"), script_key); script_vb->add_child(script_key_error); sections->add_child(script_vb); @@ -1289,7 +1289,7 @@ ProjectExportDialog::ProjectExportDialog() { export_error = memnew(Label); main_vb->add_child(export_error); export_error->hide(); - export_error->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor")); + export_error->add_theme_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_theme_color("error_color", "Editor")); export_templates_error = memnew(HBoxContainer); main_vb->add_child(export_templates_error); @@ -1297,7 +1297,7 @@ ProjectExportDialog::ProjectExportDialog() { Label *export_error2 = memnew(Label); export_templates_error->add_child(export_error2); - export_error2->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor")); + export_error2->add_theme_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_theme_color("error_color", "Editor")); export_error2->set_text(" - " + TTR("Export templates for this platform are missing:") + " "); error_dialog = memnew(AcceptDialog); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index aed7c91d96..168decd788 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -117,22 +117,22 @@ private: case MESSAGE_ERROR: { - msg->add_color_override("font_color", msg->get_color("error_color", "Editor")); + msg->add_theme_color_override("font_color", msg->get_theme_color("error_color", "Editor")); msg->set_modulate(Color(1, 1, 1, 1)); - new_icon = msg->get_icon("StatusError", "EditorIcons"); + new_icon = msg->get_theme_icon("StatusError", "EditorIcons"); } break; case MESSAGE_WARNING: { - msg->add_color_override("font_color", msg->get_color("warning_color", "Editor")); + msg->add_theme_color_override("font_color", msg->get_theme_color("warning_color", "Editor")); msg->set_modulate(Color(1, 1, 1, 1)); - new_icon = msg->get_icon("StatusWarning", "EditorIcons"); + new_icon = msg->get_theme_icon("StatusWarning", "EditorIcons"); } break; case MESSAGE_SUCCESS: { msg->set_modulate(Color(1, 1, 1, 0)); - new_icon = msg->get_icon("StatusSuccess", "EditorIcons"); + new_icon = msg->get_theme_icon("StatusSuccess", "EditorIcons"); } break; } @@ -500,7 +500,7 @@ private: if (ProjectSettings::get_singleton()->save_custom(dir.plus_file("project.godot"), initial_settings, Vector<String>(), false) != OK) { set_message(TTR("Couldn't create project.godot in project path."), MESSAGE_ERROR); } else { - ResourceSaver::save(dir.plus_file("icon.png"), msg->get_icon("DefaultProjectIcon", "EditorIcons")); + ResourceSaver::save(dir.plus_file("icon.png"), msg->get_theme_icon("DefaultProjectIcon", "EditorIcons")); FileAccess *f = FileAccess::open(dir.plus_file("default_env.tres"), FileAccess::WRITE); if (!f) { @@ -649,10 +649,10 @@ private: project_name->clear(); _text_changed(""); - if (status_rect->get_texture() == msg->get_icon("StatusError", "EditorIcons")) + if (status_rect->get_texture() == msg->get_theme_icon("StatusError", "EditorIcons")) msg->show(); - if (install_status_rect->get_texture() == msg->get_icon("StatusError", "EditorIcons")) + if (install_status_rect->get_texture() == msg->get_theme_icon("StatusError", "EditorIcons")) msg->show(); } @@ -977,7 +977,7 @@ public: } break; case NOTIFICATION_DRAW: { if (hover) { - draw_style_box(get_stylebox("hover", "Tree"), Rect2(Point2(), get_size() - Size2(10, 0) * EDSCALE)); + draw_style_box(get_theme_stylebox("hover", "Tree"), Rect2(Point2(), get_size() - Size2(10, 0) * EDSCALE)); } } break; } @@ -1152,7 +1152,7 @@ void ProjectList::_notification(int p_what) { void ProjectList::load_project_icon(int p_index) { Item &item = _projects.write[p_index]; - Ref<Texture2D> default_icon = get_icon("DefaultProjectIcon", "EditorIcons"); + Ref<Texture2D> default_icon = get_theme_icon("DefaultProjectIcon", "EditorIcons"); Ref<Texture2D> icon; if (item.icon != "") { Ref<Image> img; @@ -1322,13 +1322,13 @@ void ProjectList::create_project_item_control(int p_index) { Item &item = _projects.write[p_index]; ERR_FAIL_COND(item.control != NULL); // Already created - Ref<Texture2D> favorite_icon = get_icon("Favorites", "EditorIcons"); - Color font_color = get_color("font_color", "Tree"); + Ref<Texture2D> favorite_icon = get_theme_icon("Favorites", "EditorIcons"); + Color font_color = get_theme_color("font_color", "Tree"); ProjectListItemControl *hb = memnew(ProjectListItemControl); hb->connect("draw", callable_mp(this, &ProjectList::_panel_draw), varray(hb)); hb->connect("gui_input", callable_mp(this, &ProjectList::_panel_input), varray(hb)); - hb->add_constant_override("separation", 10 * EDSCALE); + hb->add_theme_constant_override("separation", 10 * EDSCALE); hb->set_tooltip(item.description); VBoxContainer *favorite_box = memnew(VBoxContainer); @@ -1348,7 +1348,7 @@ void ProjectList::create_project_item_control(int p_index) { TextureRect *tf = memnew(TextureRect); // The project icon may not be loaded by the time the control is displayed, // so use a loading placeholder. - tf->set_texture(get_icon("ProjectIconLoading", "EditorIcons")); + tf->set_texture(get_theme_icon("ProjectIconLoading", "EditorIcons")); tf->set_v_size_flags(SIZE_SHRINK_CENTER); if (item.missing) { tf->set_modulate(Color(1, 1, 1, 0.5)); @@ -1366,8 +1366,8 @@ void ProjectList::create_project_item_control(int p_index) { ec->set_mouse_filter(MOUSE_FILTER_PASS); vb->add_child(ec); Label *title = memnew(Label(!item.missing ? item.project_name : TTR("Missing Project"))); - title->add_font_override("font", get_font("title", "EditorFonts")); - title->add_color_override("font_color", font_color); + title->add_theme_font_override("font", get_theme_font("title", "EditorFonts")); + title->add_theme_color_override("font_color", font_color); title->set_clip_text(true); vb->add_child(title); @@ -1377,7 +1377,7 @@ void ProjectList::create_project_item_control(int p_index) { Button *show = memnew(Button); // Display a folder icon if the project directory can be opened, or a "broken file" icon if it can't - show->set_icon(get_icon(!item.missing ? "Load" : "FileBroken", "EditorIcons")); + show->set_icon(get_theme_icon(!item.missing ? "Load" : "FileBroken", "EditorIcons")); show->set_flat(true); if (!item.grayed) { // Don't make the icon less prominent if the parent is already grayed out @@ -1396,7 +1396,7 @@ void ProjectList::create_project_item_control(int p_index) { path_hb->add_child(fpath); fpath->set_h_size_flags(Control::SIZE_EXPAND_FILL); fpath->set_modulate(Color(1, 1, 1, 0.5)); - fpath->add_color_override("font_color", font_color); + fpath->add_theme_color_override("font_color", font_color); fpath->set_clip_text(true); _scroll_children->add_child(hb); @@ -1728,12 +1728,12 @@ void ProjectList::erase_selected_projects() { void ProjectList::_panel_draw(Node *p_hb) { Control *hb = Object::cast_to<Control>(p_hb); - hb->draw_line(Point2(0, hb->get_size().y + 1), Point2(hb->get_size().x - 10, hb->get_size().y + 1), get_color("guide_color", "Tree")); + hb->draw_line(Point2(0, hb->get_size().y + 1), Point2(hb->get_size().x - 10, hb->get_size().y + 1), get_theme_color("guide_color", "Tree")); String key = _projects[p_hb->get_index()].project_key; if (_selected_project_keys.has(key)) { - hb->draw_style_box(get_stylebox("selected", "Tree"), Rect2(Point2(), hb->get_size() - Size2(10, 0) * EDSCALE)); + hb->draw_style_box(get_theme_stylebox("selected", "Tree"), Rect2(Point2(), hb->get_size() - Size2(10, 0) * EDSCALE)); } } @@ -2296,7 +2296,7 @@ void ProjectManager::_language_selected(int p_id) { String lang = language_btn->get_item_metadata(p_id); EditorSettings::get_singleton()->set("interface/editor/editor_language", lang); language_btn->set_text(lang); - language_btn->set_icon(get_icon("Environment", "EditorIcons")); + language_btn->set_icon(get_theme_icon("Environment", "EditorIcons")); language_restart_ask->set_text(TTR("Language changed.\nThe interface will update after restarting the editor or project manager.")); language_restart_ask->popup_centered(); @@ -2457,7 +2457,7 @@ ProjectManager::ProjectManager() { Panel *panel = memnew(Panel); gui_base->add_child(panel); panel->set_anchors_and_margins_preset(Control::PRESET_WIDE); - panel->add_style_override("panel", gui_base->get_stylebox("Background", "EditorStyles")); + panel->add_theme_style_override("panel", gui_base->get_theme_stylebox("Background", "EditorStyles")); VBoxContainer *vb = memnew(VBoxContainer); panel->add_child(vb); @@ -2517,7 +2517,7 @@ ProjectManager::ProjectManager() { search_tree_vb->add_child(sort_filters); PanelContainer *pc = memnew(PanelContainer); - pc->add_style_override("panel", gui_base->get_stylebox("bg", "Tree")); + pc->add_theme_style_override("panel", gui_base->get_theme_stylebox("bg", "Tree")); search_tree_vb->add_child(pc); pc->set_v_size_flags(Control::SIZE_EXPAND_FILL); @@ -2637,7 +2637,7 @@ ProjectManager::ProjectManager() { language_btn->set_text(lang); } } - language_btn->set_icon(get_icon("Environment", "EditorIcons")); + language_btn->set_icon(get_theme_icon("Environment", "EditorIcons")); settings_hb->add_child(language_btn); language_btn->connect("item_selected", callable_mp(this, &ProjectManager::_language_selected)); @@ -2754,7 +2754,7 @@ void ProjectListFilter::_filter_option_selected(int p_idx) { void ProjectListFilter::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE && has_search_box) { - search_box->set_right_icon(get_icon("Search", "EditorIcons")); + search_box->set_right_icon(get_theme_icon("Search", "EditorIcons")); search_box->set_clear_button_enabled(true); } } diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index af8ad48aae..dfecadeda5 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -108,19 +108,19 @@ void ProjectSettingsEditor::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { globals_editor->edit(ProjectSettings::get_singleton()); - search_button->set_icon(input_editor->get_icon("Search", "EditorIcons")); - search_box->set_right_icon(input_editor->get_icon("Search", "EditorIcons")); + search_button->set_icon(input_editor->get_theme_icon("Search", "EditorIcons")); + search_box->set_right_icon(input_editor->get_theme_icon("Search", "EditorIcons")); search_box->set_clear_button_enabled(true); - action_add_error->add_color_override("font_color", input_editor->get_color("error_color", "Editor")); + action_add_error->add_theme_color_override("font_color", input_editor->get_theme_color("error_color", "Editor")); translation_list->connect("button_pressed", callable_mp(this, &ProjectSettingsEditor::_translation_delete)); _update_actions(); - popup_add->add_icon_item(input_editor->get_icon("Keyboard", "EditorIcons"), TTR("Key"), INPUT_KEY); - popup_add->add_icon_item(input_editor->get_icon("KeyboardPhysical", "EditorIcons"), TTR("Physical Key"), INPUT_KEY_PHYSICAL); - popup_add->add_icon_item(input_editor->get_icon("JoyButton", "EditorIcons"), TTR("Joy Button"), INPUT_JOY_BUTTON); - popup_add->add_icon_item(input_editor->get_icon("JoyAxis", "EditorIcons"), TTR("Joy Axis"), INPUT_JOY_MOTION); - popup_add->add_icon_item(input_editor->get_icon("Mouse", "EditorIcons"), TTR("Mouse Button"), INPUT_MOUSE_BUTTON); + popup_add->add_icon_item(input_editor->get_theme_icon("Keyboard", "EditorIcons"), TTR("Key"), INPUT_KEY); + popup_add->add_icon_item(input_editor->get_theme_icon("KeyboardPhysical", "EditorIcons"), TTR("Physical Key"), INPUT_KEY_PHYSICAL); + popup_add->add_icon_item(input_editor->get_theme_icon("JoyButton", "EditorIcons"), TTR("Joy Button"), INPUT_JOY_BUTTON); + popup_add->add_icon_item(input_editor->get_theme_icon("JoyAxis", "EditorIcons"), TTR("Joy Axis"), INPUT_JOY_MOTION); + popup_add->add_icon_item(input_editor->get_theme_icon("Mouse", "EditorIcons"), TTR("Mouse Button"), INPUT_MOUSE_BUTTON); List<String> tfn; ResourceLoader::get_recognized_extensions_for_type("Translation", &tfn); @@ -137,22 +137,22 @@ void ProjectSettingsEditor::_notification(int p_what) { translation_res_option_file_open->add_filter("*." + E->get()); } - restart_close_button->set_icon(input_editor->get_icon("Close", "EditorIcons")); - restart_container->add_style_override("panel", input_editor->get_stylebox("bg", "Tree")); - restart_icon->set_texture(input_editor->get_icon("StatusWarning", "EditorIcons")); - restart_label->add_color_override("font_color", input_editor->get_color("warning_color", "Editor")); + restart_close_button->set_icon(input_editor->get_theme_icon("Close", "EditorIcons")); + restart_container->add_theme_style_override("panel", input_editor->get_theme_stylebox("bg", "Tree")); + restart_icon->set_texture(input_editor->get_theme_icon("StatusWarning", "EditorIcons")); + restart_label->add_theme_color_override("font_color", input_editor->get_theme_color("warning_color", "Editor")); } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - search_button->set_icon(input_editor->get_icon("Search", "EditorIcons")); - search_box->set_right_icon(input_editor->get_icon("Search", "EditorIcons")); + search_button->set_icon(input_editor->get_theme_icon("Search", "EditorIcons")); + search_box->set_right_icon(input_editor->get_theme_icon("Search", "EditorIcons")); search_box->set_clear_button_enabled(true); - action_add_error->add_color_override("font_color", input_editor->get_color("error_color", "Editor")); - popup_add->set_item_icon(popup_add->get_item_index(INPUT_KEY), input_editor->get_icon("Keyboard", "EditorIcons")); - popup_add->set_item_icon(popup_add->get_item_index(INPUT_KEY_PHYSICAL), input_editor->get_icon("KeyboardPhysical", "EditorIcons")); - popup_add->set_item_icon(popup_add->get_item_index(INPUT_JOY_BUTTON), input_editor->get_icon("JoyButton", "EditorIcons")); - popup_add->set_item_icon(popup_add->get_item_index(INPUT_JOY_MOTION), input_editor->get_icon("JoyAxis", "EditorIcons")); - popup_add->set_item_icon(popup_add->get_item_index(INPUT_MOUSE_BUTTON), input_editor->get_icon("Mouse", "EditorIcons")); + action_add_error->add_theme_color_override("font_color", input_editor->get_theme_color("error_color", "Editor")); + popup_add->set_item_icon(popup_add->get_item_index(INPUT_KEY), input_editor->get_theme_icon("Keyboard", "EditorIcons")); + popup_add->set_item_icon(popup_add->get_item_index(INPUT_KEY_PHYSICAL), input_editor->get_theme_icon("KeyboardPhysical", "EditorIcons")); + popup_add->set_item_icon(popup_add->get_item_index(INPUT_JOY_BUTTON), input_editor->get_theme_icon("JoyButton", "EditorIcons")); + popup_add->set_item_icon(popup_add->get_item_index(INPUT_JOY_MOTION), input_editor->get_theme_icon("JoyAxis", "EditorIcons")); + popup_add->set_item_icon(popup_add->get_item_index(INPUT_MOUSE_BUTTON), input_editor->get_theme_icon("Mouse", "EditorIcons")); _update_actions(); } break; } @@ -740,7 +740,7 @@ void ProjectSettingsEditor::_update_actions() { TreeItem *item = input_editor->create_item(root); item->set_text(0, name); - item->set_custom_bg_color(0, input_editor->get_color("prop_subsection", "Editor")); + item->set_custom_bg_color(0, input_editor->get_theme_color("prop_subsection", "Editor")); if (collapsed.has(name)) item->set_collapsed(collapsed[name]); @@ -748,12 +748,12 @@ void ProjectSettingsEditor::_update_actions() { item->set_cell_mode(1, TreeItem::CELL_MODE_RANGE); item->set_range_config(1, 0.0, 1.0, 0.01); item->set_range(1, action["deadzone"]); - item->set_custom_bg_color(1, input_editor->get_color("prop_subsection", "Editor")); + item->set_custom_bg_color(1, input_editor->get_theme_color("prop_subsection", "Editor")); const bool is_builtin_input = ProjectSettings::get_singleton()->get_input_presets().find(pi.name) != NULL; const String tooltip = is_builtin_input ? TTR("Built-in actions can't be removed as they're used for UI navigation.") : TTR("Remove"); - item->add_button(2, input_editor->get_icon("Add", "EditorIcons"), 1, false, TTR("Add Event")); - item->add_button(2, input_editor->get_icon("Remove", "EditorIcons"), 2, false, tooltip); + item->add_button(2, input_editor->get_theme_icon("Add", "EditorIcons"), 1, false, TTR("Add Event")); + item->add_button(2, input_editor->get_theme_icon("Remove", "EditorIcons"), 2, false, tooltip); if (is_builtin_input) { // Built-in action (like `ui_up`). Make the action not removable, @@ -780,9 +780,9 @@ void ProjectSettingsEditor::_update_actions() { action2->set_text(0, str); if ((k->get_keycode() != 0)) { - action2->set_icon(0, input_editor->get_icon("Keyboard", "EditorIcons")); + action2->set_icon(0, input_editor->get_theme_icon("Keyboard", "EditorIcons")); } else { - action2->set_icon(0, input_editor->get_icon("KeyboardPhysical", "EditorIcons")); + action2->set_icon(0, input_editor->get_theme_icon("KeyboardPhysical", "EditorIcons")); } } @@ -796,7 +796,7 @@ void ProjectSettingsEditor::_update_actions() { } action2->set_text(0, str); - action2->set_icon(0, input_editor->get_icon("JoyButton", "EditorIcons")); + action2->set_icon(0, input_editor->get_theme_icon("JoyButton", "EditorIcons")); } Ref<InputEventMouseButton> mb = event; @@ -813,7 +813,7 @@ void ProjectSettingsEditor::_update_actions() { } action2->set_text(0, str); - action2->set_icon(0, input_editor->get_icon("Mouse", "EditorIcons")); + action2->set_icon(0, input_editor->get_theme_icon("Mouse", "EditorIcons")); } Ref<InputEventJoypadMotion> jm = event; @@ -825,13 +825,13 @@ void ProjectSettingsEditor::_update_actions() { String desc = _axis_names[n]; String str = _get_device_string(jm->get_device()) + ", " + TTR("Axis") + " " + itos(ax) + " " + (jm->get_axis_value() < 0 ? "-" : "+") + desc; action2->set_text(0, str); - action2->set_icon(0, input_editor->get_icon("JoyAxis", "EditorIcons")); + action2->set_icon(0, input_editor->get_theme_icon("JoyAxis", "EditorIcons")); } action2->set_metadata(0, i); action2->set_meta("__input", event); - action2->add_button(2, input_editor->get_icon("Edit", "EditorIcons"), 3, false, TTR("Edit")); - action2->add_button(2, input_editor->get_icon("Remove", "EditorIcons"), 2, false, TTR("Remove")); + action2->add_button(2, input_editor->get_theme_icon("Edit", "EditorIcons"), 3, false, TTR("Edit")); + action2->add_button(2, input_editor->get_theme_icon("Remove", "EditorIcons"), 2, false, TTR("Remove")); // Fade out the individual event buttons slightly to make the // Add/Remove buttons stand out more. action2->set_button_color(2, 0, Color(1, 1, 1, 0.75)); @@ -1549,7 +1549,7 @@ void ProjectSettingsEditor::_update_translations() { t->set_text(0, translations[i].replace_first("res://", "")); t->set_tooltip(0, translations[i]); t->set_metadata(0, i); - t->add_button(0, input_editor->get_icon("Remove", "EditorIcons"), 0, false, TTR("Remove")); + t->add_button(0, input_editor->get_theme_icon("Remove", "EditorIcons"), 0, false, TTR("Remove")); } } @@ -1672,7 +1672,7 @@ void ProjectSettingsEditor::_update_translations() { t->set_text(0, keys[i].replace_first("res://", "")); t->set_tooltip(0, keys[i]); t->set_metadata(0, keys[i]); - t->add_button(0, input_editor->get_icon("Remove", "EditorIcons"), 0, false, TTR("Remove")); + t->add_button(0, input_editor->get_theme_icon("Remove", "EditorIcons"), 0, false, TTR("Remove")); if (keys[i] == remap_selected) { t->select(0); translation_res_option_add_button->set_disabled(false); @@ -1690,7 +1690,7 @@ void ProjectSettingsEditor::_update_translations() { t2->set_text(0, path.replace_first("res://", "")); t2->set_tooltip(0, path); t2->set_metadata(0, j); - t2->add_button(0, input_editor->get_icon("Remove", "EditorIcons"), 0, false, TTR("Remove")); + t2->add_button(0, input_editor->get_theme_icon("Remove", "EditorIcons"), 0, false, TTR("Remove")); t2->set_cell_mode(1, TreeItem::CELL_MODE_RANGE); t2->set_text(1, langnames); t2->set_editable(1, true); @@ -1875,7 +1875,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { add_prop_bar->add_child(popup_copy_to_feature); popup_copy_to_feature->get_popup()->connect("id_pressed", callable_mp(this, &ProjectSettingsEditor::_copy_to_platform)); - popup_copy_to_feature->get_popup()->connect("about_to_show", callable_mp(this, &ProjectSettingsEditor::_copy_to_platform_about_to_show)); + popup_copy_to_feature->get_popup()->connect("about_to_popup", callable_mp(this, &ProjectSettingsEditor::_copy_to_platform_about_to_show)); get_ok()->set_text(TTR("Close")); set_hide_on_ok(true); diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index 3be067c33a..41e15f47cc 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -103,11 +103,6 @@ Ref<Resource> EditorResourceConversionPlugin::convert(const Ref<Resource> &p_res void CustomPropertyEditor::_notification(int p_what) { - if (p_what == NOTIFICATION_DRAW) { - - RID ci = get_canvas_item(); - get_stylebox("panel", "PopupMenu")->draw(ci, Rect2(Point2(), get_size())); - } if (p_what == NOTIFICATION_WM_CLOSE_REQUEST) { hide(); } @@ -493,14 +488,14 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: } else if (hint == PROPERTY_HINT_EXP_EASING) { - easing_draw->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5 * EDSCALE); - easing_draw->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -5 * EDSCALE); - easing_draw->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 5 * EDSCALE); - easing_draw->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -30 * EDSCALE); - type_button->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 3 * EDSCALE); - type_button->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -3 * EDSCALE); - type_button->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, -25 * EDSCALE); - type_button->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -7 * EDSCALE); + easing_draw->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 5 * EDSCALE); + easing_draw->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -5 * EDSCALE); + easing_draw->set_anchor_and_margin(MARGIN_TOP, Control::ANCHOR_BEGIN, 5 * EDSCALE); + easing_draw->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_END, -30 * EDSCALE); + type_button->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 3 * EDSCALE); + type_button->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -3 * EDSCALE); + type_button->set_anchor_and_margin(MARGIN_TOP, Control::ANCHOR_END, -25 * EDSCALE); + type_button->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_END, -7 * EDSCALE); type_button->set_text(TTR("Preset...")); type_button->get_popup()->clear(); type_button->get_popup()->add_item(TTR("Linear"), EASING_LINEAR); @@ -573,13 +568,13 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: text_edit->set_text(v); text_edit->deselect(); - int button_margin = get_constant("button_margin", "Dialogs"); - int margin = get_constant("margin", "Dialogs"); + int button_margin = text_edit->get_theme_constant("button_margin", "Dialogs"); + int margin = text_edit->get_theme_constant("margin", "Dialogs"); - action_buttons[0]->set_anchor(MARGIN_LEFT, ANCHOR_END); - action_buttons[0]->set_anchor(MARGIN_TOP, ANCHOR_END); - action_buttons[0]->set_anchor(MARGIN_RIGHT, ANCHOR_END); - action_buttons[0]->set_anchor(MARGIN_BOTTOM, ANCHOR_END); + action_buttons[0]->set_anchor(MARGIN_LEFT, Control::ANCHOR_END); + action_buttons[0]->set_anchor(MARGIN_TOP, Control::ANCHOR_END); + action_buttons[0]->set_anchor(MARGIN_RIGHT, Control::ANCHOR_END); + action_buttons[0]->set_anchor(MARGIN_BOTTOM, Control::ANCHOR_END); action_buttons[0]->set_begin(Point2(-70 * EDSCALE, -button_margin + 5 * EDSCALE)); action_buttons[0]->set_end(Point2(-margin, -margin)); action_buttons[0]->set_text(TTR("Close")); @@ -900,7 +895,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: break; if (p_name == "script" && hint_text == "Script" && Object::cast_to<Node>(owner)) { - menu->add_icon_item(get_icon("Script", "EditorIcons"), TTR("New Script"), OBJ_MENU_NEW_SCRIPT); + menu->add_item(TTR("New Script"), OBJ_MENU_NEW_SCRIPT); menu->add_separator(); } else if (hint_text != "") { int idx = 0; @@ -953,17 +948,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: int id = TYPE_BASE_ID + idx; - if (!icon.is_valid() && has_icon(t, "EditorIcons")) { - icon = get_icon(t, "EditorIcons"); - } - - if (icon.is_valid()) { - - menu->add_icon_item(icon, vformat(TTR("New %s"), t), id); - } else { - - menu->add_item(vformat(TTR("New %s"), t), id); - } + menu->add_item(vformat(TTR("New %s"), t), id); idx++; } @@ -973,13 +958,14 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: menu->add_separator(); } - menu->add_icon_item(get_icon("Load", "EditorIcons"), TTR("Load"), OBJ_MENU_LOAD); + menu->add_item(TTR("Load"), OBJ_MENU_LOAD); if (!RES(v).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_item(TTR("Edit"), OBJ_MENU_EDIT); + menu->add_item(TTR("Clear"), OBJ_MENU_CLEAR); + menu->add_item(TTR("Make Unique"), OBJ_MENU_MAKE_UNIQUE); + RES r = v; if (r.is_valid() && r->get_path().is_resource_file()) { menu->add_separator(); @@ -1022,16 +1008,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: } for (int i = 0; i < conversions.size(); i++) { String what = conversions[i]->converts_to(); - Ref<Texture2D> icon; - if (has_icon(what, "EditorIcons")) { - - icon = get_icon(what, "EditorIcons"); - } else { - - icon = get_icon(what, "Resource"); - } - - menu->add_icon_item(icon, vformat(TTR("Convert To %s"), what), CONVERT_BASE_ID + i); + menu->add_item(vformat(TTR("Convert To %s"), what), CONVERT_BASE_ID + i); } } @@ -1500,7 +1477,7 @@ void CustomPropertyEditor::_draw_easing() { Size2 s = easing_draw->get_size(); Rect2 r(Point2(), s); r = r.grow(3); - get_stylebox("normal", "LineEdit")->draw(ci, r); + easing_draw->get_theme_stylebox("normal", "LineEdit")->draw(ci, r); int points = 48; @@ -1508,8 +1485,8 @@ void CustomPropertyEditor::_draw_easing() { float exp = v; bool flip = hint_text == "attenuation"; - Ref<Font> f = get_font("font", "Label"); - Color color = get_color("font_color", "Label"); + Ref<Font> f = easing_draw->get_theme_font("font", "Label"); + Color color = easing_draw->get_theme_color("font_color", "Label"); for (int i = 1; i <= points; i++) { @@ -1805,7 +1782,7 @@ void CustomPropertyEditor::_focus_exit() { void CustomPropertyEditor::config_action_buttons(const List<String> &p_strings) { - Ref<StyleBox> sb = get_stylebox("panel"); + Ref<StyleBox> sb = action_buttons[0]->get_theme_stylebox("panel"); int margin_top = sb->get_margin(MARGIN_TOP); int margin_left = sb->get_margin(MARGIN_LEFT); int margin_bottom = sb->get_margin(MARGIN_BOTTOM); @@ -1921,7 +1898,7 @@ CustomPropertyEditor::CustomPropertyEditor() { checks20[i] = memnew(CheckBox); checks20[i]->set_toggle_mode(true); - checks20[i]->set_focus_mode(FOCUS_NONE); + checks20[i]->set_focus_mode(Control::FOCUS_NONE); checks20gc->add_child(checks20[i]); checks20[i]->hide(); checks20[i]->connect("pressed", callable_mp(this, &CustomPropertyEditor::_action_pressed), make_binds(i)); @@ -1949,7 +1926,6 @@ CustomPropertyEditor::CustomPropertyEditor() { color_picker = NULL; - set_as_toplevel(true); file = memnew(EditorFileDialog); add_child(file); file->hide(); @@ -1983,7 +1959,7 @@ CustomPropertyEditor::CustomPropertyEditor() { type_button->get_popup()->connect("id_pressed", callable_mp(this, &CustomPropertyEditor::_type_create_selected)); menu = memnew(PopupMenu); - menu->set_pass_on_modal_close_click(false); + // menu->set_pass_on_modal_close_click(false); add_child(menu); menu->connect("id_pressed", callable_mp(this, &CustomPropertyEditor::_menu_option)); diff --git a/editor/property_editor.h b/editor/property_editor.h index bc2a222714..45466eaa42 100644 --- a/editor/property_editor.h +++ b/editor/property_editor.h @@ -63,9 +63,9 @@ public: virtual Ref<Resource> convert(const Ref<Resource> &p_resource) const; }; -class CustomPropertyEditor : public Popup { +class CustomPropertyEditor : public PopupPanel { - GDCLASS(CustomPropertyEditor, Popup); + GDCLASS(CustomPropertyEditor, PopupPanel); enum { MAX_VALUE_EDITORS = 12, diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp index 464b5cb123..54b94ebb95 100644 --- a/editor/property_selector.cpp +++ b/editor/property_selector.cpp @@ -121,33 +121,33 @@ void PropertySelector::_update_search() { bool found = false; Ref<Texture2D> type_icons[Variant::VARIANT_MAX] = { - search_options->get_icon("Variant", "EditorIcons"), - search_options->get_icon("bool", "EditorIcons"), - search_options->get_icon("int", "EditorIcons"), - search_options->get_icon("float", "EditorIcons"), - search_options->get_icon("String", "EditorIcons"), - search_options->get_icon("Vector2", "EditorIcons"), - search_options->get_icon("Rect2", "EditorIcons"), - search_options->get_icon("Vector3", "EditorIcons"), - search_options->get_icon("Transform2D", "EditorIcons"), - search_options->get_icon("Plane", "EditorIcons"), - search_options->get_icon("Quat", "EditorIcons"), - search_options->get_icon("AABB", "EditorIcons"), - search_options->get_icon("Basis", "EditorIcons"), - search_options->get_icon("Transform", "EditorIcons"), - search_options->get_icon("Color", "EditorIcons"), - search_options->get_icon("Path", "EditorIcons"), - search_options->get_icon("RID", "EditorIcons"), - search_options->get_icon("Object", "EditorIcons"), - search_options->get_icon("Dictionary", "EditorIcons"), - search_options->get_icon("Array", "EditorIcons"), - search_options->get_icon("PackedByteArray", "EditorIcons"), - search_options->get_icon("PackedInt32Array", "EditorIcons"), - search_options->get_icon("PackedFloat32Array", "EditorIcons"), - search_options->get_icon("PackedStringArray", "EditorIcons"), - search_options->get_icon("PackedVector2Array", "EditorIcons"), - search_options->get_icon("PackedVector3Array", "EditorIcons"), - search_options->get_icon("PackedColorArray", "EditorIcons") + search_options->get_theme_icon("Variant", "EditorIcons"), + search_options->get_theme_icon("bool", "EditorIcons"), + search_options->get_theme_icon("int", "EditorIcons"), + search_options->get_theme_icon("float", "EditorIcons"), + search_options->get_theme_icon("String", "EditorIcons"), + search_options->get_theme_icon("Vector2", "EditorIcons"), + search_options->get_theme_icon("Rect2", "EditorIcons"), + search_options->get_theme_icon("Vector3", "EditorIcons"), + search_options->get_theme_icon("Transform2D", "EditorIcons"), + search_options->get_theme_icon("Plane", "EditorIcons"), + search_options->get_theme_icon("Quat", "EditorIcons"), + search_options->get_theme_icon("AABB", "EditorIcons"), + search_options->get_theme_icon("Basis", "EditorIcons"), + search_options->get_theme_icon("Transform", "EditorIcons"), + search_options->get_theme_icon("Color", "EditorIcons"), + search_options->get_theme_icon("Path", "EditorIcons"), + search_options->get_theme_icon("RID", "EditorIcons"), + search_options->get_theme_icon("Object", "EditorIcons"), + search_options->get_theme_icon("Dictionary", "EditorIcons"), + search_options->get_theme_icon("Array", "EditorIcons"), + search_options->get_theme_icon("PackedByteArray", "EditorIcons"), + search_options->get_theme_icon("PackedInt32Array", "EditorIcons"), + search_options->get_theme_icon("PackedFloat32Array", "EditorIcons"), + search_options->get_theme_icon("PackedStringArray", "EditorIcons"), + search_options->get_theme_icon("PackedVector2Array", "EditorIcons"), + search_options->get_theme_icon("PackedVector3Array", "EditorIcons"), + search_options->get_theme_icon("PackedColorArray", "EditorIcons") }; for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) { @@ -161,7 +161,7 @@ void PropertySelector::_update_search() { Ref<Texture2D> icon; if (E->get().name == "Script Variables") { - icon = search_options->get_icon("Script", "EditorIcons"); + icon = search_options->get_theme_icon("Script", "EditorIcons"); } else { icon = EditorNode::get_singleton()->get_class_icon(E->get().name); } @@ -238,7 +238,7 @@ void PropertySelector::_update_search() { script_methods = false; String rep = E->get().name.replace("*", ""); if (E->get().name == "*Script Methods") { - icon = search_options->get_icon("Script", "EditorIcons"); + icon = search_options->get_theme_icon("Script", "EditorIcons"); script_methods = true; } else { icon = EditorNode::get_singleton()->get_class_icon(rep); diff --git a/editor/quick_open.cpp b/editor/quick_open.cpp index b1b76e9149..58bb061b58 100644 --- a/editor/quick_open.cpp +++ b/editor/quick_open.cpp @@ -142,7 +142,7 @@ void EditorQuickOpen::_parse_fs(EditorFileSystemDirectory *efsd, Vector<Pair<Str if (search_text.is_subsequence_ofi(path)) { Pair<String, Ref<Texture2D>> pair; pair.first = path; - pair.second = search_options->get_icon("folder", "FileDialog"); + pair.second = search_options->get_theme_icon("folder", "FileDialog"); if (search_text != String() && list.size() > 0) { @@ -171,7 +171,7 @@ void EditorQuickOpen::_parse_fs(EditorFileSystemDirectory *efsd, Vector<Pair<Str if (ClassDB::is_parent_class(efsd->get_file_type(i), base_type) && (search_text.is_subsequence_ofi(file))) { Pair<String, Ref<Texture2D>> pair; pair.first = file; - pair.second = search_options->get_icon((search_options->has_icon(efsd->get_file_type(i), ei) ? efsd->get_file_type(i) : ot), ei); + pair.second = search_options->get_theme_icon((search_options->has_theme_icon(efsd->get_file_type(i), ei) ? efsd->get_file_type(i) : ot), ei); list.push_back(pair); } } @@ -255,7 +255,7 @@ void EditorQuickOpen::_confirmed() { void EditorQuickOpen::_theme_changed() { - search_box->set_right_icon(search_options->get_icon("Search", "EditorIcons")); + search_box->set_right_icon(search_options->get_theme_icon("Search", "EditorIcons")); } void EditorQuickOpen::_notification(int p_what) { @@ -302,7 +302,7 @@ EditorQuickOpen::EditorQuickOpen() { search_options->connect("item_activated", callable_mp(this, &EditorQuickOpen::_confirmed)); search_options->set_hide_root(true); search_options->set_hide_folding(true); - search_options->add_constant_override("draw_guides", 1); + search_options->add_theme_constant_override("draw_guides", 1); ei = "EditorIcons"; ot = "Object"; add_directories = false; diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp index d8bb090fd2..c14462f07d 100644 --- a/editor/rename_dialog.cpp +++ b/editor/rename_dialog.cpp @@ -291,7 +291,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und lbl_preview = memnew(Label); lbl_preview->set_text(""); - lbl_preview->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor")); + lbl_preview->add_theme_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_theme_color("error_color", "Editor")); vbc->add_child(lbl_preview); // ---- Dialog related @@ -401,11 +401,11 @@ void RenameDialog::_update_preview(String new_text) { if (new_name == preview_node->get_name()) { // New name is identical to the old one. Don't color it as much to avoid distracting the user. - const Color accent_color = EditorNode::get_singleton()->get_gui_base()->get_color("accent_color", "Editor"); - const Color text_color = EditorNode::get_singleton()->get_gui_base()->get_color("default_color", "RichTextLabel"); - lbl_preview->add_color_override("font_color", accent_color.linear_interpolate(text_color, 0.5)); + const Color accent_color = EditorNode::get_singleton()->get_gui_base()->get_theme_color("accent_color", "Editor"); + const Color text_color = EditorNode::get_singleton()->get_gui_base()->get_theme_color("default_color", "RichTextLabel"); + lbl_preview->add_theme_color_override("font_color", accent_color.linear_interpolate(text_color, 0.5)); } else { - lbl_preview->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("success_color", "Editor")); + lbl_preview->add_theme_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_theme_color("success_color", "Editor")); } } @@ -491,7 +491,7 @@ void RenameDialog::_error_handler(void *p_self, const char *p_func, const char * self->has_errors = true; self->lbl_preview_title->set_text(TTR("Regular Expression Error")); - self->lbl_preview->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor")); + self->lbl_preview->add_theme_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_theme_color("error_color", "Editor")); self->lbl_preview->set_text(vformat(TTR("At character %s"), err_str)); } diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 597cb163e9..f0b9b32c34 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -1060,12 +1060,12 @@ void SceneTreeDock::_notification(int p_what) { spatial_editor_plugin->get_spatial_editor()->connect_compat("item_lock_status_changed", scene_tree, "_update_tree"); spatial_editor_plugin->get_spatial_editor()->connect_compat("item_group_status_changed", scene_tree, "_update_tree"); - button_add->set_icon(get_icon("Add", "EditorIcons")); - button_instance->set_icon(get_icon("Instance", "EditorIcons")); - button_create_script->set_icon(get_icon("ScriptCreate", "EditorIcons")); - button_clear_script->set_icon(get_icon("ScriptRemove", "EditorIcons")); + button_add->set_icon(get_theme_icon("Add", "EditorIcons")); + button_instance->set_icon(get_theme_icon("Instance", "EditorIcons")); + button_create_script->set_icon(get_theme_icon("ScriptCreate", "EditorIcons")); + button_clear_script->set_icon(get_theme_icon("ScriptRemove", "EditorIcons")); - filter->set_right_icon(get_icon("Search", "EditorIcons")); + filter->set_right_icon(get_theme_icon("Search", "EditorIcons")); filter->set_clear_button_enabled(true); EditorNode::get_singleton()->get_editor_selection()->connect("selection_changed", callable_mp(this, &SceneTreeDock::_selection_changed)); @@ -1080,7 +1080,7 @@ void SceneTreeDock::_notification(int p_what) { ToolButton *node_shortcuts_toggle = memnew(ToolButton); node_shortcuts_toggle->set_name("NodeShortcutsToggle"); - node_shortcuts_toggle->set_icon(get_icon("Favorites", "EditorIcons")); + node_shortcuts_toggle->set_icon(get_theme_icon("Favorites", "EditorIcons")); node_shortcuts_toggle->set_toggle_mode(true); node_shortcuts_toggle->set_pressed(EDITOR_GET("_use_favorites_root_selection")); node_shortcuts_toggle->set_anchors_and_margins_preset(Control::PRESET_CENTER_RIGHT); @@ -1099,18 +1099,19 @@ void SceneTreeDock::_notification(int p_what) { Button *button_2d = memnew(Button); beginner_node_shortcuts->add_child(button_2d); button_2d->set_text(TTR("2D Scene")); - button_2d->set_icon(get_icon("Node2D", "EditorIcons")); + button_2d->set_icon(get_theme_icon("Node2D", "EditorIcons")); button_2d->connect("pressed", callable_mp(this, &SceneTreeDock::_tool_selected), make_binds(TOOL_CREATE_2D_SCENE, false)); + button_3d = memnew(Button); beginner_node_shortcuts->add_child(button_3d); button_3d->set_text(TTR("3D Scene")); - button_3d->set_icon(get_icon("Spatial", "EditorIcons")); + button_3d->set_icon(get_theme_icon("Spatial", "EditorIcons")); button_3d->connect("pressed", callable_mp(this, &SceneTreeDock::_tool_selected), make_binds(TOOL_CREATE_3D_SCENE, false)); Button *button_ui = memnew(Button); beginner_node_shortcuts->add_child(button_ui); button_ui->set_text(TTR("User Interface")); - button_ui->set_icon(get_icon("Control", "EditorIcons")); + button_ui->set_icon(get_theme_icon("Control", "EditorIcons")); button_ui->connect("pressed", callable_mp(this, &SceneTreeDock::_tool_selected), make_binds(TOOL_CREATE_USER_INTERFACE, false)); VBoxContainer *favorite_node_shortcuts = memnew(VBoxContainer); @@ -1120,7 +1121,7 @@ void SceneTreeDock::_notification(int p_what) { Button *button_custom = memnew(Button); node_shortcuts->add_child(button_custom); button_custom->set_text(TTR("Other Node")); - button_custom->set_icon(get_icon("Add", "EditorIcons")); + button_custom->set_icon(get_theme_icon("Add", "EditorIcons")); button_custom->connect("pressed", callable_mp(this, &SceneTreeDock::_tool_selected), make_binds(TOOL_NEW, false)); node_shortcuts->add_spacer(); @@ -1136,12 +1137,12 @@ void SceneTreeDock::_notification(int p_what) { clear_inherit_confirm->disconnect("confirmed", callable_mp(this, &SceneTreeDock::_tool_selected)); } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - button_add->set_icon(get_icon("Add", "EditorIcons")); - button_instance->set_icon(get_icon("Instance", "EditorIcons")); - button_create_script->set_icon(get_icon("ScriptCreate", "EditorIcons")); - button_clear_script->set_icon(get_icon("ScriptRemove", "EditorIcons")); + button_add->set_icon(get_theme_icon("Add", "EditorIcons")); + button_instance->set_icon(get_theme_icon("Instance", "EditorIcons")); + button_create_script->set_icon(get_theme_icon("ScriptCreate", "EditorIcons")); + button_clear_script->set_icon(get_theme_icon("ScriptRemove", "EditorIcons")); - filter->set_right_icon(get_icon("Search", "EditorIcons")); + filter->set_right_icon(get_theme_icon("Search", "EditorIcons")); filter->set_clear_button_enabled(true); } break; case NOTIFICATION_PROCESS: { @@ -2392,8 +2393,8 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) { menu->clear(); if (profile_allow_editing) { - menu->add_icon_shortcut(get_icon("Add", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/add_child_node"), TOOL_NEW); - menu->add_icon_shortcut(get_icon("Instance", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/instance_scene"), TOOL_INSTANCE); + menu->add_icon_shortcut(get_theme_icon("Add", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/add_child_node"), TOOL_NEW); + menu->add_icon_shortcut(get_theme_icon("Instance", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/instance_scene"), TOOL_INSTANCE); } menu->set_size(Size2(1, 1)); @@ -2424,10 +2425,10 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) { if (menu->get_item_count() > 0) menu->add_separator(); - menu->add_icon_shortcut(get_icon("Add", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/add_child_node"), TOOL_NEW); - menu->add_icon_shortcut(get_icon("Instance", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/instance_scene"), TOOL_INSTANCE); + menu->add_icon_shortcut(get_theme_icon("Add", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/add_child_node"), TOOL_NEW); + menu->add_icon_shortcut(get_theme_icon("Instance", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/instance_scene"), TOOL_INSTANCE); } - menu->add_icon_shortcut(get_icon("Collapse", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/expand_collapse_all"), TOOL_EXPAND_COLLAPSE); + menu->add_icon_shortcut(get_theme_icon("Collapse", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/expand_collapse_all"), TOOL_EXPAND_COLLAPSE); menu->add_separator(); existing_script = selected->get_script(); @@ -2442,14 +2443,14 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) { if (full_selection.size() == 1) { add_separator = true; - menu->add_icon_shortcut(get_icon("ScriptCreate", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/attach_script"), TOOL_ATTACH_SCRIPT); + menu->add_icon_shortcut(get_theme_icon("ScriptCreate", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/attach_script"), TOOL_ATTACH_SCRIPT); if (existing_script.is_valid()) { - menu->add_icon_shortcut(get_icon("ScriptExtend", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/extend_script"), TOOL_EXTEND_SCRIPT); + menu->add_icon_shortcut(get_theme_icon("ScriptExtend", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/extend_script"), TOOL_EXTEND_SCRIPT); } } if (existing_script.is_valid() && existing_script_removable) { add_separator = true; - menu->add_icon_shortcut(get_icon("ScriptRemove", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/clear_script"), TOOL_CLEAR_SCRIPT); + menu->add_icon_shortcut(get_theme_icon("ScriptRemove", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/clear_script"), TOOL_CLEAR_SCRIPT); } else if (full_selection.size() > 1) { bool script_exists = false; for (List<Node *>::Element *E = full_selection.front(); E; E = E->next()) { @@ -2461,7 +2462,7 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) { if (script_exists) { add_separator = true; - menu->add_icon_shortcut(get_icon("ScriptRemove", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/clear_script"), TOOL_CLEAR_SCRIPT); + menu->add_icon_shortcut(get_theme_icon("ScriptRemove", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/clear_script"), TOOL_CLEAR_SCRIPT); } } @@ -2472,19 +2473,19 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) { if (profile_allow_editing) { if (full_selection.size() == 1) { - menu->add_icon_shortcut(get_icon("Rename", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/rename"), TOOL_RENAME); + menu->add_icon_shortcut(get_theme_icon("Rename", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/rename"), TOOL_RENAME); } - menu->add_icon_shortcut(get_icon("Reload", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/change_node_type"), TOOL_REPLACE); + menu->add_icon_shortcut(get_theme_icon("Reload", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/change_node_type"), TOOL_REPLACE); if (scene_tree->get_selected() != edited_scene) { menu->add_separator(); - menu->add_icon_shortcut(get_icon("MoveUp", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/move_up"), TOOL_MOVE_UP); - menu->add_icon_shortcut(get_icon("MoveDown", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/move_down"), TOOL_MOVE_DOWN); - menu->add_icon_shortcut(get_icon("Duplicate", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/duplicate"), TOOL_DUPLICATE); - menu->add_icon_shortcut(get_icon("Reparent", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/reparent"), TOOL_REPARENT); - menu->add_icon_shortcut(get_icon("ReparentToNewNode", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/reparent_to_new_node"), TOOL_REPARENT_TO_NEW_NODE); + menu->add_icon_shortcut(get_theme_icon("MoveUp", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/move_up"), TOOL_MOVE_UP); + menu->add_icon_shortcut(get_theme_icon("MoveDown", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/move_down"), TOOL_MOVE_DOWN); + menu->add_icon_shortcut(get_theme_icon("Duplicate", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/duplicate"), TOOL_DUPLICATE); + menu->add_icon_shortcut(get_theme_icon("Reparent", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/reparent"), TOOL_REPARENT); + menu->add_icon_shortcut(get_theme_icon("ReparentToNewNode", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/reparent_to_new_node"), TOOL_REPARENT_TO_NEW_NODE); if (selection.size() == 1) { - menu->add_icon_shortcut(get_icon("NewRoot", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/make_root"), TOOL_MAKE_ROOT); + menu->add_icon_shortcut(get_theme_icon("NewRoot", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/make_root"), TOOL_MAKE_ROOT); } } } @@ -2492,12 +2493,12 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) { if (profile_allow_editing) { menu->add_separator(); - menu->add_icon_shortcut(get_icon("Blend", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/merge_from_scene"), TOOL_MERGE_FROM_SCENE); - menu->add_icon_shortcut(get_icon("CreateNewSceneFrom", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/save_branch_as_scene"), TOOL_NEW_SCENE_FROM); + menu->add_icon_shortcut(get_theme_icon("Blend", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/merge_from_scene"), TOOL_MERGE_FROM_SCENE); + menu->add_icon_shortcut(get_theme_icon("CreateNewSceneFrom", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/save_branch_as_scene"), TOOL_NEW_SCENE_FROM); } if (full_selection.size() == 1) { menu->add_separator(); - menu->add_icon_shortcut(get_icon("CopyNodePath", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/copy_node_path"), TOOL_COPY_NODE_PATH); + menu->add_icon_shortcut(get_theme_icon("CopyNodePath", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/copy_node_path"), TOOL_COPY_NODE_PATH); } bool is_external = (selection[0]->get_filename() != ""); @@ -2509,7 +2510,7 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) { if (profile_allow_editing) { menu->add_item(TTR("Clear Inheritance"), TOOL_SCENE_CLEAR_INHERITANCE); } - menu->add_icon_item(get_icon("Load", "EditorIcons"), TTR("Open in Editor"), TOOL_SCENE_OPEN_INHERITED); + menu->add_icon_item(get_theme_icon("Load", "EditorIcons"), TTR("Open in Editor"), TOOL_SCENE_OPEN_INHERITED); } else if (!is_top_level) { menu->add_separator(); bool editable = EditorNode::get_singleton()->get_edited_scene()->is_editable_instance(selection[0]); @@ -2519,7 +2520,7 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) { menu->add_check_item(TTR("Load As Placeholder"), TOOL_SCENE_USE_PLACEHOLDER); menu->add_item(TTR("Make Local"), TOOL_SCENE_MAKE_LOCAL); } - menu->add_icon_item(get_icon("Load", "EditorIcons"), TTR("Open in Editor"), TOOL_SCENE_OPEN); + menu->add_icon_item(get_theme_icon("Load", "EditorIcons"), TTR("Open in Editor"), TOOL_SCENE_OPEN); if (profile_allow_editing) { menu->set_item_checked(menu->get_item_idx_from_text(TTR("Editable Children")), editable); menu->set_item_checked(menu->get_item_idx_from_text(TTR("Load As Placeholder")), placeholder); @@ -2531,14 +2532,14 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) { if (profile_allow_editing && selection.size() > 1) { //this is not a commonly used action, it makes no sense for it to be where it was nor always present. menu->add_separator(); - menu->add_icon_shortcut(get_icon("Rename", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/batch_rename"), TOOL_BATCH_RENAME); + menu->add_icon_shortcut(get_theme_icon("Rename", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/batch_rename"), TOOL_BATCH_RENAME); } menu->add_separator(); - menu->add_icon_item(get_icon("Help", "EditorIcons"), TTR("Open Documentation"), TOOL_OPEN_DOCUMENTATION); + menu->add_icon_item(get_theme_icon("Help", "EditorIcons"), TTR("Open Documentation"), TOOL_OPEN_DOCUMENTATION); if (profile_allow_editing) { menu->add_separator(); - menu->add_icon_shortcut(get_icon("Remove", "EditorIcons"), ED_SHORTCUT("scene_tree/delete", TTR("Delete Node(s)"), KEY_DELETE), TOOL_ERASE); + menu->add_icon_shortcut(get_theme_icon("Remove", "EditorIcons"), ED_SHORTCUT("scene_tree/delete", TTR("Delete Node(s)"), KEY_DELETE), TOOL_ERASE); } menu->set_size(Size2(1, 1)); menu->set_position(p_menu_pos); @@ -2797,7 +2798,7 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel VBoxContainer *vbc = this; HBoxContainer *filter_hbc = memnew(HBoxContainer); - filter_hbc->add_constant_override("separate", 0); + filter_hbc->add_theme_constant_override("separate", 0); ED_SHORTCUT("scene_tree/rename", TTR("Rename")); ED_SHORTCUT("scene_tree/batch_rename", TTR("Batch Rename"), KEY_MASK_CMD | KEY_F2); @@ -2837,7 +2838,7 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel filter->set_h_size_flags(SIZE_EXPAND_FILL); filter->set_placeholder(TTR("Filter nodes")); filter_hbc->add_child(filter); - filter->add_constant_override("minimum_spaces", 0); + filter->add_theme_constant_override("minimum_spaces", 0); filter->connect("text_changed", callable_mp(this, &SceneTreeDock::_filter_changed)); button_create_script = memnew(ToolButton); @@ -2948,7 +2949,7 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel menu = memnew(PopupMenu); add_child(menu); menu->connect("id_pressed", callable_mp(this, &SceneTreeDock::_tool_selected), make_binds(false)); - menu->set_hide_on_window_lose_focus(true); + menu_subresources = memnew(PopupMenu); menu_subresources->set_name("Sub-Resources"); menu_subresources->connect("id_pressed", callable_mp(this, &SceneTreeDock::_tool_selected), make_binds(false)); diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index 89bedf1cd1..a290e57a4e 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -201,19 +201,19 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) { item->set_metadata(0, p_node->get_path()); if (connect_to_script_mode) { - Color accent = get_color("accent_color", "Editor"); + Color accent = get_theme_color("accent_color", "Editor"); Ref<Script> script = p_node->get_script(); if (!script.is_null() && EditorNode::get_singleton()->get_object_custom_type_base(p_node) != script) { //has script - item->add_button(0, get_icon("Script", "EditorIcons"), BUTTON_SCRIPT); + item->add_button(0, get_theme_icon("Script", "EditorIcons"), BUTTON_SCRIPT); } else { //has no script (or script is a custom type) - item->set_custom_color(0, get_color("disabled_font_color", "Editor")); + item->set_custom_color(0, get_theme_color("disabled_font_color", "Editor")); item->set_selectable(0, false); if (!script.is_null()) { // make sure to mark the script if a custom type - item->add_button(0, get_icon("Script", "EditorIcons"), BUTTON_SCRIPT); + item->add_button(0, get_theme_icon("Script", "EditorIcons"), BUTTON_SCRIPT); item->set_button_disabled(0, item->get_button_count(0) - 1, true); } @@ -231,7 +231,7 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) { } else if (part_of_subscene) { if (valid_types.size() == 0) { - item->set_custom_color(0, get_color("disabled_font_color", "Editor")); + item->set_custom_color(0, get_theme_color("disabled_font_color", "Editor")); } } else if (marked.has(p_node)) { @@ -241,14 +241,14 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) { } item->set_text(0, node_name); item->set_selectable(0, marked_selectable); - item->set_custom_color(0, get_color("accent_color", "Editor")); + item->set_custom_color(0, get_theme_color("accent_color", "Editor")); } else if (!marked_selectable && !marked_children_selectable) { Node *node = p_node; while (node) { if (marked.has(node)) { item->set_selectable(0, false); - item->set_custom_color(0, get_color("error_color", "Editor")); + item->set_custom_color(0, get_theme_color("error_color", "Editor")); break; } node = node->get_parent(); @@ -259,7 +259,7 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) { String warning = p_node->get_configuration_warning(); if (warning != String()) { - item->add_button(0, get_icon("NodeWarning", "EditorIcons"), BUTTON_WARNING, false, TTR("Node configuration warning:") + "\n" + p_node->get_configuration_warning()); + item->add_button(0, get_theme_icon("NodeWarning", "EditorIcons"), BUTTON_WARNING, false, TTR("Node configuration warning:") + "\n" + p_node->get_configuration_warning()); } int num_connections = p_node->get_persistent_signal_connection_count(); @@ -268,21 +268,21 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) { if (num_connections >= 1 && num_groups >= 1) { item->add_button( 0, - get_icon("SignalsAndGroups", "EditorIcons"), + get_theme_icon("SignalsAndGroups", "EditorIcons"), BUTTON_SIGNALS, false, vformat(TTR("Node has %s connection(s) and %s group(s).\nClick to show signals dock."), num_connections, num_groups)); } else if (num_connections >= 1) { item->add_button( 0, - get_icon("Signals", "EditorIcons"), + get_theme_icon("Signals", "EditorIcons"), BUTTON_SIGNALS, false, vformat(TTR("Node has %s connection(s).\nClick to show signals dock."), num_connections)); } else if (num_groups >= 1) { item->add_button( 0, - get_icon("Groups", "EditorIcons"), + get_theme_icon("Groups", "EditorIcons"), BUTTON_GROUPS, false, vformat(TTR("Node is in %s group(s).\nClick to show groups dock."), num_groups)); @@ -290,7 +290,7 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) { } if (p_node == get_scene_node() && p_node->get_scene_inherited_state().is_valid()) { - item->add_button(0, get_icon("InstanceOptions", "EditorIcons"), BUTTON_SUBSCENE, false, TTR("Open in Editor")); + item->add_button(0, get_theme_icon("InstanceOptions", "EditorIcons"), BUTTON_SUBSCENE, false, TTR("Open in Editor")); String tooltip = TTR("Inherits:") + " " + p_node->get_scene_inherited_state()->get_path() + "\n" + TTR("Type:") + " " + p_node->get_class(); if (p_node->get_editor_description() != String()) { @@ -299,7 +299,7 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) { item->set_tooltip(0, tooltip); } else if (p_node != get_scene_node() && p_node->get_filename() != "" && can_open_instance) { - item->add_button(0, get_icon("InstanceOptions", "EditorIcons"), BUTTON_SUBSCENE, false, TTR("Open in Editor")); + item->add_button(0, get_theme_icon("InstanceOptions", "EditorIcons"), BUTTON_SUBSCENE, false, TTR("Open in Editor")); String tooltip = TTR("Instance:") + " " + p_node->get_filename() + "\n" + TTR("Type:") + " " + p_node->get_class(); if (p_node->get_editor_description() != String()) { @@ -328,7 +328,7 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) { Ref<Script> script = p_node->get_script(); if (!script.is_null()) { - item->add_button(0, get_icon("Script", "EditorIcons"), BUTTON_SCRIPT, false, TTR("Open Script:") + " " + script->get_path()); + item->add_button(0, get_theme_icon("Script", "EditorIcons"), BUTTON_SCRIPT, false, TTR("Open Script:") + " " + script->get_path()); if (EditorNode::get_singleton()->get_object_custom_type_base(p_node) == script) { item->set_button_color(0, item->get_button_count(0) - 1, Color(1, 1, 1, 0.5)); } @@ -338,17 +338,17 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) { bool is_locked = p_node->has_meta("_edit_lock_"); //_edit_group_ if (is_locked) - item->add_button(0, get_icon("Lock", "EditorIcons"), BUTTON_LOCK, false, TTR("Node is locked.\nClick to unlock it.")); + item->add_button(0, get_theme_icon("Lock", "EditorIcons"), BUTTON_LOCK, false, TTR("Node is locked.\nClick to unlock it.")); bool is_grouped = p_node->has_meta("_edit_group_"); if (is_grouped) - item->add_button(0, get_icon("Group", "EditorIcons"), BUTTON_GROUP, false, TTR("Children are not selectable.\nClick to make selectable.")); + item->add_button(0, get_theme_icon("Group", "EditorIcons"), BUTTON_GROUP, false, TTR("Children are not selectable.\nClick to make selectable.")); bool v = p_node->call("is_visible"); if (v) - item->add_button(0, get_icon("GuiVisibilityVisible", "EditorIcons"), BUTTON_VISIBILITY, false, TTR("Toggle Visibility")); + item->add_button(0, get_theme_icon("GuiVisibilityVisible", "EditorIcons"), BUTTON_VISIBILITY, false, TTR("Toggle Visibility")); else - item->add_button(0, get_icon("GuiVisibilityHidden", "EditorIcons"), BUTTON_VISIBILITY, false, TTR("Toggle Visibility")); + item->add_button(0, get_theme_icon("GuiVisibilityHidden", "EditorIcons"), BUTTON_VISIBILITY, false, TTR("Toggle Visibility")); if (!p_node->is_connected("visibility_changed", callable_mp(this, &SceneTreeEditor::_node_visibility_changed))) p_node->connect("visibility_changed", callable_mp(this, &SceneTreeEditor::_node_visibility_changed), varray(p_node)); @@ -358,17 +358,17 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) { bool is_locked = p_node->has_meta("_edit_lock_"); if (is_locked) - item->add_button(0, get_icon("Lock", "EditorIcons"), BUTTON_LOCK, false, TTR("Node is locked.\nClick to unlock it.")); + item->add_button(0, get_theme_icon("Lock", "EditorIcons"), BUTTON_LOCK, false, TTR("Node is locked.\nClick to unlock it.")); bool is_grouped = p_node->has_meta("_edit_group_"); if (is_grouped) - item->add_button(0, get_icon("Group", "EditorIcons"), BUTTON_GROUP, false, TTR("Children are not selectable.\nClick to make selectable.")); + item->add_button(0, get_theme_icon("Group", "EditorIcons"), BUTTON_GROUP, false, TTR("Children are not selectable.\nClick to make selectable.")); bool v = p_node->call("is_visible"); if (v) - item->add_button(0, get_icon("GuiVisibilityVisible", "EditorIcons"), BUTTON_VISIBILITY, false, TTR("Toggle Visibility")); + item->add_button(0, get_theme_icon("GuiVisibilityVisible", "EditorIcons"), BUTTON_VISIBILITY, false, TTR("Toggle Visibility")); else - item->add_button(0, get_icon("GuiVisibilityHidden", "EditorIcons"), BUTTON_VISIBILITY, false, TTR("Toggle Visibility")); + item->add_button(0, get_theme_icon("GuiVisibilityHidden", "EditorIcons"), BUTTON_VISIBILITY, false, TTR("Toggle Visibility")); if (!p_node->is_connected("visibility_changed", callable_mp(this, &SceneTreeEditor::_node_visibility_changed))) p_node->connect("visibility_changed", callable_mp(this, &SceneTreeEditor::_node_visibility_changed), varray(p_node)); @@ -379,7 +379,7 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) { bool is_pinned = AnimationPlayerEditor::singleton->get_player() == p_node && AnimationPlayerEditor::singleton->is_pinned(); if (is_pinned) { - item->add_button(0, get_icon("Pin", "EditorIcons"), BUTTON_PIN, false, TTR("AnimationPlayer is pinned.\nClick to unpin.")); + item->add_button(0, get_theme_icon("Pin", "EditorIcons"), BUTTON_PIN, false, TTR("AnimationPlayer is pinned.\nClick to unpin.")); } } } @@ -417,7 +417,7 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) { if (!valid) { //item->set_selectable(0,marked_selectable); - item->set_custom_color(0, get_color("disabled_font_color", "Editor")); + item->set_custom_color(0, get_theme_color("disabled_font_color", "Editor")); item->set_selectable(0, false); } } @@ -462,9 +462,9 @@ void SceneTreeEditor::_node_visibility_changed(Node *p_node) { } if (visible) - item->set_button(0, idx, get_icon("GuiVisibilityVisible", "EditorIcons")); + item->set_button(0, idx, get_theme_icon("GuiVisibilityVisible", "EditorIcons")); else - item->set_button(0, idx, get_icon("GuiVisibilityHidden", "EditorIcons")); + item->set_button(0, idx, get_theme_icon("GuiVisibilityHidden", "EditorIcons")); _update_visibility_color(p_node, item); } @@ -1141,7 +1141,7 @@ SceneTreeEditor::SceneTreeEditor(bool p_label, bool p_can_rename, bool p_can_ope tree->set_anchor(MARGIN_BOTTOM, ANCHOR_END); tree->set_begin(Point2(0, p_label ? 18 : 0)); tree->set_end(Point2(0, 0)); - tree->add_constant_override("button_margin", 0); + tree->add_theme_constant_override("button_margin", 0); add_child(tree); @@ -1200,7 +1200,7 @@ void SceneTreeDialog::_notification(int p_what) { } break; case NOTIFICATION_ENTER_TREE: { connect("confirmed", callable_mp(this, &SceneTreeDialog::_select)); - filter->set_right_icon(tree->get_icon("Search", "EditorIcons")); + filter->set_right_icon(tree->get_theme_icon("Search", "EditorIcons")); filter->set_clear_button_enabled(true); } break; case NOTIFICATION_EXIT_TREE: { @@ -1242,7 +1242,7 @@ SceneTreeDialog::SceneTreeDialog() { filter = memnew(LineEdit); filter->set_h_size_flags(Control::SIZE_EXPAND_FILL); filter->set_placeholder(TTR("Filter nodes")); - filter->add_constant_override("minimum_spaces", 0); + filter->add_theme_constant_override("minimum_spaces", 0); filter->connect("text_changed", callable_mp(this, &SceneTreeDialog::_filter_changed)); vbc->add_child(filter); diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index ae6a80d841..82199fc1f1 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -43,7 +43,7 @@ void ScriptCreateDialog::_theme_changed() { for (int i = 0; i < ScriptServer::get_language_count(); i++) { String lang = ScriptServer::get_language(i)->get_type(); - Ref<Texture2D> lang_icon = gc->get_icon(lang, "EditorIcons"); + Ref<Texture2D> lang_icon = gc->get_theme_icon(lang, "EditorIcons"); if (lang_icon.is_valid()) { language_menu->set_item_icon(i, lang_icon); } @@ -62,10 +62,10 @@ void ScriptCreateDialog::_theme_changed() { language_menu->select(default_language); } - path_button->set_icon(gc->get_icon("Folder", "EditorIcons")); - parent_browse_button->set_icon(gc->get_icon("Folder", "EditorIcons")); - parent_search_button->set_icon(gc->get_icon("ClassList", "EditorIcons")); - status_panel->add_style_override("panel", gc->get_stylebox("bg", "Tree")); + path_button->set_icon(gc->get_theme_icon("Folder", "EditorIcons")); + parent_browse_button->set_icon(gc->get_theme_icon("Folder", "EditorIcons")); + parent_search_button->set_icon(gc->get_theme_icon("ClassList", "EditorIcons")); + status_panel->add_theme_style_override("panel", gc->get_theme_stylebox("bg", "Tree")); } void ScriptCreateDialog::_notification(int p_what) { @@ -444,7 +444,7 @@ void ScriptCreateDialog::_lang_changed(int l) { override_info += ", "; } } - template_menu->set_item_icon(extended.id, gc->get_icon("Override", "EditorIcons")); + template_menu->set_item_icon(extended.id, gc->get_theme_icon("Override", "EditorIcons")); template_menu->get_popup()->set_item_tooltip(extended.id, override_info.as_string()); } // Reselect last selected template @@ -609,9 +609,9 @@ void ScriptCreateDialog::_msg_script_valid(bool valid, const String &p_msg) { error_label->set_text("- " + TTR(p_msg)); if (valid) { - error_label->add_color_override("font_color", gc->get_color("success_color", "Editor")); + error_label->add_theme_color_override("font_color", gc->get_theme_color("success_color", "Editor")); } else { - error_label->add_color_override("font_color", gc->get_color("error_color", "Editor")); + error_label->add_theme_color_override("font_color", gc->get_theme_color("error_color", "Editor")); } } @@ -619,9 +619,9 @@ void ScriptCreateDialog::_msg_path_valid(bool valid, const String &p_msg) { path_error_label->set_text("- " + TTR(p_msg)); if (valid) { - path_error_label->add_color_override("font_color", gc->get_color("success_color", "Editor")); + path_error_label->add_theme_color_override("font_color", gc->get_theme_color("success_color", "Editor")); } else { - path_error_label->add_color_override("font_color", gc->get_color("error_color", "Editor")); + path_error_label->add_theme_color_override("font_color", gc->get_theme_color("error_color", "Editor")); } } diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp index 324e1cf502..6bd06aff64 100644 --- a/editor/settings_config_dialog.cpp +++ b/editor/settings_config_dialog.cpp @@ -178,15 +178,15 @@ void EditorSettingsDialog::_unhandled_input(const Ref<InputEvent> &p_event) { void EditorSettingsDialog::_update_icons() { - search_box->set_right_icon(shortcuts->get_icon("Search", "EditorIcons")); + search_box->set_right_icon(shortcuts->get_theme_icon("Search", "EditorIcons")); search_box->set_clear_button_enabled(true); - shortcut_search_box->set_right_icon(shortcuts->get_icon("Search", "EditorIcons")); + shortcut_search_box->set_right_icon(shortcuts->get_theme_icon("Search", "EditorIcons")); shortcut_search_box->set_clear_button_enabled(true); - restart_close_button->set_icon(shortcuts->get_icon("Close", "EditorIcons")); - restart_container->add_style_override("panel", shortcuts->get_stylebox("bg", "Tree")); - restart_icon->set_texture(shortcuts->get_icon("StatusWarning", "EditorIcons")); - restart_label->add_color_override("font_color", shortcuts->get_color("warning_color", "Editor")); + restart_close_button->set_icon(shortcuts->get_theme_icon("Close", "EditorIcons")); + restart_container->add_theme_style_override("panel", shortcuts->get_theme_stylebox("bg", "Tree")); + restart_icon->set_texture(shortcuts->get_theme_icon("StatusWarning", "EditorIcons")); + restart_label->add_theme_color_override("font_color", shortcuts->get_theme_color("warning_color", "Editor")); } void EditorSettingsDialog::_update_shortcuts() { @@ -232,8 +232,8 @@ void EditorSettingsDialog::_update_shortcuts() { } sections[section_name] = section; - section->set_custom_bg_color(0, shortcuts->get_color("prop_subsection", "Editor")); - section->set_custom_bg_color(1, shortcuts->get_color("prop_subsection", "Editor")); + section->set_custom_bg_color(0, shortcuts->get_theme_color("prop_subsection", "Editor")); + section->set_custom_bg_color(1, shortcuts->get_theme_color("prop_subsection", "Editor")); } // Don't match unassigned shortcuts when searching for assigned keys in search results. @@ -245,16 +245,16 @@ void EditorSettingsDialog::_update_shortcuts() { item->set_text(1, sc->get_as_text()); if (!sc->is_shortcut(original) && !(sc->get_shortcut().is_null() && original.is_null())) { - item->add_button(1, shortcuts->get_icon("Reload", "EditorIcons"), 2); + item->add_button(1, shortcuts->get_theme_icon("Reload", "EditorIcons"), 2); } if (sc->get_as_text() == "None") { // Fade out unassigned shortcut labels for easier visual grepping. - item->set_custom_color(1, shortcuts->get_color("font_color", "Label") * Color(1, 1, 1, 0.5)); + item->set_custom_color(1, shortcuts->get_theme_color("font_color", "Label") * Color(1, 1, 1, 0.5)); } - item->add_button(1, shortcuts->get_icon("Edit", "EditorIcons"), 0); - item->add_button(1, shortcuts->get_icon("Close", "EditorIcons"), 1); + item->add_button(1, shortcuts->get_theme_icon("Edit", "EditorIcons"), 0); + item->add_button(1, shortcuts->get_theme_icon("Close", "EditorIcons"), 1); item->set_tooltip(0, E->get()); item->set_metadata(0, E->get()); } diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp index d6e443ec14..a3030e7380 100644 --- a/editor/spatial_editor_gizmos.cpp +++ b/editor/spatial_editor_gizmos.cpp @@ -803,9 +803,9 @@ LightSpatialGizmoPlugin::LightSpatialGizmoPlugin() { create_material("lines_secondary", Color(1, 1, 1, 0.35), false, false, true); create_material("lines_billboard", Color(1, 1, 1), true, false, true); - create_icon_material("light_directional_icon", SpatialEditor::get_singleton()->get_icon("GizmoDirectionalLight", "EditorIcons")); - create_icon_material("light_omni_icon", SpatialEditor::get_singleton()->get_icon("GizmoLight", "EditorIcons")); - create_icon_material("light_spot_icon", SpatialEditor::get_singleton()->get_icon("GizmoSpotLight", "EditorIcons")); + create_icon_material("light_directional_icon", SpatialEditor::get_singleton()->get_theme_icon("GizmoDirectionalLight", "EditorIcons")); + create_icon_material("light_omni_icon", SpatialEditor::get_singleton()->get_theme_icon("GizmoLight", "EditorIcons")); + create_icon_material("light_spot_icon", SpatialEditor::get_singleton()->get_theme_icon("GizmoSpotLight", "EditorIcons")); create_handle_material("handles"); create_handle_material("handles_billboard", true); @@ -1090,7 +1090,7 @@ AudioStreamPlayer3DSpatialGizmoPlugin::AudioStreamPlayer3DSpatialGizmoPlugin() { Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/stream_player_3d", Color(0.4, 0.8, 1)); - create_icon_material("stream_player_3d_icon", SpatialEditor::get_singleton()->get_icon("GizmoSpatialSamplePlayer", "EditorIcons")); + create_icon_material("stream_player_3d_icon", SpatialEditor::get_singleton()->get_theme_icon("GizmoSpatialSamplePlayer", "EditorIcons")); create_material("stream_player_3d_material_primary", gizmo_color); create_material("stream_player_3d_material_secondary", gizmo_color * Color(1, 1, 1, 0.35)); create_handle_material("handles"); @@ -1571,12 +1571,12 @@ Position3DSpatialGizmoPlugin::Position3DSpatialGizmoPlugin() { cursor_points.push_back(Vector3(0, -cs, 0)); cursor_points.push_back(Vector3(0, 0, +cs)); cursor_points.push_back(Vector3(0, 0, -cs)); - cursor_colors.push_back(EditorNode::get_singleton()->get_gui_base()->get_color("axis_x_color", "Editor")); - cursor_colors.push_back(EditorNode::get_singleton()->get_gui_base()->get_color("axis_x_color", "Editor")); - cursor_colors.push_back(EditorNode::get_singleton()->get_gui_base()->get_color("axis_y_color", "Editor")); - cursor_colors.push_back(EditorNode::get_singleton()->get_gui_base()->get_color("axis_y_color", "Editor")); - cursor_colors.push_back(EditorNode::get_singleton()->get_gui_base()->get_color("axis_z_color", "Editor")); - cursor_colors.push_back(EditorNode::get_singleton()->get_gui_base()->get_color("axis_z_color", "Editor")); + cursor_colors.push_back(EditorNode::get_singleton()->get_gui_base()->get_theme_color("axis_x_color", "Editor")); + cursor_colors.push_back(EditorNode::get_singleton()->get_gui_base()->get_theme_color("axis_x_color", "Editor")); + cursor_colors.push_back(EditorNode::get_singleton()->get_gui_base()->get_theme_color("axis_y_color", "Editor")); + cursor_colors.push_back(EditorNode::get_singleton()->get_gui_base()->get_theme_color("axis_y_color", "Editor")); + cursor_colors.push_back(EditorNode::get_singleton()->get_gui_base()->get_theme_color("axis_z_color", "Editor")); + cursor_colors.push_back(EditorNode::get_singleton()->get_gui_base()->get_theme_color("axis_z_color", "Editor")); Ref<StandardMaterial3D> mat = memnew(StandardMaterial3D); mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); @@ -2343,7 +2343,7 @@ void VisibilityNotifierGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { //// CPUParticlesGizmoPlugin::CPUParticlesGizmoPlugin() { - create_icon_material("particles_icon", SpatialEditor::get_singleton()->get_icon("GizmoCPUParticles", "EditorIcons")); + create_icon_material("particles_icon", SpatialEditor::get_singleton()->get_theme_icon("GizmoCPUParticles", "EditorIcons")); } bool CPUParticlesGizmoPlugin::has_gizmo(Spatial *p_spatial) { @@ -2374,7 +2374,7 @@ ParticlesGizmoPlugin::ParticlesGizmoPlugin() { create_material("particles_material", gizmo_color); gizmo_color.a = 0.1; create_material("particles_solid_material", gizmo_color); - create_icon_material("particles_icon", SpatialEditor::get_singleton()->get_icon("GizmoParticles", "EditorIcons")); + create_icon_material("particles_icon", SpatialEditor::get_singleton()->get_theme_icon("GizmoParticles", "EditorIcons")); create_handle_material("handles"); } @@ -2543,7 +2543,7 @@ ReflectionProbeGizmoPlugin::ReflectionProbeGizmoPlugin() { gizmo_color.a = 0.1; create_material("reflection_probe_solid_material", gizmo_color); - create_icon_material("reflection_probe_icon", SpatialEditor::get_singleton()->get_icon("GizmoReflectionProbe", "EditorIcons")); + create_icon_material("reflection_probe_icon", SpatialEditor::get_singleton()->get_theme_icon("GizmoReflectionProbe", "EditorIcons")); create_handle_material("handles"); } @@ -2731,7 +2731,7 @@ GIProbeGizmoPlugin::GIProbeGizmoPlugin() { gizmo_color.a = 0.05; create_material("gi_probe_solid_material", gizmo_color); - create_icon_material("gi_probe_icon", SpatialEditor::get_singleton()->get_icon("GizmoGIProbe", "EditorIcons")); + create_icon_material("gi_probe_icon", SpatialEditor::get_singleton()->get_theme_icon("GizmoGIProbe", "EditorIcons")); create_handle_material("handles"); } |