summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2020-03-12 09:37:40 -0300
committerJuan Linietsky <reduzio@gmail.com>2020-03-26 15:49:42 +0100
commit441f1a5fe9a3bf0e4e5dab578f793500b1ff6e3d (patch)
tree6421bcc3235e6fdcd726244ac7d455886e17734b
parent543fb1c4dadd75914d595b089820aef42e691075 (diff)
Popups are now windows also (broken!)
-rw-r--r--editor/animation_bezier_editor.cpp42
-rw-r--r--editor/animation_track_editor.cpp218
-rw-r--r--editor/animation_track_editor_plugins.cpp90
-rw-r--r--editor/code_editor.cpp84
-rw-r--r--editor/connections_dialog.cpp22
-rw-r--r--editor/create_dialog.cpp14
-rw-r--r--editor/debugger/editor_debugger_node.cpp19
-rw-r--r--editor/debugger/editor_debugger_tree.cpp6
-rw-r--r--editor/debugger/editor_network_profiler.cpp26
-rw-r--r--editor/debugger/editor_profiler.cpp16
-rw-r--r--editor/debugger/editor_visual_profiler.cpp18
-rw-r--r--editor/debugger/script_editor_debugger.cpp68
-rw-r--r--editor/dependency_editor.cpp12
-rw-r--r--editor/editor_about.cpp16
-rw-r--r--editor/editor_asset_installer.cpp24
-rw-r--r--editor/editor_audio_buses.cpp72
-rw-r--r--editor/editor_autoload_settings.cpp8
-rw-r--r--editor/editor_dir_dialog.cpp2
-rw-r--r--editor/editor_feature_profile.cpp2
-rw-r--r--editor/editor_file_dialog.cpp78
-rw-r--r--editor/editor_help.cpp64
-rw-r--r--editor/editor_help_search.cpp22
-rw-r--r--editor/editor_inspector.cpp110
-rw-r--r--editor/editor_log.cpp18
-rw-r--r--editor/editor_node.cpp192
-rw-r--r--editor/editor_path.cpp2
-rw-r--r--editor/editor_plugin_settings.cpp2
-rw-r--r--editor/editor_properties.cpp98
-rw-r--r--editor/editor_properties_array_dict.cpp18
-rw-r--r--editor/editor_resource_preview.cpp2
-rw-r--r--editor/editor_sectioned_inspector.cpp4
-rw-r--r--editor/editor_spin_slider.cpp26
-rw-r--r--editor/export_template_manager.cpp6
-rw-r--r--editor/filesystem_dock.cpp141
-rw-r--r--editor/find_in_files.cpp10
-rw-r--r--editor/groups_editor.cpp28
-rw-r--r--editor/import_dock.cpp6
-rw-r--r--editor/inspector_dock.cpp44
-rw-r--r--editor/node_dock.cpp4
-rw-r--r--editor/pane_drag.cpp4
-rw-r--r--editor/plugins/abstract_polygon_2d_editor.cpp12
-rw-r--r--editor/plugins/animation_blend_space_1d_editor.cpp34
-rw-r--r--editor/plugins/animation_blend_space_2d_editor.cpp46
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.cpp28
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp30
-rw-r--r--editor/plugins/animation_state_machine_editor.cpp74
-rw-r--r--editor/plugins/asset_library_editor_plugin.cpp68
-rw-r--r--editor/plugins/audio_stream_editor_plugin.cpp26
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp230
-rw-r--r--editor/plugins/collision_polygon_editor_plugin.cpp6
-rw-r--r--editor/plugins/collision_shape_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/cpu_particles_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/cpu_particles_editor_plugin.cpp2
-rw-r--r--editor/plugins/curve_editor_plugin.cpp22
-rw-r--r--editor/plugins/debugger_editor_plugin.cpp1
-rw-r--r--editor/plugins/gi_probe_editor_plugin.cpp10
-rw-r--r--editor/plugins/item_list_editor_plugin.cpp4
-rw-r--r--editor/plugins/material_editor_plugin.cpp18
-rw-r--r--editor/plugins/mesh_editor_plugin.cpp8
-rw-r--r--editor/plugins/mesh_instance_editor_plugin.cpp2
-rw-r--r--editor/plugins/mesh_library_editor_plugin.cpp2
-rw-r--r--editor/plugins/multimesh_editor_plugin.cpp2
-rw-r--r--editor/plugins/particles_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/particles_editor_plugin.cpp2
-rw-r--r--editor/plugins/path_2d_editor_plugin.cpp18
-rw-r--r--editor/plugins/path_editor_plugin.cpp8
-rw-r--r--editor/plugins/physical_bone_plugin.cpp2
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.cpp36
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.cpp8
-rw-r--r--editor/plugins/root_motion_editor_plugin.cpp6
-rw-r--r--editor/plugins/script_editor_plugin.cpp48
-rw-r--r--editor/plugins/script_editor_plugin.h2
-rw-r--r--editor/plugins/script_text_editor.cpp87
-rw-r--r--editor/plugins/script_text_editor.h2
-rw-r--r--editor/plugins/shader_editor_plugin.cpp69
-rw-r--r--editor/plugins/skeleton_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/skeleton_editor_plugin.cpp2
-rw-r--r--editor/plugins/skeleton_ik_editor_plugin.cpp2
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp196
-rw-r--r--editor/plugins/sprite_editor_plugin.cpp2
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp28
-rw-r--r--editor/plugins/style_box_editor_plugin.cpp2
-rw-r--r--editor/plugins/text_editor.cpp72
-rw-r--r--editor/plugins/text_editor.h2
-rw-r--r--editor/plugins/texture_editor_plugin.cpp4
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp14
-rw-r--r--editor/plugins/theme_editor_plugin.cpp22
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp38
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp76
-rw-r--r--editor/plugins/version_control_editor_plugin.cpp32
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp92
-rw-r--r--editor/progress_dialog.cpp16
-rw-r--r--editor/progress_dialog.h4
-rw-r--r--editor/project_export.cpp26
-rw-r--r--editor/project_manager.cpp50
-rw-r--r--editor/project_settings_editor.cpp70
-rw-r--r--editor/property_editor.cpp80
-rw-r--r--editor/property_editor.h4
-rw-r--r--editor/property_selector.cpp58
-rw-r--r--editor/quick_open.cpp8
-rw-r--r--editor/rename_dialog.cpp12
-rw-r--r--editor/scene_tree_dock.cpp87
-rw-r--r--editor/scene_tree_editor.cpp58
-rw-r--r--editor/script_create_dialog.cpp20
-rw-r--r--editor/settings_config_dialog.cpp24
-rw-r--r--editor/spatial_editor_gizmos.cpp28
-rw-r--r--main/tests/test_gui.cpp2
-rw-r--r--modules/gdnative/gdnative_library_editor_plugin.cpp24
-rw-r--r--modules/gdnavigation/navigation_mesh_editor_plugin.cpp4
-rw-r--r--modules/gdscript/editor/gdscript_highlighter.cpp10
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp10
-rw-r--r--modules/visual_script/visual_script_editor.cpp166
-rw-r--r--modules/visual_script/visual_script_editor.h2
-rw-r--r--modules/visual_script/visual_script_property_selector.cpp64
-rw-r--r--platform/windows/display_server_windows.cpp32
-rw-r--r--platform/windows/display_server_windows.h2
-rw-r--r--scene/2d/canvas_item.cpp16
-rw-r--r--scene/2d/canvas_item.h1
-rw-r--r--scene/gui/box_container.cpp6
-rw-r--r--scene/gui/button.cpp86
-rw-r--r--scene/gui/check_box.cpp20
-rw-r--r--scene/gui/check_button.cpp16
-rw-r--r--scene/gui/color_picker.cpp38
-rw-r--r--scene/gui/control.cpp305
-rw-r--r--scene/gui/control.h74
-rw-r--r--scene/gui/dialogs.cpp18
-rw-r--r--scene/gui/file_dialog.cpp36
-rw-r--r--scene/gui/gradient_edit.cpp6
-rw-r--r--scene/gui/graph_edit.cpp34
-rw-r--r--scene/gui/graph_node.cpp56
-rw-r--r--scene/gui/grid_container.cpp8
-rw-r--r--scene/gui/item_list.cpp30
-rw-r--r--scene/gui/label.cpp34
-rw-r--r--scene/gui/line_edit.cpp70
-rw-r--r--scene/gui/link_button.cpp20
-rw-r--r--scene/gui/margin_container.cpp16
-rw-r--r--scene/gui/menu_button.cpp14
-rw-r--r--scene/gui/option_button.cpp39
-rw-r--r--scene/gui/panel.cpp2
-rw-r--r--scene/gui/panel_container.cpp18
-rw-r--r--scene/gui/popup.cpp263
-rw-r--r--scene/gui/popup.h39
-rw-r--r--scene/gui/popup_menu.cpp510
-rw-r--r--scene/gui/popup_menu.h13
-rw-r--r--scene/gui/progress_bar.cpp14
-rw-r--r--scene/gui/rich_text_label.cpp82
-rw-r--r--scene/gui/scroll_bar.cpp50
-rw-r--r--scene/gui/scroll_container.cpp8
-rw-r--r--scene/gui/separator.cpp6
-rw-r--r--scene/gui/slider.cpp16
-rw-r--r--scene/gui/spin_box.cpp4
-rw-r--r--scene/gui/split_container.cpp26
-rw-r--r--scene/gui/tab_container.cpp98
-rw-r--r--scene/gui/tabs.cpp104
-rw-r--r--scene/gui/text_edit.cpp106
-rw-r--r--scene/gui/tree.cpp84
-rw-r--r--scene/main/viewport.cpp36
-rw-r--r--scene/main/window.cpp98
-rw-r--r--scene/main/window.h18
159 files changed, 3284 insertions, 3258 deletions
diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp
index 6dcc9dd8ae..f3e3025e81 100644
--- a/editor/animation_bezier_editor.cpp
+++ b/editor/animation_bezier_editor.cpp
@@ -215,20 +215,20 @@ void AnimationBezierTrackEdit::_draw_line_clipped(const Vector2 &p_from, const V
void AnimationBezierTrackEdit::_notification(int p_what) {
if (p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_ENTER_TREE) {
- bezier_icon = get_icon("KeyBezierPoint", "EditorIcons");
- bezier_handle_icon = get_icon("KeyBezierHandle", "EditorIcons");
- selected_icon = get_icon("KeyBezierSelected", "EditorIcons");
+ bezier_icon = get_theme_icon("KeyBezierPoint", "EditorIcons");
+ bezier_handle_icon = get_theme_icon("KeyBezierHandle", "EditorIcons");
+ selected_icon = get_theme_icon("KeyBezierSelected", "EditorIcons");
if (handle_mode_option->get_item_count() == 0) {
- handle_mode_option->add_icon_item(get_icon("BezierHandlesFree", "EditorIcons"), TTR("Free"), HANDLE_MODE_FREE);
- handle_mode_option->add_icon_item(get_icon("BezierHandlesBalanced", "EditorIcons"), TTR("Balanced"), HANDLE_MODE_BALANCED);
- handle_mode_option->add_icon_item(get_icon("BezierHandlesMirror", "EditorIcons"), TTR("Mirror"), HANDLE_MODE_MIRROR);
+ handle_mode_option->add_icon_item(get_theme_icon("BezierHandlesFree", "EditorIcons"), TTR("Free"), HANDLE_MODE_FREE);
+ handle_mode_option->add_icon_item(get_theme_icon("BezierHandlesBalanced", "EditorIcons"), TTR("Balanced"), HANDLE_MODE_BALANCED);
+ handle_mode_option->add_icon_item(get_theme_icon("BezierHandlesMirror", "EditorIcons"), TTR("Mirror"), HANDLE_MODE_MIRROR);
}
}
if (p_what == NOTIFICATION_RESIZED) {
int right_limit = get_size().width - timeline->get_buttons_width();
- int hsep = get_constant("hseparation", "ItemList");
- int vsep = get_constant("vseparation", "ItemList");
+ int hsep = get_theme_constant("hseparation", "ItemList");
+ int vsep = get_theme_constant("vseparation", "ItemList");
handle_mode_option->set_position(Vector2(right_limit + hsep, get_size().height - handle_mode_option->get_combined_minimum_size().height - vsep));
handle_mode_option->set_size(Vector2(timeline->get_buttons_width() - hsep * 2, handle_mode_option->get_combined_minimum_size().height));
@@ -240,15 +240,15 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
int limit = timeline->get_name_limit();
if (has_focus()) {
- Color accent = get_color("accent_color", "Editor");
+ Color accent = get_theme_color("accent_color", "Editor");
accent.a *= 0.7;
draw_rect(Rect2(Point2(), get_size()), accent, false);
}
- Ref<Font> 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> &current, 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");
}
diff --git a/main/tests/test_gui.cpp b/main/tests/test_gui.cpp
index 645588529f..5ad1b2fe31 100644
--- a/main/tests/test_gui.cpp
+++ b/main/tests/test_gui.cpp
@@ -220,7 +220,7 @@ public:
richtext->add_text("faeries.\n");
richtext->pop();
richtext->add_text("In this new episode, we will attempt to ");
- richtext->push_font(richtext->get_font("mono_font", "Fonts"));
+ richtext->push_font(richtext->get_theme_font("mono_font", "Fonts"));
richtext->push_color(Color(0.7, 0.5, 1.0));
richtext->add_text("deliver something nice");
richtext->pop();
diff --git a/modules/gdnative/gdnative_library_editor_plugin.cpp b/modules/gdnative/gdnative_library_editor_plugin.cpp
index e2f1fc81ac..9b4c3c794e 100644
--- a/modules/gdnative/gdnative_library_editor_plugin.cpp
+++ b/modules/gdnative/gdnative_library_editor_plugin.cpp
@@ -77,9 +77,9 @@ void GDNativeLibraryEditor::_update_tree() {
platform->set_text(0, E->get().name);
platform->set_metadata(0, E->get().library_extension);
- platform->set_custom_bg_color(0, get_color("prop_category", "Editor"));
- platform->set_custom_bg_color(1, get_color("prop_category", "Editor"));
- platform->set_custom_bg_color(2, get_color("prop_category", "Editor"));
+ platform->set_custom_bg_color(0, get_theme_color("prop_category", "Editor"));
+ platform->set_custom_bg_color(1, get_theme_color("prop_category", "Editor"));
+ platform->set_custom_bg_color(2, get_theme_color("prop_category", "Editor"));
platform->set_selectable(0, false);
platform->set_expand_right(0, true);
@@ -91,31 +91,31 @@ void GDNativeLibraryEditor::_update_tree() {
bit->set_text(0, it->get());
bit->set_metadata(0, target);
bit->set_selectable(0, false);
- bit->set_custom_bg_color(0, get_color("prop_subsection", "Editor"));
+ bit->set_custom_bg_color(0, get_theme_color("prop_subsection", "Editor"));
- bit->add_button(1, get_icon("Folder", "EditorIcons"), BUTTON_SELECT_LIBRARY, false, TTR("Select the dynamic library for this entry"));
+ bit->add_button(1, get_theme_icon("Folder", "EditorIcons"), BUTTON_SELECT_LIBRARY, false, TTR("Select the dynamic library for this entry"));
String file = entry_configs[target].library;
if (!file.empty()) {
- bit->add_button(1, get_icon("Clear", "EditorIcons"), BUTTON_CLEAR_LIBRARY, false, TTR("Clear"));
+ bit->add_button(1, get_theme_icon("Clear", "EditorIcons"), BUTTON_CLEAR_LIBRARY, false, TTR("Clear"));
}
bit->set_text(1, file);
- bit->add_button(2, get_icon("Folder", "EditorIcons"), BUTTON_SELECT_DEPENDENCES, false, TTR("Select dependencies of the library for this entry"));
+ bit->add_button(2, get_theme_icon("Folder", "EditorIcons"), BUTTON_SELECT_DEPENDENCES, false, TTR("Select dependencies of the library for this entry"));
Array files = entry_configs[target].dependencies;
if (files.size()) {
- bit->add_button(2, get_icon("Clear", "EditorIcons"), BUTTON_CLEAR_DEPENDENCES, false, TTR("Clear"));
+ bit->add_button(2, get_theme_icon("Clear", "EditorIcons"), BUTTON_CLEAR_DEPENDENCES, false, TTR("Clear"));
}
bit->set_text(2, Variant(files));
- bit->add_button(3, get_icon("MoveUp", "EditorIcons"), BUTTON_MOVE_UP, false, TTR("Move Up"));
- bit->add_button(3, get_icon("MoveDown", "EditorIcons"), BUTTON_MOVE_DOWN, false, TTR("Move Down"));
- bit->add_button(3, get_icon("Remove", "EditorIcons"), BUTTON_ERASE_ENTRY, false, TTR("Remove current entry"));
+ bit->add_button(3, get_theme_icon("MoveUp", "EditorIcons"), BUTTON_MOVE_UP, false, TTR("Move Up"));
+ bit->add_button(3, get_theme_icon("MoveDown", "EditorIcons"), BUTTON_MOVE_DOWN, false, TTR("Move Down"));
+ bit->add_button(3, get_theme_icon("Remove", "EditorIcons"), BUTTON_ERASE_ENTRY, false, TTR("Remove current entry"));
}
TreeItem *new_arch = tree->create_item(platform);
new_arch->set_text(0, TTR("Double click to create a new entry"));
new_arch->set_text_align(0, TreeItem::ALIGN_CENTER);
- new_arch->set_custom_color(0, get_color("accent_color", "Editor"));
+ new_arch->set_custom_color(0, get_theme_color("accent_color", "Editor"));
new_arch->set_expand_right(0, true);
new_arch->set_metadata(1, E->key());
diff --git a/modules/gdnavigation/navigation_mesh_editor_plugin.cpp b/modules/gdnavigation/navigation_mesh_editor_plugin.cpp
index ba55b13088..05feb97131 100644
--- a/modules/gdnavigation/navigation_mesh_editor_plugin.cpp
+++ b/modules/gdnavigation/navigation_mesh_editor_plugin.cpp
@@ -50,8 +50,8 @@ void NavigationMeshEditor::_notification(int p_option) {
if (p_option == NOTIFICATION_ENTER_TREE) {
- button_bake->set_icon(get_icon("Bake", "EditorIcons"));
- button_reset->set_icon(get_icon("Reload", "EditorIcons"));
+ button_bake->set_icon(get_theme_icon("Bake", "EditorIcons"));
+ button_reset->set_icon(get_theme_icon("Reload", "EditorIcons"));
}
}
diff --git a/modules/gdscript/editor/gdscript_highlighter.cpp b/modules/gdscript/editor/gdscript_highlighter.cpp
index 687e1785be..0aca4dbc5e 100644
--- a/modules/gdscript/editor/gdscript_highlighter.cpp
+++ b/modules/gdscript/editor/gdscript_highlighter.cpp
@@ -358,11 +358,11 @@ List<String> GDScriptSyntaxHighlighter::get_supported_languages() {
}
void GDScriptSyntaxHighlighter::_update_cache() {
- font_color = text_editor->get_color("font_color");
- symbol_color = text_editor->get_color("symbol_color");
- function_color = text_editor->get_color("function_color");
- number_color = text_editor->get_color("number_color");
- member_color = text_editor->get_color("member_variable_color");
+ font_color = text_editor->get_theme_color("font_color");
+ symbol_color = text_editor->get_theme_color("symbol_color");
+ function_color = text_editor->get_theme_color("function_color");
+ number_color = text_editor->get_theme_color("number_color");
+ member_color = text_editor->get_theme_color("member_variable_color");
const String text_editor_color_theme = EditorSettings::get_singleton()->get("text_editor/theme/color_theme");
const bool default_theme = text_editor_color_theme == "Default";
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index dc624f6087..1917a69388 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -1147,8 +1147,8 @@ void GridMapEditor::_notification(int p_what) {
} break;
case NOTIFICATION_THEME_CHANGED: {
- options->set_icon(get_icon("GridMap", "EditorIcons"));
- search_box->set_right_icon(get_icon("Search", "EditorIcons"));
+ options->set_icon(get_theme_icon("GridMap", "EditorIcons"));
+ search_box->set_right_icon(get_theme_icon("Search", "EditorIcons"));
} break;
}
}
@@ -1227,7 +1227,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
floor->set_min(-32767);
floor->set_max(32767);
floor->set_step(1);
- floor->get_line_edit()->add_constant_override("minimum_spaces", 16);
+ floor->get_line_edit()->add_theme_constant_override("minimum_spaces", 16);
spatial_editor_hb->add_child(floor);
floor->connect("value_changed", callable_mp(this, &GridMapEditor::_floor_changed));
@@ -1305,14 +1305,14 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
mode_thumbnail = memnew(ToolButton);
mode_thumbnail->set_toggle_mode(true);
mode_thumbnail->set_pressed(true);
- mode_thumbnail->set_icon(p_editor->get_gui_base()->get_icon("FileThumbnail", "EditorIcons"));
+ mode_thumbnail->set_icon(p_editor->get_gui_base()->get_theme_icon("FileThumbnail", "EditorIcons"));
hb->add_child(mode_thumbnail);
mode_thumbnail->connect("pressed", callable_mp(this, &GridMapEditor::_set_display_mode), varray(DISPLAY_THUMBNAIL));
mode_list = memnew(ToolButton);
mode_list->set_toggle_mode(true);
mode_list->set_pressed(false);
- mode_list->set_icon(p_editor->get_gui_base()->get_icon("FileList", "EditorIcons"));
+ mode_list->set_icon(p_editor->get_gui_base()->get_theme_icon("FileList", "EditorIcons"));
hb->add_child(mode_list);
mode_list->connect("pressed", callable_mp(this, &GridMapEditor::_set_display_mode), varray(DISPLAY_LIST));
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index 94f1448ae4..19771ef373 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -504,36 +504,36 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
select_func_text->hide();
Ref<Texture2D> type_icons[Variant::VARIANT_MAX] = {
- Control::get_icon("Variant", "EditorIcons"),
- Control::get_icon("bool", "EditorIcons"),
- Control::get_icon("int", "EditorIcons"),
- Control::get_icon("float", "EditorIcons"),
- Control::get_icon("String", "EditorIcons"),
- Control::get_icon("Vector2", "EditorIcons"),
- Control::get_icon("Rect2", "EditorIcons"),
- Control::get_icon("Vector3", "EditorIcons"),
- Control::get_icon("Transform2D", "EditorIcons"),
- Control::get_icon("Plane", "EditorIcons"),
- Control::get_icon("Quat", "EditorIcons"),
- Control::get_icon("AABB", "EditorIcons"),
- Control::get_icon("Basis", "EditorIcons"),
- Control::get_icon("Transform", "EditorIcons"),
- Control::get_icon("Color", "EditorIcons"),
- Control::get_icon("NodePath", "EditorIcons"),
- Control::get_icon("RID", "EditorIcons"),
- Control::get_icon("MiniObject", "EditorIcons"),
- Control::get_icon("Dictionary", "EditorIcons"),
- Control::get_icon("Array", "EditorIcons"),
- Control::get_icon("PackedByteArray", "EditorIcons"),
- Control::get_icon("PackedInt32Array", "EditorIcons"),
- Control::get_icon("PackedFloat32Array", "EditorIcons"),
- Control::get_icon("PackedStringArray", "EditorIcons"),
- Control::get_icon("PackedVector2Array", "EditorIcons"),
- Control::get_icon("PackedVector3Array", "EditorIcons"),
- Control::get_icon("PackedColorArray", "EditorIcons")
+ Control::get_theme_icon("Variant", "EditorIcons"),
+ Control::get_theme_icon("bool", "EditorIcons"),
+ Control::get_theme_icon("int", "EditorIcons"),
+ Control::get_theme_icon("float", "EditorIcons"),
+ Control::get_theme_icon("String", "EditorIcons"),
+ Control::get_theme_icon("Vector2", "EditorIcons"),
+ Control::get_theme_icon("Rect2", "EditorIcons"),
+ Control::get_theme_icon("Vector3", "EditorIcons"),
+ Control::get_theme_icon("Transform2D", "EditorIcons"),
+ Control::get_theme_icon("Plane", "EditorIcons"),
+ Control::get_theme_icon("Quat", "EditorIcons"),
+ Control::get_theme_icon("AABB", "EditorIcons"),
+ Control::get_theme_icon("Basis", "EditorIcons"),
+ Control::get_theme_icon("Transform", "EditorIcons"),
+ Control::get_theme_icon("Color", "EditorIcons"),
+ Control::get_theme_icon("NodePath", "EditorIcons"),
+ Control::get_theme_icon("RID", "EditorIcons"),
+ Control::get_theme_icon("MiniObject", "EditorIcons"),
+ Control::get_theme_icon("Dictionary", "EditorIcons"),
+ Control::get_theme_icon("Array", "EditorIcons"),
+ Control::get_theme_icon("PackedByteArray", "EditorIcons"),
+ Control::get_theme_icon("PackedInt32Array", "EditorIcons"),
+ Control::get_theme_icon("PackedFloat32Array", "EditorIcons"),
+ Control::get_theme_icon("PackedStringArray", "EditorIcons"),
+ Control::get_theme_icon("PackedVector2Array", "EditorIcons"),
+ Control::get_theme_icon("PackedVector3Array", "EditorIcons"),
+ Control::get_theme_icon("PackedColorArray", "EditorIcons")
};
- Ref<Texture2D> seq_port = Control::get_icon("VisualShaderPort", "EditorIcons");
+ Ref<Texture2D> seq_port = Control::get_theme_icon("VisualShaderPort", "EditorIcons");
for (List<StringName>::Element *F = funcs.front(); F; F = F->next()) { // loop through all the functions
@@ -596,7 +596,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
LineEdit *line_edit = memnew(LineEdit);
line_edit->set_text(node->get_text());
line_edit->set_expand_to_text_length(true);
- line_edit->add_font_override("font", get_font("source", "EditorFonts"));
+ line_edit->add_theme_font_override("font", get_theme_font("source", "EditorFonts"));
gnode->add_child(line_edit);
line_edit->connect("text_changed", callable_mp(this, &VisualScriptEditor::_expression_text_changed), varray(E->get()));
} else {
@@ -637,14 +637,14 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
mono_color.a = 0.85;
c = mono_color;
}
- gnode->add_color_override("title_color", c);
+ gnode->add_theme_color_override("title_color", c);
c.a = 0.7;
- gnode->add_color_override("close_color", c);
- gnode->add_color_override("resizer_color", ic);
- gnode->add_style_override("frame", sbf);
+ gnode->add_theme_color_override("close_color", c);
+ gnode->add_theme_color_override("resizer_color", ic);
+ gnode->add_theme_style_override("frame", sbf);
}
- const Color mono_color = get_color("mono_color", "Editor");
+ const Color mono_color = get_theme_color("mono_color", "Editor");
int slot_idx = 0;
@@ -750,7 +750,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
}
Button *rmbtn = memnew(Button);
- rmbtn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Remove", "EditorIcons"));
+ rmbtn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("Remove", "EditorIcons"));
hbc->add_child(rmbtn);
rmbtn->connect("pressed", callable_mp(this, &VisualScriptEditor::_remove_input_port), varray(E->get(), i), CONNECT_DEFERRED);
} else {
@@ -812,7 +812,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
if (is_vslist) {
Button *rmbtn = memnew(Button);
- rmbtn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Remove", "EditorIcons"));
+ rmbtn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("Remove", "EditorIcons"));
hbc->add_child(rmbtn);
rmbtn->connect("pressed", callable_mp(this, &VisualScriptEditor::_remove_output_port), varray(E->get(), i), CONNECT_DEFERRED);
@@ -856,7 +856,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
gnode->add_child(vbc);
- bool dark_theme = get_constant("dark_theme", "Editor");
+ bool dark_theme = get_theme_constant("dark_theme", "Editor");
if (i < mixed_seq_ports) {
gnode->set_slot(slot_idx, left_ok, left_type, _color_from_type(left_type, dark_theme), true, TYPE_SEQUENCE, mono_color, Ref<Texture2D>(), seq_port);
} else {
@@ -940,9 +940,9 @@ void VisualScriptEditor::_update_members() {
TreeItem *functions = members->create_item(root);
functions->set_selectable(0, false);
functions->set_text(0, TTR("Functions:"));
- functions->add_button(0, Control::get_icon("Override", "EditorIcons"), 1, false, TTR("Override an existing built-in function."));
- functions->add_button(0, Control::get_icon("Add", "EditorIcons"), 0, false, TTR("Create a new function."));
- functions->set_custom_color(0, Control::get_color("mono_color", "Editor"));
+ functions->add_button(0, Control::get_theme_icon("Override", "EditorIcons"), 1, false, TTR("Override an existing built-in function."));
+ functions->add_button(0, Control::get_theme_icon("Add", "EditorIcons"), 0, false, TTR("Create a new function."));
+ functions->set_custom_color(0, Control::get_theme_color("mono_color", "Editor"));
List<StringName> func_names;
script->get_function_list(&func_names);
@@ -956,7 +956,7 @@ void VisualScriptEditor::_update_members() {
ti->set_text(0, E->get());
ti->set_selectable(0, true);
ti->set_metadata(0, E->get());
- ti->add_button(0, Control::get_icon("Edit", "EditorIcons"), 0);
+ ti->add_button(0, Control::get_theme_icon("Edit", "EditorIcons"), 0);
if (selected == E->get())
ti->select(0);
}
@@ -964,37 +964,37 @@ void VisualScriptEditor::_update_members() {
TreeItem *variables = members->create_item(root);
variables->set_selectable(0, false);
variables->set_text(0, TTR("Variables:"));
- variables->add_button(0, Control::get_icon("Add", "EditorIcons"), -1, false, TTR("Create a new variable."));
- variables->set_custom_color(0, Control::get_color("mono_color", "Editor"));
+ variables->add_button(0, Control::get_theme_icon("Add", "EditorIcons"), -1, false, TTR("Create a new variable."));
+ variables->set_custom_color(0, Control::get_theme_color("mono_color", "Editor"));
Ref<Texture2D> type_icons[Variant::VARIANT_MAX] = {
- Control::get_icon("Variant", "EditorIcons"),
- Control::get_icon("bool", "EditorIcons"),
- Control::get_icon("int", "EditorIcons"),
- Control::get_icon("float", "EditorIcons"),
- Control::get_icon("String", "EditorIcons"),
- Control::get_icon("Vector2", "EditorIcons"),
- Control::get_icon("Rect2", "EditorIcons"),
- Control::get_icon("Vector3", "EditorIcons"),
- Control::get_icon("Transform2D", "EditorIcons"),
- Control::get_icon("Plane", "EditorIcons"),
- Control::get_icon("Quat", "EditorIcons"),
- Control::get_icon("AABB", "EditorIcons"),
- Control::get_icon("Basis", "EditorIcons"),
- Control::get_icon("Transform", "EditorIcons"),
- Control::get_icon("Color", "EditorIcons"),
- Control::get_icon("NodePath", "EditorIcons"),
- Control::get_icon("RID", "EditorIcons"),
- Control::get_icon("MiniObject", "EditorIcons"),
- Control::get_icon("Dictionary", "EditorIcons"),
- Control::get_icon("Array", "EditorIcons"),
- Control::get_icon("PackedByteArray", "EditorIcons"),
- Control::get_icon("PackedInt32Array", "EditorIcons"),
- Control::get_icon("PackedFloat32Array", "EditorIcons"),
- Control::get_icon("PackedStringArray", "EditorIcons"),
- Control::get_icon("PackedVector2Array", "EditorIcons"),
- Control::get_icon("PackedVector3Array", "EditorIcons"),
- Control::get_icon("PackedColorArray", "EditorIcons")
+ Control::get_theme_icon("Variant", "EditorIcons"),
+ Control::get_theme_icon("bool", "EditorIcons"),
+ Control::get_theme_icon("int", "EditorIcons"),
+ Control::get_theme_icon("float", "EditorIcons"),
+ Control::get_theme_icon("String", "EditorIcons"),
+ Control::get_theme_icon("Vector2", "EditorIcons"),
+ Control::get_theme_icon("Rect2", "EditorIcons"),
+ Control::get_theme_icon("Vector3", "EditorIcons"),
+ Control::get_theme_icon("Transform2D", "EditorIcons"),
+ Control::get_theme_icon("Plane", "EditorIcons"),
+ Control::get_theme_icon("Quat", "EditorIcons"),
+ Control::get_theme_icon("AABB", "EditorIcons"),
+ Control::get_theme_icon("Basis", "EditorIcons"),
+ Control::get_theme_icon("Transform", "EditorIcons"),
+ Control::get_theme_icon("Color", "EditorIcons"),
+ Control::get_theme_icon("NodePath", "EditorIcons"),
+ Control::get_theme_icon("RID", "EditorIcons"),
+ Control::get_theme_icon("MiniObject", "EditorIcons"),
+ Control::get_theme_icon("Dictionary", "EditorIcons"),
+ Control::get_theme_icon("Array", "EditorIcons"),
+ Control::get_theme_icon("PackedByteArray", "EditorIcons"),
+ Control::get_theme_icon("PackedInt32Array", "EditorIcons"),
+ Control::get_theme_icon("PackedFloat32Array", "EditorIcons"),
+ Control::get_theme_icon("PackedStringArray", "EditorIcons"),
+ Control::get_theme_icon("PackedVector2Array", "EditorIcons"),
+ Control::get_theme_icon("PackedVector3Array", "EditorIcons"),
+ Control::get_theme_icon("PackedColorArray", "EditorIcons")
};
List<StringName> var_names;
@@ -1017,8 +1017,8 @@ void VisualScriptEditor::_update_members() {
TreeItem *_signals = members->create_item(root);
_signals->set_selectable(0, false);
_signals->set_text(0, TTR("Signals:"));
- _signals->add_button(0, Control::get_icon("Add", "EditorIcons"), -1, false, TTR("Create a new signal."));
- _signals->set_custom_color(0, Control::get_color("mono_color", "Editor"));
+ _signals->add_button(0, Control::get_theme_icon("Add", "EditorIcons"), -1, false, TTR("Create a new signal."));
+ _signals->set_custom_color(0, Control::get_theme_color("mono_color", "Editor"));
List<StringName> signal_names;
script->get_custom_signal_list(&signal_names);
@@ -1034,12 +1034,12 @@ void VisualScriptEditor::_update_members() {
String base_type = script->get_instance_base_type();
String icon_type = base_type;
- if (!Control::has_icon(base_type, "EditorIcons")) {
+ if (!Control::has_theme_icon(base_type, "EditorIcons")) {
icon_type = "Object";
}
base_type_select->set_text(base_type);
- base_type_select->set_icon(Control::get_icon(icon_type, "EditorIcons"));
+ base_type_select->set_icon(Control::get_theme_icon(icon_type, "EditorIcons"));
updating_members = false;
}
@@ -1252,7 +1252,7 @@ void VisualScriptEditor::_add_func_input() {
hbox->add_child(type_box);
Button *delete_button = memnew(Button);
- delete_button->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Remove", "EditorIcons"));
+ delete_button->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("Remove", "EditorIcons"));
delete_button->set_tooltip(vformat(TTR("Delete input port")));
hbox->add_child(delete_button);
@@ -2377,7 +2377,7 @@ void VisualScriptEditor::_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);
}
@@ -2459,9 +2459,9 @@ String VisualScriptEditor::get_name() {
return name;
}
-Ref<Texture2D> VisualScriptEditor::get_icon() {
+Ref<Texture2D> VisualScriptEditor::get_theme_icon() {
- return Control::get_icon("VisualScript", "EditorIcons");
+ return Control::get_theme_icon("VisualScript", "EditorIcons");
}
bool VisualScriptEditor::is_unsaved() {
@@ -3925,9 +3925,9 @@ void VisualScriptEditor::_notification(int p_what) {
return;
}
- edit_variable_edit->add_style_override("bg", get_stylebox("bg", "Tree"));
- edit_signal_edit->add_style_override("bg", get_stylebox("bg", "Tree"));
- func_input_scroll->add_style_override("bg", get_stylebox("bg", "Tree"));
+ edit_variable_edit->add_theme_style_override("bg", get_theme_stylebox("bg", "Tree"));
+ edit_signal_edit->add_theme_style_override("bg", get_theme_stylebox("bg", "Tree"));
+ func_input_scroll->add_theme_style_override("bg", get_theme_stylebox("bg", "Tree"));
Ref<Theme> tm = EditorNode::get_singleton()->get_theme_base()->get_theme();
@@ -4479,9 +4479,9 @@ void VisualScriptEditor::_member_rmb_selected(const Vector2 &p_pos) {
TreeItem *root = members->get_root();
- Ref<Texture2D> del_icon = Control::get_icon("Remove", "EditorIcons");
+ Ref<Texture2D> del_icon = Control::get_theme_icon("Remove", "EditorIcons");
- Ref<Texture2D> edit_icon = Control::get_icon("Edit", "EditorIcons");
+ Ref<Texture2D> edit_icon = Control::get_theme_icon("Edit", "EditorIcons");
if (ti->get_parent() == root->get_children()) {
diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h
index 79388e7298..d9494e4d04 100644
--- a/modules/visual_script/visual_script_editor.h
+++ b/modules/visual_script/visual_script_editor.h
@@ -298,7 +298,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/modules/visual_script/visual_script_property_selector.cpp b/modules/visual_script/visual_script_property_selector.cpp
index c12eda683a..d749e3257a 100644
--- a/modules/visual_script/visual_script_property_selector.cpp
+++ b/modules/visual_script/visual_script_property_selector.cpp
@@ -99,35 +99,35 @@ void VisualScriptPropertySelector::_update_search() {
List<PropertyInfo> props;
TreeItem *category = NULL;
Ref<Texture2D> type_icons[Variant::VARIANT_MAX] = {
- vbc->get_icon("Variant", "EditorIcons"),
- vbc->get_icon("bool", "EditorIcons"),
- vbc->get_icon("int", "EditorIcons"),
- vbc->get_icon("float", "EditorIcons"),
- vbc->get_icon("String", "EditorIcons"),
- vbc->get_icon("Vector2", "EditorIcons"),
- vbc->get_icon("Rect2", "EditorIcons"),
- vbc->get_icon("Vector3", "EditorIcons"),
- vbc->get_icon("Transform2D", "EditorIcons"),
- vbc->get_icon("Plane", "EditorIcons"),
- vbc->get_icon("Quat", "EditorIcons"),
- vbc->get_icon("AABB", "EditorIcons"),
- vbc->get_icon("Basis", "EditorIcons"),
- vbc->get_icon("Transform", "EditorIcons"),
- vbc->get_icon("Color", "EditorIcons"),
- vbc->get_icon("Path", "EditorIcons"),
- vbc->get_icon("RID", "EditorIcons"),
- vbc->get_icon("Object", "EditorIcons"),
- vbc->get_icon("Dictionary", "EditorIcons"),
- vbc->get_icon("Array", "EditorIcons"),
- vbc->get_icon("PackedByteArray", "EditorIcons"),
- vbc->get_icon("PackedInt32Array", "EditorIcons"),
- vbc->get_icon("PackedFloat32Array", "EditorIcons"),
- vbc->get_icon("PackedInt64Array", "EditorIcons"),
- vbc->get_icon("PackedFloat64Array", "EditorIcons"),
- vbc->get_icon("PackedStringArray", "EditorIcons"),
- vbc->get_icon("PackedVector2Array", "EditorIcons"),
- vbc->get_icon("PackedVector3Array", "EditorIcons"),
- vbc->get_icon("PackedColorArray", "EditorIcons")
+ vbc->get_theme_icon("Variant", "EditorIcons"),
+ vbc->get_theme_icon("bool", "EditorIcons"),
+ vbc->get_theme_icon("int", "EditorIcons"),
+ vbc->get_theme_icon("float", "EditorIcons"),
+ vbc->get_theme_icon("String", "EditorIcons"),
+ vbc->get_theme_icon("Vector2", "EditorIcons"),
+ vbc->get_theme_icon("Rect2", "EditorIcons"),
+ vbc->get_theme_icon("Vector3", "EditorIcons"),
+ vbc->get_theme_icon("Transform2D", "EditorIcons"),
+ vbc->get_theme_icon("Plane", "EditorIcons"),
+ vbc->get_theme_icon("Quat", "EditorIcons"),
+ vbc->get_theme_icon("AABB", "EditorIcons"),
+ vbc->get_theme_icon("Basis", "EditorIcons"),
+ vbc->get_theme_icon("Transform", "EditorIcons"),
+ vbc->get_theme_icon("Color", "EditorIcons"),
+ vbc->get_theme_icon("Path", "EditorIcons"),
+ vbc->get_theme_icon("RID", "EditorIcons"),
+ vbc->get_theme_icon("Object", "EditorIcons"),
+ vbc->get_theme_icon("Dictionary", "EditorIcons"),
+ vbc->get_theme_icon("Array", "EditorIcons"),
+ vbc->get_theme_icon("PackedByteArray", "EditorIcons"),
+ vbc->get_theme_icon("PackedInt32Array", "EditorIcons"),
+ vbc->get_theme_icon("PackedFloat32Array", "EditorIcons"),
+ vbc->get_theme_icon("PackedInt64Array", "EditorIcons"),
+ vbc->get_theme_icon("PackedFloat64Array", "EditorIcons"),
+ vbc->get_theme_icon("PackedStringArray", "EditorIcons"),
+ vbc->get_theme_icon("PackedVector2Array", "EditorIcons"),
+ vbc->get_theme_icon("PackedVector3Array", "EditorIcons"),
+ vbc->get_theme_icon("PackedColorArray", "EditorIcons")
};
{
String b = String(E->get());
@@ -252,7 +252,7 @@ void VisualScriptPropertySelector::_update_search() {
TreeItem *item = search_options->create_item(category ? category : root);
item->set_text(0, desc);
- item->set_icon(0, vbc->get_icon("MemberMethod", "EditorIcons"));
+ item->set_icon(0, vbc->get_theme_icon("MemberMethod", "EditorIcons"));
item->set_metadata(0, name);
item->set_selectable(0, true);
@@ -316,7 +316,7 @@ void VisualScriptPropertySelector::create_visualscript_item(const String &name,
if (search_input == String() || text.findn(search_input) != -1) {
TreeItem *item = search_options->create_item(root);
item->set_text(0, text);
- item->set_icon(0, vbc->get_icon("VisualScript", "EditorIcons"));
+ item->set_icon(0, vbc->get_theme_icon("VisualScript", "EditorIcons"));
item->set_metadata(0, name);
item->set_metadata(1, "action");
item->set_selectable(0, true);
@@ -399,7 +399,7 @@ void VisualScriptPropertySelector::get_visual_node_names(const String &root_filt
}
item->set_text(0, type_name + String("").join(desc));
- item->set_icon(0, vbc->get_icon("VisualScript", "EditorIcons"));
+ item->set_icon(0, vbc->get_theme_icon("VisualScript", "EditorIcons"));
item->set_selectable(0, true);
item->set_metadata(0, E->get());
item->set_selectable(0, true);
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index d705ce631a..e2c78da5a9 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -527,9 +527,20 @@ Point2i DisplayServerWindows::window_get_position(WindowID p_window) const {
return wd.last_pos;
}
+ POINT point;
+ point.x = 0;
+ point.y = 0;
+
+ ClientToScreen(wd.hWnd, &point);
+
+ return Point2i(point.x, point.y);
+
+#if 0
+ //do not use this method, as it includes windows decorations
RECT r;
GetWindowRect(wd.hWnd, &r);
return Point2(r.left, r.top);
+#endif
}
void DisplayServerWindows::_update_real_mouse_position(WindowID p_window) {
@@ -551,10 +562,25 @@ void DisplayServerWindows::window_set_position(const Point2i &p_position, Window
WindowData &wd = windows[p_window];
if (wd.fullscreen) return;
+#if 0
+ //wrong needs to account properly for decorations
RECT r;
GetWindowRect(wd.hWnd, &r);
MoveWindow(wd.hWnd, p_position.x, p_position.y, r.right - r.left, r.bottom - r.top, TRUE);
+#else
+
+ RECT rc;
+ rc.left = p_position.x;
+ rc.right = p_position.x + wd.width;
+ rc.bottom = p_position.y + wd.height;
+ rc.top = p_position.y;
+ const DWORD style = GetWindowLongPtr(wd.hWnd, GWL_STYLE);
+ const DWORD exStyle = GetWindowLongPtr(wd.hWnd, GWL_EXSTYLE);
+
+ AdjustWindowRectEx(&rc, style, false, exStyle);
+ MoveWindow(wd.hWnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, TRUE);
+#endif
// Don't let the mouse leave the window when moved
if (mouse_mode == MOUSE_MODE_CONFINED) {
RECT rect;
@@ -2535,8 +2561,10 @@ DisplayServer::WindowID DisplayServerWindows::_create_window(WindowMode p_mode,
dwExStyle,
L"Engine", L"",
dwStyle | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
- (GetSystemMetrics(SM_CXSCREEN) - WindowRect.right) / 2,
- (GetSystemMetrics(SM_CYSCREEN) - WindowRect.bottom) / 2,
+ // (GetSystemMetrics(SM_CXSCREEN) - WindowRect.right) / 2,
+ // (GetSystemMetrics(SM_CYSCREEN) - WindowRect.bottom) / 2,
+ WindowRect.left,
+ WindowRect.top,
WindowRect.right - WindowRect.left,
WindowRect.bottom - WindowRect.top,
NULL, NULL, hInstance, NULL);
diff --git a/platform/windows/display_server_windows.h b/platform/windows/display_server_windows.h
index 5fef08fbd5..0c07e6283c 100644
--- a/platform/windows/display_server_windows.h
+++ b/platform/windows/display_server_windows.h
@@ -222,7 +222,7 @@ class DisplayServerWindows : public DisplayServer {
HCURSOR hCursor;
- WNDPROC user_proc;
+ WNDPROC user_proc = nullptr;
void _send_window_event(const WindowData &wd, WindowEvent p_event);
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index 2d2da005d0..321f3f2e6f 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -34,6 +34,7 @@
#include "core/message_queue.h"
#include "core/method_bind_ext.gen.inc"
#include "scene/main/canvas_layer.h"
+#include "scene/main/viewport.h"
#include "scene/main/window.h"
#include "scene/resources/font.h"
#include "scene/resources/style_box.h"
@@ -454,6 +455,21 @@ Transform2D CanvasItem::get_global_transform_with_canvas() const {
return get_global_transform();
}
+Transform2D CanvasItem::get_screen_transform() const {
+ ERR_FAIL_COND_V(!is_inside_tree(), Transform2D());
+ Transform2D xform = get_global_transform_with_canvas();
+
+ Window *w = Object::cast_to<Window>(get_viewport());
+ if (w) {
+ Transform2D s;
+ s.set_origin(w->get_position());
+
+ xform = s * xform;
+ }
+
+ return xform;
+}
+
Transform2D CanvasItem::get_global_transform() const {
#ifdef DEBUG_ENABLED
ERR_FAIL_COND_V(!is_inside_tree(), get_transform());
diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h
index 6bfe3cf0c7..3f176e5f60 100644
--- a/scene/2d/canvas_item.h
+++ b/scene/2d/canvas_item.h
@@ -367,6 +367,7 @@ public:
virtual Transform2D get_global_transform() const;
virtual Transform2D get_global_transform_with_canvas() const;
+ virtual Transform2D get_screen_transform() const;
CanvasItem *get_toplevel() const;
_FORCE_INLINE_ RID get_canvas_item() const {
diff --git a/scene/gui/box_container.cpp b/scene/gui/box_container.cpp
index e0bfeac9f7..0da6e0fdfa 100644
--- a/scene/gui/box_container.cpp
+++ b/scene/gui/box_container.cpp
@@ -45,7 +45,7 @@ void BoxContainer::_resort() {
Size2i new_size = get_size();
- int sep = get_constant("separation"); //,vertical?"VBoxContainer":"HBoxContainer");
+ int sep = get_theme_constant("separation"); //,vertical?"VBoxContainer":"HBoxContainer");
bool first = true;
int children_count = 0;
@@ -206,7 +206,7 @@ Size2 BoxContainer::get_minimum_size() const {
/* Calculate MINIMUM SIZE */
Size2i minimum;
- int sep = get_constant("separation"); //,vertical?"VBoxContainer":"HBoxContainer");
+ int sep = get_theme_constant("separation"); //,vertical?"VBoxContainer":"HBoxContainer");
bool first = true;
@@ -310,7 +310,7 @@ MarginContainer *VBoxContainer::add_margin_child(const String &p_label, Control
l->set_text(p_label);
add_child(l);
MarginContainer *mc = memnew(MarginContainer);
- mc->add_constant_override("margin_left", 0);
+ mc->add_theme_constant_override("margin_left", 0);
mc->add_child(p_control);
add_child(mc);
if (p_expand)
diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp
index 784d298bff..f71d322412 100644
--- a/scene/gui/button.cpp
+++ b/scene/gui/button.cpp
@@ -35,14 +35,14 @@
Size2 Button::get_minimum_size() const {
- Size2 minsize = get_font("font")->get_string_size(xl_text);
+ Size2 minsize = get_theme_font("font")->get_string_size(xl_text);
if (clip_text)
minsize.width = 0;
if (!expand_icon) {
Ref<Texture2D> _icon;
- if (icon.is_null() && has_icon("icon"))
- _icon = Control::get_icon("icon");
+ if (icon.is_null() && has_theme_icon("icon"))
+ _icon = Control::get_theme_icon("icon");
else
_icon = icon;
@@ -51,11 +51,11 @@ Size2 Button::get_minimum_size() const {
minsize.height = MAX(minsize.height, _icon->get_height());
minsize.width += _icon->get_width();
if (xl_text != "")
- minsize.width += get_constant("hseparation");
+ minsize.width += get_theme_constant("hseparation");
}
}
- return get_stylebox("normal")->get_minimum_size() + minsize;
+ return get_theme_stylebox("normal")->get_minimum_size() + minsize;
}
void Button::_set_internal_margin(Margin p_margin, float p_value) {
@@ -79,30 +79,30 @@ void Button::_notification(int p_what) {
Color color;
Color color_icon(1, 1, 1, 1);
- Ref<StyleBox> style = get_stylebox("normal");
+ Ref<StyleBox> style = get_theme_stylebox("normal");
switch (get_draw_mode()) {
case DRAW_NORMAL: {
- style = get_stylebox("normal");
+ style = get_theme_stylebox("normal");
if (!flat)
style->draw(ci, Rect2(Point2(0, 0), size));
- color = get_color("font_color");
- if (has_color("icon_color_normal"))
- color_icon = get_color("icon_color_normal");
+ color = get_theme_color("font_color");
+ if (has_theme_color("icon_color_normal"))
+ color_icon = get_theme_color("icon_color_normal");
} break;
case DRAW_HOVER_PRESSED: {
- if (has_stylebox("hover_pressed") && has_stylebox_override("hover_pressed")) {
- style = get_stylebox("hover_pressed");
+ if (has_theme_stylebox("hover_pressed") && has_theme_stylebox_override("hover_pressed")) {
+ style = get_theme_stylebox("hover_pressed");
if (!flat)
style->draw(ci, Rect2(Point2(0, 0), size));
- if (has_color("font_color_hover_pressed"))
- color = get_color("font_color_hover_pressed");
+ if (has_theme_color("font_color_hover_pressed"))
+ color = get_theme_color("font_color_hover_pressed");
else
- color = get_color("font_color");
- if (has_color("icon_color_hover_pressed"))
- color_icon = get_color("icon_color_hover_pressed");
+ color = get_theme_color("font_color");
+ if (has_theme_color("icon_color_hover_pressed"))
+ color_icon = get_theme_color("icon_color_hover_pressed");
break;
}
@@ -110,49 +110,49 @@ void Button::_notification(int p_what) {
}
case DRAW_PRESSED: {
- style = get_stylebox("pressed");
+ style = get_theme_stylebox("pressed");
if (!flat)
style->draw(ci, Rect2(Point2(0, 0), size));
- if (has_color("font_color_pressed"))
- color = get_color("font_color_pressed");
+ if (has_theme_color("font_color_pressed"))
+ color = get_theme_color("font_color_pressed");
else
- color = get_color("font_color");
- if (has_color("icon_color_pressed"))
- color_icon = get_color("icon_color_pressed");
+ color = get_theme_color("font_color");
+ if (has_theme_color("icon_color_pressed"))
+ color_icon = get_theme_color("icon_color_pressed");
} break;
case DRAW_HOVER: {
- style = get_stylebox("hover");
+ style = get_theme_stylebox("hover");
if (!flat)
style->draw(ci, Rect2(Point2(0, 0), size));
- color = get_color("font_color_hover");
- if (has_color("icon_color_hover"))
- color_icon = get_color("icon_color_hover");
+ color = get_theme_color("font_color_hover");
+ if (has_theme_color("icon_color_hover"))
+ color_icon = get_theme_color("icon_color_hover");
} break;
case DRAW_DISABLED: {
- style = get_stylebox("disabled");
+ style = get_theme_stylebox("disabled");
if (!flat)
style->draw(ci, Rect2(Point2(0, 0), size));
- color = get_color("font_color_disabled");
- if (has_color("icon_color_disabled"))
- color_icon = get_color("icon_color_disabled");
+ color = get_theme_color("font_color_disabled");
+ if (has_theme_color("icon_color_disabled"))
+ color_icon = get_theme_color("icon_color_disabled");
} break;
}
if (has_focus()) {
- Ref<StyleBox> style2 = get_stylebox("focus");
+ Ref<StyleBox> style2 = get_theme_stylebox("focus");
style2->draw(ci, Rect2(Point2(), size));
}
- Ref<Font> font = get_font("font");
+ Ref<Font> font = get_theme_font("font");
Ref<Texture2D> _icon;
- if (icon.is_null() && has_icon("icon"))
- _icon = Control::get_icon("icon");
+ if (icon.is_null() && has_theme_icon("icon"))
+ _icon = Control::get_theme_icon("icon");
else
_icon = icon;
@@ -166,14 +166,14 @@ void Button::_notification(int p_what) {
float icon_ofs_region = 0;
if (_internal_margin[MARGIN_LEFT] > 0) {
- icon_ofs_region = _internal_margin[MARGIN_LEFT] + get_constant("hseparation");
+ icon_ofs_region = _internal_margin[MARGIN_LEFT] + get_theme_constant("hseparation");
}
if (expand_icon) {
Size2 _size = get_size() - style->get_offset() * 2;
- _size.width -= get_constant("hseparation") + icon_ofs_region;
+ _size.width -= get_theme_constant("hseparation") + icon_ofs_region;
if (!clip_text)
- _size.width -= get_font("font")->get_string_size(xl_text).width;
+ _size.width -= get_theme_font("font")->get_string_size(xl_text).width;
float icon_width = _icon->get_width() * _size.height / _icon->get_height();
float icon_height = _size.height;
@@ -188,13 +188,13 @@ void Button::_notification(int p_what) {
}
}
- Point2 icon_ofs = !_icon.is_null() ? Point2(icon_region.size.width + get_constant("hseparation"), 0) : Point2();
+ Point2 icon_ofs = !_icon.is_null() ? Point2(icon_region.size.width + get_theme_constant("hseparation"), 0) : Point2();
int text_clip = size.width - style->get_minimum_size().width - icon_ofs.width;
if (_internal_margin[MARGIN_LEFT] > 0) {
- text_clip -= _internal_margin[MARGIN_LEFT] + get_constant("hseparation");
+ text_clip -= _internal_margin[MARGIN_LEFT] + get_theme_constant("hseparation");
}
if (_internal_margin[MARGIN_RIGHT] > 0) {
- text_clip -= _internal_margin[MARGIN_RIGHT] + get_constant("hseparation");
+ text_clip -= _internal_margin[MARGIN_RIGHT] + get_theme_constant("hseparation");
}
Point2 text_ofs = (size - style->get_minimum_size() - icon_ofs - font->get_string_size(xl_text) - Point2(_internal_margin[MARGIN_RIGHT] - _internal_margin[MARGIN_LEFT], 0)) / 2.0;
@@ -202,7 +202,7 @@ void Button::_notification(int p_what) {
switch (align) {
case ALIGN_LEFT: {
if (_internal_margin[MARGIN_LEFT] > 0) {
- text_ofs.x = style->get_margin(MARGIN_LEFT) + icon_ofs.x + _internal_margin[MARGIN_LEFT] + get_constant("hseparation");
+ text_ofs.x = style->get_margin(MARGIN_LEFT) + icon_ofs.x + _internal_margin[MARGIN_LEFT] + get_theme_constant("hseparation");
} else {
text_ofs.x = style->get_margin(MARGIN_LEFT) + icon_ofs.x;
}
@@ -216,7 +216,7 @@ void Button::_notification(int p_what) {
} break;
case ALIGN_RIGHT: {
if (_internal_margin[MARGIN_RIGHT] > 0) {
- text_ofs.x = size.x - style->get_margin(MARGIN_RIGHT) - font->get_string_size(xl_text).x - _internal_margin[MARGIN_RIGHT] - get_constant("hseparation");
+ text_ofs.x = size.x - style->get_margin(MARGIN_RIGHT) - font->get_string_size(xl_text).x - _internal_margin[MARGIN_RIGHT] - get_theme_constant("hseparation");
} else {
text_ofs.x = size.x - style->get_margin(MARGIN_RIGHT) - font->get_string_size(xl_text).x;
}
diff --git a/scene/gui/check_box.cpp b/scene/gui/check_box.cpp
index 89bd8ab0dd..d68bd4fe4e 100644
--- a/scene/gui/check_box.cpp
+++ b/scene/gui/check_box.cpp
@@ -33,10 +33,10 @@
#include "servers/visual_server.h"
Size2 CheckBox::get_icon_size() const {
- Ref<Texture2D> checked = Control::get_icon("checked");
- Ref<Texture2D> unchecked = Control::get_icon("unchecked");
- Ref<Texture2D> radio_checked = Control::get_icon("radio_checked");
- Ref<Texture2D> radio_unchecked = Control::get_icon("radio_unchecked");
+ Ref<Texture2D> checked = Control::get_theme_icon("checked");
+ Ref<Texture2D> unchecked = Control::get_theme_icon("unchecked");
+ Ref<Texture2D> radio_checked = Control::get_theme_icon("radio_checked");
+ Ref<Texture2D> radio_unchecked = Control::get_theme_icon("radio_unchecked");
Size2 tex_size = Size2(0, 0);
if (!checked.is_null())
@@ -56,9 +56,9 @@ Size2 CheckBox::get_minimum_size() const {
Size2 tex_size = get_icon_size();
minsize.width += tex_size.width;
if (get_text().length() > 0) {
- minsize.width += get_constant("hseparation");
+ minsize.width += get_theme_constant("hseparation");
}
- Ref<StyleBox> sb = get_stylebox("normal");
+ Ref<StyleBox> sb = get_theme_stylebox("normal");
minsize.height = MAX(minsize.height, tex_size.height + sb->get_margin(MARGIN_TOP) + sb->get_margin(MARGIN_BOTTOM));
return minsize;
@@ -73,13 +73,13 @@ void CheckBox::_notification(int p_what) {
RID ci = get_canvas_item();
- Ref<Texture2D> on = Control::get_icon(is_radio() ? "radio_checked" : "checked");
- Ref<Texture2D> off = Control::get_icon(is_radio() ? "radio_unchecked" : "unchecked");
- Ref<StyleBox> sb = get_stylebox("normal");
+ Ref<Texture2D> on = Control::get_theme_icon(is_radio() ? "radio_checked" : "checked");
+ Ref<Texture2D> off = Control::get_theme_icon(is_radio() ? "radio_unchecked" : "unchecked");
+ Ref<StyleBox> sb = get_theme_stylebox("normal");
Vector2 ofs;
ofs.x = sb->get_margin(MARGIN_LEFT);
- ofs.y = int((get_size().height - get_icon_size().height) / 2) + get_constant("check_vadjust");
+ ofs.y = int((get_size().height - get_icon_size().height) / 2) + get_theme_constant("check_vadjust");
if (is_pressed())
on->draw(ci, ofs);
diff --git a/scene/gui/check_button.cpp b/scene/gui/check_button.cpp
index 0b093ce850..ac967a128c 100644
--- a/scene/gui/check_button.cpp
+++ b/scene/gui/check_button.cpp
@@ -35,8 +35,8 @@
Size2 CheckButton::get_icon_size() const {
- Ref<Texture2D> on = Control::get_icon(is_disabled() ? "on_disabled" : "on");
- Ref<Texture2D> off = Control::get_icon(is_disabled() ? "off_disabled" : "off");
+ Ref<Texture2D> on = Control::get_theme_icon(is_disabled() ? "on_disabled" : "on");
+ Ref<Texture2D> off = Control::get_theme_icon(is_disabled() ? "off_disabled" : "off");
Size2 tex_size = Size2(0, 0);
if (!on.is_null())
tex_size = Size2(on->get_width(), on->get_height());
@@ -52,8 +52,8 @@ Size2 CheckButton::get_minimum_size() const {
Size2 tex_size = get_icon_size();
minsize.width += tex_size.width;
if (get_text().length() > 0)
- minsize.width += get_constant("hseparation");
- Ref<StyleBox> sb = get_stylebox("normal");
+ minsize.width += get_theme_constant("hseparation");
+ Ref<StyleBox> sb = get_theme_stylebox("normal");
minsize.height = MAX(minsize.height, tex_size.height + sb->get_margin(MARGIN_TOP) + sb->get_margin(MARGIN_BOTTOM));
return minsize;
@@ -68,15 +68,15 @@ void CheckButton::_notification(int p_what) {
RID ci = get_canvas_item();
- Ref<Texture2D> on = Control::get_icon(is_disabled() ? "on_disabled" : "on");
- Ref<Texture2D> off = Control::get_icon(is_disabled() ? "off_disabled" : "off");
+ Ref<Texture2D> on = Control::get_theme_icon(is_disabled() ? "on_disabled" : "on");
+ Ref<Texture2D> off = Control::get_theme_icon(is_disabled() ? "off_disabled" : "off");
- Ref<StyleBox> sb = get_stylebox("normal");
+ Ref<StyleBox> sb = get_theme_stylebox("normal");
Vector2 ofs;
Size2 tex_size = get_icon_size();
ofs.x = get_size().width - (tex_size.width + sb->get_margin(MARGIN_RIGHT));
- ofs.y = (get_size().height - tex_size.height) / 2 + get_constant("check_vadjust");
+ ofs.y = (get_size().height - tex_size.height) / 2 + get_theme_constant("check_vadjust");
if (is_pressed())
on->draw(ci, ofs);
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index 79125cc14b..2a3f7467dc 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -45,15 +45,15 @@ void ColorPicker::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_THEME_CHANGED: {
- btn_pick->set_icon(get_icon("screen_picker", "ColorPicker"));
- bt_add_preset->set_icon(get_icon("add_preset"));
+ btn_pick->set_icon(get_theme_icon("screen_picker", "ColorPicker"));
+ bt_add_preset->set_icon(get_theme_icon("add_preset"));
_update_controls();
} break;
case NOTIFICATION_ENTER_TREE: {
- btn_pick->set_icon(get_icon("screen_picker", "ColorPicker"));
- bt_add_preset->set_icon(get_icon("add_preset"));
+ btn_pick->set_icon(get_theme_icon("screen_picker", "ColorPicker"));
+ bt_add_preset->set_icon(get_theme_icon("add_preset"));
_update_color();
@@ -70,13 +70,13 @@ void ColorPicker::_notification(int p_what) {
case NOTIFICATION_PARENTED: {
for (int i = 0; i < 4; i++)
- set_margin((Margin)i, get_constant("margin"));
+ set_margin((Margin)i, get_theme_constant("margin"));
} break;
case NOTIFICATION_VISIBILITY_CHANGED: {
Popup *p = Object::cast_to<Popup>(get_parent());
if (p)
- p->set_size(Size2(get_combined_minimum_size().width + get_constant("margin") * 2, get_combined_minimum_size().height + get_constant("margin") * 2));
+ p->set_size(Size2(get_combined_minimum_size().width + get_theme_constant("margin") * 2, get_combined_minimum_size().height + get_theme_constant("margin") * 2));
} break;
case NOTIFICATION_WM_CLOSE_REQUEST: {
@@ -267,7 +267,7 @@ void ColorPicker::_text_type_toggled() {
text_is_constructor = !text_is_constructor;
if (text_is_constructor) {
text_type->set_text("");
- text_type->set_icon(get_icon("Script", "EditorIcons"));
+ text_type->set_icon(get_theme_icon("Script", "EditorIcons"));
c_text->set_editable(false);
} else {
@@ -399,14 +399,14 @@ void ColorPicker::_sample_draw() {
const Rect2 r = Rect2(Point2(), Size2(uv_edit->get_size().width, sample->get_size().height * 0.95));
if (color.a < 1.0) {
- sample->draw_texture_rect(get_icon("preset_bg", "ColorPicker"), r, true);
+ sample->draw_texture_rect(get_theme_icon("preset_bg", "ColorPicker"), r, true);
}
sample->draw_rect(r, color);
if (color.r > 1 || color.g > 1 || color.b > 1) {
// Draw an indicator to denote that the color is "overbright" and can't be displayed accurately in the preview
- sample->draw_texture(get_icon("overbright_indicator", "ColorPicker"), Point2());
+ sample->draw_texture(get_theme_icon("overbright_indicator", "ColorPicker"), Point2());
}
}
@@ -445,7 +445,7 @@ void ColorPicker::_hsv_draw(int p_which, Control *c) {
c->draw_line(Point2(0, y), Point2(c->get_size().x, y), col.inverted());
c->draw_line(Point2(x, y), Point2(x, y), Color(1, 1, 1), 2);
} else if (p_which == 1) {
- Ref<Texture2D> hue = get_icon("color_hue", "ColorPicker");
+ Ref<Texture2D> hue = get_theme_icon("color_hue", "ColorPicker");
c->draw_texture_rect(hue, Rect2(Point2(), c->get_size()));
int y = c->get_size().y - c->get_size().y * (1.0 - h);
Color col = Color();
@@ -738,12 +738,12 @@ ColorPicker::ColorPicker() :
uv_edit->set_mouse_filter(MOUSE_FILTER_PASS);
uv_edit->set_h_size_flags(SIZE_EXPAND_FILL);
uv_edit->set_v_size_flags(SIZE_EXPAND_FILL);
- uv_edit->set_custom_minimum_size(Size2(get_constant("sv_width"), get_constant("sv_height")));
+ uv_edit->set_custom_minimum_size(Size2(get_theme_constant("sv_width"), get_theme_constant("sv_height")));
uv_edit->connect("draw", callable_mp(this, &ColorPicker::_hsv_draw), make_binds(0, uv_edit));
w_edit = memnew(Control);
hb_edit->add_child(w_edit);
- w_edit->set_custom_minimum_size(Size2(get_constant("h_width"), 0));
+ w_edit->set_custom_minimum_size(Size2(get_theme_constant("h_width"), 0));
w_edit->set_h_size_flags(SIZE_FILL);
w_edit->set_v_size_flags(SIZE_EXPAND_FILL);
w_edit->connect("gui_input", callable_mp(this, &ColorPicker::_w_input));
@@ -777,7 +777,7 @@ ColorPicker::ColorPicker() :
HBoxContainer *hbc = memnew(HBoxContainer);
labels[i] = memnew(Label());
- labels[i]->set_custom_minimum_size(Size2(get_constant("label_width"), 0));
+ labels[i]->set_custom_minimum_size(Size2(get_theme_constant("label_width"), 0));
labels[i]->set_v_size_flags(SIZE_SHRINK_CENTER);
hbc->add_child(labels[i]);
@@ -881,8 +881,8 @@ void ColorPickerButton::_modal_closed() {
void ColorPickerButton::pressed() {
_update_picker();
- popup->set_position(get_global_position() - picker->get_combined_minimum_size() * get_global_transform().get_scale());
- popup->set_scale(get_global_transform().get_scale());
+ popup->set_position(get_screen_position() - picker->get_combined_minimum_size() * get_global_transform().get_scale());
+ //popup->set_scale(get_global_transform().get_scale());
popup->popup();
picker->set_focus_on_line_edit();
}
@@ -892,14 +892,14 @@ void ColorPickerButton::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_DRAW: {
- const Ref<StyleBox> normal = get_stylebox("normal");
+ const Ref<StyleBox> normal = get_theme_stylebox("normal");
const Rect2 r = Rect2(normal->get_offset(), get_size() - normal->get_minimum_size());
- draw_texture_rect(Control::get_icon("bg", "ColorPickerButton"), r, true);
+ draw_texture_rect(Control::get_theme_icon("bg", "ColorPickerButton"), r, true);
draw_rect(r, color);
if (color.r > 1 || color.g > 1 || color.b > 1) {
// Draw an indicator to denote that the color is "overbright" and can't be displayed accurately in the preview
- draw_texture(Control::get_icon("overbright_indicator", "ColorPicker"), normal->get_offset());
+ draw_texture(Control::get_theme_icon("overbright_indicator", "ColorPicker"), normal->get_offset());
}
} break;
case NOTIFICATION_WM_CLOSE_REQUEST: {
@@ -963,7 +963,7 @@ void ColorPickerButton::_update_picker() {
add_child(popup);
picker->connect("color_changed", callable_mp(this, &ColorPickerButton::_color_changed));
popup->connect("modal_closed", callable_mp(this, &ColorPickerButton::_modal_closed));
- popup->connect("about_to_show", callable_mp((BaseButton *)this, &BaseButton::set_pressed), varray(true));
+ popup->connect("about_to_popup", callable_mp((BaseButton *)this, &BaseButton::set_pressed), varray(true));
popup->connect("popup_hide", callable_mp((BaseButton *)this, &BaseButton::set_pressed), varray(false));
picker->set_pick_color(color);
picker->set_edit_alpha(edit_alpha);
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 55ef2a6bed..062d15c05b 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -260,22 +260,22 @@ bool Control::_set(const StringName &p_name, const Variant &p_value) {
} else {
if (name.begins_with("custom_icons/")) {
String dname = name.get_slicec('/', 1);
- add_icon_override(dname, p_value);
+ add_theme_icon_override(dname, p_value);
} else if (name.begins_with("custom_shaders/")) {
String dname = name.get_slicec('/', 1);
- add_shader_override(dname, p_value);
+ add_theme_shader_override(dname, p_value);
} else if (name.begins_with("custom_styles/")) {
String dname = name.get_slicec('/', 1);
- add_style_override(dname, p_value);
+ add_theme_style_override(dname, p_value);
} else if (name.begins_with("custom_fonts/")) {
String dname = name.get_slicec('/', 1);
- add_font_override(dname, p_value);
+ add_theme_font_override(dname, p_value);
} else if (name.begins_with("custom_colors/")) {
String dname = name.get_slicec('/', 1);
- add_color_override(dname, p_value);
+ add_theme_color_override(dname, p_value);
} else if (name.begins_with("custom_constants/")) {
String dname = name.get_slicec('/', 1);
- add_constant_override(dname, p_value);
+ add_theme_constant_override(dname, p_value);
} else
return false;
}
@@ -817,11 +817,11 @@ Size2 Control::get_minimum_size() const {
}
template <class T>
-bool Control::_find_theme_item(T &r_ret, T (Theme::*get_func)(const StringName &, const StringName &) const, bool (Theme::*has_func)(const StringName &, const StringName &) const, const StringName &p_name, const StringName &p_type) const {
+bool Control::_find_theme_item(Control *p_theme_owner, Window *p_theme_owner_window, T &r_ret, T (Theme::*get_func)(const StringName &, const StringName &) const, bool (Theme::*has_func)(const StringName &, const StringName &) const, const StringName &p_name, const StringName &p_type) {
// try with custom themes
- Control *theme_owner = data.theme_owner;
- Window *theme_owner_window = data.theme_owner_window;
+ Control *theme_owner = p_theme_owner;
+ Window *theme_owner_window = p_theme_owner_window;
while (theme_owner || theme_owner_window) {
@@ -863,11 +863,11 @@ bool Control::_find_theme_item(T &r_ret, T (Theme::*get_func)(const StringName &
return false;
}
-bool Control::_has_theme_item(bool (Theme::*has_func)(const StringName &, const StringName &) const, const StringName &p_name, const StringName &p_type) const {
+bool Control::_has_theme_item(Control *p_theme_owner, Window *p_theme_owner_window, bool (Theme::*has_func)(const StringName &, const StringName &) const, const StringName &p_name, const StringName &p_type) {
// try with custom themes
- Control *theme_owner = data.theme_owner;
- Window *theme_owner_window = data.theme_owner_window;
+ Control *theme_owner = p_theme_owner;
+ Window *theme_owner_window = p_theme_owner_window;
while (theme_owner || theme_owner_window) {
@@ -907,7 +907,7 @@ bool Control::_has_theme_item(bool (Theme::*has_func)(const StringName &, const
return false;
}
-Ref<Texture2D> Control::get_icon(const StringName &p_name, const StringName &p_type) const {
+Ref<Texture2D> Control::get_theme_icon(const StringName &p_name, const StringName &p_type) const {
if (p_type == StringName() || p_type == get_class_name()) {
@@ -918,22 +918,28 @@ Ref<Texture2D> Control::get_icon(const StringName &p_name, const StringName &p_t
StringName type = p_type ? p_type : get_class_name();
+ return get_icons(data.theme_owner, data.theme_owner_window, p_name, type);
+}
+
+Ref<Texture2D> Control::get_icons(Control *p_theme_owner, Window *p_theme_owner_window, const StringName &p_name, const StringName &p_type) {
+
Ref<Texture2D> icon;
- if (_find_theme_item(icon, &Theme::get_icon, &Theme::has_icon, p_name, type)) {
+ if (_find_theme_item(p_theme_owner, p_theme_owner_window, icon, &Theme::get_icon, &Theme::has_icon, p_name, p_type)) {
return icon;
}
if (Theme::get_project_default().is_valid()) {
- if (Theme::get_project_default()->has_icon(p_name, type)) {
- return Theme::get_project_default()->get_icon(p_name, type);
+ if (Theme::get_project_default()->has_icon(p_name, p_type)) {
+ return Theme::get_project_default()->get_icon(p_name, p_type);
}
}
- return Theme::get_default()->get_icon(p_name, type);
+ return Theme::get_default()->get_icon(p_name, p_type);
}
-Ref<Shader> Control::get_shader(const StringName &p_name, const StringName &p_type) const {
+Ref<Shader> Control::get_theme_shader(const StringName &p_name, const StringName &p_type) const {
+
if (p_type == StringName() || p_type == get_class_name()) {
const Ref<Shader> *sdr = data.shader_override.getptr(p_name);
@@ -943,22 +949,27 @@ Ref<Shader> Control::get_shader(const StringName &p_name, const StringName &p_ty
StringName type = p_type ? p_type : get_class_name();
+ return get_shaders(data.theme_owner, data.theme_owner_window, p_name, type);
+}
+
+Ref<Shader> Control::get_shaders(Control *p_theme_owner, Window *p_theme_owner_window, const StringName &p_name, const StringName &p_type) {
+
Ref<Shader> shader;
- if (_find_theme_item(shader, &Theme::get_shader, &Theme::has_shader, p_name, type)) {
+ if (_find_theme_item(p_theme_owner, p_theme_owner_window, shader, &Theme::get_shader, &Theme::has_shader, p_name, p_type)) {
return shader;
}
if (Theme::get_project_default().is_valid()) {
- if (Theme::get_project_default()->has_shader(p_name, type)) {
- return Theme::get_project_default()->get_shader(p_name, type);
+ if (Theme::get_project_default()->has_shader(p_name, p_type)) {
+ return Theme::get_project_default()->get_shader(p_name, p_type);
}
}
- return Theme::get_default()->get_shader(p_name, type);
+ return Theme::get_default()->get_shader(p_name, p_type);
}
-Ref<StyleBox> Control::get_stylebox(const StringName &p_name, const StringName &p_type) const {
+Ref<StyleBox> Control::get_theme_stylebox(const StringName &p_name, const StringName &p_type) const {
if (p_type == StringName() || p_type == get_class_name()) {
const Ref<StyleBox> *style = data.style_override.getptr(p_name);
@@ -968,21 +979,27 @@ Ref<StyleBox> Control::get_stylebox(const StringName &p_name, const StringName &
StringName type = p_type ? p_type : get_class_name();
+ return get_styleboxs(data.theme_owner, data.theme_owner_window, p_name, type);
+}
+
+Ref<StyleBox> Control::get_styleboxs(Control *p_theme_owner, Window *p_theme_owner_window, const StringName &p_name, const StringName &p_type) {
+
Ref<StyleBox> stylebox;
- if (_find_theme_item(stylebox, &Theme::get_stylebox, &Theme::has_stylebox, p_name, type)) {
+ if (_find_theme_item(p_theme_owner, p_theme_owner_window, stylebox, &Theme::get_stylebox, &Theme::has_stylebox, p_name, p_type)) {
return stylebox;
}
if (Theme::get_project_default().is_valid()) {
- if (Theme::get_project_default()->has_stylebox(p_name, type)) {
- return Theme::get_project_default()->get_stylebox(p_name, type);
+ if (Theme::get_project_default()->has_stylebox(p_name, p_type)) {
+ return Theme::get_project_default()->get_stylebox(p_name, p_type);
}
}
- return Theme::get_default()->get_stylebox(p_name, type);
+ return Theme::get_default()->get_stylebox(p_name, p_type);
}
-Ref<Font> Control::get_font(const StringName &p_name, const StringName &p_type) const {
+
+Ref<Font> Control::get_theme_font(const StringName &p_name, const StringName &p_type) const {
if (p_type == StringName() || p_type == get_class_name()) {
const Ref<Font> *font = data.font_override.getptr(p_name);
@@ -992,21 +1009,27 @@ Ref<Font> Control::get_font(const StringName &p_name, const StringName &p_type)
StringName type = p_type ? p_type : get_class_name();
+ return get_fonts(data.theme_owner, data.theme_owner_window, p_name, type);
+}
+
+Ref<Font> Control::get_fonts(Control *p_theme_owner, Window *p_theme_owner_window, const StringName &p_name, const StringName &p_type) {
+
Ref<Font> font;
- if (_find_theme_item(font, &Theme::get_font, &Theme::has_font, p_name, type)) {
+ if (_find_theme_item(p_theme_owner, p_theme_owner_window, font, &Theme::get_font, &Theme::has_font, p_name, p_type)) {
return font;
}
if (Theme::get_project_default().is_valid()) {
- if (Theme::get_project_default()->has_font(p_name, type)) {
- return Theme::get_project_default()->get_font(p_name, type);
+ if (Theme::get_project_default()->has_font(p_name, p_type)) {
+ return Theme::get_project_default()->get_font(p_name, p_type);
}
}
- return Theme::get_default()->get_font(p_name, type);
+ return Theme::get_default()->get_font(p_name, p_type);
}
-Color Control::get_color(const StringName &p_name, const StringName &p_type) const {
+
+Color Control::get_theme_color(const StringName &p_name, const StringName &p_type) const {
if (p_type == StringName() || p_type == get_class_name()) {
const Color *color = data.color_override.getptr(p_name);
@@ -1016,21 +1039,26 @@ Color Control::get_color(const StringName &p_name, const StringName &p_type) con
StringName type = p_type ? p_type : get_class_name();
+ return get_colors(data.theme_owner, data.theme_owner_window, p_name, type);
+}
+
+Color Control::get_colors(Control *p_theme_owner, Window *p_theme_owner_window, const StringName &p_name, const StringName &p_type) {
+
Color color;
- if (_find_theme_item(color, &Theme::get_color, &Theme::has_color, p_name, type)) {
+ if (_find_theme_item(p_theme_owner, p_theme_owner_window, color, &Theme::get_color, &Theme::has_color, p_name, p_type)) {
return color;
}
if (Theme::get_project_default().is_valid()) {
- if (Theme::get_project_default()->has_color(p_name, type)) {
- return Theme::get_project_default()->get_color(p_name, type);
+ if (Theme::get_project_default()->has_color(p_name, p_type)) {
+ return Theme::get_project_default()->get_color(p_name, p_type);
}
}
- return Theme::get_default()->get_color(p_name, type);
+ return Theme::get_default()->get_color(p_name, p_type);
}
-int Control::get_constant(const StringName &p_name, const StringName &p_type) const {
+int Control::get_theme_constant(const StringName &p_name, const StringName &p_type) const {
if (p_type == StringName() || p_type == get_class_name()) {
const int *constant = data.constant_override.getptr(p_name);
@@ -1040,178 +1068,212 @@ int Control::get_constant(const StringName &p_name, const StringName &p_type) co
StringName type = p_type ? p_type : get_class_name();
+ return get_constants(data.theme_owner, data.theme_owner_window, p_name, type);
+}
+
+int Control::get_constants(Control *p_theme_owner, Window *p_theme_owner_window, const StringName &p_name, const StringName &p_type) {
+
int constant;
- if (_find_theme_item(constant, &Theme::get_constant, &Theme::has_constant, p_name, type)) {
+ if (_find_theme_item(p_theme_owner, p_theme_owner_window, constant, &Theme::get_constant, &Theme::has_constant, p_name, p_type)) {
return constant;
}
if (Theme::get_project_default().is_valid()) {
- if (Theme::get_project_default()->has_constant(p_name, type)) {
- return Theme::get_project_default()->get_constant(p_name, type);
+ if (Theme::get_project_default()->has_constant(p_name, p_type)) {
+ return Theme::get_project_default()->get_constant(p_name, p_type);
}
}
- return Theme::get_default()->get_constant(p_name, type);
+ return Theme::get_default()->get_constant(p_name, p_type);
}
-bool Control::has_icon_override(const StringName &p_name) const {
+bool Control::has_theme_icon_override(const StringName &p_name) const {
const Ref<Texture2D> *tex = data.icon_override.getptr(p_name);
return tex != NULL;
}
-bool Control::has_shader_override(const StringName &p_name) const {
+bool Control::has_theme_shader_override(const StringName &p_name) const {
const Ref<Shader> *sdr = data.shader_override.getptr(p_name);
return sdr != NULL;
}
-bool Control::has_stylebox_override(const StringName &p_name) const {
+bool Control::has_theme_stylebox_override(const StringName &p_name) const {
const Ref<StyleBox> *style = data.style_override.getptr(p_name);
return style != NULL;
}
-bool Control::has_font_override(const StringName &p_name) const {
+bool Control::has_theme_font_override(const StringName &p_name) const {
const Ref<Font> *font = data.font_override.getptr(p_name);
return font != NULL;
}
-bool Control::has_color_override(const StringName &p_name) const {
+bool Control::has_theme_color_override(const StringName &p_name) const {
const Color *color = data.color_override.getptr(p_name);
return color != NULL;
}
-bool Control::has_constant_override(const StringName &p_name) const {
+bool Control::has_theme_constant_override(const StringName &p_name) const {
const int *constant = data.constant_override.getptr(p_name);
return constant != NULL;
}
-bool Control::has_icon(const StringName &p_name, const StringName &p_type) const {
+bool Control::has_theme_icon(const StringName &p_name, const StringName &p_type) const {
if (p_type == StringName() || p_type == get_class_name()) {
- if (has_icon_override(p_name))
+ if (has_theme_icon_override(p_name))
return true;
}
StringName type = p_type ? p_type : get_class_name();
- if (_has_theme_item(&Theme::has_icon, p_name, type)) {
+ return has_icons(data.theme_owner, data.theme_owner_window, p_name, type);
+}
+
+bool Control::has_icons(Control *p_theme_owner, Window *p_theme_owner_window, const StringName &p_name, const StringName &p_type) {
+
+ if (_has_theme_item(p_theme_owner, p_theme_owner_window, &Theme::has_icon, p_name, p_type)) {
return true;
}
if (Theme::get_project_default().is_valid()) {
- if (Theme::get_project_default()->has_color(p_name, type)) {
+ if (Theme::get_project_default()->has_color(p_name, p_type)) {
return true;
}
}
- return Theme::get_default()->has_icon(p_name, type);
+ return Theme::get_default()->has_icon(p_name, p_type);
}
-bool Control::has_shader(const StringName &p_name, const StringName &p_type) const {
+bool Control::has_theme_shader(const StringName &p_name, const StringName &p_type) const {
if (p_type == StringName() || p_type == get_class_name()) {
- if (has_shader_override(p_name))
+ if (has_theme_shader_override(p_name))
return true;
}
StringName type = p_type ? p_type : get_class_name();
- if (_has_theme_item(&Theme::has_shader, p_name, type)) {
+ return has_shaders(data.theme_owner, data.theme_owner_window, p_name, type);
+}
+bool Control::has_shaders(Control *p_theme_owner, Window *p_theme_owner_window, const StringName &p_name, const StringName &p_type) {
+
+ if (_has_theme_item(p_theme_owner, p_theme_owner_window, &Theme::has_shader, p_name, p_type)) {
return true;
}
if (Theme::get_project_default().is_valid()) {
- if (Theme::get_project_default()->has_shader(p_name, type)) {
+ if (Theme::get_project_default()->has_shader(p_name, p_type)) {
return true;
}
}
- return Theme::get_default()->has_shader(p_name, type);
+ return Theme::get_default()->has_shader(p_name, p_type);
}
-bool Control::has_stylebox(const StringName &p_name, const StringName &p_type) const {
+
+bool Control::has_theme_stylebox(const StringName &p_name, const StringName &p_type) const {
if (p_type == StringName() || p_type == get_class_name()) {
- if (has_stylebox_override(p_name))
+ if (has_theme_stylebox_override(p_name))
return true;
}
StringName type = p_type ? p_type : get_class_name();
- if (_has_theme_item(&Theme::has_stylebox, p_name, type)) {
+ return has_styleboxs(data.theme_owner, data.theme_owner_window, p_name, type);
+}
+
+bool Control::has_styleboxs(Control *p_theme_owner, Window *p_theme_owner_window, const StringName &p_name, const StringName &p_type) {
+
+ if (_has_theme_item(p_theme_owner, p_theme_owner_window, &Theme::has_stylebox, p_name, p_type)) {
return true;
}
if (Theme::get_project_default().is_valid()) {
- if (Theme::get_project_default()->has_stylebox(p_name, type)) {
+ if (Theme::get_project_default()->has_stylebox(p_name, p_type)) {
return true;
}
}
- return Theme::get_default()->has_stylebox(p_name, type);
+ return Theme::get_default()->has_stylebox(p_name, p_type);
}
-bool Control::has_font(const StringName &p_name, const StringName &p_type) const {
+
+bool Control::has_theme_font(const StringName &p_name, const StringName &p_type) const {
if (p_type == StringName() || p_type == get_class_name()) {
- if (has_font_override(p_name))
+ if (has_theme_font_override(p_name))
return true;
}
StringName type = p_type ? p_type : get_class_name();
- if (_has_theme_item(&Theme::has_font, p_name, type)) {
+ return has_fonts(data.theme_owner, data.theme_owner_window, p_name, type);
+}
+bool Control::has_fonts(Control *p_theme_owner, Window *p_theme_owner_window, const StringName &p_name, const StringName &p_type) {
+
+ if (_has_theme_item(p_theme_owner, p_theme_owner_window, &Theme::has_font, p_name, p_type)) {
return true;
}
if (Theme::get_project_default().is_valid()) {
- if (Theme::get_project_default()->has_font(p_name, type)) {
+ if (Theme::get_project_default()->has_font(p_name, p_type)) {
return true;
}
}
- return Theme::get_default()->has_font(p_name, type);
+ return Theme::get_default()->has_font(p_name, p_type);
}
-bool Control::has_color(const StringName &p_name, const StringName &p_type) const {
+bool Control::has_theme_color(const StringName &p_name, const StringName &p_type) const {
if (p_type == StringName() || p_type == get_class_name()) {
- if (has_color_override(p_name))
+ if (has_theme_color_override(p_name))
return true;
}
StringName type = p_type ? p_type : get_class_name();
- if (_has_theme_item(&Theme::has_color, p_name, type)) {
+ return has_colors(data.theme_owner, data.theme_owner_window, p_name, type);
+}
+bool Control::has_colors(Control *p_theme_owner, Window *p_theme_owner_window, const StringName &p_name, const StringName &p_type) {
+
+ if (_has_theme_item(p_theme_owner, p_theme_owner_window, &Theme::has_color, p_name, p_type)) {
return true;
}
if (Theme::get_project_default().is_valid()) {
- if (Theme::get_project_default()->has_color(p_name, type)) {
+ if (Theme::get_project_default()->has_color(p_name, p_type)) {
return true;
}
}
- return Theme::get_default()->has_color(p_name, type);
+ return Theme::get_default()->has_color(p_name, p_type);
}
-bool Control::has_constant(const StringName &p_name, const StringName &p_type) const {
+bool Control::has_theme_constant(const StringName &p_name, const StringName &p_type) const {
if (p_type == StringName() || p_type == get_class_name()) {
- if (has_constant_override(p_name))
+ if (has_theme_constant_override(p_name))
return true;
}
StringName type = p_type ? p_type : get_class_name();
- if (_has_theme_item(&Theme::has_constant, p_name, type)) {
+ return has_constants(data.theme_owner, data.theme_owner_window, p_name, p_type);
+}
+
+bool Control::has_constants(Control *p_theme_owner, Window *p_theme_owner_window, const StringName &p_name, const StringName &p_type) {
+
+ if (_has_theme_item(p_theme_owner, p_theme_owner_window, &Theme::has_constant, p_name, p_type)) {
return true;
}
if (Theme::get_project_default().is_valid()) {
- if (Theme::get_project_default()->has_constant(p_name, type)) {
+ if (Theme::get_project_default()->has_constant(p_name, p_type)) {
return true;
}
}
- return Theme::get_default()->has_constant(p_name, type);
+ return Theme::get_default()->has_constant(p_name, p_type);
}
Rect2 Control::get_parent_anchorable_rect() const {
@@ -1654,6 +1716,17 @@ Point2 Control::get_global_position() const {
return get_global_transform().get_origin();
}
+Point2 Control::get_screen_position() const {
+ ERR_FAIL_COND_V(!is_inside_tree(), Point2());
+ Point2 global_pos = get_global_position();
+ Window *w = Object::cast_to<Window>(get_viewport());
+ if (w) {
+ global_pos += w->get_position();
+ }
+
+ return global_pos;
+}
+
void Control::_set_global_position(const Point2 &p_point) {
set_global_position(p_point);
}
@@ -1748,6 +1821,20 @@ Rect2 Control::get_global_rect() const {
return Rect2(get_global_position(), get_size());
}
+Rect2 Control::get_screen_rect() const {
+
+ ERR_FAIL_COND_V(!is_inside_tree(), Rect2());
+
+ Rect2 r(get_global_position(), get_size());
+
+ Window *w = Object::cast_to<Window>(get_viewport());
+ if (w) {
+ r.position += w->get_position();
+ }
+
+ return r;
+}
+
Rect2 Control::get_window_rect() const {
ERR_FAIL_COND_V(!is_inside_tree(), Rect2());
Rect2 gr = get_global_rect();
@@ -1765,7 +1852,7 @@ Rect2 Control::get_anchorable_rect() const {
return Rect2(Point2(), get_size());
}
-void Control::add_icon_override(const StringName &p_name, const Ref<Texture2D> &p_icon) {
+void Control::add_theme_icon_override(const StringName &p_name, const Ref<Texture2D> &p_icon) {
if (data.icon_override.has(p_name)) {
data.icon_override[p_name]->disconnect("changed", callable_mp(this, &Control::_override_changed));
@@ -1783,7 +1870,7 @@ void Control::add_icon_override(const StringName &p_name, const Ref<Texture2D> &
notification(NOTIFICATION_THEME_CHANGED);
}
-void Control::add_shader_override(const StringName &p_name, const Ref<Shader> &p_shader) {
+void Control::add_theme_shader_override(const StringName &p_name, const Ref<Shader> &p_shader) {
if (data.shader_override.has(p_name)) {
data.shader_override[p_name]->disconnect("changed", callable_mp(this, &Control::_override_changed));
@@ -1800,7 +1887,7 @@ void Control::add_shader_override(const StringName &p_name, const Ref<Shader> &p
}
notification(NOTIFICATION_THEME_CHANGED);
}
-void Control::add_style_override(const StringName &p_name, const Ref<StyleBox> &p_style) {
+void Control::add_theme_style_override(const StringName &p_name, const Ref<StyleBox> &p_style) {
if (data.style_override.has(p_name)) {
data.style_override[p_name]->disconnect("changed", callable_mp(this, &Control::_override_changed));
@@ -1818,7 +1905,7 @@ void Control::add_style_override(const StringName &p_name, const Ref<StyleBox> &
notification(NOTIFICATION_THEME_CHANGED);
}
-void Control::add_font_override(const StringName &p_name, const Ref<Font> &p_font) {
+void Control::add_theme_font_override(const StringName &p_name, const Ref<Font> &p_font) {
if (data.font_override.has(p_name)) {
data.font_override[p_name]->disconnect("changed", callable_mp(this, &Control::_override_changed));
@@ -1835,12 +1922,12 @@ void Control::add_font_override(const StringName &p_name, const Ref<Font> &p_fon
}
notification(NOTIFICATION_THEME_CHANGED);
}
-void Control::add_color_override(const StringName &p_name, const Color &p_color) {
+void Control::add_theme_color_override(const StringName &p_name, const Color &p_color) {
data.color_override[p_name] = p_color;
notification(NOTIFICATION_THEME_CHANGED);
}
-void Control::add_constant_override(const StringName &p_name, int p_constant) {
+void Control::add_theme_constant_override(const StringName &p_name, int p_constant) {
data.constant_override[p_name] = p_constant;
notification(NOTIFICATION_THEME_CHANGED);
@@ -2797,31 +2884,31 @@ void Control::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_theme", "theme"), &Control::set_theme);
ClassDB::bind_method(D_METHOD("get_theme"), &Control::get_theme);
- ClassDB::bind_method(D_METHOD("add_icon_override", "name", "texture"), &Control::add_icon_override);
- ClassDB::bind_method(D_METHOD("add_shader_override", "name", "shader"), &Control::add_shader_override);
- ClassDB::bind_method(D_METHOD("add_stylebox_override", "name", "stylebox"), &Control::add_style_override);
- ClassDB::bind_method(D_METHOD("add_font_override", "name", "font"), &Control::add_font_override);
- ClassDB::bind_method(D_METHOD("add_color_override", "name", "color"), &Control::add_color_override);
- ClassDB::bind_method(D_METHOD("add_constant_override", "name", "constant"), &Control::add_constant_override);
-
- ClassDB::bind_method(D_METHOD("get_icon", "name", "type"), &Control::get_icon, DEFVAL(""));
- ClassDB::bind_method(D_METHOD("get_stylebox", "name", "type"), &Control::get_stylebox, DEFVAL(""));
- ClassDB::bind_method(D_METHOD("get_font", "name", "type"), &Control::get_font, DEFVAL(""));
- ClassDB::bind_method(D_METHOD("get_color", "name", "type"), &Control::get_color, DEFVAL(""));
- ClassDB::bind_method(D_METHOD("get_constant", "name", "type"), &Control::get_constant, DEFVAL(""));
-
- ClassDB::bind_method(D_METHOD("has_icon_override", "name"), &Control::has_icon_override);
- ClassDB::bind_method(D_METHOD("has_shader_override", "name"), &Control::has_shader_override);
- ClassDB::bind_method(D_METHOD("has_stylebox_override", "name"), &Control::has_stylebox_override);
- ClassDB::bind_method(D_METHOD("has_font_override", "name"), &Control::has_font_override);
- ClassDB::bind_method(D_METHOD("has_color_override", "name"), &Control::has_color_override);
- ClassDB::bind_method(D_METHOD("has_constant_override", "name"), &Control::has_constant_override);
-
- ClassDB::bind_method(D_METHOD("has_icon", "name", "type"), &Control::has_icon, DEFVAL(""));
- ClassDB::bind_method(D_METHOD("has_stylebox", "name", "type"), &Control::has_stylebox, DEFVAL(""));
- ClassDB::bind_method(D_METHOD("has_font", "name", "type"), &Control::has_font, DEFVAL(""));
- ClassDB::bind_method(D_METHOD("has_color", "name", "type"), &Control::has_color, DEFVAL(""));
- ClassDB::bind_method(D_METHOD("has_constant", "name", "type"), &Control::has_constant, DEFVAL(""));
+ ClassDB::bind_method(D_METHOD("add_theme_icon_override", "name", "texture"), &Control::add_theme_icon_override);
+ ClassDB::bind_method(D_METHOD("add_theme_shader_override", "name", "shader"), &Control::add_theme_shader_override);
+ ClassDB::bind_method(D_METHOD("add_theme_stylebox_override", "name", "stylebox"), &Control::add_theme_style_override);
+ ClassDB::bind_method(D_METHOD("add_theme_font_override", "name", "font"), &Control::add_theme_font_override);
+ ClassDB::bind_method(D_METHOD("add_theme_color_override", "name", "color"), &Control::add_theme_color_override);
+ ClassDB::bind_method(D_METHOD("add_theme_constant_override", "name", "constant"), &Control::add_theme_constant_override);
+
+ ClassDB::bind_method(D_METHOD("get_theme_icon", "name", "type"), &Control::get_theme_icon, DEFVAL(""));
+ ClassDB::bind_method(D_METHOD("get_theme_stylebox", "name", "type"), &Control::get_theme_stylebox, DEFVAL(""));
+ ClassDB::bind_method(D_METHOD("get_theme_font", "name", "type"), &Control::get_theme_font, DEFVAL(""));
+ ClassDB::bind_method(D_METHOD("get_theme_color", "name", "type"), &Control::get_theme_color, DEFVAL(""));
+ ClassDB::bind_method(D_METHOD("get_theme_constant", "name", "type"), &Control::get_theme_constant, DEFVAL(""));
+
+ ClassDB::bind_method(D_METHOD("has_theme_icon_override", "name"), &Control::has_theme_icon_override);
+ ClassDB::bind_method(D_METHOD("has_theme_shader_override", "name"), &Control::has_theme_shader_override);
+ ClassDB::bind_method(D_METHOD("has_theme_stylebox_override", "name"), &Control::has_theme_stylebox_override);
+ ClassDB::bind_method(D_METHOD("has_theme_font_override", "name"), &Control::has_theme_font_override);
+ ClassDB::bind_method(D_METHOD("has_theme_color_override", "name"), &Control::has_theme_color_override);
+ ClassDB::bind_method(D_METHOD("has_theme_constant_override", "name"), &Control::has_theme_constant_override);
+
+ ClassDB::bind_method(D_METHOD("has_theme_icon", "name", "type"), &Control::has_theme_icon, DEFVAL(""));
+ ClassDB::bind_method(D_METHOD("has_theme_stylebox", "name", "type"), &Control::has_theme_stylebox, DEFVAL(""));
+ ClassDB::bind_method(D_METHOD("has_theme_font", "name", "type"), &Control::has_theme_font, DEFVAL(""));
+ ClassDB::bind_method(D_METHOD("has_theme_color", "name", "type"), &Control::has_theme_color, DEFVAL(""));
+ ClassDB::bind_method(D_METHOD("has_theme_constant", "name", "type"), &Control::has_theme_constant, DEFVAL(""));
ClassDB::bind_method(D_METHOD("get_parent_control"), &Control::get_parent_control);
diff --git a/scene/gui/control.h b/scene/gui/control.h
index 83b9dd7861..22839df712 100644
--- a/scene/gui/control.h
+++ b/scene/gui/control.h
@@ -248,9 +248,23 @@ private:
static void _propagate_theme_changed(Node *p_at, Control *p_owner, Window *p_owner_window, bool p_assign = true);
template <class T>
- _FORCE_INLINE_ bool _find_theme_item(T &, T (Theme::*get_func)(const StringName &, const StringName &) const, bool (Theme::*has_func)(const StringName &, const StringName &) const, const StringName &p_name, const StringName &p_type) const;
+ _FORCE_INLINE_ static bool _find_theme_item(Control *p_theme_owner, Window *p_theme_owner_window, T &, T (Theme::*get_func)(const StringName &, const StringName &) const, bool (Theme::*has_func)(const StringName &, const StringName &) const, const StringName &p_name, const StringName &p_type);
- _FORCE_INLINE_ bool _has_theme_item(bool (Theme::*has_func)(const StringName &, const StringName &) const, const StringName &p_name, const StringName &p_type) const;
+ _FORCE_INLINE_ static bool _has_theme_item(Control *p_theme_owner, Window *p_theme_owner_window, bool (Theme::*has_func)(const StringName &, const StringName &) const, const StringName &p_name, const StringName &p_type);
+
+ static Ref<Texture2D> get_icons(Control *p_theme_owner, Window *p_theme_owner_window, const StringName &p_name, const StringName &p_type = StringName());
+ static Ref<Shader> get_shaders(Control *p_theme_owner, Window *p_theme_owner_window, const StringName &p_name, const StringName &p_type = StringName());
+ static Ref<StyleBox> get_styleboxs(Control *p_theme_owner, Window *p_theme_owner_window, const StringName &p_name, const StringName &p_type = StringName());
+ static Ref<Font> get_fonts(Control *p_theme_owner, Window *p_theme_owner_window, const StringName &p_name, const StringName &p_type = StringName());
+ static Color get_colors(Control *p_theme_owner, Window *p_theme_owner_window, const StringName &p_name, const StringName &p_type = StringName());
+ static int get_constants(Control *p_theme_owner, Window *p_theme_owner_window, const StringName &p_name, const StringName &p_type = StringName());
+
+ static bool has_icons(Control *p_theme_owner, Window *p_theme_owner_window, const StringName &p_name, const StringName &p_type = StringName());
+ static bool has_shaders(Control *p_theme_owner, Window *p_theme_owner_window, const StringName &p_name, const StringName &p_type = StringName());
+ static bool has_styleboxs(Control *p_theme_owner, Window *p_theme_owner_window, const StringName &p_name, const StringName &p_type = StringName());
+ static bool has_fonts(Control *p_theme_owner, Window *p_theme_owner_window, const StringName &p_name, const StringName &p_type = StringName());
+ static bool has_colors(Control *p_theme_owner, Window *p_theme_owner_window, const StringName &p_name, const StringName &p_type = StringName());
+ static bool has_constants(Control *p_theme_owner, Window *p_theme_owner_window, const StringName &p_name, const StringName &p_type = StringName());
protected:
virtual void add_child_notify(Node *p_child);
@@ -356,12 +370,14 @@ public:
void set_global_position(const Point2 &p_point, bool p_keep_margins = false);
Point2 get_position() const;
Point2 get_global_position() const;
+ Point2 get_screen_position() const;
void set_size(const Size2 &p_size, bool p_keep_margins = false);
Size2 get_size() const;
Rect2 get_rect() const;
Rect2 get_global_rect() const;
+ Rect2 get_screen_rect() const;
Rect2 get_window_rect() const; ///< use with care, as it blocks waiting for the visual server
Rect2 get_anchorable_rect() const;
@@ -427,33 +443,33 @@ public:
/* SKINNING */
- void add_icon_override(const StringName &p_name, const Ref<Texture2D> &p_icon);
- void add_shader_override(const StringName &p_name, const Ref<Shader> &p_shader);
- void add_style_override(const StringName &p_name, const Ref<StyleBox> &p_style);
- void add_font_override(const StringName &p_name, const Ref<Font> &p_font);
- void add_color_override(const StringName &p_name, const Color &p_color);
- void add_constant_override(const StringName &p_name, int p_constant);
-
- Ref<Texture2D> get_icon(const StringName &p_name, const StringName &p_type = StringName()) const;
- Ref<Shader> get_shader(const StringName &p_name, const StringName &p_type = StringName()) const;
- Ref<StyleBox> get_stylebox(const StringName &p_name, const StringName &p_type = StringName()) const;
- Ref<Font> get_font(const StringName &p_name, const StringName &p_type = StringName()) const;
- Color get_color(const StringName &p_name, const StringName &p_type = StringName()) const;
- int get_constant(const StringName &p_name, const StringName &p_type = StringName()) const;
-
- bool has_icon_override(const StringName &p_name) const;
- bool has_shader_override(const StringName &p_name) const;
- bool has_stylebox_override(const StringName &p_name) const;
- bool has_font_override(const StringName &p_name) const;
- bool has_color_override(const StringName &p_name) const;
- bool has_constant_override(const StringName &p_name) const;
-
- bool has_icon(const StringName &p_name, const StringName &p_type = StringName()) const;
- bool has_shader(const StringName &p_name, const StringName &p_type = StringName()) const;
- bool has_stylebox(const StringName &p_name, const StringName &p_type = StringName()) const;
- bool has_font(const StringName &p_name, const StringName &p_type = StringName()) const;
- bool has_color(const StringName &p_name, const StringName &p_type = StringName()) const;
- bool has_constant(const StringName &p_name, const StringName &p_type = StringName()) const;
+ void add_theme_icon_override(const StringName &p_name, const Ref<Texture2D> &p_icon);
+ void add_theme_shader_override(const StringName &p_name, const Ref<Shader> &p_shader);
+ void add_theme_style_override(const StringName &p_name, const Ref<StyleBox> &p_style);
+ void add_theme_font_override(const StringName &p_name, const Ref<Font> &p_font);
+ void add_theme_color_override(const StringName &p_name, const Color &p_color);
+ void add_theme_constant_override(const StringName &p_name, int p_constant);
+
+ Ref<Texture2D> get_theme_icon(const StringName &p_name, const StringName &p_type = StringName()) const;
+ Ref<Shader> get_theme_shader(const StringName &p_name, const StringName &p_type = StringName()) const;
+ Ref<StyleBox> get_theme_stylebox(const StringName &p_name, const StringName &p_type = StringName()) const;
+ Ref<Font> get_theme_font(const StringName &p_name, const StringName &p_type = StringName()) const;
+ Color get_theme_color(const StringName &p_name, const StringName &p_type = StringName()) const;
+ int get_theme_constant(const StringName &p_name, const StringName &p_type = StringName()) const;
+
+ bool has_theme_icon_override(const StringName &p_name) const;
+ bool has_theme_shader_override(const StringName &p_name) const;
+ bool has_theme_stylebox_override(const StringName &p_name) const;
+ bool has_theme_font_override(const StringName &p_name) const;
+ bool has_theme_color_override(const StringName &p_name) const;
+ bool has_theme_constant_override(const StringName &p_name) const;
+
+ bool has_theme_icon(const StringName &p_name, const StringName &p_type = StringName()) const;
+ bool has_theme_shader(const StringName &p_name, const StringName &p_type = StringName()) const;
+ bool has_theme_stylebox(const StringName &p_name, const StringName &p_type = StringName()) const;
+ bool has_theme_font(const StringName &p_name, const StringName &p_type = StringName()) const;
+ bool has_theme_color(const StringName &p_name, const StringName &p_type = StringName()) const;
+ bool has_theme_constant(const StringName &p_name, const StringName &p_type = StringName()) const;
/* TOOLTIP */
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp
index 71000847a1..2e87a92969 100644
--- a/scene/gui/dialogs.cpp
+++ b/scene/gui/dialogs.cpp
@@ -69,15 +69,22 @@ void AcceptDialog::_notification(int p_what) {
} else {
if (parent_visible) {
parent_visible->disconnect("focus_entered", callable_mp(this, &AcceptDialog::_parent_focused));
+ parent_visible = nullptr;
}
}
} break;
case NOTIFICATION_THEME_CHANGED: {
- bg->add_style_override("panel", bg->get_stylebox("panel", "AcceptDialog"));
+ bg->add_theme_style_override("panel", bg->get_theme_stylebox("panel", "AcceptDialog"));
} break;
+ case NOTIFICATION_EXIT_TREE: {
+ if (parent_visible) {
+ parent_visible->disconnect("focus_entered", callable_mp(this, &AcceptDialog::_parent_focused));
+ parent_visible = nullptr;
+ }
+ } break;
case NOTIFICATION_READY:
case NOTIFICATION_WM_SIZE_CHANGED: {
if (is_visible()) {
@@ -167,7 +174,7 @@ void AcceptDialog::_update_child_rects() {
if (label->get_text().empty()) {
label_size.height = 0;
}
- int margin = hbc->get_constant("margin", "Dialogs");
+ int margin = hbc->get_theme_constant("margin", "Dialogs");
Size2 size = get_size();
Size2 hminsize = hbc->get_combined_minimum_size();
@@ -198,7 +205,7 @@ void AcceptDialog::_update_child_rects() {
Size2 AcceptDialog::_get_contents_minimum_size() const {
- int margin = hbc->get_constant("margin", "Dialogs");
+ int margin = hbc->get_theme_constant("margin", "Dialogs");
Size2 minsize = label->get_combined_minimum_size();
for (int i = 0; i < get_child_count(); i++) {
@@ -296,6 +303,7 @@ AcceptDialog::AcceptDialog() {
parent_visible = nullptr;
+ set_wrap_controls(true);
set_visible(false);
set_transient(true);
@@ -304,8 +312,8 @@ AcceptDialog::AcceptDialog() {
hbc = memnew(HBoxContainer);
- int margin = hbc->get_constant("margin", "Dialogs");
- int button_margin = hbc->get_constant("button_margin", "Dialogs");
+ int margin = hbc->get_theme_constant("margin", "Dialogs");
+ int button_margin = hbc->get_theme_constant("button_margin", "Dialogs");
label = memnew(Label);
label->set_anchor(MARGIN_RIGHT, Control::ANCHOR_END);
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index 2f7949ea12..a4f0338f00 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -46,21 +46,21 @@ VBoxContainer *FileDialog::get_vbox() {
void FileDialog::_theme_changed() {
- Color font_color = vbc->get_color("font_color", "ToolButton");
- Color font_color_hover = vbc->get_color("font_color_hover", "ToolButton");
- Color font_color_pressed = vbc->get_color("font_color_pressed", "ToolButton");
+ Color font_color = vbc->get_theme_color("font_color", "ToolButton");
+ Color font_color_hover = vbc->get_theme_color("font_color_hover", "ToolButton");
+ Color font_color_pressed = vbc->get_theme_color("font_color_pressed", "ToolButton");
- dir_up->add_color_override("icon_color_normal", font_color);
- dir_up->add_color_override("icon_color_hover", font_color_hover);
- dir_up->add_color_override("icon_color_pressed", font_color_pressed);
+ dir_up->add_theme_color_override("icon_color_normal", font_color);
+ dir_up->add_theme_color_override("icon_color_hover", font_color_hover);
+ dir_up->add_theme_color_override("icon_color_pressed", font_color_pressed);
- refresh->add_color_override("icon_color_normal", font_color);
- refresh->add_color_override("icon_color_hover", font_color_hover);
- refresh->add_color_override("icon_color_pressed", font_color_pressed);
+ refresh->add_theme_color_override("icon_color_normal", font_color);
+ refresh->add_theme_color_override("icon_color_hover", font_color_hover);
+ refresh->add_theme_color_override("icon_color_pressed", font_color_pressed);
- show_hidden->add_color_override("icon_color_normal", font_color);
- show_hidden->add_color_override("icon_color_hover", font_color_hover);
- show_hidden->add_color_override("icon_color_pressed", font_color_pressed);
+ show_hidden->add_theme_color_override("icon_color_normal", font_color);
+ show_hidden->add_theme_color_override("icon_color_hover", font_color_hover);
+ show_hidden->add_theme_color_override("icon_color_pressed", font_color_pressed);
}
void FileDialog::_notification(int p_what) {
@@ -73,9 +73,9 @@ void FileDialog::_notification(int p_what) {
}
if (p_what == NOTIFICATION_ENTER_TREE) {
- dir_up->set_icon(vbc->get_icon("parent_folder"));
- refresh->set_icon(vbc->get_icon("reload"));
- show_hidden->set_icon(vbc->get_icon("toggle_hidden"));
+ dir_up->set_icon(vbc->get_theme_icon("parent_folder"));
+ refresh->set_icon(vbc->get_theme_icon("reload"));
+ show_hidden->set_icon(vbc->get_theme_icon("toggle_hidden"));
_theme_changed();
}
}
@@ -429,8 +429,8 @@ void FileDialog::update_file_list() {
dir_access->list_dir_begin();
TreeItem *root = tree->create_item();
- Ref<Texture2D> folder = vbc->get_icon("folder");
- const Color folder_color = vbc->get_color("folder_icon_modulate");
+ Ref<Texture2D> folder = vbc->get_theme_icon("folder");
+ const Color folder_color = vbc->get_theme_color("folder_icon_modulate");
List<String> files;
List<String> dirs;
@@ -528,7 +528,7 @@ void FileDialog::update_file_list() {
}
if (mode == FILE_MODE_OPEN_DIR) {
- ti->set_custom_color(0, vbc->get_color("files_disabled"));
+ ti->set_custom_color(0, vbc->get_theme_color("files_disabled"));
ti->set_selectable(0, false);
}
Dictionary d;
diff --git a/scene/gui/gradient_edit.cpp b/scene/gui/gradient_edit.cpp
index 6345bfe562..88107f754c 100644
--- a/scene/gui/gradient_edit.cpp
+++ b/scene/gui/gradient_edit.cpp
@@ -76,15 +76,15 @@ void GradientEdit::_show_color_picker() {
if (grabbed == -1)
return;
picker->set_pick_color(points[grabbed].color);
- Size2 minsize = popup->get_combined_minimum_size();
+ Size2 minsize = popup->get_contents_minimum_size();
bool show_above = false;
if (get_global_position().y + get_size().y + minsize.y > get_viewport_rect().size.y) {
show_above = true;
}
if (show_above) {
- popup->set_position(get_global_position() - Vector2(0, minsize.y));
+ popup->set_position(get_screen_position() - Vector2(0, minsize.y));
} else {
- popup->set_position(get_global_position() + Vector2(0, get_size().y));
+ popup->set_position(get_screen_position() + Vector2(0, get_size().y));
}
popup->popup();
}
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index ddc80d2726..fd7935b376 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -281,13 +281,13 @@ void GraphEdit::remove_child_notify(Node *p_child) {
void GraphEdit::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
- port_grab_distance_horizontal = get_constant("port_grab_distance_horizontal");
- port_grab_distance_vertical = get_constant("port_grab_distance_vertical");
+ port_grab_distance_horizontal = get_theme_constant("port_grab_distance_horizontal");
+ port_grab_distance_vertical = get_theme_constant("port_grab_distance_vertical");
- zoom_minus->set_icon(get_icon("minus"));
- zoom_reset->set_icon(get_icon("reset"));
- zoom_plus->set_icon(get_icon("more"));
- snap_button->set_icon(get_icon("snap"));
+ zoom_minus->set_icon(get_theme_icon("minus"));
+ zoom_reset->set_icon(get_theme_icon("reset"));
+ zoom_plus->set_icon(get_theme_icon("more"));
+ snap_button->set_icon(get_theme_icon("snap"));
}
if (p_what == NOTIFICATION_READY) {
Size2 hmin = h_scroll->get_combined_minimum_size();
@@ -305,7 +305,7 @@ void GraphEdit::_notification(int p_what) {
}
if (p_what == NOTIFICATION_DRAW) {
- draw_style_box(get_stylebox("bg"), Rect2(Point2(), get_size()));
+ draw_style_box(get_theme_stylebox("bg"), Rect2(Point2(), get_size()));
if (is_using_snap()) {
//draw grid
@@ -318,8 +318,8 @@ void GraphEdit::_notification(int p_what) {
Point2i from = (offset / float(snap)).floor();
Point2i len = (size / float(snap)).floor() + Vector2(1, 1);
- Color grid_minor = get_color("grid_minor");
- Color grid_major = get_color("grid_major");
+ Color grid_minor = get_theme_color("grid_minor");
+ Color grid_major = get_theme_color("grid_major");
for (int i = from.x; i < from.x + len.x; i++) {
@@ -357,7 +357,7 @@ void GraphEdit::_notification(int p_what) {
bool GraphEdit::_filter_input(const Point2 &p_point) {
- Ref<Texture2D> port = get_icon("port", "GraphNode");
+ Ref<Texture2D> port = get_theme_icon("port", "GraphNode");
for (int i = get_child_count() - 1; i >= 0; i--) {
@@ -389,7 +389,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
Ref<InputEventMouseButton> mb = p_ev;
if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) {
- Ref<Texture2D> port = get_icon("port", "GraphNode");
+ Ref<Texture2D> port = get_theme_icon("port", "GraphNode");
Vector2 mpos(mb->get_position().x, mb->get_position().y);
for (int i = get_child_count() - 1; i >= 0; i--) {
@@ -501,7 +501,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
connecting_target = false;
top_layer->update();
- Ref<Texture2D> port = get_icon("port", "GraphNode");
+ Ref<Texture2D> port = get_theme_icon("port", "GraphNode");
Vector2 mpos = mm->get_position();
for (int i = get_child_count() - 1; i >= 0; i--) {
@@ -666,8 +666,8 @@ void GraphEdit::_draw_cos_line(CanvasItem *p_where, const Vector2 &p_from, const
//cubic bezier code
float diff = p_to.x - p_from.x;
float cp_offset;
- int cp_len = get_constant("bezier_len_pos");
- int cp_neg_len = get_constant("bezier_len_neg");
+ int cp_len = get_theme_constant("bezier_len_pos");
+ int cp_neg_len = get_theme_constant("bezier_len_neg");
if (diff > 0) {
cp_offset = MIN(cp_len, diff * 0.5);
@@ -697,7 +697,7 @@ void GraphEdit::_draw_cos_line(CanvasItem *p_where, const Vector2 &p_from, const
void GraphEdit::_connections_layer_draw() {
- Color activity_color = get_color("activity");
+ Color activity_color = get_theme_color("activity");
//draw connections
List<List<Connection>::Element *> to_erase;
for (List<Connection>::Element *E = connections.front(); E; E = E->next()) {
@@ -784,8 +784,8 @@ void GraphEdit::_top_layer_draw() {
}
if (box_selecting) {
- top_layer->draw_rect(box_selecting_rect, get_color("selection_fill"));
- top_layer->draw_rect(box_selecting_rect, get_color("selection_stroke"), false);
+ top_layer->draw_rect(box_selecting_rect, get_theme_color("selection_fill"));
+ top_layer->draw_rect(box_selecting_rect, get_theme_color("selection_stroke"), false);
}
}
diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp
index 82e890395a..c28a60ff87 100644
--- a/scene/gui/graph_node.cpp
+++ b/scene/gui/graph_node.cpp
@@ -117,8 +117,8 @@ void GraphNode::_get_property_list(List<PropertyInfo> *p_list) const {
void GraphNode::_resort() {
- int sep = get_constant("separation");
- Ref<StyleBox> sb = get_stylebox("frame");
+ int sep = get_theme_constant("separation");
+ Ref<StyleBox> sb = get_theme_stylebox("frame");
bool first = true;
Size2 minsize;
@@ -169,8 +169,8 @@ void GraphNode::_resort() {
bool GraphNode::has_point(const Point2 &p_point) const {
if (comment) {
- Ref<StyleBox> comment = get_stylebox("comment");
- Ref<Texture2D> resizer = get_icon("resizer");
+ Ref<StyleBox> comment = get_theme_stylebox("comment");
+ Ref<Texture2D> resizer = get_theme_icon("resizer");
if (Rect2(get_size() - resizer->get_size(), resizer->get_size()).has_point(p_point)) {
return true;
@@ -195,28 +195,28 @@ void GraphNode::_notification(int p_what) {
Ref<StyleBox> sb;
if (comment) {
- sb = get_stylebox(selected ? "commentfocus" : "comment");
+ sb = get_theme_stylebox(selected ? "commentfocus" : "comment");
} else {
- sb = get_stylebox(selected ? "selectedframe" : "frame");
+ sb = get_theme_stylebox(selected ? "selectedframe" : "frame");
}
//sb=sb->duplicate();
//sb->call("set_modulate",modulate);
- Ref<Texture2D> port = get_icon("port");
- Ref<Texture2D> close = get_icon("close");
- Ref<Texture2D> resizer = get_icon("resizer");
- int close_offset = get_constant("close_offset");
- int close_h_offset = get_constant("close_h_offset");
- Color close_color = get_color("close_color");
- Color resizer_color = get_color("resizer_color");
- Ref<Font> title_font = get_font("title_font");
- int title_offset = get_constant("title_offset");
- int title_h_offset = get_constant("title_h_offset");
- Color title_color = get_color("title_color");
+ Ref<Texture2D> port = get_theme_icon("port");
+ Ref<Texture2D> close = get_theme_icon("close");
+ Ref<Texture2D> resizer = get_theme_icon("resizer");
+ int close_offset = get_theme_constant("close_offset");
+ int close_h_offset = get_theme_constant("close_h_offset");
+ Color close_color = get_theme_color("close_color");
+ Color resizer_color = get_theme_color("resizer_color");
+ Ref<Font> title_font = get_theme_font("title_font");
+ int title_offset = get_theme_constant("title_offset");
+ int title_h_offset = get_theme_constant("title_h_offset");
+ Color title_color = get_theme_color("title_color");
Point2i icofs = -port->get_size() * 0.5;
- int edgeofs = get_constant("port_offset");
+ int edgeofs = get_theme_constant("port_offset");
icofs.y += sb->get_margin(MARGIN_TOP);
draw_style_box(sb, Rect2(Point2(), get_size()));
@@ -227,10 +227,10 @@ void GraphNode::_notification(int p_what) {
} break;
case OVERLAY_BREAKPOINT: {
- draw_style_box(get_stylebox("breakpoint"), Rect2(Point2(), get_size()));
+ draw_style_box(get_theme_stylebox("breakpoint"), Rect2(Point2(), get_size()));
} break;
case OVERLAY_POSITION: {
- draw_style_box(get_stylebox("position"), Rect2(Point2(), get_size()));
+ draw_style_box(get_theme_stylebox("position"), Rect2(Point2(), get_size()));
} break;
}
@@ -370,16 +370,16 @@ Color GraphNode::get_slot_color_right(int p_idx) const {
Size2 GraphNode::get_minimum_size() const {
- Ref<Font> title_font = get_font("title_font");
+ Ref<Font> title_font = get_theme_font("title_font");
- int sep = get_constant("separation");
- Ref<StyleBox> sb = get_stylebox("frame");
+ int sep = get_theme_constant("separation");
+ Ref<StyleBox> sb = get_theme_stylebox("frame");
bool first = true;
Size2 minsize;
minsize.x = title_font->get_string_size(title).x;
if (show_close) {
- Ref<Texture2D> close = get_icon("close");
+ Ref<Texture2D> close = get_theme_icon("close");
minsize.x += sep + close->get_width();
}
@@ -464,10 +464,10 @@ bool GraphNode::is_close_button_visible() const {
void GraphNode::_connpos_update() {
- int edgeofs = get_constant("port_offset");
- int sep = get_constant("separation");
+ int edgeofs = get_theme_constant("port_offset");
+ int sep = get_theme_constant("separation");
- Ref<StyleBox> sb = get_stylebox("frame");
+ Ref<StyleBox> sb = get_theme_stylebox("frame");
conn_input_cache.clear();
conn_output_cache.clear();
int vofs = 0;
@@ -606,7 +606,7 @@ void GraphNode::_gui_input(const Ref<InputEvent> &p_ev) {
return;
}
- Ref<Texture2D> resizer = get_icon("resizer");
+ Ref<Texture2D> resizer = get_theme_icon("resizer");
if (resizable && mpos.x > get_size().x - resizer->get_width() && mpos.y > get_size().y - resizer->get_height()) {
diff --git a/scene/gui/grid_container.cpp b/scene/gui/grid_container.cpp
index 0028093a95..16f6fd0111 100644
--- a/scene/gui/grid_container.cpp
+++ b/scene/gui/grid_container.cpp
@@ -41,8 +41,8 @@ void GridContainer::_notification(int p_what) {
Set<int> col_expanded; // Columns which have the SIZE_EXPAND flag set.
Set<int> row_expanded; // Rows which have the SIZE_EXPAND flag set.
- int hsep = get_constant("hseparation");
- int vsep = get_constant("vseparation");
+ int hsep = get_theme_constant("hseparation");
+ int vsep = get_theme_constant("vseparation");
int max_col = MIN(get_child_count(), columns);
int max_row = ceil((float)get_child_count() / (float)columns);
@@ -200,8 +200,8 @@ Size2 GridContainer::get_minimum_size() const {
Map<int, int> col_minw;
Map<int, int> row_minh;
- int hsep = get_constant("hseparation");
- int vsep = get_constant("vseparation");
+ int hsep = get_theme_constant("hseparation");
+ int vsep = get_theme_constant("vseparation");
int max_row = 0;
int max_col = 0;
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index 5e662b8df0..2db44d0b66 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -495,7 +495,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
search_string = ""; //any mousepress cancels
Vector2 pos = mb->get_position();
- Ref<StyleBox> bg = get_stylebox("bg");
+ Ref<StyleBox> bg = get_theme_stylebox("bg");
pos -= bg->get_offset();
pos.y += scroll_bar->get_value();
@@ -820,7 +820,7 @@ void ItemList::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
- Ref<StyleBox> bg = get_stylebox("bg");
+ Ref<StyleBox> bg = get_theme_stylebox("bg");
int mw = scroll_bar->get_minimum_size().x;
scroll_bar->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -mw);
@@ -837,18 +837,18 @@ void ItemList::_notification(int p_what) {
draw_style_box(bg, Rect2(Point2(), size));
- int hseparation = get_constant("hseparation");
- int vseparation = get_constant("vseparation");
- int icon_margin = get_constant("icon_margin");
- int line_separation = get_constant("line_separation");
+ int hseparation = get_theme_constant("hseparation");
+ int vseparation = get_theme_constant("vseparation");
+ int icon_margin = get_theme_constant("icon_margin");
+ int line_separation = get_theme_constant("line_separation");
- Ref<StyleBox> sbsel = has_focus() ? get_stylebox("selected_focus") : get_stylebox("selected");
- Ref<StyleBox> cursor = has_focus() ? get_stylebox("cursor") : get_stylebox("cursor_unfocused");
+ Ref<StyleBox> sbsel = has_focus() ? get_theme_stylebox("selected_focus") : get_theme_stylebox("selected");
+ Ref<StyleBox> cursor = has_focus() ? get_theme_stylebox("cursor") : get_theme_stylebox("cursor_unfocused");
- Ref<Font> font = get_font("font");
- Color guide_color = get_color("guide_color");
- Color font_color = get_color("font_color");
- Color font_color_selected = get_color("font_color_selected");
+ Ref<Font> font = get_theme_font("font");
+ Color guide_color = get_theme_color("guide_color");
+ Color font_color = get_theme_color("font_color");
+ Color font_color_selected = get_theme_color("font_color_selected");
int font_height = font->get_height();
Vector<int> line_size_cache;
Vector<int> line_limit_cache;
@@ -860,7 +860,7 @@ void ItemList::_notification(int p_what) {
if (has_focus()) {
VisualServer::get_singleton()->canvas_item_add_clip_ignore(get_canvas_item(), true);
- draw_style_box(get_stylebox("bg_focus"), Rect2(Point2(), size));
+ draw_style_box(get_theme_stylebox("bg_focus"), Rect2(Point2(), size));
VisualServer::get_singleton()->canvas_item_add_clip_ignore(get_canvas_item(), false);
}
@@ -1251,7 +1251,7 @@ void ItemList::_scroll_changed(double) {
int ItemList::get_item_at_position(const Point2 &p_pos, bool p_exact) const {
Vector2 pos = p_pos;
- Ref<StyleBox> bg = get_stylebox("bg");
+ Ref<StyleBox> bg = get_theme_stylebox("bg");
pos -= bg->get_offset();
pos.y += scroll_bar->get_value();
@@ -1286,7 +1286,7 @@ bool ItemList::is_pos_at_end_of_items(const Point2 &p_pos) const {
return true;
Vector2 pos = p_pos;
- Ref<StyleBox> bg = get_stylebox("bg");
+ Ref<StyleBox> bg = get_theme_stylebox("bg");
pos -= bg->get_offset();
pos.y += scroll_bar->get_value();
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp
index c900b35d65..ef1bb958f6 100644
--- a/scene/gui/label.cpp
+++ b/scene/gui/label.cpp
@@ -65,7 +65,7 @@ bool Label::is_uppercase() const {
int Label::get_line_height() const {
- return get_font("font")->get_height();
+ return get_theme_font("font")->get_height();
}
void Label::_notification(int p_what) {
@@ -94,14 +94,14 @@ void Label::_notification(int p_what) {
Size2 string_size;
Size2 size = get_size();
- Ref<StyleBox> style = get_stylebox("normal");
- Ref<Font> font = get_font("font");
- Color font_color = get_color("font_color");
- Color font_color_shadow = get_color("font_color_shadow");
- bool use_outline = get_constant("shadow_as_outline");
- Point2 shadow_ofs(get_constant("shadow_offset_x"), get_constant("shadow_offset_y"));
- int line_spacing = get_constant("line_spacing");
- Color font_outline_modulate = get_color("font_outline_modulate");
+ Ref<StyleBox> style = get_theme_stylebox("normal");
+ Ref<Font> font = get_theme_font("font");
+ Color font_color = get_theme_color("font_color");
+ Color font_color_shadow = get_theme_color("font_color_shadow");
+ bool use_outline = get_theme_constant("shadow_as_outline");
+ Point2 shadow_ofs(get_theme_constant("shadow_offset_x"), get_theme_constant("shadow_offset_y"));
+ int line_spacing = get_theme_constant("line_spacing");
+ Color font_outline_modulate = get_theme_color("font_outline_modulate");
style->draw(ci, Rect2(Point2(0, 0), get_size()));
@@ -300,7 +300,7 @@ void Label::_notification(int p_what) {
Size2 Label::get_minimum_size() const {
- Size2 min_style = get_stylebox("normal")->get_minimum_size();
+ Size2 min_style = get_theme_stylebox("normal")->get_minimum_size();
// don't want to mutable everything
if (word_cache_dirty) {
@@ -319,7 +319,7 @@ Size2 Label::get_minimum_size() const {
int Label::get_longest_line_width() const {
- Ref<Font> font = get_font("font");
+ Ref<Font> font = get_theme_font("font");
real_t max_line_width = 0;
real_t line_width = 0;
@@ -363,9 +363,9 @@ int Label::get_line_count() const {
int Label::get_visible_line_count() const {
- int line_spacing = get_constant("line_spacing");
- int font_h = get_font("font")->get_height() + line_spacing;
- int lines_visible = (get_size().height - get_stylebox("normal")->get_minimum_size().height + line_spacing) / font_h;
+ int line_spacing = get_theme_constant("line_spacing");
+ int font_h = get_theme_font("font")->get_height() + line_spacing;
+ int lines_visible = (get_size().height - get_theme_stylebox("normal")->get_minimum_size().height + line_spacing) / font_h;
if (lines_visible > line_count)
lines_visible = line_count;
@@ -387,20 +387,20 @@ void Label::regenerate_word_cache() {
int width;
if (autowrap) {
- Ref<StyleBox> style = get_stylebox("normal");
+ Ref<StyleBox> style = get_theme_stylebox("normal");
width = MAX(get_size().width, get_custom_minimum_size().width) - style->get_minimum_size().width;
} else {
width = get_longest_line_width();
}
- Ref<Font> font = get_font("font");
+ Ref<Font> font = get_theme_font("font");
real_t current_word_size = 0;
int word_pos = 0;
real_t line_width = 0;
int space_count = 0;
real_t space_width = font->get_char_size(' ').width;
- int line_spacing = get_constant("line_spacing");
+ int line_spacing = get_theme_constant("line_spacing");
line_count = 1;
total_char_cache = 0;
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 0bbb82db91..fd82c33c4e 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -56,7 +56,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
if (b->is_pressed() && b->get_button_index() == BUTTON_RIGHT && context_menu_enabled) {
menu->set_position(get_global_transform().xform(get_local_mouse_position()));
menu->set_size(Vector2(1, 1));
- menu->set_scale(get_global_transform().get_scale());
+ //menu->set_scale(get_global_transform().get_scale());
menu->popup();
grab_focus();
accept_event();
@@ -552,10 +552,10 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
} break;
case KEY_MENU: {
if (context_menu_enabled) {
- Point2 pos = Point2(get_cursor_pixel_pos(), (get_size().y + get_font("font")->get_height()) / 2);
+ Point2 pos = Point2(get_cursor_pixel_pos(), (get_size().y + get_theme_font("font")->get_height()) / 2);
menu->set_position(get_global_transform().xform(pos));
menu->set_size(Vector2(1, 1));
- menu->set_scale(get_global_transform().get_scale());
+ // menu->set_scale(get_global_transform().get_scale());
menu->popup();
menu->grab_focus();
}
@@ -629,7 +629,7 @@ void LineEdit::drop_data(const Point2 &p_point, const Variant &p_data) {
set_cursor_at_pixel_pos(p_point.x);
int selected = selection.end - selection.begin;
- Ref<Font> font = get_font("font");
+ Ref<Font> font = get_theme_font("font");
if (font != NULL) {
for (int i = selection.begin; i < selection.end; i++)
cached_width -= font->get_char_size(pass ? secret_character[0] : text[i]).width;
@@ -654,8 +654,8 @@ bool LineEdit::_is_over_clear_button(const Point2 &p_pos) const {
if (!clear_button_enabled || !has_point(p_pos)) {
return false;
}
- Ref<Texture2D> icon = Control::get_icon("clear");
- int x_ofs = get_stylebox("normal")->get_offset().x;
+ Ref<Texture2D> icon = Control::get_theme_icon("clear");
+ int x_ofs = get_theme_stylebox("normal")->get_offset().x;
return p_pos.x > get_size().width - icon->get_width() - x_ofs;
}
@@ -709,19 +709,19 @@ void LineEdit::_notification(int p_what) {
RID ci = get_canvas_item();
- Ref<StyleBox> style = get_stylebox("normal");
+ Ref<StyleBox> style = get_theme_stylebox("normal");
if (!is_editable()) {
- style = get_stylebox("read_only");
+ style = get_theme_stylebox("read_only");
draw_caret = false;
}
- Ref<Font> font = get_font("font");
+ Ref<Font> font = get_theme_font("font");
style->draw(ci, Rect2(Point2(), size));
if (has_focus()) {
- get_stylebox("focus")->draw(ci, Rect2(Point2(), size));
+ get_theme_stylebox("focus")->draw(ci, Rect2(Point2(), size));
}
int x_ofs = 0;
@@ -756,10 +756,10 @@ void LineEdit::_notification(int p_what) {
int font_ascent = font->get_ascent();
- Color selection_color = get_color("selection_color");
- Color font_color = is_editable() ? get_color("font_color") : get_color("font_color_uneditable");
- Color font_color_selected = get_color("font_color_selected");
- Color cursor_color = get_color("cursor_color");
+ Color selection_color = get_theme_color("selection_color");
+ Color font_color = is_editable() ? get_theme_color("font_color") : get_theme_color("font_color_uneditable");
+ Color font_color_selected = get_theme_color("font_color_selected");
+ Color cursor_color = get_theme_color("cursor_color");
const String &t = using_placeholder ? placeholder_translated : text;
// Draw placeholder color.
@@ -768,13 +768,13 @@ void LineEdit::_notification(int p_what) {
bool display_clear_icon = !using_placeholder && is_editable() && clear_button_enabled;
if (right_icon.is_valid() || display_clear_icon) {
- Ref<Texture2D> r_icon = display_clear_icon ? Control::get_icon("clear") : right_icon;
+ Ref<Texture2D> r_icon = display_clear_icon ? Control::get_theme_icon("clear") : right_icon;
Color color_icon(1, 1, 1, !is_editable() ? .5 * .9 : .9);
if (display_clear_icon) {
if (clear_button_status.press_attempt && clear_button_status.pressing_inside) {
- color_icon = get_color("clear_button_color_pressed");
+ color_icon = get_theme_color("clear_button_color_pressed");
} else {
- color_icon = get_color("clear_button_color");
+ color_icon = get_theme_color("clear_button_color");
}
}
@@ -1054,13 +1054,13 @@ void LineEdit::shift_selection_check_post(bool p_shift) {
void LineEdit::set_cursor_at_pixel_pos(int p_x) {
- Ref<Font> font = get_font("font");
+ Ref<Font> font = get_theme_font("font");
int ofs = window_pos;
- Ref<StyleBox> style = get_stylebox("normal");
+ Ref<StyleBox> style = get_theme_stylebox("normal");
int pixel_ofs = 0;
Size2 size = get_size();
bool display_clear_icon = !text.empty() && is_editable() && clear_button_enabled;
- int r_icon_width = Control::get_icon("clear")->get_width();
+ int r_icon_width = Control::get_theme_icon("clear")->get_width();
switch (align) {
@@ -1108,13 +1108,13 @@ void LineEdit::set_cursor_at_pixel_pos(int p_x) {
int LineEdit::get_cursor_pixel_pos() {
- Ref<Font> font = get_font("font");
+ Ref<Font> font = get_theme_font("font");
int ofs = window_pos;
- Ref<StyleBox> style = get_stylebox("normal");
+ Ref<StyleBox> style = get_theme_stylebox("normal");
int pixel_ofs = 0;
Size2 size = get_size();
bool display_clear_icon = !text.empty() && is_editable() && clear_button_enabled;
- int r_icon_width = Control::get_icon("clear")->get_width();
+ int r_icon_width = Control::get_theme_icon("clear")->get_width();
switch (align) {
@@ -1201,7 +1201,7 @@ void LineEdit::delete_char() {
if ((text.length() <= 0) || (cursor_pos == 0)) return;
- Ref<Font> font = get_font("font");
+ Ref<Font> font = get_theme_font("font");
if (font != NULL) {
cached_width -= font->get_char_size(pass ? secret_character[0] : text[cursor_pos - 1]).width;
}
@@ -1220,7 +1220,7 @@ void LineEdit::delete_char() {
void LineEdit::delete_text(int p_from_column, int p_to_column) {
if (text.size() > 0) {
- Ref<Font> font = get_font("font");
+ Ref<Font> font = get_theme_font("font");
if (font != NULL) {
for (int i = p_from_column; i < p_to_column; i++)
cached_width -= font->get_char_size(pass ? secret_character[0] : text[i]).width;
@@ -1318,8 +1318,8 @@ void LineEdit::set_cursor_position(int p_pos) {
return;
}
- Ref<StyleBox> style = get_stylebox("normal");
- Ref<Font> font = get_font("font");
+ Ref<StyleBox> style = get_theme_stylebox("normal");
+ Ref<Font> font = get_theme_font("font");
if (cursor_pos <= window_pos) {
// Adjust window if cursor goes too much to the left.
@@ -1329,7 +1329,7 @@ void LineEdit::set_cursor_position(int p_pos) {
int window_width = get_size().width - style->get_minimum_size().width;
bool display_clear_icon = !text.empty() && is_editable() && clear_button_enabled;
if (right_icon.is_valid() || display_clear_icon) {
- Ref<Texture2D> r_icon = display_clear_icon ? Control::get_icon("clear") : right_icon;
+ Ref<Texture2D> r_icon = display_clear_icon ? Control::get_theme_icon("clear") : right_icon;
window_width -= r_icon->get_width();
}
@@ -1404,14 +1404,14 @@ void LineEdit::clear_internal() {
Size2 LineEdit::get_minimum_size() const {
- Ref<StyleBox> style = get_stylebox("normal");
- Ref<Font> font = get_font("font");
+ Ref<StyleBox> style = get_theme_stylebox("normal");
+ Ref<Font> font = get_theme_font("font");
Size2 min_size;
// Minimum size of text.
int space_size = font->get_char_size(' ').x;
- min_size.width = get_constant("minimum_spaces") * space_size;
+ min_size.width = get_theme_constant("minimum_spaces") * space_size;
if (expand_to_text_length) {
// Add a space because some fonts are too exact, and because cursor needs a bit more when at the end.
@@ -1422,8 +1422,8 @@ Size2 LineEdit::get_minimum_size() const {
// Take icons into account.
if (!text.empty() && is_editable() && clear_button_enabled) {
- min_size.width = MAX(min_size.width, Control::get_icon("clear")->get_width());
- min_size.height = MAX(min_size.height, Control::get_icon("clear")->get_height());
+ min_size.width = MAX(min_size.width, Control::get_theme_icon("clear")->get_width());
+ min_size.height = MAX(min_size.height, Control::get_theme_icon("clear")->get_height());
}
if (right_icon.is_valid()) {
min_size.width = MAX(min_size.width, right_icon->get_width());
@@ -1702,7 +1702,7 @@ void LineEdit::_emit_text_change() {
}
void LineEdit::update_cached_width() {
- Ref<Font> font = get_font("font");
+ Ref<Font> font = get_theme_font("font");
cached_width = 0;
if (font != NULL) {
String text = get_text();
@@ -1713,7 +1713,7 @@ void LineEdit::update_cached_width() {
}
void LineEdit::update_placeholder_width() {
- Ref<Font> font = get_font("font");
+ Ref<Font> font = get_theme_font("font");
cached_placeholder_width = 0;
if (font != NULL) {
for (int i = 0; i < placeholder_translated.length(); i++) {
diff --git a/scene/gui/link_button.cpp b/scene/gui/link_button.cpp
index 4b8054bac6..3dffa06b49 100644
--- a/scene/gui/link_button.cpp
+++ b/scene/gui/link_button.cpp
@@ -54,7 +54,7 @@ LinkButton::UnderlineMode LinkButton::get_underline_mode() const {
Size2 LinkButton::get_minimum_size() const {
- return get_font("font")->get_string_size(text);
+ return get_theme_font("font")->get_string_size(text);
}
void LinkButton::_notification(int p_what) {
@@ -72,29 +72,29 @@ void LinkButton::_notification(int p_what) {
case DRAW_NORMAL: {
- color = get_color("font_color");
+ color = get_theme_color("font_color");
do_underline = underline_mode == UNDERLINE_MODE_ALWAYS;
} break;
case DRAW_HOVER_PRESSED:
case DRAW_PRESSED: {
- if (has_color("font_color_pressed"))
- color = get_color("font_color_pressed");
+ if (has_theme_color("font_color_pressed"))
+ color = get_theme_color("font_color_pressed");
else
- color = get_color("font_color");
+ color = get_theme_color("font_color");
do_underline = underline_mode != UNDERLINE_MODE_NEVER;
} break;
case DRAW_HOVER: {
- color = get_color("font_color_hover");
+ color = get_theme_color("font_color_hover");
do_underline = underline_mode != UNDERLINE_MODE_NEVER;
} break;
case DRAW_DISABLED: {
- color = get_color("font_color_disabled");
+ color = get_theme_color("font_color_disabled");
do_underline = underline_mode == UNDERLINE_MODE_ALWAYS;
} break;
@@ -102,16 +102,16 @@ void LinkButton::_notification(int p_what) {
if (has_focus()) {
- Ref<StyleBox> style = get_stylebox("focus");
+ Ref<StyleBox> style = get_theme_stylebox("focus");
style->draw(ci, Rect2(Point2(), size));
}
- Ref<Font> font = get_font("font");
+ Ref<Font> font = get_theme_font("font");
draw_string(font, Vector2(0, font->get_ascent()), text, color);
if (do_underline) {
- int underline_spacing = get_constant("underline_spacing");
+ int underline_spacing = get_theme_constant("underline_spacing");
int width = font->get_string_size(text).width;
int y = font->get_ascent() + underline_spacing;
diff --git a/scene/gui/margin_container.cpp b/scene/gui/margin_container.cpp
index 53373fc297..1cd4ff4ff8 100644
--- a/scene/gui/margin_container.cpp
+++ b/scene/gui/margin_container.cpp
@@ -32,10 +32,10 @@
Size2 MarginContainer::get_minimum_size() const {
- int margin_left = get_constant("margin_left");
- int margin_top = get_constant("margin_top");
- int margin_right = get_constant("margin_right");
- int margin_bottom = get_constant("margin_bottom");
+ int margin_left = get_theme_constant("margin_left");
+ int margin_top = get_theme_constant("margin_top");
+ int margin_right = get_theme_constant("margin_right");
+ int margin_bottom = get_theme_constant("margin_bottom");
Size2 max;
@@ -67,10 +67,10 @@ void MarginContainer::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_SORT_CHILDREN: {
- int margin_left = get_constant("margin_left");
- int margin_top = get_constant("margin_top");
- int margin_right = get_constant("margin_right");
- int margin_bottom = get_constant("margin_bottom");
+ int margin_left = get_theme_constant("margin_left");
+ int margin_top = get_theme_constant("margin_top");
+ int margin_right = get_theme_constant("margin_right");
+ int margin_bottom = get_theme_constant("margin_bottom");
Size2 s = get_size();
diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp
index 7f2ea7d3ed..4cae7b8f40 100644
--- a/scene/gui/menu_button.cpp
+++ b/scene/gui/menu_button.cpp
@@ -52,14 +52,13 @@ void MenuButton::_unhandled_key_input(Ref<InputEvent> p_event) {
void MenuButton::pressed() {
- emit_signal("about_to_show");
+ emit_signal("about_to_popup");
Size2 size = get_size();
- Point2 gp = get_global_position();
- popup->set_global_position(gp + Size2(0, size.height * get_global_transform().get_scale().y));
+ Point2 gp = get_screen_position();
+ popup->set_position(gp + Size2(0, size.height * get_global_transform().get_scale().y));
popup->set_size(Size2(size.width, 0));
- popup->set_scale(get_global_transform().get_scale());
- popup->set_parent_rect(Rect2(Point2(gp - popup->get_global_position()), get_size()));
+ popup->set_parent_rect(Rect2(Point2(gp - popup->get_position()), get_size()));
popup->popup();
}
@@ -116,7 +115,7 @@ void MenuButton::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "items", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_items", "_get_items");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "switch_on_hover"), "set_switch_on_hover", "is_switch_on_hover");
- ADD_SIGNAL(MethodInfo("about_to_show"));
+ ADD_SIGNAL(MethodInfo("about_to_popup"));
}
void MenuButton::set_disable_shortcuts(bool p_disabled) {
@@ -137,8 +136,7 @@ MenuButton::MenuButton() {
popup = memnew(PopupMenu);
popup->hide();
add_child(popup);
- popup->set_pass_on_modal_close_click(false);
- popup->connect("about_to_show", callable_mp((BaseButton *)this, &BaseButton::set_pressed), varray(true)); // For when switching from another MenuButton.
+ popup->connect("about_to_popup", callable_mp((BaseButton *)this, &BaseButton::set_pressed), varray(true)); // For when switching from another MenuButton.
popup->connect("popup_hide", callable_mp((BaseButton *)this, &BaseButton::set_pressed), varray(false));
}
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp
index c185761beb..30ecd651b1 100644
--- a/scene/gui/option_button.cpp
+++ b/scene/gui/option_button.cpp
@@ -36,12 +36,12 @@ Size2 OptionButton::get_minimum_size() const {
Size2 minsize = Button::get_minimum_size();
- if (has_icon("arrow")) {
- const Size2 padding = get_stylebox("normal")->get_minimum_size();
- const Size2 arrow_size = Control::get_icon("arrow")->get_size();
+ if (has_theme_icon("arrow")) {
+ const Size2 padding = get_theme_stylebox("normal")->get_minimum_size();
+ const Size2 arrow_size = Control::get_theme_icon("arrow")->get_size();
Size2 content_size = minsize - padding;
- content_size.width += arrow_size.width + get_constant("hseparation");
+ content_size.width += arrow_size.width + get_theme_constant("hseparation");
content_size.height = MAX(content_size.height, arrow_size.height);
minsize = content_size + padding;
@@ -55,37 +55,37 @@ void OptionButton::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_DRAW: {
- if (!has_icon("arrow"))
+ if (!has_theme_icon("arrow"))
return;
RID ci = get_canvas_item();
- Ref<Texture2D> arrow = Control::get_icon("arrow");
+ Ref<Texture2D> arrow = Control::get_theme_icon("arrow");
Color clr = Color(1, 1, 1);
- if (get_constant("modulate_arrow")) {
+ if (get_theme_constant("modulate_arrow")) {
switch (get_draw_mode()) {
case DRAW_PRESSED:
- clr = get_color("font_color_pressed");
+ clr = get_theme_color("font_color_pressed");
break;
case DRAW_HOVER:
- clr = get_color("font_color_hover");
+ clr = get_theme_color("font_color_hover");
break;
case DRAW_DISABLED:
- clr = get_color("font_color_disabled");
+ clr = get_theme_color("font_color_disabled");
break;
default:
- clr = get_color("font_color");
+ clr = get_theme_color("font_color");
}
}
Size2 size = get_size();
- Point2 ofs(size.width - arrow->get_width() - get_constant("arrow_margin"), int(Math::abs((size.height - arrow->get_height()) / 2)));
+ Point2 ofs(size.width - arrow->get_width() - get_theme_constant("arrow_margin"), int(Math::abs((size.height - arrow->get_height()) / 2)));
arrow->draw(ci, ofs, clr);
} break;
case NOTIFICATION_THEME_CHANGED: {
- if (has_icon("arrow")) {
- _set_internal_margin(MARGIN_RIGHT, Control::get_icon("arrow")->get_width());
+ if (has_theme_icon("arrow")) {
+ _set_internal_margin(MARGIN_RIGHT, Control::get_theme_icon("arrow")->get_width());
}
} break;
case NOTIFICATION_VISIBILITY_CHANGED: {
@@ -109,9 +109,8 @@ void OptionButton::_selected(int p_which) {
void OptionButton::pressed() {
Size2 size = get_size();
- popup->set_global_position(get_global_position() + Size2(0, size.height * get_global_transform().get_scale().y));
+ popup->set_position(get_screen_position() + Size2(0, size.height * get_global_transform().get_scale().y));
popup->set_size(Size2(size.width, 0));
- popup->set_scale(get_global_transform().get_scale());
popup->popup();
}
@@ -351,15 +350,15 @@ OptionButton::OptionButton() {
set_toggle_mode(true);
set_text_align(ALIGN_LEFT);
set_action_mode(ACTION_MODE_BUTTON_PRESS);
- if (has_icon("arrow")) {
- _set_internal_margin(MARGIN_RIGHT, Control::get_icon("arrow")->get_width());
+ if (has_theme_icon("arrow")) {
+ _set_internal_margin(MARGIN_RIGHT, Control::get_theme_icon("arrow")->get_width());
}
popup = memnew(PopupMenu);
popup->hide();
add_child(popup);
- popup->set_pass_on_modal_close_click(false);
- popup->set_notify_transform(true);
+ // popup->set_pass_on_modal_close_click(false);
+ // popup->set_notify_transform(true);
popup->set_allow_search(true);
popup->connect("index_pressed", callable_mp(this, &OptionButton::_selected));
popup->connect("id_focused", callable_mp(this, &OptionButton::_focused));
diff --git a/scene/gui/panel.cpp b/scene/gui/panel.cpp
index 1957e4f271..ae51463a15 100644
--- a/scene/gui/panel.cpp
+++ b/scene/gui/panel.cpp
@@ -36,7 +36,7 @@ void Panel::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
RID ci = get_canvas_item();
- Ref<StyleBox> style = mode == MODE_BACKGROUND ? get_stylebox("panel") : get_stylebox("panel_fg");
+ Ref<StyleBox> style = mode == MODE_BACKGROUND ? get_theme_stylebox("panel") : get_theme_stylebox("panel_fg");
style->draw(ci, Rect2(Point2(), get_size()));
}
}
diff --git a/scene/gui/panel_container.cpp b/scene/gui/panel_container.cpp
index 6cf23b8a32..dc9daf3c91 100644
--- a/scene/gui/panel_container.cpp
+++ b/scene/gui/panel_container.cpp
@@ -34,10 +34,10 @@ Size2 PanelContainer::get_minimum_size() const {
Ref<StyleBox> style;
- if (has_stylebox("panel"))
- style = get_stylebox("panel");
+ if (has_theme_stylebox("panel"))
+ style = get_theme_stylebox("panel");
else
- style = get_stylebox("panel", "PanelContainer");
+ style = get_theme_stylebox("panel", "PanelContainer");
Size2 ms;
for (int i = 0; i < get_child_count(); i++) {
@@ -65,10 +65,10 @@ void PanelContainer::_notification(int p_what) {
RID ci = get_canvas_item();
Ref<StyleBox> style;
- if (has_stylebox("panel"))
- style = get_stylebox("panel");
+ if (has_theme_stylebox("panel"))
+ style = get_theme_stylebox("panel");
else
- style = get_stylebox("panel", "PanelContainer");
+ style = get_theme_stylebox("panel", "PanelContainer");
style->draw(ci, Rect2(Point2(), get_size()));
}
@@ -77,10 +77,10 @@ void PanelContainer::_notification(int p_what) {
Ref<StyleBox> style;
- if (has_stylebox("panel"))
- style = get_stylebox("panel");
+ if (has_theme_stylebox("panel"))
+ style = get_theme_stylebox("panel");
else
- style = get_stylebox("panel", "PanelContainer");
+ style = get_theme_stylebox("panel", "PanelContainer");
Size2 size = get_size();
Point2 ofs;
diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp
index 6896d5d609..4ed87ff42f 100644
--- a/scene/gui/popup.cpp
+++ b/scene/gui/popup.cpp
@@ -32,227 +32,100 @@
#include "core/engine.h"
#include "core/os/keyboard.h"
+#include "scene/gui/panel.h"
-void Popup::_gui_input(Ref<InputEvent> p_event) {
-}
-
-void Popup::_notification(int p_what) {
-
- if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
- if (popped_up && !is_visible_in_tree()) {
- popped_up = false;
- notification(NOTIFICATION_POPUP_HIDE);
- emit_signal("popup_hide");
- }
-
- update_configuration_warning();
- }
-
- if (p_what == NOTIFICATION_EXIT_TREE) {
- if (popped_up) {
- popped_up = false;
- notification(NOTIFICATION_POPUP_HIDE);
- emit_signal("popup_hide");
- }
- }
-
- if (p_what == NOTIFICATION_ENTER_TREE) {
-//small helper to make editing of these easier in editor
-#ifdef TOOLS_ENABLED
- if (Engine::get_singleton()->is_editor_hint() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->is_a_parent_of(this)) {
- //edited on editor
- set_as_toplevel(false);
- } else
-#endif
- if (is_visible()) {
- hide();
- }
+void Popup::_input_from_window(const Ref<InputEvent> &p_event) {
+ Ref<InputEventKey> key = p_event;
+ if (key.is_valid() && key->is_pressed() && key->get_keycode() == KEY_ESCAPE) {
+ _close_pressed();
}
}
-void Popup::_fix_size() {
-
- Point2 pos = get_global_position();
- Size2 size = get_size() * get_scale();
- Point2 window_size = get_viewport_rect().size - get_viewport_transform().get_origin();
-
- if (pos.x + size.width > window_size.width)
- pos.x = window_size.width - size.width;
- if (pos.x < 0)
- pos.x = 0;
-
- if (pos.y + size.height > window_size.height)
- pos.y = window_size.height - size.height;
- if (pos.y < 0)
- pos.y = 0;
- if (pos != get_position())
- set_global_position(pos);
+void Popup::_parent_focused() {
+ _close_pressed();
}
+void Popup::_notification(int p_what) {
-void Popup::set_as_minsize() {
-
- Size2 total_minsize;
-
- for (int i = 0; i < get_child_count(); i++) {
-
- Control *c = Object::cast_to<Control>(get_child(i));
- if (!c)
- continue;
- if (!c->is_visible())
- continue;
-
- Size2 minsize = c->get_combined_minimum_size();
-
- for (int j = 0; j < 2; j++) {
-
- Margin m_beg = Margin(0 + j);
- Margin m_end = Margin(2 + j);
-
- float margin_begin = c->get_margin(m_beg);
- float margin_end = c->get_margin(m_end);
- float anchor_begin = c->get_anchor(m_beg);
- float anchor_end = c->get_anchor(m_end);
-
- minsize[j] += margin_begin * (ANCHOR_END - anchor_begin) + margin_end * anchor_end;
- }
-
- total_minsize.width = MAX(total_minsize.width, minsize.width);
- total_minsize.height = MAX(total_minsize.height, minsize.height);
+ switch (p_what) {
+ case NOTIFICATION_VISIBILITY_CHANGED: {
+ if (is_visible()) {
+
+ parent_visible = get_parent_visible_window();
+ if (parent_visible) {
+ parent_visible->connect("focus_entered", callable_mp(this, &Popup::_parent_focused));
+ }
+ } else {
+ if (parent_visible) {
+ parent_visible->disconnect("focus_entered", callable_mp(this, &Popup::_parent_focused));
+ parent_visible = nullptr;
+ }
+
+ emit_signal("popup_hide");
+ }
+
+ } break;
+ case NOTIFICATION_EXIT_TREE: {
+ if (parent_visible) {
+ parent_visible->disconnect("focus_entered", callable_mp(this, &Popup::_parent_focused));
+ parent_visible = nullptr;
+ }
+ } break;
+ case NOTIFICATION_WM_CLOSE_REQUEST: {
+ _close_pressed();
+ } break;
}
-
- set_size(total_minsize);
-}
-
-void Popup::popup_centered_clamped(const Size2 &p_size, float p_fallback_ratio) {
-
- Size2 popup_size = p_size;
- Size2 window_size = get_viewport_rect().size;
-
- // clamp popup size in each dimension if window size is too small (using fallback ratio)
- popup_size.x = MIN(window_size.x * p_fallback_ratio, popup_size.x);
- popup_size.y = MIN(window_size.y * p_fallback_ratio, popup_size.y);
-
- popup_centered_size(popup_size);
-}
-
-void Popup::popup_centered_minsize(const Size2 &p_minsize) {
-
- set_custom_minimum_size(p_minsize);
- _fix_size();
- popup_centered_size();
-}
-
-void Popup::popup_centered_size(const Size2 &p_size) {
-
- Rect2 rect;
- Size2 window_size = get_viewport_rect().size;
- rect.size = p_size == Size2() ? get_size() : p_size;
- rect.position = ((window_size - rect.size) / 2.0).floor();
-
- _popup(rect, true);
}
-void Popup::popup_centered_ratio(float p_screen_ratio) {
-
- Rect2 rect;
- Size2 window_size = get_viewport_rect().size;
- rect.size = (window_size * p_screen_ratio).floor();
- rect.position = ((window_size - rect.size) / 2.0).floor();
-
- _popup(rect, true);
-}
-
-void Popup::popup(const Rect2 &p_bounds) {
-
- _popup(p_bounds);
-}
-
-void Popup::_popup(const Rect2 &p_bounds, const bool p_centered) {
-
- emit_signal("about_to_show");
- show_modal(exclusive);
-
- // Fit the popup into the optionally provided bounds.
- if (!p_bounds.has_no_area()) {
- set_size(p_bounds.size);
+void Popup::_close_pressed() {
- // check if p_bounds.size was using an outdated cached values
- if (p_centered && p_bounds.size != get_size()) {
- set_position(p_bounds.position - ((get_size() - p_bounds.size) / 2.0).floor());
- } else {
- set_position(p_bounds.position);
- }
+ Window *parent_window = parent_visible;
+ if (parent_visible) {
+ parent_visible->disconnect("focus_entered", callable_mp(this, &Popup::_parent_focused));
+ parent_visible = nullptr;
}
- _fix_size();
-
- Control *focusable = find_next_valid_focus();
- if (focusable)
- focusable->grab_focus();
-
- _post_popup();
- notification(NOTIFICATION_POST_POPUP);
- popped_up = true;
-}
+ call_deferred("hide");
-void Popup::set_exclusive(bool p_exclusive) {
+ emit_signal("cancelled");
- exclusive = p_exclusive;
+ if (parent_window) {
+ //parent_window->grab_focus();
+ }
}
-bool Popup::is_exclusive() const {
-
- return exclusive;
+void Popup::set_as_minsize() {
+ set_size(get_contents_minimum_size());
}
-
void Popup::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_as_minsize"), &Popup::set_as_minsize);
- ClassDB::bind_method(D_METHOD("popup_centered_size", "size"), &Popup::popup_centered_size, DEFVAL(Size2()));
- ClassDB::bind_method(D_METHOD("popup_centered_ratio", "ratio"), &Popup::popup_centered_ratio, DEFVAL(0.75));
- ClassDB::bind_method(D_METHOD("popup_centered_minsize", "minsize"), &Popup::popup_centered_minsize, DEFVAL(Size2()));
- ClassDB::bind_method(D_METHOD("popup_centered_clamped", "size", "fallback_ratio"), &Popup::popup_centered_clamped, DEFVAL(Size2()), DEFVAL(0.75));
- ClassDB::bind_method(D_METHOD("popup", "bounds"), &Popup::popup, DEFVAL(Rect2()));
- ClassDB::bind_method(D_METHOD("set_exclusive", "enable"), &Popup::set_exclusive);
- ClassDB::bind_method(D_METHOD("is_exclusive"), &Popup::is_exclusive);
- ADD_SIGNAL(MethodInfo("about_to_show"));
ADD_SIGNAL(MethodInfo("popup_hide"));
- ADD_GROUP("Popup", "popup_");
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "popup_exclusive"), "set_exclusive", "is_exclusive");
-
- BIND_CONSTANT(NOTIFICATION_POST_POPUP);
- BIND_CONSTANT(NOTIFICATION_POPUP_HIDE);
}
Popup::Popup() {
- set_as_toplevel(true);
- exclusive = false;
- popped_up = false;
- hide();
-}
+ parent_visible = nullptr;
-String Popup::get_configuration_warning() const {
+ set_wrap_controls(true);
+ set_visible(false);
+ set_transient(true);
+ set_flag(FLAG_BORDERLESS, true);
+ set_flag(FLAG_RESIZE_DISABLED, true);
- if (is_visible_in_tree()) {
- return TTR("Popups will hide by default unless you call popup() or any of the popup*() functions. Making them visible for editing is fine, but they will hide upon running.");
- }
-
- return String();
+ connect("window_input", callable_mp(this, &Popup::_input_from_window));
}
Popup::~Popup() {
}
-Size2 PopupPanel::get_minimum_size() const {
+Size2 PopupPanel::_get_contents_minimum_size() const {
- Ref<StyleBox> p = get_stylebox("panel");
+ Ref<StyleBox> p = get_theme_stylebox("panel", "PopupPanel");
Size2 ms;
for (int i = 0; i < get_child_count(); i++) {
Control *c = Object::cast_to<Control>(get_child(i));
- if (!c)
+ if (!c || c == panel)
continue;
if (c->is_set_as_toplevel())
@@ -268,7 +141,7 @@ Size2 PopupPanel::get_minimum_size() const {
void PopupPanel::_update_child_rects() {
- Ref<StyleBox> p = get_stylebox("panel");
+ Ref<StyleBox> p = get_theme_stylebox("panel", "PopupPanel");
Vector2 cpos(p->get_offset());
Vector2 csize(get_size() - p->get_minimum_size());
@@ -281,24 +154,30 @@ void PopupPanel::_update_child_rects() {
if (c->is_set_as_toplevel())
continue;
- c->set_position(cpos);
- c->set_size(csize);
+ if (c == panel) {
+ c->set_position(Vector2());
+ c->set_size(get_size());
+ } else {
+ c->set_position(cpos);
+ c->set_size(csize);
+ }
}
}
void PopupPanel::_notification(int p_what) {
- if (p_what == NOTIFICATION_DRAW) {
-
- get_stylebox("panel")->draw(get_canvas_item(), Rect2(Point2(), get_size()));
- } else if (p_what == NOTIFICATION_READY) {
+ if (p_what == NOTIFICATION_READY || p_what == NOTIFICATION_ENTER_TREE) {
+ panel->add_theme_style_override("panel", get_theme_stylebox("panel", "PopupPanel"));
_update_child_rects();
- } else if (p_what == NOTIFICATION_RESIZED) {
+ } else if (p_what == NOTIFICATION_WM_SIZE_CHANGED) {
_update_child_rects();
}
}
PopupPanel::PopupPanel() {
+
+ panel = memnew(Panel);
+ add_child(panel);
}
diff --git a/scene/gui/popup.h b/scene/gui/popup.h
index fc4158d41c..20b355bc18 100644
--- a/scene/gui/popup.h
+++ b/scene/gui/popup.h
@@ -31,44 +31,24 @@
#ifndef POPUP_H
#define POPUP_H
-#include "scene/gui/control.h"
+#include "scene/main/window.h"
-class Popup : public Control {
+class Popup : public Window {
- GDCLASS(Popup, Control);
+ GDCLASS(Popup, Window);
- bool exclusive;
- bool popped_up;
+ Window *parent_visible;
-private:
- void _popup(const Rect2 &p_bounds = Rect2(), const bool p_centered = false);
+ void _input_from_window(const Ref<InputEvent> &p_event);
+ void _parent_focused();
+ void _close_pressed();
protected:
- virtual void _post_popup() {}
-
- void _gui_input(Ref<InputEvent> p_event);
void _notification(int p_what);
- virtual void _fix_size();
static void _bind_methods();
public:
- enum {
- NOTIFICATION_POST_POPUP = 80,
- NOTIFICATION_POPUP_HIDE = 81
- };
-
- void set_exclusive(bool p_exclusive);
- bool is_exclusive() const;
-
- void popup_centered_ratio(float p_screen_ratio = 0.75);
- void popup_centered_size(const Size2 &p_size = Size2());
- void popup_centered_minsize(const Size2 &p_minsize = Size2());
void set_as_minsize();
- void popup_centered_clamped(const Size2 &p_size = Size2(), float p_fallback_ratio = 0.75);
- virtual void popup(const Rect2 &p_bounds = Rect2());
-
- virtual String get_configuration_warning() const;
-
Popup();
~Popup();
};
@@ -77,13 +57,16 @@ class PopupPanel : public Popup {
GDCLASS(PopupPanel, Popup);
+ Panel *panel;
+
protected:
void _update_child_rects();
void _notification(int p_what);
+ virtual Size2 _get_contents_minimum_size() const;
+
public:
void set_child_rect(Control *p_child);
- virtual Size2 get_minimum_size() const;
PopupPanel();
};
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index c45220ea60..6951026dec 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -35,6 +35,7 @@
#include "core/os/os.h"
#include "core/print_string.h"
#include "core/translation.h"
+#include "scene/gui/control.h"
String PopupMenu::_get_accel_text(int p_item) const {
@@ -47,18 +48,18 @@ String PopupMenu::_get_accel_text(int p_item) const {
return String();
}
-Size2 PopupMenu::get_minimum_size() const {
+Size2 PopupMenu::_get_contents_minimum_size() const {
- int vseparation = get_constant("vseparation");
- int hseparation = get_constant("hseparation");
+ int vseparation = get_theme_constant("vseparation");
+ int hseparation = get_theme_constant("hseparation");
- Size2 minsize = get_stylebox("panel")->get_minimum_size();
- Ref<Font> font = get_font("font");
+ Size2 minsize = get_theme_stylebox("panel")->get_minimum_size();
+ Ref<Font> font = get_theme_font("font");
float max_w = 0;
float icon_w = 0;
int font_h = font->get_height();
- int check_w = MAX(get_icon("checked")->get_width(), get_icon("radio_checked")->get_width()) + hseparation;
+ int check_w = MAX(get_theme_icon("checked")->get_width(), get_theme_icon("radio_checked")->get_width()) + hseparation;
int accel_max_w = 0;
bool has_check = false;
@@ -93,7 +94,7 @@ Size2 PopupMenu::get_minimum_size() const {
}
if (items[i].submenu != "")
- size.width += get_icon("submenu")->get_width();
+ size.width += get_theme_icon("submenu")->get_width();
max_w = MAX(max_w, size.width);
@@ -112,15 +113,15 @@ int PopupMenu::_get_mouse_over(const Point2 &p_over) const {
if (p_over.x < 0 || p_over.x >= get_size().width)
return -1;
- Ref<StyleBox> style = get_stylebox("panel");
+ Ref<StyleBox> style = get_theme_stylebox("panel");
Point2 ofs = style->get_offset();
if (ofs.y > p_over.y)
return -1;
- Ref<Font> font = get_font("font");
- int vseparation = get_constant("vseparation");
+ Ref<Font> font = get_theme_font("font");
+ int vseparation = get_theme_constant("vseparation");
float font_h = font->get_height();
for (int i = 0; i < items.size(); i++) {
@@ -152,27 +153,27 @@ void PopupMenu::_activate_submenu(int over) {
ERR_FAIL_COND_MSG(!n, "Item subnode does not exist: " + items[over].submenu + ".");
Popup *pm = Object::cast_to<Popup>(n);
ERR_FAIL_COND_MSG(!pm, "Item subnode is not a Popup: " + items[over].submenu + ".");
- if (pm->is_visible_in_tree())
+ if (pm->is_visible())
return; //already visible!
- Point2 p = get_global_position();
+ Point2 p = get_position();
Rect2 pr(p, get_size());
- Ref<StyleBox> style = get_stylebox("panel");
+ Ref<StyleBox> style = get_theme_stylebox("panel");
- Point2 pos = p + Point2(get_size().width, items[over]._ofs_cache - style->get_offset().y) * get_global_transform().get_scale();
+ Point2 pos = p + Point2(get_size().width, items[over]._ofs_cache - style->get_offset().y);
Size2 size = pm->get_size();
// fix pos
- if (pos.x + size.width > get_viewport_rect().size.width)
+ if (pos.x + size.width > get_screen_rect().size.width)
pos.x = p.x - size.width;
pm->set_position(pos);
- pm->set_scale(get_global_transform().get_scale());
+ // pm->set_scale(get_global_transform().get_scale());
pm->popup();
PopupMenu *pum = Object::cast_to<PopupMenu>(pm);
if (pum) {
- pr.position -= pum->get_global_position();
+ pr.position -= pum->get_position();
pum->clear_autohide_areas();
pum->add_autohide_area(Rect2(pr.position.x, pr.position.y, pr.size.x, items[over]._ofs_cache));
if (over < items.size() - 1) {
@@ -192,17 +193,17 @@ void PopupMenu::_submenu_timeout() {
void PopupMenu::_scroll(float p_factor, const Point2 &p_over) {
- int vseparation = get_constant("vseparation");
- Ref<Font> font = get_font("font");
+ int vseparation = get_theme_constant("vseparation");
+ Ref<Font> font = get_theme_font("font");
- float dy = (vseparation + font->get_height()) * 3 * p_factor * get_global_transform().get_scale().y;
+ float dy = (vseparation + font->get_height()) * 3 * p_factor;
if (dy > 0) {
- const float global_top = get_global_position().y;
+ const float global_top = get_position().y;
const float limit = global_top < 0 ? -global_top : 0;
dy = MIN(dy, limit);
} else if (dy < 0) {
- const float global_bottom = get_global_position().y + get_size().y * get_global_transform().get_scale().y;
- const float viewport_height = get_viewport_rect().size.y;
+ const float global_bottom = get_position().y + get_size().y;
+ const float viewport_height = get_screen_rect().size.y;
const float limit = global_bottom > viewport_height ? global_bottom - viewport_height : 0;
dy = -MIN(-dy, limit);
}
@@ -231,8 +232,8 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
mouse_over = i;
emit_signal("id_focused", i);
- update();
- accept_event();
+ control->update();
+ set_input_as_handled();
break;
}
}
@@ -251,8 +252,8 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
mouse_over = i;
emit_signal("id_focused", i);
- update();
- accept_event();
+ control->update();
+ set_input_as_handled();
break;
}
}
@@ -261,13 +262,13 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
Node *n = get_parent();
if (n && Object::cast_to<PopupMenu>(n)) {
hide();
- accept_event();
+ set_input_as_handled();
}
} else if (p_event->is_action("ui_right") && p_event->is_pressed()) {
if (mouse_over >= 0 && mouse_over < items.size() && !items[mouse_over].separator && items[mouse_over].submenu != "" && submenu_over != mouse_over) {
_activate_submenu(mouse_over);
- accept_event();
+ set_input_as_handled();
}
} else if (p_event->is_action("ui_accept") && p_event->is_pressed()) {
@@ -278,7 +279,7 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
} else {
activate_item(mouse_over);
}
- accept_event();
+ set_input_as_handled();
}
}
@@ -294,13 +295,13 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
case BUTTON_WHEEL_DOWN: {
- if (get_global_position().y + get_size().y * get_global_transform().get_scale().y > get_viewport_rect().size.y) {
+ if (get_position().y + get_size().y > get_screen_rect().size.y) {
_scroll(-b->get_factor(), b->get_position());
}
} break;
case BUTTON_WHEEL_UP: {
- if (get_global_position().y < 0) {
+ if (get_position().y < 0) {
_scroll(b->get_factor(), b->get_position());
}
} break;
@@ -338,7 +339,7 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
}
}
- //update();
+ //control->update();
}
Ref<InputEventMouseMotion> m = p_event;
@@ -364,7 +365,7 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
if (id < 0) {
mouse_over = -1;
- update();
+ control->update();
return;
}
@@ -375,13 +376,13 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
if (over != mouse_over) {
mouse_over = over;
- update();
+ control->update();
}
}
Ref<InputEventPanGesture> pan_gesture = p_event;
if (pan_gesture.is_valid()) {
- if (get_global_position().y + get_size().y > get_viewport_rect().size.y || get_global_position().y < 0) {
+ if (get_position().y + get_size().y > get_screen_rect().size.y || get_position().y < 0) {
_scroll(-pan_gesture->get_delta().y, pan_gesture->get_position());
}
}
@@ -416,191 +417,174 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
if (items[i].text.findn(search_string) == 0) {
mouse_over = i;
emit_signal("id_focused", i);
- update();
- accept_event();
+ control->update();
+ set_input_as_handled();
break;
}
}
}
}
-bool PopupMenu::has_point(const Point2 &p_point) const {
+void PopupMenu::_draw() {
- if (parent_rect.has_point(p_point))
- return true;
- for (const List<Rect2>::Element *E = autohide_areas.front(); E; E = E->next()) {
+ RID ci = control->get_canvas_item();
+ Size2 size = get_size();
- if (E->get().has_point(p_point))
- return true;
- }
-
- return Control::has_point(p_point);
-}
+ Ref<StyleBox> style = get_theme_stylebox("panel");
+ Ref<StyleBox> hover = get_theme_stylebox("hover");
+ Ref<Font> font = get_theme_font("font");
+ // In Item::checkable_type enum order (less the non-checkable member)
+ Ref<Texture2D> check[] = { get_theme_icon("checked"), get_theme_icon("radio_checked") };
+ Ref<Texture2D> uncheck[] = { get_theme_icon("unchecked"), get_theme_icon("radio_unchecked") };
+ Ref<Texture2D> submenu = get_theme_icon("submenu");
+ Ref<StyleBox> separator = get_theme_stylebox("separator");
+ Ref<StyleBox> labeled_separator_left = get_theme_stylebox("labeled_separator_left");
+ Ref<StyleBox> labeled_separator_right = get_theme_stylebox("labeled_separator_right");
-void PopupMenu::_notification(int p_what) {
+ style->draw(ci, Rect2(Point2(), get_size()));
+ Point2 ofs = style->get_offset();
+ int vseparation = get_theme_constant("vseparation");
+ int hseparation = get_theme_constant("hseparation");
+ Color font_color = get_theme_color("font_color");
+ Color font_color_disabled = get_theme_color("font_color_disabled");
+ Color font_color_accel = get_theme_color("font_color_accel");
+ Color font_color_hover = get_theme_color("font_color_hover");
+ float font_h = font->get_height();
- switch (p_what) {
+ // Add the check and the wider icon to the offset of all items.
+ float icon_ofs = 0.0;
+ bool has_check = false;
+ for (int i = 0; i < items.size(); i++) {
- case NOTIFICATION_ENTER_TREE: {
+ if (!items[i].icon.is_null())
+ icon_ofs = MAX(items[i].icon->get_size().width, icon_ofs);
- PopupMenu *pm = Object::cast_to<PopupMenu>(get_parent());
- if (pm) {
- // Inherit submenu's popup delay time from parent menu
- float pm_delay = pm->get_submenu_popup_delay();
- set_submenu_popup_delay(pm_delay);
- }
- } break;
- case NOTIFICATION_TRANSLATION_CHANGED: {
+ if (items[i].checkable_type)
+ has_check = true;
+ }
+ if (icon_ofs > 0.0)
+ icon_ofs += hseparation;
- for (int i = 0; i < items.size(); i++) {
- items.write[i].xl_text = tr(items[i].text);
- }
+ float check_ofs = 0.0;
+ if (has_check)
+ check_ofs = MAX(get_theme_icon("checked")->get_width(), get_theme_icon("radio_checked")->get_width()) + hseparation;
- minimum_size_changed();
- update();
- } break;
- case NOTIFICATION_DRAW: {
-
- RID ci = get_canvas_item();
- Size2 size = get_size();
-
- Ref<StyleBox> style = get_stylebox("panel");
- Ref<StyleBox> hover = get_stylebox("hover");
- Ref<Font> font = get_font("font");
- // In Item::checkable_type enum order (less the non-checkable member)
- Ref<Texture2D> check[] = { get_icon("checked"), get_icon("radio_checked") };
- Ref<Texture2D> uncheck[] = { get_icon("unchecked"), get_icon("radio_unchecked") };
- Ref<Texture2D> submenu = get_icon("submenu");
- Ref<StyleBox> separator = get_stylebox("separator");
- Ref<StyleBox> labeled_separator_left = get_stylebox("labeled_separator_left");
- Ref<StyleBox> labeled_separator_right = get_stylebox("labeled_separator_right");
-
- style->draw(ci, Rect2(Point2(), get_size()));
- Point2 ofs = style->get_offset();
- int vseparation = get_constant("vseparation");
- int hseparation = get_constant("hseparation");
- Color font_color = get_color("font_color");
- Color font_color_disabled = get_color("font_color_disabled");
- Color font_color_accel = get_color("font_color_accel");
- Color font_color_hover = get_color("font_color_hover");
- float font_h = font->get_height();
-
- // Add the check and the wider icon to the offset of all items.
- float icon_ofs = 0.0;
- bool has_check = false;
- for (int i = 0; i < items.size(); i++) {
+ for (int i = 0; i < items.size(); i++) {
- if (!items[i].icon.is_null())
- icon_ofs = MAX(items[i].icon->get_size().width, icon_ofs);
+ if (i > 0)
+ ofs.y += vseparation;
+ Point2 item_ofs = ofs;
+ Size2 icon_size;
+ float h;
- if (items[i].checkable_type)
- has_check = true;
- }
- if (icon_ofs > 0.0)
- icon_ofs += hseparation;
+ if (!items[i].icon.is_null()) {
- float check_ofs = 0.0;
- if (has_check)
- check_ofs = MAX(get_icon("checked")->get_width(), get_icon("radio_checked")->get_width()) + hseparation;
+ icon_size = items[i].icon->get_size();
+ h = MAX(icon_size.height, font_h);
+ } else {
- for (int i = 0; i < items.size(); i++) {
+ h = font_h;
+ }
- if (i > 0)
- ofs.y += vseparation;
- Point2 item_ofs = ofs;
- Size2 icon_size;
- float h;
+ if (i == mouse_over) {
- if (!items[i].icon.is_null()) {
+ hover->draw(ci, Rect2(item_ofs + Point2(-hseparation, -vseparation / 2), Size2(get_size().width - style->get_minimum_size().width + hseparation * 2, h + vseparation)));
+ }
- icon_size = items[i].icon->get_size();
- h = MAX(icon_size.height, font_h);
- } else {
+ String text = items[i].xl_text;
- h = font_h;
+ item_ofs.x += items[i].h_ofs;
+ if (items[i].separator) {
+
+ int sep_h = separator->get_center_size().height + separator->get_minimum_size().height;
+ if (text != String()) {
+ int ss = font->get_string_size(text).width;
+ int center = (get_size().width) / 2;
+ int l = center - ss / 2;
+ int r = center + ss / 2;
+ if (l > item_ofs.x) {
+ labeled_separator_left->draw(ci, Rect2(item_ofs + Point2(0, Math::floor((h - sep_h) / 2.0)), Size2(MAX(0, l - item_ofs.x), sep_h)));
}
-
- if (i == mouse_over) {
-
- hover->draw(ci, Rect2(item_ofs + Point2(-hseparation, -vseparation / 2), Size2(get_size().width - style->get_minimum_size().width + hseparation * 2, h + vseparation)));
+ if (r < get_size().width - style->get_margin(MARGIN_RIGHT)) {
+ labeled_separator_right->draw(ci, Rect2(Point2(r, item_ofs.y + Math::floor((h - sep_h) / 2.0)), Size2(MAX(0, get_size().width - style->get_margin(MARGIN_RIGHT) - r), sep_h)));
}
+ } else {
+ separator->draw(ci, Rect2(item_ofs + Point2(0, Math::floor((h - sep_h) / 2.0)), Size2(get_size().width - style->get_minimum_size().width, sep_h)));
+ }
+ }
- String text = items[i].xl_text;
+ Color icon_color(1, 1, 1, items[i].disabled ? 0.5 : 1);
- item_ofs.x += items[i].h_ofs;
- if (items[i].separator) {
+ if (items[i].checkable_type) {
+ Texture2D *icon = (items[i].checked ? check[items[i].checkable_type - 1] : uncheck[items[i].checkable_type - 1]).ptr();
+ icon->draw(ci, item_ofs + Point2(0, Math::floor((h - icon->get_height()) / 2.0)), icon_color);
+ }
- int sep_h = separator->get_center_size().height + separator->get_minimum_size().height;
- if (text != String()) {
- int ss = font->get_string_size(text).width;
- int center = (get_size().width) / 2;
- int l = center - ss / 2;
- int r = center + ss / 2;
- if (l > item_ofs.x) {
- labeled_separator_left->draw(ci, Rect2(item_ofs + Point2(0, Math::floor((h - sep_h) / 2.0)), Size2(MAX(0, l - item_ofs.x), sep_h)));
- }
- if (r < get_size().width - style->get_margin(MARGIN_RIGHT)) {
- labeled_separator_right->draw(ci, Rect2(Point2(r, item_ofs.y + Math::floor((h - sep_h) / 2.0)), Size2(MAX(0, get_size().width - style->get_margin(MARGIN_RIGHT) - r), sep_h)));
- }
- } else {
- separator->draw(ci, Rect2(item_ofs + Point2(0, Math::floor((h - sep_h) / 2.0)), Size2(get_size().width - style->get_minimum_size().width, sep_h)));
- }
- }
+ if (!items[i].icon.is_null()) {
+ items[i].icon->draw(ci, item_ofs + Size2(check_ofs, 0) + Point2(0, Math::floor((h - icon_size.height) / 2.0)), icon_color);
+ }
- Color icon_color(1, 1, 1, items[i].disabled ? 0.5 : 1);
+ if (items[i].submenu != "") {
+ submenu->draw(ci, Point2(size.width - style->get_margin(MARGIN_RIGHT) - submenu->get_width(), item_ofs.y + Math::floor(h - submenu->get_height()) / 2), icon_color);
+ }
- if (items[i].checkable_type) {
- Texture2D *icon = (items[i].checked ? check[items[i].checkable_type - 1] : uncheck[items[i].checkable_type - 1]).ptr();
- icon->draw(ci, item_ofs + Point2(0, Math::floor((h - icon->get_height()) / 2.0)), icon_color);
- }
+ item_ofs.y += font->get_ascent();
+ if (items[i].separator) {
- if (!items[i].icon.is_null()) {
- items[i].icon->draw(ci, item_ofs + Size2(check_ofs, 0) + Point2(0, Math::floor((h - icon_size.height) / 2.0)), icon_color);
- }
+ if (text != String()) {
+ int center = (get_size().width - font->get_string_size(text).width) / 2;
+ font->draw(ci, Point2(center, item_ofs.y + Math::floor((h - font_h) / 2.0)), text, font_color_disabled);
+ }
+ } else {
- if (items[i].submenu != "") {
- submenu->draw(ci, Point2(size.width - style->get_margin(MARGIN_RIGHT) - submenu->get_width(), item_ofs.y + Math::floor(h - submenu->get_height()) / 2), icon_color);
- }
+ item_ofs.x += icon_ofs + check_ofs;
+ font->draw(ci, item_ofs + Point2(0, Math::floor((h - font_h) / 2.0)), text, items[i].disabled ? font_color_disabled : (i == mouse_over ? font_color_hover : font_color));
+ }
- item_ofs.y += font->get_ascent();
- if (items[i].separator) {
+ if (items[i].accel || (items[i].shortcut.is_valid() && items[i].shortcut->is_valid())) {
+ //accelerator
+ String text2 = _get_accel_text(i);
+ item_ofs.x = size.width - style->get_margin(MARGIN_RIGHT) - font->get_string_size(text2).width;
+ font->draw(ci, item_ofs + Point2(0, Math::floor((h - font_h) / 2.0)), text2, i == mouse_over ? font_color_hover : font_color_accel);
+ }
- if (text != String()) {
- int center = (get_size().width - font->get_string_size(text).width) / 2;
- font->draw(ci, Point2(center, item_ofs.y + Math::floor((h - font_h) / 2.0)), text, font_color_disabled);
- }
- } else {
+ items.write[i]._ofs_cache = ofs.y;
- item_ofs.x += icon_ofs + check_ofs;
- font->draw(ci, item_ofs + Point2(0, Math::floor((h - font_h) / 2.0)), text, items[i].disabled ? font_color_disabled : (i == mouse_over ? font_color_hover : font_color));
- }
+ ofs.y += h;
+ }
+}
- if (items[i].accel || (items[i].shortcut.is_valid() && items[i].shortcut->is_valid())) {
- //accelerator
- String text2 = _get_accel_text(i);
- item_ofs.x = size.width - style->get_margin(MARGIN_RIGHT) - font->get_string_size(text2).width;
- font->draw(ci, item_ofs + Point2(0, Math::floor((h - font_h) / 2.0)), text2, i == mouse_over ? font_color_hover : font_color_accel);
- }
+void PopupMenu::_notification(int p_what) {
- items.write[i]._ofs_cache = ofs.y;
+ switch (p_what) {
+
+ case NOTIFICATION_ENTER_TREE: {
- ofs.y += h;
+ PopupMenu *pm = Object::cast_to<PopupMenu>(get_parent());
+ if (pm) {
+ // Inherit submenu's popup delay time from parent menu
+ float pm_delay = pm->get_submenu_popup_delay();
+ set_submenu_popup_delay(pm_delay);
}
} break;
- case NOTIFICATION_WM_FOCUS_OUT: {
+ case NOTIFICATION_TRANSLATION_CHANGED: {
- if (hide_on_window_lose_focus)
- hide();
+ for (int i = 0; i < items.size(); i++) {
+ items.write[i].xl_text = tr(items[i].text);
+ }
+
+ child_controls_changed();
+ control->update();
} break;
- case NOTIFICATION_MOUSE_ENTER: {
+ case NOTIFICATION_WM_MOUSE_ENTER: {
grab_focus();
} break;
- case NOTIFICATION_MOUSE_EXIT: {
+ case NOTIFICATION_WM_MOUSE_EXIT: {
if (mouse_over >= 0 && (items[mouse_over].submenu == "" || submenu_over != -1)) {
mouse_over = -1;
- update();
+ control->update();
}
} break;
case NOTIFICATION_POST_POPUP: {
@@ -608,26 +592,28 @@ void PopupMenu::_notification(int p_what) {
initial_button_mask = InputFilter::get_singleton()->get_mouse_button_mask();
during_grabbed_click = (bool)initial_button_mask;
} break;
- case NOTIFICATION_POPUP_HIDE: {
+ case NOTIFICATION_VISIBILITY_CHANGED: {
- if (mouse_over >= 0) {
- mouse_over = -1;
- update();
- }
+ if (!is_visible()) {
+ if (mouse_over >= 0) {
+ mouse_over = -1;
+ control->update();
+ }
- for (int i = 0; i < items.size(); i++) {
- if (items[i].submenu == "")
- continue;
+ for (int i = 0; i < items.size(); i++) {
+ if (items[i].submenu == "")
+ continue;
- Node *n = get_node(items[i].submenu);
- if (!n)
- continue;
+ Node *n = get_node(items[i].submenu);
+ if (!n)
+ continue;
- PopupMenu *pm = Object::cast_to<PopupMenu>(n);
- if (!pm || !pm->is_visible())
- continue;
+ PopupMenu *pm = Object::cast_to<PopupMenu>(n);
+ if (!pm || !pm->is_visible())
+ continue;
- pm->hide();
+ pm->hide();
+ }
}
} break;
}
@@ -648,8 +634,8 @@ void PopupMenu::add_item(const String &p_label, int p_id, uint32_t p_accel) {
Item item;
ITEM_SETUP_WITH_ACCEL(p_label, p_id, p_accel);
items.push_back(item);
- update();
- minimum_size_changed();
+ control->update();
+ child_controls_changed();
}
void PopupMenu::add_icon_item(const Ref<Texture2D> &p_icon, const String &p_label, int p_id, uint32_t p_accel) {
@@ -658,8 +644,8 @@ void PopupMenu::add_icon_item(const Ref<Texture2D> &p_icon, const String &p_labe
ITEM_SETUP_WITH_ACCEL(p_label, p_id, p_accel);
item.icon = p_icon;
items.push_back(item);
- update();
- minimum_size_changed();
+ control->update();
+ child_controls_changed();
}
void PopupMenu::add_check_item(const String &p_label, int p_id, uint32_t p_accel) {
@@ -668,8 +654,8 @@ void PopupMenu::add_check_item(const String &p_label, int p_id, uint32_t p_accel
ITEM_SETUP_WITH_ACCEL(p_label, p_id, p_accel);
item.checkable_type = Item::CHECKABLE_TYPE_CHECK_BOX;
items.push_back(item);
- update();
- minimum_size_changed();
+ control->update();
+ child_controls_changed();
}
void PopupMenu::add_icon_check_item(const Ref<Texture2D> &p_icon, const String &p_label, int p_id, uint32_t p_accel) {
@@ -679,8 +665,8 @@ void PopupMenu::add_icon_check_item(const Ref<Texture2D> &p_icon, const String &
item.icon = p_icon;
item.checkable_type = Item::CHECKABLE_TYPE_CHECK_BOX;
items.push_back(item);
- update();
- minimum_size_changed();
+ control->update();
+ child_controls_changed();
}
void PopupMenu::add_radio_check_item(const String &p_label, int p_id, uint32_t p_accel) {
@@ -689,8 +675,8 @@ void PopupMenu::add_radio_check_item(const String &p_label, int p_id, uint32_t p
ITEM_SETUP_WITH_ACCEL(p_label, p_id, p_accel);
item.checkable_type = Item::CHECKABLE_TYPE_RADIO_BUTTON;
items.push_back(item);
- update();
- minimum_size_changed();
+ control->update();
+ child_controls_changed();
}
void PopupMenu::add_icon_radio_check_item(const Ref<Texture2D> &p_icon, const String &p_label, int p_id, uint32_t p_accel) {
@@ -700,8 +686,8 @@ void PopupMenu::add_icon_radio_check_item(const Ref<Texture2D> &p_icon, const St
item.icon = p_icon;
item.checkable_type = Item::CHECKABLE_TYPE_RADIO_BUTTON;
items.push_back(item);
- update();
- minimum_size_changed();
+ control->update();
+ child_controls_changed();
}
void PopupMenu::add_multistate_item(const String &p_label, int p_max_states, int p_default_state, int p_id, uint32_t p_accel) {
@@ -711,8 +697,8 @@ void PopupMenu::add_multistate_item(const String &p_label, int p_max_states, int
item.max_states = p_max_states;
item.state = p_default_state;
items.push_back(item);
- update();
- minimum_size_changed();
+ control->update();
+ child_controls_changed();
}
#define ITEM_SETUP_WITH_SHORTCUT(p_shortcut, p_id, p_global) \
@@ -729,8 +715,8 @@ void PopupMenu::add_shortcut(const Ref<ShortCut> &p_shortcut, int p_id, bool p_g
Item item;
ITEM_SETUP_WITH_SHORTCUT(p_shortcut, p_id, p_global);
items.push_back(item);
- update();
- minimum_size_changed();
+ control->update();
+ child_controls_changed();
}
void PopupMenu::add_icon_shortcut(const Ref<Texture2D> &p_icon, const Ref<ShortCut> &p_shortcut, int p_id, bool p_global) {
@@ -739,8 +725,8 @@ void PopupMenu::add_icon_shortcut(const Ref<Texture2D> &p_icon, const Ref<ShortC
ITEM_SETUP_WITH_SHORTCUT(p_shortcut, p_id, p_global);
item.icon = p_icon;
items.push_back(item);
- update();
- minimum_size_changed();
+ control->update();
+ child_controls_changed();
}
void PopupMenu::add_check_shortcut(const Ref<ShortCut> &p_shortcut, int p_id, bool p_global) {
@@ -749,8 +735,8 @@ void PopupMenu::add_check_shortcut(const Ref<ShortCut> &p_shortcut, int p_id, bo
ITEM_SETUP_WITH_SHORTCUT(p_shortcut, p_id, p_global);
item.checkable_type = Item::CHECKABLE_TYPE_CHECK_BOX;
items.push_back(item);
- update();
- minimum_size_changed();
+ control->update();
+ child_controls_changed();
}
void PopupMenu::add_icon_check_shortcut(const Ref<Texture2D> &p_icon, const Ref<ShortCut> &p_shortcut, int p_id, bool p_global) {
@@ -760,8 +746,8 @@ void PopupMenu::add_icon_check_shortcut(const Ref<Texture2D> &p_icon, const Ref<
item.icon = p_icon;
item.checkable_type = Item::CHECKABLE_TYPE_CHECK_BOX;
items.push_back(item);
- update();
- minimum_size_changed();
+ control->update();
+ child_controls_changed();
}
void PopupMenu::add_radio_check_shortcut(const Ref<ShortCut> &p_shortcut, int p_id, bool p_global) {
@@ -770,8 +756,8 @@ void PopupMenu::add_radio_check_shortcut(const Ref<ShortCut> &p_shortcut, int p_
ITEM_SETUP_WITH_SHORTCUT(p_shortcut, p_id, p_global);
item.checkable_type = Item::CHECKABLE_TYPE_RADIO_BUTTON;
items.push_back(item);
- update();
- minimum_size_changed();
+ control->update();
+ child_controls_changed();
}
void PopupMenu::add_icon_radio_check_shortcut(const Ref<Texture2D> &p_icon, const Ref<ShortCut> &p_shortcut, int p_id, bool p_global) {
@@ -781,8 +767,8 @@ void PopupMenu::add_icon_radio_check_shortcut(const Ref<Texture2D> &p_icon, cons
item.icon = p_icon;
item.checkable_type = Item::CHECKABLE_TYPE_RADIO_BUTTON;
items.push_back(item);
- update();
- minimum_size_changed();
+ control->update();
+ child_controls_changed();
}
void PopupMenu::add_submenu_item(const String &p_label, const String &p_submenu, int p_id) {
@@ -793,8 +779,8 @@ void PopupMenu::add_submenu_item(const String &p_label, const String &p_submenu,
item.id = p_id == -1 ? items.size() : p_id;
item.submenu = p_submenu;
items.push_back(item);
- update();
- minimum_size_changed();
+ control->update();
+ child_controls_changed();
}
#undef ITEM_SETUP_WITH_ACCEL
@@ -808,16 +794,16 @@ void PopupMenu::set_item_text(int p_idx, const String &p_text) {
items.write[p_idx].text = p_text;
items.write[p_idx].xl_text = tr(p_text);
- update();
- minimum_size_changed();
+ control->update();
+ child_controls_changed();
}
void PopupMenu::set_item_icon(int p_idx, const Ref<Texture2D> &p_icon) {
ERR_FAIL_INDEX(p_idx, items.size());
items.write[p_idx].icon = p_icon;
- update();
- minimum_size_changed();
+ control->update();
+ child_controls_changed();
}
void PopupMenu::set_item_checked(int p_idx, bool p_checked) {
@@ -825,16 +811,16 @@ void PopupMenu::set_item_checked(int p_idx, bool p_checked) {
items.write[p_idx].checked = p_checked;
- update();
- minimum_size_changed();
+ control->update();
+ child_controls_changed();
}
void PopupMenu::set_item_id(int p_idx, int p_id) {
ERR_FAIL_INDEX(p_idx, items.size());
items.write[p_idx].id = p_id;
- update();
- minimum_size_changed();
+ control->update();
+ child_controls_changed();
}
void PopupMenu::set_item_accelerator(int p_idx, uint32_t p_accel) {
@@ -842,40 +828,40 @@ void PopupMenu::set_item_accelerator(int p_idx, uint32_t p_accel) {
ERR_FAIL_INDEX(p_idx, items.size());
items.write[p_idx].accel = p_accel;
- update();
- minimum_size_changed();
+ control->update();
+ child_controls_changed();
}
void PopupMenu::set_item_metadata(int p_idx, const Variant &p_meta) {
ERR_FAIL_INDEX(p_idx, items.size());
items.write[p_idx].metadata = p_meta;
- update();
- minimum_size_changed();
+ control->update();
+ child_controls_changed();
}
void PopupMenu::set_item_disabled(int p_idx, bool p_disabled) {
ERR_FAIL_INDEX(p_idx, items.size());
items.write[p_idx].disabled = p_disabled;
- update();
- minimum_size_changed();
+ control->update();
+ child_controls_changed();
}
void PopupMenu::set_item_submenu(int p_idx, const String &p_submenu) {
ERR_FAIL_INDEX(p_idx, items.size());
items.write[p_idx].submenu = p_submenu;
- update();
- minimum_size_changed();
+ control->update();
+ child_controls_changed();
}
void PopupMenu::toggle_item_checked(int p_idx) {
ERR_FAIL_INDEX(p_idx, items.size());
items.write[p_idx].checked = !items[p_idx].checked;
- update();
- minimum_size_changed();
+ control->update();
+ child_controls_changed();
}
String PopupMenu::get_item_text(int p_idx) const {
@@ -968,7 +954,7 @@ void PopupMenu::set_item_as_separator(int p_idx, bool p_separator) {
ERR_FAIL_INDEX(p_idx, items.size());
items.write[p_idx].separator = p_separator;
- update();
+ control->update();
}
bool PopupMenu::is_item_separator(int p_idx) const {
@@ -980,21 +966,21 @@ void PopupMenu::set_item_as_checkable(int p_idx, bool p_checkable) {
ERR_FAIL_INDEX(p_idx, items.size());
items.write[p_idx].checkable_type = p_checkable ? Item::CHECKABLE_TYPE_CHECK_BOX : Item::CHECKABLE_TYPE_NONE;
- update();
+ control->update();
}
void PopupMenu::set_item_as_radio_checkable(int p_idx, bool p_radio_checkable) {
ERR_FAIL_INDEX(p_idx, items.size());
items.write[p_idx].checkable_type = p_radio_checkable ? Item::CHECKABLE_TYPE_RADIO_BUTTON : Item::CHECKABLE_TYPE_NONE;
- update();
+ control->update();
}
void PopupMenu::set_item_tooltip(int p_idx, const String &p_tooltip) {
ERR_FAIL_INDEX(p_idx, items.size());
items.write[p_idx].tooltip = p_tooltip;
- update();
+ control->update();
}
void PopupMenu::set_item_shortcut(int p_idx, const Ref<ShortCut> &p_shortcut, bool p_global) {
@@ -1009,29 +995,29 @@ void PopupMenu::set_item_shortcut(int p_idx, const Ref<ShortCut> &p_shortcut, bo
_ref_shortcut(items[p_idx].shortcut);
}
- update();
+ control->update();
}
void PopupMenu::set_item_h_offset(int p_idx, int p_offset) {
ERR_FAIL_INDEX(p_idx, items.size());
items.write[p_idx].h_ofs = p_offset;
- update();
- minimum_size_changed();
+ control->update();
+ child_controls_changed();
}
void PopupMenu::set_item_multistate(int p_idx, int p_state) {
ERR_FAIL_INDEX(p_idx, items.size());
items.write[p_idx].state = p_state;
- update();
+ control->update();
}
void PopupMenu::set_item_shortcut_disabled(int p_idx, bool p_disabled) {
ERR_FAIL_INDEX(p_idx, items.size());
items.write[p_idx].shortcut_is_disabled = p_disabled;
- update();
+ control->update();
}
void PopupMenu::toggle_item_multistate(int p_idx) {
@@ -1045,7 +1031,7 @@ void PopupMenu::toggle_item_multistate(int p_idx) {
if (items.write[p_idx].max_states <= items[p_idx].state)
items.write[p_idx].state = 0;
- update();
+ control->update();
}
bool PopupMenu::is_item_checkable(int p_idx) const {
@@ -1177,8 +1163,8 @@ void PopupMenu::remove_item(int p_idx) {
}
items.remove(p_idx);
- update();
- minimum_size_changed();
+ control->update();
+ child_controls_changed();
}
void PopupMenu::add_separator(const String &p_text) {
@@ -1191,7 +1177,7 @@ void PopupMenu::add_separator(const String &p_text) {
sep.xl_text = tr(p_text);
}
items.push_back(sep);
- update();
+ control->update();
}
void PopupMenu::clear() {
@@ -1203,8 +1189,8 @@ void PopupMenu::clear() {
}
items.clear();
mouse_over = -1;
- update();
- minimum_size_changed();
+ control->update();
+ child_controls_changed();
}
Array PopupMenu::_get_items() const {
@@ -1345,16 +1331,6 @@ bool PopupMenu::get_allow_search() const {
return allow_search;
}
-void PopupMenu::set_hide_on_window_lose_focus(bool p_enabled) {
-
- hide_on_window_lose_focus = p_enabled;
-}
-
-bool PopupMenu::is_hide_on_window_lose_focus() const {
-
- return hide_on_window_lose_focus;
-}
-
String PopupMenu::get_tooltip(const Point2 &p_pos) const {
int over = _get_mouse_over(p_pos);
@@ -1466,9 +1442,6 @@ void PopupMenu::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_submenu_popup_delay", "seconds"), &PopupMenu::set_submenu_popup_delay);
ClassDB::bind_method(D_METHOD("get_submenu_popup_delay"), &PopupMenu::get_submenu_popup_delay);
- ClassDB::bind_method(D_METHOD("set_hide_on_window_lose_focus", "enable"), &PopupMenu::set_hide_on_window_lose_focus);
- ClassDB::bind_method(D_METHOD("is_hide_on_window_lose_focus"), &PopupMenu::is_hide_on_window_lose_focus);
-
ClassDB::bind_method(D_METHOD("set_allow_search", "allow"), &PopupMenu::set_allow_search);
ClassDB::bind_method(D_METHOD("get_allow_search"), &PopupMenu::get_allow_search);
@@ -1486,7 +1459,6 @@ void PopupMenu::_bind_methods() {
void PopupMenu::popup(const Rect2 &p_bounds) {
- grab_click_focus();
moved = Vector2();
invalidated_click = true;
Popup::popup(p_bounds);
@@ -1494,6 +1466,13 @@ void PopupMenu::popup(const Rect2 &p_bounds) {
PopupMenu::PopupMenu() {
+ control = memnew(Control);
+ add_child(control);
+
+ control->set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ control->connect("gui_input", callable_mp(this, &PopupMenu::_gui_input));
+ control->connect("draw", callable_mp(this, &PopupMenu::_draw));
+
mouse_over = -1;
submenu_over = -1;
initial_button_mask = 0;
@@ -1503,12 +1482,9 @@ PopupMenu::PopupMenu() {
search_time_msec = 0;
search_string = "";
- set_focus_mode(FOCUS_ALL);
- set_as_toplevel(true);
set_hide_on_item_selection(true);
set_hide_on_checkable_item_selection(true);
set_hide_on_multistate_item_selection(false);
- set_hide_on_window_lose_focus(true);
submenu_timer = memnew(Timer);
submenu_timer->set_wait_time(0.3);
diff --git a/scene/gui/popup_menu.h b/scene/gui/popup_menu.h
index a3a858cfde..511c630ad2 100644
--- a/scene/gui/popup_menu.h
+++ b/scene/gui/popup_menu.h
@@ -32,6 +32,7 @@
#define POPUP_MENU_H
#include "scene/gui/popup.h"
+#include "scene/gui/shortcut.h"
class PopupMenu : public Popup {
@@ -87,7 +88,7 @@ class PopupMenu : public Popup {
Rect2 parent_rect;
String _get_accel_text(int p_item) const;
int _get_mouse_over(const Point2 &p_over) const;
- virtual Size2 get_minimum_size() const;
+ virtual Size2 _get_contents_minimum_size() const;
void _scroll(float p_factor, const Point2 &p_over);
void _gui_input(const Ref<InputEvent> &p_event);
void _activate_submenu(int over);
@@ -97,7 +98,6 @@ class PopupMenu : public Popup {
bool hide_on_item_selection;
bool hide_on_checkable_item_selection;
bool hide_on_multistate_item_selection;
- bool hide_on_window_lose_focus;
Vector2 moved;
Array _get_items() const;
@@ -112,9 +112,11 @@ class PopupMenu : public Popup {
uint64_t search_time_msec;
String search_string;
-protected:
- virtual bool has_point(const Point2 &p_point) const;
+ Control *control;
+
+ void _draw();
+protected:
friend class MenuButton;
void _notification(int p_what);
static void _bind_methods();
@@ -213,9 +215,6 @@ public:
virtual void popup(const Rect2 &p_bounds = Rect2());
- void set_hide_on_window_lose_focus(bool p_enabled);
- bool is_hide_on_window_lose_focus() const;
-
PopupMenu();
~PopupMenu();
};
diff --git a/scene/gui/progress_bar.cpp b/scene/gui/progress_bar.cpp
index e11295d7e7..362c45453d 100644
--- a/scene/gui/progress_bar.cpp
+++ b/scene/gui/progress_bar.cpp
@@ -32,9 +32,9 @@
Size2 ProgressBar::get_minimum_size() const {
- Ref<StyleBox> bg = get_stylebox("bg");
- Ref<StyleBox> fg = get_stylebox("fg");
- Ref<Font> font = get_font("font");
+ Ref<StyleBox> bg = get_theme_stylebox("bg");
+ Ref<StyleBox> fg = get_theme_stylebox("fg");
+ Ref<Font> font = get_theme_font("font");
Size2 minimum_size = bg->get_minimum_size();
minimum_size.height = MAX(minimum_size.height, fg->get_minimum_size().height);
@@ -52,10 +52,10 @@ void ProgressBar::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
- Ref<StyleBox> bg = get_stylebox("bg");
- Ref<StyleBox> fg = get_stylebox("fg");
- Ref<Font> font = get_font("font");
- Color font_color = get_color("font_color");
+ Ref<StyleBox> bg = get_theme_stylebox("bg");
+ Ref<StyleBox> fg = get_theme_stylebox("fg");
+ Ref<Font> font = get_theme_font("font");
+ Color font_color = get_theme_color("font_color");
draw_style_box(bg, Rect2(Point2(), get_size()));
float r = get_as_ratio();
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 2a21df002c..614d109534 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -143,7 +143,7 @@ RichTextLabel::Item *RichTextLabel::_get_prev_item(Item *p_item, bool p_free) {
}
Rect2 RichTextLabel::_get_text_rect() {
- Ref<StyleBox> style = get_stylebox("normal");
+ Ref<StyleBox> style = get_theme_stylebox("normal");
return Rect2(style->get_offset(), get_size() - style->get_minimum_size());
}
@@ -241,7 +241,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
l.space_caches.push_back(spaces); \
} \
line_wrapped = false; \
- y += line_height + get_constant(SceneStringNames::get_singleton()->line_separation); \
+ y += line_height + get_theme_constant(SceneStringNames::get_singleton()->line_separation); \
line_height = 0; \
line_ascent = 0; \
line_descent = 0; \
@@ -306,8 +306,8 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
Color selection_bg;
if (p_mode == PROCESS_DRAW) {
- selection_fg = get_color("font_color_selected");
- selection_bg = get_color("selection_color");
+ selection_fg = get_theme_color("font_color_selected");
+ selection_bg = get_theme_color("selection_color");
}
int rchar = 0;
@@ -668,13 +668,13 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
lh = 0;
ItemTable *table = static_cast<ItemTable *>(it);
- int hseparation = get_constant("table_hseparation");
- int vseparation = get_constant("table_vseparation");
+ int hseparation = get_theme_constant("table_hseparation");
+ int vseparation = get_theme_constant("table_vseparation");
Color ccolor = _find_color(table, p_base_color);
Vector2 draw_ofs = Point2(wofs, y);
- Color font_color_shadow = get_color("font_color_shadow");
- bool use_outline = get_constant("shadow_as_outline");
- Point2 shadow_ofs2(get_constant("shadow_offset_x"), get_constant("shadow_offset_y"));
+ Color font_color_shadow = get_theme_color("font_color_shadow");
+ bool use_outline = get_theme_constant("shadow_as_outline");
+ Point2 shadow_ofs2(get_theme_constant("shadow_offset_x"), get_theme_constant("shadow_offset_y"));
if (p_mode == PROCESS_CACHE) {
@@ -988,11 +988,11 @@ void RichTextLabel::_notification(int p_what) {
Size2 size = get_size();
Rect2 text_rect = _get_text_rect();
- draw_style_box(get_stylebox("normal"), Rect2(Point2(), size));
+ draw_style_box(get_theme_stylebox("normal"), Rect2(Point2(), size));
if (has_focus()) {
VisualServer::get_singleton()->canvas_item_add_clip_ignore(ci, true);
- draw_style_box(get_stylebox("focus"), Rect2(Point2(), size));
+ draw_style_box(get_theme_stylebox("focus"), Rect2(Point2(), size));
VisualServer::get_singleton()->canvas_item_add_clip_ignore(ci, false);
}
@@ -1013,11 +1013,11 @@ void RichTextLabel::_notification(int p_what) {
if (from_line >= main->lines.size())
break; //nothing to draw
int y = (main->lines[from_line].height_accum_cache - main->lines[from_line].height_cache) - ofs;
- Ref<Font> base_font = get_font("normal_font");
- Color base_color = get_color("default_color");
- Color font_color_shadow = get_color("font_color_shadow");
- bool use_outline = get_constant("shadow_as_outline");
- Point2 shadow_ofs(get_constant("shadow_offset_x"), get_constant("shadow_offset_y"));
+ Ref<Font> base_font = get_theme_font("normal_font");
+ Color base_color = get_theme_color("default_color");
+ Color font_color_shadow = get_theme_color("font_color_shadow");
+ bool use_outline = get_theme_constant("shadow_as_outline");
+ Point2 shadow_ofs(get_theme_constant("shadow_offset_x"), get_theme_constant("shadow_offset_y"));
visible_line_count = 0;
while (y < size.height && from_line < main->lines.size()) {
@@ -1044,9 +1044,9 @@ void RichTextLabel::_find_click(ItemFrame *p_frame, const Point2i &p_click, Item
Rect2 text_rect = _get_text_rect();
int ofs = vscroll->get_value();
- Color font_color_shadow = get_color("font_color_shadow");
- bool use_outline = get_constant("shadow_as_outline");
- Point2 shadow_ofs(get_constant("shadow_offset_x"), get_constant("shadow_offset_y"));
+ Color font_color_shadow = get_theme_color("font_color_shadow");
+ bool use_outline = get_theme_constant("shadow_as_outline");
+ Point2 shadow_ofs(get_theme_constant("shadow_offset_x"), get_theme_constant("shadow_offset_y"));
//todo, change to binary search
int from_line = 0;
@@ -1062,8 +1062,8 @@ void RichTextLabel::_find_click(ItemFrame *p_frame, const Point2i &p_click, Item
return;
int y = (p_frame->lines[from_line].height_accum_cache - p_frame->lines[from_line].height_cache) - ofs;
- Ref<Font> base_font = get_font("normal_font");
- Color base_color = get_color("default_color");
+ Ref<Font> base_font = get_theme_font("normal_font");
+ Color base_color = get_theme_color("default_color");
while (y < text_rect.get_size().height && from_line < p_frame->lines.size()) {
@@ -1228,14 +1228,14 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) {
case KEY_UP: {
if (vscroll->is_visible_in_tree()) {
- vscroll->set_value(vscroll->get_value() - get_font("normal_font")->get_height());
+ vscroll->set_value(vscroll->get_value() - get_theme_font("normal_font")->get_height());
handled = true;
}
} break;
case KEY_DOWN: {
if (vscroll->is_visible_in_tree()) {
- vscroll->set_value(vscroll->get_value() + get_font("normal_font")->get_height());
+ vscroll->set_value(vscroll->get_value() + get_theme_font("normal_font")->get_height());
handled = true;
}
} break;
@@ -1526,11 +1526,11 @@ void RichTextLabel::_validate_line_caches(ItemFrame *p_frame) {
size.width = fixed_width;
}
Rect2 text_rect = _get_text_rect();
- Color font_color_shadow = get_color("font_color_shadow");
- bool use_outline = get_constant("shadow_as_outline");
- Point2 shadow_ofs(get_constant("shadow_offset_x"), get_constant("shadow_offset_y"));
+ Color font_color_shadow = get_theme_color("font_color_shadow");
+ bool use_outline = get_theme_constant("shadow_as_outline");
+ Point2 shadow_ofs(get_theme_constant("shadow_offset_x"), get_theme_constant("shadow_offset_y"));
- Ref<Font> base_font = get_font("normal_font");
+ Ref<Font> base_font = get_theme_font("normal_font");
for (int i = p_frame->first_invalid_line; i < p_frame->lines.size(); i++) {
@@ -1545,7 +1545,7 @@ void RichTextLabel::_validate_line_caches(ItemFrame *p_frame) {
int total_height = 0;
if (p_frame->lines.size())
- total_height = p_frame->lines[p_frame->lines.size() - 1].height_accum_cache + get_stylebox("normal")->get_minimum_size().height;
+ total_height = p_frame->lines[p_frame->lines.size() - 1].height_accum_cache + get_theme_stylebox("normal")->get_minimum_size().height;
main->first_invalid_line = p_frame->lines.size();
@@ -1759,35 +1759,35 @@ void RichTextLabel::push_font(const Ref<Font> &p_font) {
}
void RichTextLabel::push_normal() {
- Ref<Font> normal_font = get_font("normal_font");
+ Ref<Font> normal_font = get_theme_font("normal_font");
ERR_FAIL_COND(normal_font.is_null());
push_font(normal_font);
}
void RichTextLabel::push_bold() {
- Ref<Font> bold_font = get_font("bold_font");
+ Ref<Font> bold_font = get_theme_font("bold_font");
ERR_FAIL_COND(bold_font.is_null());
push_font(bold_font);
}
void RichTextLabel::push_bold_italics() {
- Ref<Font> bold_italics_font = get_font("bold_italics_font");
+ Ref<Font> bold_italics_font = get_theme_font("bold_italics_font");
ERR_FAIL_COND(bold_italics_font.is_null());
push_font(bold_italics_font);
}
void RichTextLabel::push_italics() {
- Ref<Font> italics_font = get_font("italics_font");
+ Ref<Font> italics_font = get_theme_font("italics_font");
ERR_FAIL_COND(italics_font.is_null());
push_font(italics_font);
}
void RichTextLabel::push_mono() {
- Ref<Font> mono_font = get_font("mono_font");
+ Ref<Font> mono_font = get_theme_font("mono_font");
ERR_FAIL_COND(mono_font.is_null());
push_font(mono_font);
@@ -2045,13 +2045,13 @@ Error RichTextLabel::append_bbcode(const String &p_bbcode) {
int pos = 0;
List<String> tag_stack;
- Ref<Font> normal_font = get_font("normal_font");
- Ref<Font> bold_font = get_font("bold_font");
- Ref<Font> italics_font = get_font("italics_font");
- Ref<Font> bold_italics_font = get_font("bold_italics_font");
- Ref<Font> mono_font = get_font("mono_font");
+ Ref<Font> normal_font = get_theme_font("normal_font");
+ Ref<Font> bold_font = get_theme_font("bold_font");
+ Ref<Font> italics_font = get_theme_font("italics_font");
+ Ref<Font> bold_italics_font = get_theme_font("bold_italics_font");
+ Ref<Font> mono_font = get_theme_font("mono_font");
- Color base_color = get_color("default_color");
+ Color base_color = get_theme_color("default_color");
int indent_level = 0;
@@ -2519,7 +2519,7 @@ bool RichTextLabel::search(const String &p_string, bool p_from_selection, bool p
_validate_line_caches(main);
- int fh = _find_font(t).is_valid() ? _find_font(t)->get_height() : get_font("normal_font")->get_height();
+ int fh = _find_font(t).is_valid() ? _find_font(t)->get_height() : get_theme_font("normal_font")->get_height();
float offset = 0;
@@ -2693,7 +2693,7 @@ void RichTextLabel::install_effect(const Variant effect) {
int RichTextLabel::get_content_height() {
int total_height = 0;
if (main->lines.size())
- total_height = main->lines[main->lines.size() - 1].height_accum_cache + get_stylebox("normal")->get_minimum_size().height;
+ total_height = main->lines[main->lines.size() - 1].height_accum_cache + get_theme_stylebox("normal")->get_minimum_size().height;
return total_height;
}
diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp
index 7fc83703c3..5e9541730e 100644
--- a/scene/gui/scroll_bar.cpp
+++ b/scene/gui/scroll_bar.cpp
@@ -72,8 +72,8 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
if (b->is_pressed()) {
double ofs = orientation == VERTICAL ? b->get_position().y : b->get_position().x;
- Ref<Texture2D> decr = get_icon("decrement");
- Ref<Texture2D> incr = get_icon("increment");
+ Ref<Texture2D> decr = get_theme_icon("decrement");
+ Ref<Texture2D> incr = get_theme_icon("increment");
double decr_size = orientation == VERTICAL ? decr->get_height() : decr->get_width();
double incr_size = orientation == VERTICAL ? incr->get_height() : incr->get_width();
@@ -149,7 +149,7 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
if (drag.active) {
double ofs = orientation == VERTICAL ? m->get_position().y : m->get_position().x;
- Ref<Texture2D> decr = get_icon("decrement");
+ Ref<Texture2D> decr = get_theme_icon("decrement");
double decr_size = orientation == VERTICAL ? decr->get_height() : decr->get_width();
ofs -= decr_size;
@@ -160,8 +160,8 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
} else {
double ofs = orientation == VERTICAL ? m->get_position().y : m->get_position().x;
- Ref<Texture2D> decr = get_icon("decrement");
- Ref<Texture2D> incr = get_icon("increment");
+ Ref<Texture2D> decr = get_theme_icon("decrement");
+ Ref<Texture2D> incr = get_theme_icon("increment");
double decr_size = orientation == VERTICAL ? decr->get_height() : decr->get_width();
double incr_size = orientation == VERTICAL ? incr->get_height() : incr->get_width();
@@ -234,17 +234,17 @@ void ScrollBar::_notification(int p_what) {
RID ci = get_canvas_item();
- Ref<Texture2D> decr = highlight == HIGHLIGHT_DECR ? get_icon("decrement_highlight") : get_icon("decrement");
- Ref<Texture2D> incr = highlight == HIGHLIGHT_INCR ? get_icon("increment_highlight") : get_icon("increment");
- Ref<StyleBox> bg = has_focus() ? get_stylebox("scroll_focus") : get_stylebox("scroll");
+ Ref<Texture2D> decr = highlight == HIGHLIGHT_DECR ? get_theme_icon("decrement_highlight") : get_theme_icon("decrement");
+ Ref<Texture2D> incr = highlight == HIGHLIGHT_INCR ? get_theme_icon("increment_highlight") : get_theme_icon("increment");
+ Ref<StyleBox> bg = has_focus() ? get_theme_stylebox("scroll_focus") : get_theme_stylebox("scroll");
Ref<StyleBox> grabber;
if (drag.active)
- grabber = get_stylebox("grabber_pressed");
+ grabber = get_theme_stylebox("grabber_pressed");
else if (highlight == HIGHLIGHT_RANGE)
- grabber = get_stylebox("grabber_highlight");
+ grabber = get_theme_stylebox("grabber_highlight");
else
- grabber = get_stylebox("grabber");
+ grabber = get_theme_stylebox("grabber");
Point2 ofs;
@@ -417,7 +417,7 @@ void ScrollBar::_notification(int p_what) {
double ScrollBar::get_grabber_min_size() const {
- Ref<StyleBox> grabber = get_stylebox("grabber");
+ Ref<StyleBox> grabber = get_theme_stylebox("grabber");
Size2 gminsize = grabber->get_minimum_size() + grabber->get_center_size();
return (orientation == VERTICAL) ? gminsize.height : gminsize.width;
}
@@ -443,17 +443,17 @@ double ScrollBar::get_area_size() const {
switch (orientation) {
case VERTICAL: {
double area = get_size().height;
- area -= get_stylebox("scroll")->get_minimum_size().height;
- area -= get_icon("increment")->get_height();
- area -= get_icon("decrement")->get_height();
+ area -= get_theme_stylebox("scroll")->get_minimum_size().height;
+ area -= get_theme_icon("increment")->get_height();
+ area -= get_theme_icon("decrement")->get_height();
area -= get_grabber_min_size();
return area;
} break;
case HORIZONTAL: {
double area = get_size().width;
- area -= get_stylebox("scroll")->get_minimum_size().width;
- area -= get_icon("increment")->get_width();
- area -= get_icon("decrement")->get_width();
+ area -= get_theme_stylebox("scroll")->get_minimum_size().width;
+ area -= get_theme_icon("increment")->get_width();
+ area -= get_theme_icon("decrement")->get_width();
area -= get_grabber_min_size();
return area;
} break;
@@ -469,14 +469,14 @@ double ScrollBar::get_area_offset() const {
if (orientation == VERTICAL) {
- ofs += get_stylebox("hscroll")->get_margin(MARGIN_TOP);
- ofs += get_icon("decrement")->get_height();
+ ofs += get_theme_stylebox("hscroll")->get_margin(MARGIN_TOP);
+ ofs += get_theme_icon("decrement")->get_height();
}
if (orientation == HORIZONTAL) {
- ofs += get_stylebox("hscroll")->get_margin(MARGIN_LEFT);
- ofs += get_icon("decrement")->get_width();
+ ofs += get_theme_stylebox("hscroll")->get_margin(MARGIN_LEFT);
+ ofs += get_theme_icon("decrement")->get_width();
}
return ofs;
@@ -501,9 +501,9 @@ double ScrollBar::get_grabber_offset() const {
Size2 ScrollBar::get_minimum_size() const {
- Ref<Texture2D> incr = get_icon("increment");
- Ref<Texture2D> decr = get_icon("decrement");
- Ref<StyleBox> bg = get_stylebox("scroll");
+ Ref<Texture2D> incr = get_theme_icon("increment");
+ Ref<Texture2D> decr = get_theme_icon("decrement");
+ Ref<StyleBox> bg = get_theme_stylebox("scroll");
Size2 minsize;
if (orientation == VERTICAL) {
diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp
index 32943e04e0..fb17adf96e 100644
--- a/scene/gui/scroll_container.cpp
+++ b/scene/gui/scroll_container.cpp
@@ -39,7 +39,7 @@ bool ScrollContainer::clips_input() const {
Size2 ScrollContainer::get_minimum_size() const {
- Ref<StyleBox> sb = get_stylebox("bg");
+ Ref<StyleBox> sb = get_theme_stylebox("bg");
Size2 min_size;
for (int i = 0; i < get_child_count(); i++) {
@@ -276,7 +276,7 @@ void ScrollContainer::_notification(int p_what) {
Size2 size = get_size();
Point2 ofs;
- Ref<StyleBox> sb = get_stylebox("bg");
+ Ref<StyleBox> sb = get_theme_stylebox("bg");
size -= sb->get_minimum_size();
ofs += sb->get_offset();
@@ -323,7 +323,7 @@ void ScrollContainer::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
- Ref<StyleBox> sb = get_stylebox("bg");
+ Ref<StyleBox> sb = get_theme_stylebox("bg");
draw_style_box(sb, Rect2(Vector2(), get_size()));
update_scrollbars();
@@ -404,7 +404,7 @@ void ScrollContainer::_notification(int p_what) {
void ScrollContainer::update_scrollbars() {
Size2 size = get_size();
- Ref<StyleBox> sb = get_stylebox("bg");
+ Ref<StyleBox> sb = get_theme_stylebox("bg");
size -= sb->get_minimum_size();
Size2 hmin;
diff --git a/scene/gui/separator.cpp b/scene/gui/separator.cpp
index 4635efb233..75c4b7cce9 100644
--- a/scene/gui/separator.cpp
+++ b/scene/gui/separator.cpp
@@ -34,9 +34,9 @@ Size2 Separator::get_minimum_size() const {
Size2 ms(3, 3);
if (orientation == VERTICAL) {
- ms.x = get_constant("separation");
+ ms.x = get_theme_constant("separation");
} else { // HORIZONTAL
- ms.y = get_constant("separation");
+ ms.y = get_theme_constant("separation");
}
return ms;
}
@@ -48,7 +48,7 @@ void Separator::_notification(int p_what) {
case NOTIFICATION_DRAW: {
Size2i size = get_size();
- Ref<StyleBox> style = get_stylebox("separator");
+ Ref<StyleBox> style = get_theme_stylebox("separator");
Size2i ssize = style->get_minimum_size() + style->get_center_size();
if (orientation == VERTICAL) {
diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp
index 85887ef7b1..e47e2b869d 100644
--- a/scene/gui/slider.cpp
+++ b/scene/gui/slider.cpp
@@ -33,10 +33,10 @@
Size2 Slider::get_minimum_size() const {
- Ref<StyleBox> style = get_stylebox("slider");
+ Ref<StyleBox> style = get_theme_stylebox("slider");
Size2i ss = style->get_minimum_size() + style->get_center_size();
- Ref<Texture2D> grabber = get_icon("grabber");
+ Ref<Texture2D> grabber = get_theme_icon("grabber");
Size2i rs = grabber->get_size();
if (orientation == HORIZONTAL)
@@ -57,7 +57,7 @@ void Slider::_gui_input(Ref<InputEvent> p_event) {
if (mb->get_button_index() == BUTTON_LEFT) {
if (mb->is_pressed()) {
- Ref<Texture2D> grabber = get_icon(mouse_inside || has_focus() ? "grabber_highlight" : "grabber");
+ Ref<Texture2D> grabber = get_theme_icon(mouse_inside || has_focus() ? "grabber_highlight" : "grabber");
grab.pos = orientation == VERTICAL ? mb->get_position().y : mb->get_position().x;
double grab_width = (double)grabber->get_size().width;
@@ -87,7 +87,7 @@ void Slider::_gui_input(Ref<InputEvent> p_event) {
if (grab.active) {
Size2i size = get_size();
- Ref<Texture2D> grabber = get_icon("grabber");
+ Ref<Texture2D> grabber = get_theme_icon("grabber");
float motion = (orientation == VERTICAL ? mm->get_position().y : mm->get_position().x) - grab.pos;
if (orientation == VERTICAL)
motion = -motion;
@@ -165,10 +165,10 @@ void Slider::_notification(int p_what) {
case NOTIFICATION_DRAW: {
RID ci = get_canvas_item();
Size2i size = get_size();
- Ref<StyleBox> style = get_stylebox("slider");
- Ref<StyleBox> grabber_area = get_stylebox("grabber_area");
- Ref<Texture2D> grabber = get_icon(editable ? ((mouse_inside || has_focus()) ? "grabber_highlight" : "grabber") : "grabber_disabled");
- Ref<Texture2D> tick = get_icon("tick");
+ Ref<StyleBox> style = get_theme_stylebox("slider");
+ Ref<StyleBox> grabber_area = get_theme_stylebox("grabber_area");
+ Ref<Texture2D> grabber = get_theme_icon(editable ? ((mouse_inside || has_focus()) ? "grabber_highlight" : "grabber") : "grabber_disabled");
+ Ref<Texture2D> tick = get_theme_icon("tick");
double ratio = Math::is_nan(get_as_ratio()) ? 0 : get_as_ratio();
if (orientation == VERTICAL) {
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index 12b2f39538..ccfa8ebf63 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -196,7 +196,7 @@ void SpinBox::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
- Ref<Texture2D> updown = get_icon("updown");
+ Ref<Texture2D> updown = get_theme_icon("updown");
_adjust_width_for_icon(updown);
@@ -210,7 +210,7 @@ void SpinBox::_notification(int p_what) {
//_value_changed(0);
} else if (p_what == NOTIFICATION_ENTER_TREE) {
- _adjust_width_for_icon(get_icon("updown"));
+ _adjust_width_for_icon(get_theme_icon("updown"));
_value_changed(0);
} else if (p_what == NOTIFICATION_THEME_CHANGED) {
diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp
index 255278be2b..4eb614a9ac 100644
--- a/scene/gui/split_container.cpp
+++ b/scene/gui/split_container.cpp
@@ -74,8 +74,8 @@ void SplitContainer::_resort() {
bool second_expanded = (vertical ? second->get_v_size_flags() : second->get_h_size_flags()) & SIZE_EXPAND;
// Determine the separation between items
- Ref<Texture2D> g = get_icon("grabber");
- int sep = get_constant("separation");
+ Ref<Texture2D> g = get_theme_icon("grabber");
+ int sep = get_theme_constant("separation");
sep = (dragger_visibility != DRAGGER_HIDDEN_COLLAPSED) ? MAX(sep, vertical ? g->get_height() : g->get_width()) : 0;
// Compute the minimum size
@@ -123,8 +123,8 @@ Size2 SplitContainer::get_minimum_size() const {
/* Calculate MINIMUM SIZE */
Size2i minimum;
- Ref<Texture2D> g = get_icon("grabber");
- int sep = get_constant("separation");
+ Ref<Texture2D> g = get_theme_icon("grabber");
+ int sep = get_theme_constant("separation");
sep = (dragger_visibility != DRAGGER_HIDDEN_COLLAPSED) ? MAX(sep, vertical ? g->get_height() : g->get_width()) : 0;
for (int i = 0; i < 2; i++) {
@@ -167,7 +167,7 @@ void SplitContainer::_notification(int p_what) {
case NOTIFICATION_MOUSE_EXIT: {
mouse_inside = false;
- if (get_constant("autohide"))
+ if (get_theme_constant("autohide"))
update();
} break;
case NOTIFICATION_DRAW: {
@@ -175,14 +175,14 @@ void SplitContainer::_notification(int p_what) {
if (!_getch(0) || !_getch(1))
return;
- if (collapsed || (!dragging && !mouse_inside && get_constant("autohide")))
+ if (collapsed || (!dragging && !mouse_inside && get_theme_constant("autohide")))
return;
if (dragger_visibility != DRAGGER_VISIBLE)
return;
- int sep = dragger_visibility != DRAGGER_HIDDEN_COLLAPSED ? get_constant("separation") : 0;
- Ref<Texture2D> tex = get_icon("grabber");
+ int sep = dragger_visibility != DRAGGER_HIDDEN_COLLAPSED ? get_theme_constant("separation") : 0;
+ Ref<Texture2D> tex = get_theme_icon("grabber");
Size2 size = get_size();
if (vertical)
@@ -210,7 +210,7 @@ void SplitContainer::_gui_input(const Ref<InputEvent> &p_event) {
if (mb->is_pressed()) {
- int sep = get_constant("separation");
+ int sep = get_theme_constant("separation");
if (vertical) {
@@ -242,14 +242,14 @@ void SplitContainer::_gui_input(const Ref<InputEvent> &p_event) {
bool mouse_inside_state = false;
if (vertical)
- mouse_inside_state = mm->get_position().y > middle_sep && mm->get_position().y < middle_sep + get_constant("separation");
+ mouse_inside_state = mm->get_position().y > middle_sep && mm->get_position().y < middle_sep + get_theme_constant("separation");
else
- mouse_inside_state = mm->get_position().x > middle_sep && mm->get_position().x < middle_sep + get_constant("separation");
+ mouse_inside_state = mm->get_position().x > middle_sep && mm->get_position().x < middle_sep + get_theme_constant("separation");
if (mouse_inside != mouse_inside_state) {
mouse_inside = mouse_inside_state;
- if (get_constant("autohide"))
+ if (get_theme_constant("autohide"))
update();
}
@@ -270,7 +270,7 @@ Control::CursorShape SplitContainer::get_cursor_shape(const Point2 &p_pos) const
if (!collapsed && _getch(0) && _getch(1) && dragger_visibility == DRAGGER_VISIBLE) {
- int sep = get_constant("separation");
+ int sep = get_theme_constant("separation");
if (vertical) {
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index 6290d364fc..7cecbf7fa2 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -41,14 +41,14 @@ int TabContainer::_get_top_margin() const {
return 0;
// Respect the minimum tab height.
- Ref<StyleBox> tab_bg = get_stylebox("tab_bg");
- Ref<StyleBox> tab_fg = get_stylebox("tab_fg");
- Ref<StyleBox> tab_disabled = get_stylebox("tab_disabled");
+ Ref<StyleBox> tab_bg = get_theme_stylebox("tab_bg");
+ Ref<StyleBox> tab_fg = get_theme_stylebox("tab_fg");
+ Ref<StyleBox> tab_disabled = get_theme_stylebox("tab_disabled");
int tab_height = MAX(MAX(tab_bg->get_minimum_size().height, tab_fg->get_minimum_size().height), tab_disabled->get_minimum_size().height);
// Font height or higher icon wins.
- Ref<Font> font = get_font("font");
+ Ref<Font> font = get_theme_font("font");
int content_height = font->get_height();
Vector<Control *> tabs = _get_tabs();
@@ -81,15 +81,15 @@ void TabContainer::_gui_input(const Ref<InputEvent> &p_event) {
return;
// Handle menu button.
- Ref<Texture2D> menu = get_icon("menu");
+ Ref<Texture2D> menu = get_theme_icon("menu");
if (popup && pos.x > size.width - menu->get_width()) {
emit_signal("pre_popup_pressed");
- Vector2 popup_pos = get_global_position();
- popup_pos.x += size.width * get_global_transform().get_scale().x - popup->get_size().width * popup->get_global_transform().get_scale().x;
- popup_pos.y += menu->get_height() * get_global_transform().get_scale().y;
+ Vector2 popup_pos = get_screen_position();
+ popup_pos.x += size.width - popup->get_size().width;
+ popup_pos.y += menu->get_height();
- popup->set_global_position(popup_pos);
+ popup->set_position(popup_pos);
popup->popup();
return;
}
@@ -107,8 +107,8 @@ void TabContainer::_gui_input(const Ref<InputEvent> &p_event) {
popup_ofs = menu->get_width();
}
- Ref<Texture2D> increment = get_icon("increment");
- Ref<Texture2D> decrement = get_icon("decrement");
+ Ref<Texture2D> increment = get_theme_icon("increment");
+ Ref<Texture2D> decrement = get_theme_icon("decrement");
if (pos.x > size.width - increment->get_width() - popup_ofs) {
if (last_tab_cache < tabs.size() - 1) {
first_tab_cache += 1;
@@ -159,7 +159,7 @@ void TabContainer::_gui_input(const Ref<InputEvent> &p_event) {
return;
}
- Ref<Texture2D> menu = get_icon("menu");
+ Ref<Texture2D> menu = get_theme_icon("menu");
if (popup) {
if (pos.x >= size.width - menu->get_width()) {
@@ -191,8 +191,8 @@ void TabContainer::_gui_input(const Ref<InputEvent> &p_event) {
popup_ofs = menu->get_width();
}
- Ref<Texture2D> increment = get_icon("increment");
- Ref<Texture2D> decrement = get_icon("decrement");
+ Ref<Texture2D> increment = get_theme_icon("increment");
+ Ref<Texture2D> decrement = get_theme_icon("decrement");
if (pos.x >= size.width - increment->get_width() - popup_ofs) {
if (highlight_arrow != 1) {
@@ -224,10 +224,10 @@ void TabContainer::_notification(int p_what) {
case NOTIFICATION_RESIZED: {
Vector<Control *> tabs = _get_tabs();
- int side_margin = get_constant("side_margin");
- Ref<Texture2D> menu = get_icon("menu");
- Ref<Texture2D> increment = get_icon("increment");
- Ref<Texture2D> decrement = get_icon("decrement");
+ int side_margin = get_theme_constant("side_margin");
+ Ref<Texture2D> menu = get_theme_icon("menu");
+ Ref<Texture2D> increment = get_theme_icon("increment");
+ Ref<Texture2D> decrement = get_theme_icon("decrement");
int header_width = get_size().width - side_margin * 2;
// Find the width of the header area.
@@ -262,28 +262,28 @@ void TabContainer::_notification(int p_what) {
Size2 size = get_size();
// Draw only the tab area if the header is hidden.
- Ref<StyleBox> panel = get_stylebox("panel");
+ Ref<StyleBox> panel = get_theme_stylebox("panel");
if (!tabs_visible) {
panel->draw(canvas, Rect2(0, 0, size.width, size.height));
return;
}
Vector<Control *> tabs = _get_tabs();
- Ref<StyleBox> tab_bg = get_stylebox("tab_bg");
- Ref<StyleBox> tab_fg = get_stylebox("tab_fg");
- Ref<StyleBox> tab_disabled = get_stylebox("tab_disabled");
- Ref<Texture2D> increment = get_icon("increment");
- Ref<Texture2D> increment_hl = get_icon("increment_highlight");
- Ref<Texture2D> decrement = get_icon("decrement");
- Ref<Texture2D> decrement_hl = get_icon("decrement_highlight");
- Ref<Texture2D> menu = get_icon("menu");
- Ref<Texture2D> menu_hl = get_icon("menu_highlight");
- Ref<Font> font = get_font("font");
- Color font_color_fg = get_color("font_color_fg");
- Color font_color_bg = get_color("font_color_bg");
- Color font_color_disabled = get_color("font_color_disabled");
- int side_margin = get_constant("side_margin");
- int icon_text_distance = get_constant("hseparation");
+ Ref<StyleBox> tab_bg = get_theme_stylebox("tab_bg");
+ Ref<StyleBox> tab_fg = get_theme_stylebox("tab_fg");
+ Ref<StyleBox> tab_disabled = get_theme_stylebox("tab_disabled");
+ Ref<Texture2D> increment = get_theme_icon("increment");
+ Ref<Texture2D> increment_hl = get_theme_icon("increment_highlight");
+ Ref<Texture2D> decrement = get_theme_icon("decrement");
+ Ref<Texture2D> decrement_hl = get_theme_icon("decrement_highlight");
+ Ref<Texture2D> menu = get_theme_icon("menu");
+ Ref<Texture2D> menu_hl = get_theme_icon("menu_highlight");
+ Ref<Font> font = get_theme_font("font");
+ Color font_color_fg = get_theme_color("font_color_fg");
+ Color font_color_bg = get_theme_color("font_color_bg");
+ Color font_color_disabled = get_theme_color("font_color_disabled");
+ int side_margin = get_theme_constant("side_margin");
+ int icon_text_distance = get_theme_constant("hseparation");
// Find out start and width of the header area.
int header_x = side_margin;
@@ -458,7 +458,7 @@ int TabContainer::_get_tab_width(int p_index) const {
return 0;
// Get the width of the text displayed on the tab.
- Ref<Font> font = get_font("font");
+ Ref<Font> font = get_theme_font("font");
String text = control->has_meta("_tab_name") ? String(tr(String(control->get_meta("_tab_name")))) : String(control->get_name());
int width = font->get_string_size(text).width;
@@ -468,14 +468,14 @@ int TabContainer::_get_tab_width(int p_index) const {
if (icon.is_valid()) {
width += icon->get_width();
if (text != "")
- width += get_constant("hseparation");
+ width += get_theme_constant("hseparation");
}
}
// Respect a minimum size.
- Ref<StyleBox> tab_bg = get_stylebox("tab_bg");
- Ref<StyleBox> tab_fg = get_stylebox("tab_fg");
- Ref<StyleBox> tab_disabled = get_stylebox("tab_disabled");
+ Ref<StyleBox> tab_bg = get_theme_stylebox("tab_bg");
+ Ref<StyleBox> tab_fg = get_theme_stylebox("tab_fg");
+ Ref<StyleBox> tab_disabled = get_theme_stylebox("tab_disabled");
if (get_tab_disabled(p_index)) {
width += tab_disabled->get_minimum_size().width;
} else if (p_index == current) {
@@ -530,7 +530,7 @@ void TabContainer::add_child_notify(Node *p_child) {
c->set_anchors_and_margins_preset(Control::PRESET_WIDE);
if (tabs_visible)
c->set_margin(MARGIN_TOP, _get_top_margin());
- Ref<StyleBox> sb = get_stylebox("panel");
+ Ref<StyleBox> sb = get_theme_stylebox("panel");
c->set_margin(Margin(MARGIN_TOP), c->get_margin(Margin(MARGIN_TOP)) + sb->get_margin(Margin(MARGIN_TOP)));
c->set_margin(Margin(MARGIN_LEFT), c->get_margin(Margin(MARGIN_LEFT)) + sb->get_margin(Margin(MARGIN_LEFT)));
c->set_margin(Margin(MARGIN_RIGHT), c->get_margin(Margin(MARGIN_RIGHT)) - sb->get_margin(Margin(MARGIN_RIGHT)));
@@ -554,7 +554,7 @@ void TabContainer::set_current_tab(int p_current) {
int pending_previous = current;
current = p_current;
- Ref<StyleBox> sb = get_stylebox("panel");
+ Ref<StyleBox> sb = get_theme_stylebox("panel");
Vector<Control *> tabs = _get_tabs();
for (int i = 0; i < tabs.size(); i++) {
@@ -745,12 +745,12 @@ int TabContainer::get_tab_idx_at_point(const Point2 &p_point) const {
int right_ofs = 0;
if (popup) {
- Ref<Texture2D> menu = get_icon("menu");
+ Ref<Texture2D> menu = get_theme_icon("menu");
right_ofs += menu->get_width();
}
if (buttons_visible_cache) {
- Ref<Texture2D> increment = get_icon("increment");
- Ref<Texture2D> decrement = get_icon("decrement");
+ Ref<Texture2D> increment = get_theme_icon("increment");
+ Ref<Texture2D> decrement = get_theme_icon("decrement");
right_ofs += increment->get_width() + decrement->get_width();
}
if (p_point.x > size.width - right_ofs) {
@@ -933,17 +933,17 @@ Size2 TabContainer::get_minimum_size() const {
ms.y = MAX(ms.y, cms.y);
}
- Ref<StyleBox> tab_bg = get_stylebox("tab_bg");
- Ref<StyleBox> tab_fg = get_stylebox("tab_fg");
- Ref<StyleBox> tab_disabled = get_stylebox("tab_disabled");
- Ref<Font> font = get_font("font");
+ Ref<StyleBox> tab_bg = get_theme_stylebox("tab_bg");
+ Ref<StyleBox> tab_fg = get_theme_stylebox("tab_fg");
+ Ref<StyleBox> tab_disabled = get_theme_stylebox("tab_disabled");
+ Ref<Font> font = get_theme_font("font");
if (tabs_visible) {
ms.y += MAX(MAX(tab_bg->get_minimum_size().y, tab_fg->get_minimum_size().y), tab_disabled->get_minimum_size().y);
ms.y += font->get_height();
}
- Ref<StyleBox> sb = get_stylebox("panel");
+ Ref<StyleBox> sb = get_theme_stylebox("panel");
ms += sb->get_minimum_size();
return ms;
diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp
index 901408919a..ea6d44e3a7 100644
--- a/scene/gui/tabs.cpp
+++ b/scene/gui/tabs.cpp
@@ -37,10 +37,10 @@
Size2 Tabs::get_minimum_size() const {
- Ref<StyleBox> tab_bg = get_stylebox("tab_bg");
- Ref<StyleBox> tab_fg = get_stylebox("tab_fg");
- Ref<StyleBox> tab_disabled = get_stylebox("tab_disabled");
- Ref<Font> font = get_font("font");
+ Ref<StyleBox> tab_bg = get_theme_stylebox("tab_bg");
+ Ref<StyleBox> tab_fg = get_theme_stylebox("tab_fg");
+ Ref<StyleBox> tab_disabled = get_theme_stylebox("tab_disabled");
+ Ref<Font> font = get_theme_font("font");
Size2 ms(0, MAX(MAX(tab_bg->get_minimum_size().height, tab_fg->get_minimum_size().height), tab_disabled->get_minimum_size().height) + font->get_height());
@@ -50,7 +50,7 @@ Size2 Tabs::get_minimum_size() const {
if (tex.is_valid()) {
ms.height = MAX(ms.height, tex->get_size().height);
if (tabs[i].text != "")
- ms.width += get_constant("hseparation");
+ ms.width += get_theme_constant("hseparation");
}
ms.width += Math::ceil(font->get_string_size(tabs[i].xl_text).width);
@@ -65,15 +65,15 @@ Size2 Tabs::get_minimum_size() const {
if (tabs[i].right_button.is_valid()) {
Ref<Texture2D> rb = tabs[i].right_button;
Size2 bms = rb->get_size();
- bms.width += get_constant("hseparation");
+ bms.width += get_theme_constant("hseparation");
ms.width += bms.width;
ms.height = MAX(bms.height + tab_bg->get_minimum_size().height, ms.height);
}
if (cb_displaypolicy == CLOSE_BUTTON_SHOW_ALWAYS || (cb_displaypolicy == CLOSE_BUTTON_SHOW_ACTIVE_ONLY && i == current)) {
- Ref<Texture2D> cb = get_icon("close");
+ Ref<Texture2D> cb = get_theme_icon("close");
Size2 bms = cb->get_size();
- bms.width += get_constant("hseparation");
+ bms.width += get_theme_constant("hseparation");
ms.width += bms.width;
ms.height = MAX(bms.height + tab_bg->get_minimum_size().height, ms.height);
}
@@ -94,8 +94,8 @@ void Tabs::_gui_input(const Ref<InputEvent> &p_event) {
highlight_arrow = -1;
if (buttons_visible) {
- Ref<Texture2D> incr = get_icon("increment");
- Ref<Texture2D> decr = get_icon("decrement");
+ Ref<Texture2D> incr = get_theme_icon("increment");
+ Ref<Texture2D> decr = get_theme_icon("decrement");
int limit = get_size().width - incr->get_width() - decr->get_width();
@@ -163,8 +163,8 @@ void Tabs::_gui_input(const Ref<InputEvent> &p_event) {
if (buttons_visible) {
- Ref<Texture2D> incr = get_icon("increment");
- Ref<Texture2D> decr = get_icon("decrement");
+ Ref<Texture2D> incr = get_theme_icon("increment");
+ Ref<Texture2D> decr = get_theme_icon("decrement");
int limit = get_size().width - incr->get_width() - decr->get_width();
@@ -238,14 +238,14 @@ void Tabs::_notification(int p_what) {
_update_cache();
RID ci = get_canvas_item();
- Ref<StyleBox> tab_bg = get_stylebox("tab_bg");
- Ref<StyleBox> tab_fg = get_stylebox("tab_fg");
- Ref<StyleBox> tab_disabled = get_stylebox("tab_disabled");
- Ref<Font> font = get_font("font");
- Color color_fg = get_color("font_color_fg");
- Color color_bg = get_color("font_color_bg");
- Color color_disabled = get_color("font_color_disabled");
- Ref<Texture2D> close = get_icon("close");
+ Ref<StyleBox> tab_bg = get_theme_stylebox("tab_bg");
+ Ref<StyleBox> tab_fg = get_theme_stylebox("tab_fg");
+ Ref<StyleBox> tab_disabled = get_theme_stylebox("tab_disabled");
+ Ref<Font> font = get_theme_font("font");
+ Color color_fg = get_theme_color("font_color_fg");
+ Color color_bg = get_theme_color("font_color_bg");
+ Color color_disabled = get_theme_color("font_color_disabled");
+ Ref<Texture2D> close = get_theme_icon("close");
int h = get_size().height;
int w = 0;
@@ -267,10 +267,10 @@ void Tabs::_notification(int p_what) {
w = 0;
}
- Ref<Texture2D> incr = get_icon("increment");
- Ref<Texture2D> decr = get_icon("decrement");
- Ref<Texture2D> incr_hl = get_icon("increment_highlight");
- Ref<Texture2D> decr_hl = get_icon("decrement_highlight");
+ Ref<Texture2D> incr = get_theme_icon("increment");
+ Ref<Texture2D> decr = get_theme_icon("decrement");
+ Ref<Texture2D> incr_hl = get_theme_icon("increment_highlight");
+ Ref<Texture2D> decr_hl = get_theme_icon("decrement_highlight");
int limit = get_size().width - incr->get_size().width - decr->get_size().width;
@@ -318,7 +318,7 @@ void Tabs::_notification(int p_what) {
icon->draw(ci, Point2i(w, sb->get_margin(MARGIN_TOP) + ((sb_rect.size.y - sb_ms.y) - icon->get_height()) / 2));
if (tabs[i].text != "")
- w += icon->get_width() + get_constant("hseparation");
+ w += icon->get_width() + get_theme_constant("hseparation");
}
font->draw(ci, Point2i(w, sb->get_margin(MARGIN_TOP) + ((sb_rect.size.y - sb_ms.y) - font->get_height()) / 2 + font->get_ascent()), tabs[i].xl_text, col, tabs[i].size_text);
@@ -327,10 +327,10 @@ void Tabs::_notification(int p_what) {
if (tabs[i].right_button.is_valid()) {
- Ref<StyleBox> style = get_stylebox("button");
+ Ref<StyleBox> style = get_theme_stylebox("button");
Ref<Texture2D> rb = tabs[i].right_button;
- w += get_constant("hseparation");
+ w += get_theme_constant("hseparation");
Rect2 rb_rect;
rb_rect.size = style->get_minimum_size() + rb->get_size();
@@ -339,7 +339,7 @@ void Tabs::_notification(int p_what) {
if (rb_hover == i) {
if (rb_pressing)
- get_stylebox("button_pressed")->draw(ci, rb_rect);
+ get_theme_stylebox("button_pressed")->draw(ci, rb_rect);
else
style->draw(ci, rb_rect);
}
@@ -351,10 +351,10 @@ void Tabs::_notification(int p_what) {
if (cb_displaypolicy == CLOSE_BUTTON_SHOW_ALWAYS || (cb_displaypolicy == CLOSE_BUTTON_SHOW_ACTIVE_ONLY && i == current)) {
- Ref<StyleBox> style = get_stylebox("button");
+ Ref<StyleBox> style = get_theme_stylebox("button");
Ref<Texture2D> cb = close;
- w += get_constant("hseparation");
+ w += get_theme_constant("hseparation");
Rect2 cb_rect;
cb_rect.size = style->get_minimum_size() + cb->get_size();
@@ -363,7 +363,7 @@ void Tabs::_notification(int p_what) {
if (!tabs[i].disabled && cb_hover == i) {
if (cb_pressing)
- get_stylebox("button_pressed")->draw(ci, cb_rect);
+ get_theme_stylebox("button_pressed")->draw(ci, cb_rect);
else
style->draw(ci, cb_rect);
}
@@ -532,12 +532,12 @@ void Tabs::_update_hover() {
}
void Tabs::_update_cache() {
- Ref<StyleBox> tab_disabled = get_stylebox("tab_disabled");
- Ref<StyleBox> tab_bg = get_stylebox("tab_bg");
- Ref<StyleBox> tab_fg = get_stylebox("tab_fg");
- Ref<Font> font = get_font("font");
- Ref<Texture2D> incr = get_icon("increment");
- Ref<Texture2D> decr = get_icon("decrement");
+ Ref<StyleBox> tab_disabled = get_theme_stylebox("tab_disabled");
+ Ref<StyleBox> tab_bg = get_theme_stylebox("tab_bg");
+ Ref<StyleBox> tab_fg = get_theme_stylebox("tab_fg");
+ Ref<Font> font = get_theme_font("font");
+ Ref<Texture2D> incr = get_theme_icon("increment");
+ Ref<Texture2D> decr = get_theme_icon("decrement");
int limit = get_size().width - incr->get_width() - decr->get_width();
int w = 0;
@@ -577,12 +577,12 @@ void Tabs::_update_cache() {
slen = m_width - (sb->get_margin(MARGIN_LEFT) + sb->get_margin(MARGIN_RIGHT));
if (tabs[i].icon.is_valid()) {
slen -= tabs[i].icon->get_width();
- slen -= get_constant("hseparation");
+ slen -= get_theme_constant("hseparation");
}
if (cb_displaypolicy == CLOSE_BUTTON_SHOW_ALWAYS || (cb_displaypolicy == CLOSE_BUTTON_SHOW_ACTIVE_ONLY && i == current)) {
- Ref<Texture2D> cb = get_icon("close");
+ Ref<Texture2D> cb = get_theme_icon("close");
slen -= cb->get_width();
- slen -= get_constant("hseparation");
+ slen -= get_theme_constant("hseparation");
}
slen = MAX(slen, 1);
lsize = m_width;
@@ -799,10 +799,10 @@ int Tabs::get_tab_width(int p_idx) const {
ERR_FAIL_INDEX_V(p_idx, tabs.size(), 0);
- Ref<StyleBox> tab_bg = get_stylebox("tab_bg");
- Ref<StyleBox> tab_fg = get_stylebox("tab_fg");
- Ref<StyleBox> tab_disabled = get_stylebox("tab_disabled");
- Ref<Font> font = get_font("font");
+ Ref<StyleBox> tab_bg = get_theme_stylebox("tab_bg");
+ Ref<StyleBox> tab_fg = get_theme_stylebox("tab_fg");
+ Ref<StyleBox> tab_disabled = get_theme_stylebox("tab_disabled");
+ Ref<Font> font = get_theme_font("font");
int x = 0;
@@ -810,7 +810,7 @@ int Tabs::get_tab_width(int p_idx) const {
if (tex.is_valid()) {
x += tex->get_width();
if (tabs[p_idx].text != "")
- x += get_constant("hseparation");
+ x += get_theme_constant("hseparation");
}
x += Math::ceil(font->get_string_size(tabs[p_idx].xl_text).width);
@@ -825,13 +825,13 @@ int Tabs::get_tab_width(int p_idx) const {
if (tabs[p_idx].right_button.is_valid()) {
Ref<Texture2D> rb = tabs[p_idx].right_button;
x += rb->get_width();
- x += get_constant("hseparation");
+ x += get_theme_constant("hseparation");
}
if (cb_displaypolicy == CLOSE_BUTTON_SHOW_ALWAYS || (cb_displaypolicy == CLOSE_BUTTON_SHOW_ACTIVE_ONLY && p_idx == current)) {
- Ref<Texture2D> cb = get_icon("close");
+ Ref<Texture2D> cb = get_theme_icon("close");
x += cb->get_width();
- x += get_constant("hseparation");
+ x += get_theme_constant("hseparation");
}
return x;
@@ -842,8 +842,8 @@ void Tabs::_ensure_no_over_offset() {
if (!is_inside_tree())
return;
- Ref<Texture2D> incr = get_icon("increment");
- Ref<Texture2D> decr = get_icon("decrement");
+ Ref<Texture2D> incr = get_theme_icon("increment");
+ Ref<Texture2D> decr = get_theme_icon("decrement");
int limit = get_size().width - incr->get_width() - decr->get_width();
@@ -885,8 +885,8 @@ void Tabs::ensure_tab_visible(int p_idx) {
}
int prev_offset = offset;
- Ref<Texture2D> incr = get_icon("increment");
- Ref<Texture2D> decr = get_icon("decrement");
+ Ref<Texture2D> incr = get_theme_icon("increment");
+ Ref<Texture2D> decr = get_theme_icon("decrement");
int limit = get_size().width - incr->get_width() - decr->get_width();
for (int i = offset; i <= p_idx; i++) {
if (tabs[i].ofs_cache + tabs[i].size_cache > limit) {
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 7de6a04c54..5bc920b04e 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -1584,11 +1584,11 @@ void TextEdit::_notification(int p_what) {
bool completion_below = false;
if (completion_active && completion_options.size() > 0) {
// Code completion box.
- Ref<StyleBox> csb = get_stylebox("completion");
- int maxlines = get_constant("completion_lines");
- int cmax_width = get_constant("completion_max_width") * cache.font->get_char_size('x').x;
- int scrollw = get_constant("completion_scroll_width");
- Color scrollc = get_color("completion_scroll_color");
+ Ref<StyleBox> csb = get_theme_stylebox("completion");
+ int maxlines = get_theme_constant("completion_lines");
+ int cmax_width = get_theme_constant("completion_max_width") * cache.font->get_char_size('x').x;
+ int scrollw = get_theme_constant("completion_scroll_width");
+ Color scrollc = get_theme_color("completion_scroll_color");
const int completion_options_size = completion_options.size();
int lines = MIN(completion_options_size, maxlines);
@@ -1607,7 +1607,7 @@ void TextEdit::_notification(int p_what) {
}
// Add space for completion icons.
- const int icon_hsep = get_constant("hseparation", "ItemList");
+ const int icon_hsep = get_theme_constant("hseparation", "ItemList");
Size2 icon_area_size(get_row_height(), get_row_height());
w += icon_area_size.width + icon_hsep;
@@ -1694,9 +1694,9 @@ void TextEdit::_notification(int p_what) {
if (show_hint) {
- Ref<StyleBox> sb = get_stylebox("panel", "TooltipPanel");
+ Ref<StyleBox> sb = get_theme_stylebox("panel", "TooltipPanel");
Ref<Font> font = cache.font;
- Color font_color = get_color("font_color", "TooltipLabel");
+ Color font_color = get_theme_color("font_color", "TooltipLabel");
int max_w = 0;
int sc = completion_hint.get_slice_count("\n");
@@ -2477,9 +2477,9 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
}
}
- menu->set_position(get_global_transform().xform(get_local_mouse_position()));
+ menu->set_position(get_screen_transform().xform(get_local_mouse_position()));
menu->set_size(Vector2(1, 1));
- menu->set_scale(get_global_transform().get_scale());
+ // menu->set_scale(get_global_transform().get_scale());
menu->popup();
grab_focus();
}
@@ -2634,7 +2634,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (k->get_keycode() == KEY_PAGEUP) {
- completion_index -= get_constant("completion_lines");
+ completion_index -= get_theme_constant("completion_lines");
if (completion_index < 0)
completion_index = 0;
completion_current = completion_options[completion_index];
@@ -2645,7 +2645,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (k->get_keycode() == KEY_PAGEDOWN) {
- completion_index += get_constant("completion_lines");
+ completion_index += get_theme_constant("completion_lines");
if (completion_index >= completion_options.size())
completion_index = completion_options.size() - 1;
completion_current = completion_options[completion_index];
@@ -3735,7 +3735,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (context_menu_enabled) {
menu->set_position(get_global_transform().xform(_get_cursor_pixel_pos()));
menu->set_size(Vector2(1, 1));
- menu->set_scale(get_global_transform().get_scale());
+ // menu->set_scale(get_global_transform().get_scale());
menu->popup();
menu->grab_focus();
}
@@ -5026,51 +5026,51 @@ void TextEdit::_toggle_draw_caret() {
void TextEdit::_update_caches() {
- cache.style_normal = get_stylebox("normal");
- cache.style_focus = get_stylebox("focus");
- cache.style_readonly = get_stylebox("read_only");
- cache.completion_background_color = get_color("completion_background_color");
- cache.completion_selected_color = get_color("completion_selected_color");
- cache.completion_existing_color = get_color("completion_existing_color");
- cache.completion_font_color = get_color("completion_font_color");
- cache.font = get_font("font");
- cache.caret_color = get_color("caret_color");
- cache.caret_background_color = get_color("caret_background_color");
- cache.line_number_color = get_color("line_number_color");
- cache.safe_line_number_color = get_color("safe_line_number_color");
- cache.font_color = get_color("font_color");
- cache.font_color_selected = get_color("font_color_selected");
- cache.font_color_readonly = get_color("font_color_readonly");
- cache.keyword_color = get_color("keyword_color");
- cache.function_color = get_color("function_color");
- cache.member_variable_color = get_color("member_variable_color");
- cache.number_color = get_color("number_color");
- cache.selection_color = get_color("selection_color");
- cache.mark_color = get_color("mark_color");
- cache.current_line_color = get_color("current_line_color");
- cache.line_length_guideline_color = get_color("line_length_guideline_color");
- cache.bookmark_color = get_color("bookmark_color");
- cache.breakpoint_color = get_color("breakpoint_color");
- cache.executing_line_color = get_color("executing_line_color");
- cache.code_folding_color = get_color("code_folding_color");
- cache.brace_mismatch_color = get_color("brace_mismatch_color");
- cache.word_highlighted_color = get_color("word_highlighted_color");
- cache.search_result_color = get_color("search_result_color");
- cache.search_result_border_color = get_color("search_result_border_color");
- cache.symbol_color = get_color("symbol_color");
- cache.background_color = get_color("background_color");
+ cache.style_normal = get_theme_stylebox("normal");
+ cache.style_focus = get_theme_stylebox("focus");
+ cache.style_readonly = get_theme_stylebox("read_only");
+ cache.completion_background_color = get_theme_color("completion_background_color");
+ cache.completion_selected_color = get_theme_color("completion_selected_color");
+ cache.completion_existing_color = get_theme_color("completion_existing_color");
+ cache.completion_font_color = get_theme_color("completion_font_color");
+ cache.font = get_theme_font("font");
+ cache.caret_color = get_theme_color("caret_color");
+ cache.caret_background_color = get_theme_color("caret_background_color");
+ cache.line_number_color = get_theme_color("line_number_color");
+ cache.safe_line_number_color = get_theme_color("safe_line_number_color");
+ cache.font_color = get_theme_color("font_color");
+ cache.font_color_selected = get_theme_color("font_color_selected");
+ cache.font_color_readonly = get_theme_color("font_color_readonly");
+ cache.keyword_color = get_theme_color("keyword_color");
+ cache.function_color = get_theme_color("function_color");
+ cache.member_variable_color = get_theme_color("member_variable_color");
+ cache.number_color = get_theme_color("number_color");
+ cache.selection_color = get_theme_color("selection_color");
+ cache.mark_color = get_theme_color("mark_color");
+ cache.current_line_color = get_theme_color("current_line_color");
+ cache.line_length_guideline_color = get_theme_color("line_length_guideline_color");
+ cache.bookmark_color = get_theme_color("bookmark_color");
+ cache.breakpoint_color = get_theme_color("breakpoint_color");
+ cache.executing_line_color = get_theme_color("executing_line_color");
+ cache.code_folding_color = get_theme_color("code_folding_color");
+ cache.brace_mismatch_color = get_theme_color("brace_mismatch_color");
+ cache.word_highlighted_color = get_theme_color("word_highlighted_color");
+ cache.search_result_color = get_theme_color("search_result_color");
+ cache.search_result_border_color = get_theme_color("search_result_border_color");
+ cache.symbol_color = get_theme_color("symbol_color");
+ cache.background_color = get_theme_color("background_color");
#ifdef TOOLS_ENABLED
- cache.line_spacing = get_constant("line_spacing") * EDSCALE;
+ cache.line_spacing = get_theme_constant("line_spacing") * EDSCALE;
#else
cache.line_spacing = get_constant("line_spacing");
#endif
cache.row_height = cache.font->get_height() + cache.line_spacing;
- cache.tab_icon = get_icon("tab");
- cache.space_icon = get_icon("space");
- cache.folded_icon = get_icon("folded");
- cache.can_fold_icon = get_icon("fold");
- cache.folded_eol_icon = get_icon("GuiEllipsis", "EditorIcons");
- cache.executing_icon = get_icon("MainPlay", "EditorIcons");
+ cache.tab_icon = get_theme_icon("tab");
+ cache.space_icon = get_theme_icon("space");
+ cache.folded_icon = get_theme_icon("folded");
+ cache.can_fold_icon = get_theme_icon("fold");
+ cache.folded_eol_icon = get_theme_icon("GuiEllipsis", "EditorIcons");
+ cache.executing_icon = get_theme_icon("MainPlay", "EditorIcons");
text.set_font(cache.font);
if (syntax_highlighter) {
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 0ac8a9bf94..7bac82bf63 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -952,45 +952,45 @@ TreeItem::~TreeItem() {
void Tree::update_cache() {
- cache.font = get_font("font");
- cache.tb_font = get_font("title_button_font");
- cache.bg = get_stylebox("bg");
- cache.selected = get_stylebox("selected");
- cache.selected_focus = get_stylebox("selected_focus");
- cache.cursor = get_stylebox("cursor");
- cache.cursor_unfocus = get_stylebox("cursor_unfocused");
- cache.button_pressed = get_stylebox("button_pressed");
-
- cache.checked = get_icon("checked");
- cache.unchecked = get_icon("unchecked");
- cache.arrow_collapsed = get_icon("arrow_collapsed");
- cache.arrow = get_icon("arrow");
- cache.select_arrow = get_icon("select_arrow");
- cache.updown = get_icon("updown");
-
- cache.custom_button = get_stylebox("custom_button");
- cache.custom_button_hover = get_stylebox("custom_button_hover");
- cache.custom_button_pressed = get_stylebox("custom_button_pressed");
- cache.custom_button_font_highlight = get_color("custom_button_font_highlight");
-
- cache.font_color = get_color("font_color");
- cache.font_color_selected = get_color("font_color_selected");
- cache.guide_color = get_color("guide_color");
- cache.drop_position_color = get_color("drop_position_color");
- cache.hseparation = get_constant("hseparation");
- cache.vseparation = get_constant("vseparation");
- cache.item_margin = get_constant("item_margin");
- cache.button_margin = get_constant("button_margin");
- cache.draw_guides = get_constant("draw_guides");
- cache.draw_relationship_lines = get_constant("draw_relationship_lines");
- cache.relationship_line_color = get_color("relationship_line_color");
- cache.scroll_border = get_constant("scroll_border");
- cache.scroll_speed = get_constant("scroll_speed");
-
- cache.title_button = get_stylebox("title_button_normal");
- cache.title_button_pressed = get_stylebox("title_button_pressed");
- cache.title_button_hover = get_stylebox("title_button_hover");
- cache.title_button_color = get_color("title_button_color");
+ cache.font = get_theme_font("font");
+ cache.tb_font = get_theme_font("title_button_font");
+ cache.bg = get_theme_stylebox("bg");
+ cache.selected = get_theme_stylebox("selected");
+ cache.selected_focus = get_theme_stylebox("selected_focus");
+ cache.cursor = get_theme_stylebox("cursor");
+ cache.cursor_unfocus = get_theme_stylebox("cursor_unfocused");
+ cache.button_pressed = get_theme_stylebox("button_pressed");
+
+ cache.checked = get_theme_icon("checked");
+ cache.unchecked = get_theme_icon("unchecked");
+ cache.arrow_collapsed = get_theme_icon("arrow_collapsed");
+ cache.arrow = get_theme_icon("arrow");
+ cache.select_arrow = get_theme_icon("select_arrow");
+ cache.updown = get_theme_icon("updown");
+
+ cache.custom_button = get_theme_stylebox("custom_button");
+ cache.custom_button_hover = get_theme_stylebox("custom_button_hover");
+ cache.custom_button_pressed = get_theme_stylebox("custom_button_pressed");
+ cache.custom_button_font_highlight = get_theme_color("custom_button_font_highlight");
+
+ cache.font_color = get_theme_color("font_color");
+ cache.font_color_selected = get_theme_color("font_color_selected");
+ cache.guide_color = get_theme_color("guide_color");
+ cache.drop_position_color = get_theme_color("drop_position_color");
+ cache.hseparation = get_theme_constant("hseparation");
+ cache.vseparation = get_theme_constant("vseparation");
+ cache.item_margin = get_theme_constant("item_margin");
+ cache.button_margin = get_theme_constant("button_margin");
+ cache.draw_guides = get_theme_constant("draw_guides");
+ cache.draw_relationship_lines = get_theme_constant("draw_relationship_lines");
+ cache.relationship_line_color = get_theme_color("relationship_line_color");
+ cache.scroll_border = get_theme_constant("scroll_border");
+ cache.scroll_speed = get_theme_constant("scroll_speed");
+
+ cache.title_button = get_theme_stylebox("title_button_normal");
+ cache.title_button_pressed = get_theme_stylebox("title_button_pressed");
+ cache.title_button_hover = get_theme_stylebox("title_button_hover");
+ cache.title_button_color = get_theme_color("title_button_color");
v_scroll->set_custom_step(cache.font->get_height());
}
@@ -1291,7 +1291,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2
}
}
- Color col = p_item->cells[i].custom_color ? p_item->cells[i].color : get_color(p_item->cells[i].selected ? "font_color_selected" : "font_color");
+ Color col = p_item->cells[i].custom_color ? p_item->cells[i].color : get_theme_color(p_item->cells[i].selected ? "font_color_selected" : "font_color");
Color icon_col = p_item->cells[i].icon_color;
Point2i text_pos = item_rect.position;
@@ -3011,7 +3011,7 @@ void Tree::_notification(int p_what) {
RID ci = get_canvas_item();
Ref<StyleBox> bg = cache.bg;
- Ref<StyleBox> bg_focus = get_stylebox("bg_focus");
+ Ref<StyleBox> bg_focus = get_theme_stylebox("bg_focus");
Point2 draw_ofs;
draw_ofs += bg->get_offset();
@@ -4020,7 +4020,7 @@ Tree::Tree() {
popup_menu = memnew(PopupMenu);
popup_menu->hide();
add_child(popup_menu);
- popup_menu->set_as_toplevel(true);
+ // popup_menu->set_as_toplevel(true);
text_editor = memnew(LineEdit);
add_child(text_editor);
text_editor->set_as_toplevel(true);
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 4fbb1cb870..50d0520d4b 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -1309,7 +1309,7 @@ Transform2D Viewport::_get_input_pre_xform() const {
Transform2D pre_xf;
- if (to_screen_rect != Rect2i()) {
+ if (to_screen_rect.size.x != 0 && to_screen_rect.size.y != 0) {
pre_xf.elements[2] = -to_screen_rect.position;
pre_xf.scale(size / to_screen_rect.size);
@@ -1460,7 +1460,7 @@ void Viewport::_gui_show_tooltip() {
gui.tooltip_label = memnew(TooltipLabel);
gui.tooltip_popup->add_child(gui.tooltip_label);
- Ref<StyleBox> ttp = gui.tooltip_label->get_stylebox("panel", "TooltipPanel");
+ Ref<StyleBox> ttp = gui.tooltip_label->get_theme_stylebox("panel", "TooltipPanel");
gui.tooltip_label->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, ttp->get_margin(MARGIN_LEFT));
gui.tooltip_label->set_anchor_and_margin(MARGIN_TOP, Control::ANCHOR_BEGIN, ttp->get_margin(MARGIN_TOP));
@@ -1995,37 +1995,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
Control *top = gui.modal_stack.back()->get();
if (over != top && !top->is_a_parent_of(over)) {
-
- PopupMenu *popup_menu = Object::cast_to<PopupMenu>(top);
- MenuButton *popup_menu_parent = NULL;
- MenuButton *menu_button = Object::cast_to<MenuButton>(over);
-
- if (popup_menu) {
- popup_menu_parent = Object::cast_to<MenuButton>(popup_menu->get_parent());
- if (!popup_menu_parent) {
- // Go through the parents to see if there's a MenuButton at the end.
- while (Object::cast_to<PopupMenu>(popup_menu->get_parent())) {
- popup_menu = Object::cast_to<PopupMenu>(popup_menu->get_parent());
- }
- popup_menu_parent = Object::cast_to<MenuButton>(popup_menu->get_parent());
- }
- }
-
- // If the mouse is over a menu button, this menu will open automatically
- // if there is already a pop-up menu open at the same hierarchical level.
- if (popup_menu_parent && menu_button && popup_menu_parent->is_switch_on_hover() &&
- !menu_button->is_disabled() && menu_button->is_switch_on_hover() &&
- (popup_menu_parent->get_parent()->is_a_parent_of(menu_button) ||
- menu_button->get_parent()->is_a_parent_of(popup_menu))) {
-
- popup_menu->notification(Control::NOTIFICATION_MODAL_CLOSE);
- popup_menu->_modal_stack_remove();
- popup_menu->hide();
-
- menu_button->pressed();
- } else {
- over = NULL; //nothing can be found outside the modal stack
- }
+ over = NULL; //nothing can be found outside the modal stack
}
}
diff --git a/scene/main/window.cpp b/scene/main/window.cpp
index 61817f086c..6d61f3f0a8 100644
--- a/scene/main/window.cpp
+++ b/scene/main/window.cpp
@@ -394,7 +394,7 @@ void Window::_make_transient() {
if (window) {
transient_parent = window;
window->transient_children.insert(this);
- if (exclusive) {
+ if (is_inside_tree() && is_visible() && exclusive) {
if (transient_parent->exclusive_child == nullptr) {
transient_parent->exclusive_child = this;
} else if (transient_parent->exclusive_child != this) {
@@ -439,9 +439,9 @@ void Window::set_exclusive(bool p_exclusive) {
exclusive = p_exclusive;
if (transient_parent) {
- if (p_exclusive) {
+ if (p_exclusive && is_inside_tree() && is_visible()) {
ERR_FAIL_COND_MSG(transient_parent->exclusive_child && transient_parent->exclusive_child != this, "Transient parent has another exclusive child.");
- transient_parent->exclusive_child = nullptr;
+ transient_parent->exclusive_child = this;
} else {
if (transient_parent->exclusive_child == this) {
transient_parent->exclusive_child = nullptr;
@@ -762,8 +762,10 @@ void Window::_window_input(const Ref<InputEvent> &p_ev) {
if (exclusive_child != nullptr) {
exclusive_child->grab_focus();
+ print_line("drop because of exclusive");
return; //has an exclusive child, can't get events until child is closed
}
+
emit_signal(SceneStringNames::get_singleton()->window_input, p_ev);
input(p_ev);
if (!is_input_handled()) {
@@ -897,6 +899,8 @@ void Window::popup_centered_ratio(float p_ratio) {
}
void Window::popup(const Rect2 &p_screen_rect) {
+
+ emit_signal("about_to_popup");
if (p_screen_rect != Rect2()) {
set_position(p_screen_rect.position);
set_size(p_screen_rect.size);
@@ -908,6 +912,10 @@ void Window::popup(const Rect2 &p_screen_rect) {
notification(NOTIFICATION_POST_POPUP);
}
+Size2 Window::get_contents_minimum_size() const {
+ return _get_contents_minimum_size();
+}
+
void Window::grab_focus() {
if (window_id != DisplayServer::INVALID_WINDOW_ID) {
DisplayServer::get_singleton()->window_move_to_foreground(window_id);
@@ -979,6 +987,74 @@ Ref<Theme> Window::get_theme() const {
return theme;
}
+Ref<Texture2D> Window::get_theme_icon(const StringName &p_name, const StringName &p_type) const {
+ return Control::get_icons(theme_owner, theme_owner_window, p_name, p_type);
+}
+Ref<Shader> Window::get_theme_shader(const StringName &p_name, const StringName &p_type) const {
+ return Control::get_shaders(theme_owner, theme_owner_window, p_name, p_type);
+}
+Ref<StyleBox> Window::get_theme_stylebox(const StringName &p_name, const StringName &p_type) const {
+ return Control::get_styleboxs(theme_owner, theme_owner_window, p_name, p_type);
+}
+Ref<Font> Window::get_theme_font(const StringName &p_name, const StringName &p_type) const {
+ return Control::get_fonts(theme_owner, theme_owner_window, p_name, p_type);
+}
+Color Window::get_theme_color(const StringName &p_name, const StringName &p_type) const {
+ return Control::get_colors(theme_owner, theme_owner_window, p_name, p_type);
+}
+int Window::get_theme_constant(const StringName &p_name, const StringName &p_type) const {
+ return Control::get_constants(theme_owner, theme_owner_window, p_name, p_type);
+}
+
+bool Window::has_theme_icon(const StringName &p_name, const StringName &p_type) const {
+ return Control::has_icons(theme_owner, theme_owner_window, p_name, p_type);
+}
+bool Window::has_theme_shader(const StringName &p_name, const StringName &p_type) const {
+ return Control::has_shaders(theme_owner, theme_owner_window, p_name, p_type);
+}
+bool Window::has_theme_stylebox(const StringName &p_name, const StringName &p_type) const {
+ return Control::has_styleboxs(theme_owner, theme_owner_window, p_name, p_type);
+}
+bool Window::has_theme_font(const StringName &p_name, const StringName &p_type) const {
+ return Control::has_fonts(theme_owner, theme_owner_window, p_name, p_type);
+}
+bool Window::has_theme_color(const StringName &p_name, const StringName &p_type) const {
+ return Control::has_colors(theme_owner, theme_owner_window, p_name, p_type);
+}
+bool Window::has_theme_constant(const StringName &p_name, const StringName &p_type) const {
+ return Control::has_constants(theme_owner, theme_owner_window, p_name, p_type);
+}
+
+Rect2i Window::get_screen_rect() const {
+ if (is_embedded()) {
+ //viewport
+ return Rect2i();
+ } else {
+ int x = get_position().x;
+ int closest_dist = 0x7FFFFFFF;
+ Rect2i closest_rect;
+ for (int i = 0; i < DisplayServer::get_singleton()->get_screen_count(); i++) {
+ Rect2i s(DisplayServer::get_singleton()->screen_get_position(i), DisplayServer::get_singleton()->screen_get_size(i));
+ int d;
+ if (x >= s.position.x && x < s.size.x) {
+ //contained
+ closest_rect = s;
+ break;
+ } else if (x < s.position.x) {
+ d = s.position.x - x;
+ } else {
+ d = x - (s.position.x + s.size.x);
+ }
+
+ if (d < closest_dist) {
+ closest_dist = d;
+ closest_rect = s;
+ }
+ }
+ return closest_rect;
+ }
+}
+
void Window::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_title", "title"), &Window::set_title);
@@ -1055,6 +1131,18 @@ void Window::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_theme", "theme"), &Window::set_theme);
ClassDB::bind_method(D_METHOD("get_theme"), &Window::get_theme);
+ ClassDB::bind_method(D_METHOD("get_theme_icon", "name", "type"), &Window::get_theme_icon, DEFVAL(""));
+ ClassDB::bind_method(D_METHOD("get_theme_stylebox", "name", "type"), &Window::get_theme_stylebox, DEFVAL(""));
+ ClassDB::bind_method(D_METHOD("get_theme_font", "name", "type"), &Window::get_theme_font, DEFVAL(""));
+ ClassDB::bind_method(D_METHOD("get_theme_color", "name", "type"), &Window::get_theme_color, DEFVAL(""));
+ ClassDB::bind_method(D_METHOD("get_theme_constant", "name", "type"), &Window::get_theme_constant, DEFVAL(""));
+
+ ClassDB::bind_method(D_METHOD("has_theme_icon", "name", "type"), &Window::has_theme_icon, DEFVAL(""));
+ ClassDB::bind_method(D_METHOD("has_theme_stylebox", "name", "type"), &Window::has_theme_stylebox, DEFVAL(""));
+ ClassDB::bind_method(D_METHOD("has_theme_font", "name", "type"), &Window::has_theme_font, DEFVAL(""));
+ ClassDB::bind_method(D_METHOD("has_theme_color", "name", "type"), &Window::has_theme_color, DEFVAL(""));
+ ClassDB::bind_method(D_METHOD("has_theme_constant", "name", "type"), &Window::has_theme_constant, DEFVAL(""));
+
ADD_PROPERTY(PropertyInfo(Variant::STRING, "title"), "set_title", "get_title");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "position"), "set_position", "get_position");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "size"), "set_size", "get_size");
@@ -1080,7 +1168,7 @@ void Window::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "theme", PROPERTY_HINT_RESOURCE_TYPE, "Theme"), "set_theme", "get_theme");
ADD_SIGNAL(MethodInfo("window_input", PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
- ADD_SIGNAL(MethodInfo("files_dropped"));
+ ADD_SIGNAL(MethodInfo("files_dropped", PropertyInfo(Variant::PACKED_STRING_ARRAY, "files")));
ADD_SIGNAL(MethodInfo("mouse_entered"));
ADD_SIGNAL(MethodInfo("mouse_exited"));
ADD_SIGNAL(MethodInfo("focus_entered"));
@@ -1088,6 +1176,8 @@ void Window::_bind_methods() {
ADD_SIGNAL(MethodInfo("close_requested"));
ADD_SIGNAL(MethodInfo("go_back_requested"));
ADD_SIGNAL(MethodInfo("visibility_changed"));
+ ADD_SIGNAL(MethodInfo("files_dropped"));
+ ADD_SIGNAL(MethodInfo("about_to_popup"));
BIND_CONSTANT(NOTIFICATION_VISIBILITY_CHANGED);
}
diff --git a/scene/main/window.h b/scene/main/window.h
index acc3e11fdc..298a611575 100644
--- a/scene/main/window.h
+++ b/scene/main/window.h
@@ -224,9 +224,27 @@ public:
void set_theme(const Ref<Theme> &p_theme);
Ref<Theme> get_theme() const;
+ Size2 get_contents_minimum_size() const;
+
void grab_focus();
bool has_focus() const;
+ Ref<Texture2D> get_theme_icon(const StringName &p_name, const StringName &p_type = StringName()) const;
+ Ref<Shader> get_theme_shader(const StringName &p_name, const StringName &p_type = StringName()) const;
+ Ref<StyleBox> get_theme_stylebox(const StringName &p_name, const StringName &p_type = StringName()) const;
+ Ref<Font> get_theme_font(const StringName &p_name, const StringName &p_type = StringName()) const;
+ Color get_theme_color(const StringName &p_name, const StringName &p_type = StringName()) const;
+ int get_theme_constant(const StringName &p_name, const StringName &p_type = StringName()) const;
+
+ bool has_theme_icon(const StringName &p_name, const StringName &p_type = StringName()) const;
+ bool has_theme_shader(const StringName &p_name, const StringName &p_type = StringName()) const;
+ bool has_theme_stylebox(const StringName &p_name, const StringName &p_type = StringName()) const;
+ bool has_theme_font(const StringName &p_name, const StringName &p_type = StringName()) const;
+ bool has_theme_color(const StringName &p_name, const StringName &p_type = StringName()) const;
+ bool has_theme_constant(const StringName &p_name, const StringName &p_type = StringName()) const;
+
+ Rect2i get_screen_rect() const;
+
Window();
~Window();
};