summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/action_map_editor.cpp2
-rw-r--r--editor/animation_bezier_editor.cpp2
-rw-r--r--editor/animation_track_editor.cpp8
-rw-r--r--editor/debugger/editor_debugger_node.cpp18
-rw-r--r--editor/debugger/editor_visual_profiler.cpp51
-rw-r--r--editor/debugger/script_editor_debugger.cpp10
-rw-r--r--editor/editor_audio_buses.cpp10
-rw-r--r--editor/editor_export.cpp2
-rw-r--r--editor/editor_file_dialog.cpp3
-rw-r--r--editor/editor_inspector.cpp16
-rw-r--r--editor/editor_node.cpp80
-rw-r--r--editor/editor_properties.cpp28
-rw-r--r--editor/editor_properties_array_dict.cpp4
-rw-r--r--editor/editor_resource_picker.cpp13
-rw-r--r--editor/editor_settings.cpp29
-rw-r--r--editor/editor_settings.h5
-rw-r--r--editor/editor_settings_dialog.cpp16
-rw-r--r--editor/editor_spin_slider.cpp13
-rw-r--r--editor/editor_spin_slider.h5
-rw-r--r--editor/editor_themes.cpp24
-rw-r--r--editor/export_template_manager.cpp2
-rw-r--r--editor/filesystem_dock.cpp124
-rw-r--r--editor/filesystem_dock.h7
-rw-r--r--editor/import/dynamic_font_import_settings.cpp1
-rw-r--r--editor/import/resource_importer_layered_texture.cpp10
-rw-r--r--editor/import/resource_importer_layered_texture.h2
-rw-r--r--editor/import/resource_importer_texture.cpp46
-rw-r--r--editor/import/resource_importer_texture.h8
-rw-r--r--editor/import/scene_import_settings.cpp4
-rw-r--r--editor/localization_editor.cpp2
-rw-r--r--editor/plugin_config_dialog.cpp4
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp1
-rw-r--r--editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp2
-rw-r--r--editor/plugins/lightmap_gi_editor_plugin.cpp2
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp44
-rw-r--r--editor/plugins/ot_features_plugin.cpp2
-rw-r--r--editor/plugins/script_editor_plugin.cpp216
-rw-r--r--editor/plugins/sprite_2d_editor_plugin.cpp25
-rw-r--r--editor/plugins/sprite_2d_editor_plugin.h1
-rw-r--r--editor/plugins/texture_editor_plugin.cpp6
-rw-r--r--editor/plugins/theme_editor_plugin.cpp6
-rw-r--r--editor/plugins/version_control_editor_plugin.cpp2
-rw-r--r--editor/project_export.cpp5
-rw-r--r--editor/project_manager.cpp2
-rw-r--r--editor/project_settings_editor.cpp4
-rw-r--r--editor/property_editor.cpp2
-rw-r--r--editor/rename_dialog.cpp2
-rw-r--r--editor/scene_tree_editor.cpp6
48 files changed, 551 insertions, 326 deletions
diff --git a/editor/action_map_editor.cpp b/editor/action_map_editor.cpp
index 3eab494761..92d53cc005 100644
--- a/editor/action_map_editor.cpp
+++ b/editor/action_map_editor.cpp
@@ -611,7 +611,7 @@ InputEventConfigurationDialog::InputEventConfigurationDialog() {
add_child(main_vbox);
tab_container = memnew(TabContainer);
- tab_container->set_tab_alignment(TabContainer::ALIGNMENT_LEFT);
+ tab_container->set_tab_alignment(TabBar::ALIGNMENT_LEFT);
tab_container->set_use_hidden_tabs_for_min_size(true);
tab_container->set_v_size_flags(Control::SIZE_EXPAND_FILL);
tab_container->connect("tab_selected", callable_mp(this, &InputEventConfigurationDialog::_tab_selected));
diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp
index c8c8c7d891..0dbe230699 100644
--- a/editor/animation_bezier_editor.cpp
+++ b/editor/animation_bezier_editor.cpp
@@ -946,7 +946,7 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
}
if (menu->get_item_count()) {
- menu->set_as_minsize();
+ menu->reset_size();
menu->set_position(popup_pos);
menu->popup();
}
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index 53f585d06b..3970fca3b5 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -2748,7 +2748,7 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
menu->add_icon_item(get_theme_icon(SNAME("TrackDiscrete"), SNAME("EditorIcons")), TTR("Discrete"), MENU_CALL_MODE_DISCRETE);
menu->add_icon_item(get_theme_icon(SNAME("TrackTrigger"), SNAME("EditorIcons")), TTR("Trigger"), MENU_CALL_MODE_TRIGGER);
menu->add_icon_item(get_theme_icon(SNAME("TrackCapture"), SNAME("EditorIcons")), TTR("Capture"), MENU_CALL_MODE_CAPTURE);
- menu->set_as_minsize();
+ menu->reset_size();
Vector2 popup_pos = get_screen_position() + update_mode_rect.position + Vector2(0, update_mode_rect.size.height);
menu->set_position(popup_pos);
@@ -2766,7 +2766,7 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
menu->add_icon_item(get_theme_icon(SNAME("InterpRaw"), SNAME("EditorIcons")), TTR("Nearest"), MENU_INTERPOLATION_NEAREST);
menu->add_icon_item(get_theme_icon(SNAME("InterpLinear"), SNAME("EditorIcons")), TTR("Linear"), MENU_INTERPOLATION_LINEAR);
menu->add_icon_item(get_theme_icon(SNAME("InterpCubic"), SNAME("EditorIcons")), TTR("Cubic"), MENU_INTERPOLATION_CUBIC);
- menu->set_as_minsize();
+ menu->reset_size();
Vector2 popup_pos = get_screen_position() + interp_mode_rect.position + Vector2(0, interp_mode_rect.size.height);
menu->set_position(popup_pos);
@@ -2783,7 +2783,7 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
menu->clear();
menu->add_icon_item(get_theme_icon(SNAME("InterpWrapClamp"), SNAME("EditorIcons")), TTR("Clamp Loop Interp"), MENU_LOOP_CLAMP);
menu->add_icon_item(get_theme_icon(SNAME("InterpWrapLoop"), SNAME("EditorIcons")), TTR("Wrap Loop Interp"), MENU_LOOP_WRAP);
- menu->set_as_minsize();
+ menu->reset_size();
Vector2 popup_pos = get_screen_position() + loop_wrap_rect.position + Vector2(0, loop_wrap_rect.size.height);
menu->set_position(popup_pos);
@@ -2885,7 +2885,7 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
menu->add_separator();
menu->add_icon_item(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), TTR("Delete Key(s)"), MENU_KEY_DELETE);
}
- menu->set_as_minsize();
+ menu->reset_size();
menu->set_position(get_screen_position() + get_local_mouse_position());
menu->popup();
diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp
index 7c9a984b6a..d5a4f5d138 100644
--- a/editor/debugger/editor_debugger_node.cpp
+++ b/editor/debugger/editor_debugger_node.cpp
@@ -39,6 +39,7 @@
#include "editor/scene_tree_dock.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/tab_container.h"
+#include "scene/resources/packed_scene.h"
template <typename Func>
void _for_all(TabContainer *p_node, const Func &p_func) {
@@ -60,7 +61,7 @@ EditorDebuggerNode::EditorDebuggerNode() {
add_theme_constant_override("margin_right", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("BottomPanelDebuggerOverride"), SNAME("EditorStyles"))->get_margin(SIDE_RIGHT));
tabs = memnew(TabContainer);
- tabs->set_tab_alignment(TabContainer::ALIGNMENT_LEFT);
+ tabs->set_tab_alignment(TabBar::ALIGNMENT_LEFT);
tabs->set_tabs_visible(false);
tabs->connect("tab_changed", callable_mp(this, &EditorDebuggerNode::_debugger_changed));
add_child(tabs);
@@ -141,11 +142,22 @@ void EditorDebuggerNode::_error_selected(const String &p_file, int p_line, int p
}
void EditorDebuggerNode::_text_editor_stack_goto(const ScriptEditorDebugger *p_debugger) {
- const String file = p_debugger->get_stack_script_file();
+ String file = p_debugger->get_stack_script_file();
if (file.is_empty()) {
return;
}
- stack_script = ResourceLoader::load(file);
+ if (file.is_resource_file()) {
+ stack_script = ResourceLoader::load(file);
+ } else {
+ // If the script is built-in, it can be opened only if the scene is loaded in memory.
+ int i = file.find("::");
+ int j = file.rfind("(", i);
+ if (j > -1) { // If the script is named, the string is "name (file)", so we need to extract the path.
+ file = file.substr(j + 1, file.find(")", i) - j - 1);
+ }
+ Ref<PackedScene> ps = ResourceLoader::load(file.get_slice("::", 0));
+ stack_script = ResourceLoader::load(file);
+ }
const int line = p_debugger->get_stack_script_line() - 1;
emit_signal(SNAME("goto_script_line"), stack_script, line);
emit_signal(SNAME("set_execution"), stack_script, line);
diff --git a/editor/debugger/editor_visual_profiler.cpp b/editor/debugger/editor_visual_profiler.cpp
index 2a1b0029d4..5df86c70fe 100644
--- a/editor/debugger/editor_visual_profiler.cpp
+++ b/editor/debugger/editor_visual_profiler.cpp
@@ -143,12 +143,12 @@ void EditorVisualProfiler::_item_selected() {
}
void EditorVisualProfiler::_update_plot() {
- int w = graph->get_size().width;
- int h = graph->get_size().height;
+ const int w = graph->get_size().width;
+ const int h = graph->get_size().height;
bool reset_texture = false;
- int desired_len = w * h * 4;
+ const int desired_len = w * h * 4;
if (graph_image.size() != desired_len) {
reset_texture = true;
@@ -156,12 +156,13 @@ void EditorVisualProfiler::_update_plot() {
}
uint8_t *wr = graph_image.ptrw();
+ const Color background_color = get_theme_color("dark_color_2", "Editor");
- //clear
+ // Clear the previous frame and set the background color.
for (int i = 0; i < desired_len; i += 4) {
- wr[i + 0] = 0;
- wr[i + 1] = 0;
- wr[i + 2] = 0;
+ wr[i + 0] = Math::fast_ftoi(background_color.r * 255);
+ wr[i + 1] = Math::fast_ftoi(background_color.g * 255);
+ wr[i + 2] = Math::fast_ftoi(background_color.b * 255);
wr[i + 3] = 255;
}
@@ -259,9 +260,9 @@ void EditorVisualProfiler::_update_plot() {
uint8_t r, g, b;
if (column_cpu[j].a == 0) {
- r = 0;
- g = 0;
- b = 0;
+ r = Math::fast_ftoi(background_color.r * 255);
+ g = Math::fast_ftoi(background_color.g * 255);
+ b = Math::fast_ftoi(background_color.b * 255);
} else {
r = CLAMP((column_cpu[j].r / column_cpu[j].a) * 255.0, 0, 255);
g = CLAMP((column_cpu[j].g / column_cpu[j].a) * 255.0, 0, 255);
@@ -279,9 +280,9 @@ void EditorVisualProfiler::_update_plot() {
uint8_t r, g, b;
if (column_gpu[j].a == 0) {
- r = 0;
- g = 0;
- b = 0;
+ r = Math::fast_ftoi(background_color.r * 255);
+ g = Math::fast_ftoi(background_color.g * 255);
+ b = Math::fast_ftoi(background_color.b * 255);
} else {
r = CLAMP((column_gpu[j].r / column_gpu[j].a) * 255.0, 0, 255);
g = CLAMP((column_gpu[j].g / column_gpu[j].a) * 255.0, 0, 255);
@@ -440,8 +441,11 @@ void EditorVisualProfiler::_graph_tex_draw() {
if (last_metric < 0) {
return;
}
+
Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ const Color color = get_theme_color(SNAME("font_color"), SNAME("Editor"));
+
if (seeking) {
int max_frames = frame_metrics.size();
int frame = cursor_metric_edit->get_value() - (frame_metrics[last_metric].frame_number - max_frames + 1);
@@ -451,10 +455,9 @@ void EditorVisualProfiler::_graph_tex_draw() {
int half_width = graph->get_size().x / 2;
int cur_x = frame * half_width / max_frames;
- //cur_x /= 2.0;
- graph->draw_line(Vector2(cur_x, 0), Vector2(cur_x, graph->get_size().y), Color(1, 1, 1, 0.8));
- graph->draw_line(Vector2(cur_x + half_width, 0), Vector2(cur_x + half_width, graph->get_size().y), Color(1, 1, 1, 0.8));
+ graph->draw_line(Vector2(cur_x, 0), Vector2(cur_x, graph->get_size().y), color * Color(1, 1, 1));
+ graph->draw_line(Vector2(cur_x + half_width, 0), Vector2(cur_x + half_width, graph->get_size().y), color * Color(1, 1, 1));
}
if (graph_height_cpu > 0) {
@@ -462,10 +465,10 @@ void EditorVisualProfiler::_graph_tex_draw() {
int half_width = graph->get_size().x / 2;
- graph->draw_line(Vector2(0, frame_y), Vector2(half_width, frame_y), Color(1, 1, 1, 0.3));
+ graph->draw_line(Vector2(0, frame_y), Vector2(half_width, frame_y), color * Color(1, 1, 1, 0.5));
- String limit_str = String::num(graph_limit, 2);
- graph->draw_string(font, Vector2(half_width - font->get_string_size(limit_str, font_size).x - 2, frame_y - 2), limit_str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(1, 1, 1, 0.6));
+ const String limit_str = String::num(graph_limit, 2) + " ms";
+ graph->draw_string(font, Vector2(half_width - font->get_string_size(limit_str, font_size).x - 2, frame_y - 2), limit_str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, color * Color(1, 1, 1, 0.75));
}
if (graph_height_gpu > 0) {
@@ -473,14 +476,14 @@ void EditorVisualProfiler::_graph_tex_draw() {
int half_width = graph->get_size().x / 2;
- graph->draw_line(Vector2(half_width, frame_y), Vector2(graph->get_size().x, frame_y), Color(1, 1, 1, 0.3));
+ graph->draw_line(Vector2(half_width, frame_y), Vector2(graph->get_size().x, frame_y), color * Color(1, 1, 1, 0.5));
- String limit_str = String::num(graph_limit, 2);
- graph->draw_string(font, Vector2(half_width * 2 - font->get_string_size(limit_str, font_size).x - 2, frame_y - 2), limit_str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(1, 1, 1, 0.6));
+ const String limit_str = String::num(graph_limit, 2) + " ms";
+ graph->draw_string(font, Vector2(half_width * 2 - font->get_string_size(limit_str, font_size).x - 2, frame_y - 2), limit_str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, color * Color(1, 1, 1, 0.75));
}
- graph->draw_string(font, Vector2(font->get_string_size("X", font_size).x, font->get_ascent(font_size) + 2), "CPU:", HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(1, 1, 1, 0.8));
- graph->draw_string(font, Vector2(font->get_string_size("X", font_size).x + graph->get_size().width / 2, font->get_ascent(font_size) + 2), "GPU:", HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(1, 1, 1, 0.8));
+ graph->draw_string(font, Vector2(font->get_string_size("X", font_size).x, font->get_ascent(font_size) + 2), "CPU:", HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, color * Color(1, 1, 1));
+ graph->draw_string(font, Vector2(font->get_string_size("X", font_size).x + graph->get_size().width / 2, font->get_ascent(font_size) + 2), "GPU:", HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, color * Color(1, 1, 1));
}
void EditorVisualProfiler::_graph_tex_mouse_exit() {
diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp
index 645d7608f3..0b9631c816 100644
--- a/editor/debugger/script_editor_debugger.cpp
+++ b/editor/debugger/script_editor_debugger.cpp
@@ -135,15 +135,15 @@ void ScriptEditorDebugger::debug_continue() {
void ScriptEditorDebugger::update_tabs() {
if (error_count == 0 && warning_count == 0) {
errors_tab->set_name(TTR("Errors"));
- tabs->set_tab_icon(errors_tab->get_index(), Ref<Texture2D>());
+ tabs->set_tab_icon(tabs->get_tab_idx_from_control(errors_tab), Ref<Texture2D>());
} else {
errors_tab->set_name(TTR("Errors") + " (" + itos(error_count + warning_count) + ")");
if (error_count >= 1 && warning_count >= 1) {
- tabs->set_tab_icon(errors_tab->get_index(), get_theme_icon(SNAME("ErrorWarning"), SNAME("EditorIcons")));
+ tabs->set_tab_icon(tabs->get_tab_idx_from_control(errors_tab), get_theme_icon(SNAME("ErrorWarning"), SNAME("EditorIcons")));
} else if (error_count >= 1) {
- tabs->set_tab_icon(errors_tab->get_index(), get_theme_icon(SNAME("Error"), SNAME("EditorIcons")));
+ tabs->set_tab_icon(tabs->get_tab_idx_from_control(errors_tab), get_theme_icon(SNAME("Error"), SNAME("EditorIcons")));
} else {
- tabs->set_tab_icon(errors_tab->get_index(), get_theme_icon(SNAME("Warning"), SNAME("EditorIcons")));
+ tabs->set_tab_icon(tabs->get_tab_idx_from_control(errors_tab), get_theme_icon(SNAME("Warning"), SNAME("EditorIcons")));
}
}
}
@@ -1658,7 +1658,7 @@ bool ScriptEditorDebugger::has_capture(const StringName &p_name) {
ScriptEditorDebugger::ScriptEditorDebugger() {
tabs = memnew(TabContainer);
- tabs->set_tab_alignment(TabContainer::ALIGNMENT_LEFT);
+ tabs->set_tab_alignment(TabBar::ALIGNMENT_LEFT);
tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("EditorStyles")));
tabs->connect("tab_changed", callable_mp(this, &ScriptEditorDebugger::_tab_changed));
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index 9685ff4b70..b64b48b4ee 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -92,6 +92,12 @@ void EditorAudioBus::_notification(int p_what) {
audio_value_preview_label->add_theme_color_override("font_color", get_theme_color(SNAME("font_color"), SNAME("TooltipLabel")));
audio_value_preview_label->add_theme_color_override("font_shadow_color", get_theme_color(SNAME("font_shadow_color"), SNAME("TooltipLabel")));
audio_value_preview_box->add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), SNAME("TooltipPanel")));
+
+ for (int i = 0; i < effect_options->get_item_count(); i++) {
+ String class_name = effect_options->get_item_metadata(i);
+ Ref<Texture> icon = EditorNode::get_singleton()->get_class_icon(class_name);
+ effect_options->set_item_icon(i, icon);
+ }
} break;
case NOTIFICATION_READY: {
@@ -917,11 +923,9 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
continue;
}
- Ref<Texture2D> icon = EditorNode::get_singleton()->get_class_icon(E);
String name = E.operator String().replace("AudioEffect", "");
effect_options->add_item(name);
effect_options->set_item_metadata(effect_options->get_item_count() - 1, E);
- effect_options->set_item_icon(effect_options->get_item_count() - 1, icon);
}
bus_options = memnew(MenuButton);
@@ -1328,7 +1332,7 @@ EditorAudioBuses::EditorAudioBuses() {
List<String> ext;
ResourceLoader::get_recognized_extensions_for_type("AudioBusLayout", &ext);
for (const String &E : ext) {
- file_dialog->add_filter("*." + E + "; Audio Bus Layout");
+ file_dialog->add_filter(vformat("*.%s; %s", E, TTR("Audio Bus Layout")));
}
add_child(file_dialog);
file_dialog->connect("file_selected", callable_mp(this, &EditorAudioBuses::_file_dialog_callback));
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index 295b477080..1afd59e99c 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -542,7 +542,7 @@ void EditorExportPlatform::_edit_filter_list(Set<String> &r_list, const String &
filters.push_back(f);
}
- DirAccess *da = DirAccess::open("res://");
+ DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
ERR_FAIL_NULL(da);
_edit_files_with_filter(da, filters, r_list, exclude);
memdelete(da);
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp
index e6343100df..0fef4597be 100644
--- a/editor/editor_file_dialog.cpp
+++ b/editor/editor_file_dialog.cpp
@@ -394,7 +394,8 @@ void EditorFileDialog::_action_pressed() {
return;
}
- String f = dir_access->get_current_dir().plus_file(file->get_text());
+ String file_text = file->get_text();
+ String f = file_text.is_absolute_path() ? file_text : dir_access->get_current_dir().plus_file(file_text);
if ((mode == FILE_MODE_OPEN_ANY || mode == FILE_MODE_OPEN_FILE) && dir_access->file_exists(f)) {
_save_to_recent();
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 675ef808e1..a83379dca4 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -691,15 +691,11 @@ void EditorProperty::unhandled_key_input(const Ref<InputEvent> &p_event) {
}
const Color *EditorProperty::_get_property_colors() {
- const Color base = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
- const float saturation = base.get_s() * 0.75;
- const float value = base.get_v();
-
static Color c[4];
- c[0].set_hsv(0.0 / 3.0 + 0.05, saturation, value);
- c[1].set_hsv(1.0 / 3.0 + 0.05, saturation, value);
- c[2].set_hsv(2.0 / 3.0 + 0.05, saturation, value);
- c[3].set_hsv(1.5 / 3.0 + 0.05, saturation, value);
+ c[0] = get_theme_color(SNAME("property_color_x"), SNAME("Editor"));
+ c[1] = get_theme_color(SNAME("property_color_y"), SNAME("Editor"));
+ c[2] = get_theme_color(SNAME("property_color_z"), SNAME("Editor"));
+ c[3] = get_theme_color(SNAME("property_color_w"), SNAME("Editor"));
return c;
}
@@ -3514,7 +3510,9 @@ void EditorInspector::_notification(int p_what) {
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
_update_inspector_bg();
- update_tree();
+ if (EditorSettings::get_singleton()->check_changed_settings_in_group("interface/inspector")) {
+ update_tree();
+ }
} break;
}
}
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index cda5e6b537..33864df7d3 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -313,6 +313,7 @@ void EditorNode::disambiguate_filenames(const Vector<String> p_full_paths, Vecto
}
}
+// TODO: This REALLY should be done in a better way than replacing all tabs after almost EVERY action.
void EditorNode::_update_scene_tabs() {
bool show_rb = EditorSettings::get_singleton()->get("interface/scene_tabs/show_script_button");
@@ -330,6 +331,9 @@ void EditorNode::_update_scene_tabs() {
disambiguate_filenames(full_path_names, disambiguated_scene_names);
+ // Workaround to ignore the tab_changed signal from the first added tab.
+ scene_tabs->disconnect("tab_changed", callable_mp(this, &EditorNode::_scene_tab_changed));
+
scene_tabs->clear_tabs();
Ref<Texture2D> script_icon = gui_base->get_theme_icon(SNAME("Script"), SNAME("EditorIcons"));
for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
@@ -388,6 +392,9 @@ void EditorNode::_update_scene_tabs() {
scene_tab_add->set_position(Point2(last_tab.position.x + last_tab.size.width + hsep, last_tab.position.y));
}
}
+
+ // Reconnect after everything is done.
+ scene_tabs->connect("tab_changed", callable_mp(this, &EditorNode::_scene_tab_changed));
}
void EditorNode::_version_control_menu_option(int p_idx) {
@@ -694,22 +701,29 @@ void EditorNode::_notification(int p_what) {
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
scene_tabs->set_tab_close_display_policy((bool(EDITOR_GET("interface/scene_tabs/always_show_close_button")) ? TabBar::CLOSE_BUTTON_SHOW_ALWAYS : TabBar::CLOSE_BUTTON_SHOW_ACTIVE_ONLY));
- theme = create_custom_theme(theme_base->get_theme());
- theme_base->set_theme(theme);
- gui_base->set_theme(theme);
+ bool theme_changed =
+ EditorSettings::get_singleton()->check_changed_settings_in_group("interface/theme") ||
+ EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor/theme");
- gui_base->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("Background"), SNAME("EditorStyles")));
- scene_root_parent->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("Content"), SNAME("EditorStyles")));
- bottom_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("panel"), SNAME("TabContainer")));
- scene_tabs->add_theme_style_override("tab_selected", gui_base->get_theme_stylebox(SNAME("SceneTabFG"), SNAME("EditorStyles")));
- scene_tabs->add_theme_style_override("tab_unselected", gui_base->get_theme_stylebox(SNAME("SceneTabBG"), SNAME("EditorStyles")));
+ if (theme_changed) {
+ theme = create_custom_theme(theme_base->get_theme());
- file_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("EditorStyles")));
- project_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("EditorStyles")));
- debug_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("EditorStyles")));
- settings_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("EditorStyles")));
- help_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("EditorStyles")));
+ theme_base->set_theme(theme);
+ gui_base->set_theme(theme);
+
+ gui_base->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("Background"), SNAME("EditorStyles")));
+ scene_root_parent->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("Content"), SNAME("EditorStyles")));
+ bottom_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("panel"), SNAME("TabContainer")));
+ scene_tabs->add_theme_style_override("tab_selected", gui_base->get_theme_stylebox(SNAME("SceneTabFG"), SNAME("EditorStyles")));
+ scene_tabs->add_theme_style_override("tab_unselected", gui_base->get_theme_stylebox(SNAME("SceneTabBG"), SNAME("EditorStyles")));
+
+ file_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("EditorStyles")));
+ project_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("EditorStyles")));
+ debug_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("EditorStyles")));
+ settings_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("EditorStyles")));
+ help_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("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);
@@ -718,7 +732,7 @@ void EditorNode::_notification(int p_what) {
}
_update_scene_tabs();
- recent_scenes->set_as_minsize();
+ recent_scenes->reset_size();
// debugger area
if (EditorDebuggerNode::get_singleton()->is_visible()) {
@@ -3777,7 +3791,7 @@ void EditorNode::_update_recent_scenes() {
recent_scenes->add_separator();
recent_scenes->add_shortcut(ED_SHORTCUT("editor/clear_recent", TTR("Clear Recent Scenes")));
- recent_scenes->set_as_minsize();
+ recent_scenes->reset_size();
}
void EditorNode::_quick_opened() {
@@ -4226,7 +4240,7 @@ void EditorNode::_dock_floating_close_request(Control *p_control) {
p_control->get_parent()->remove_child(p_control);
dock_slot[window_slot]->add_child(p_control);
- dock_slot[window_slot]->move_child(p_control, MIN((int)window->get_meta("dock_index"), dock_slot[window_slot]->get_child_count()));
+ dock_slot[window_slot]->move_child(p_control, MIN((int)window->get_meta("dock_index"), dock_slot[window_slot]->get_tab_count()));
dock_slot[window_slot]->set_current_tab(window->get_meta("dock_index"));
window->queue_delete();
@@ -4466,13 +4480,13 @@ void EditorNode::_dock_select_draw() {
if (i == dock_select_rect_over) {
dock_select->draw_rect(r, used_selected);
- } else if (dock_slot[i]->get_child_count() == 0) {
+ } else if (dock_slot[i]->get_tab_count() == 0) {
dock_select->draw_rect(r, unused);
} else {
dock_select->draw_rect(r, used);
}
- for (int j = 0; j < MIN(3, dock_slot[i]->get_child_count()); j++) {
+ for (int j = 0; j < MIN(3, dock_slot[i]->get_tab_count()); j++) {
int xofs = (r.size.width / 3) * j;
Color c = used;
if (i == dock_popup_selected && (dock_slot[i]->get_current_tab() > 3 || dock_slot[i]->get_current_tab() == j)) {
@@ -4584,7 +4598,7 @@ void EditorNode::_update_dock_slots_visibility() {
for (int i = 0; i < DOCK_SLOT_MAX; i++) {
int tabs_visible = 0;
for (int j = 0; j < dock_slot[i]->get_tab_count(); j++) {
- if (!dock_slot[i]->get_tab_hidden(j)) {
+ if (!dock_slot[i]->is_tab_hidden(j)) {
tabs_visible++;
}
}
@@ -5418,7 +5432,7 @@ void EditorNode::remove_tool_menu_item(const String &p_name) {
memdelete(n);
}
tool_menu->remove_item(i);
- tool_menu->set_as_minsize();
+ tool_menu->reset_size();
return;
}
}
@@ -5648,11 +5662,11 @@ void EditorNode::_feature_profile_changed() {
TabContainer *node_tabs = cast_to<TabContainer>(NodeDock::get_singleton()->get_parent());
TabContainer *fs_tabs = cast_to<TabContainer>(FileSystemDock::get_singleton()->get_parent());
if (profile.is_valid()) {
- node_tabs->set_tab_hidden(NodeDock::get_singleton()->get_index(), profile->is_feature_disabled(EditorFeatureProfile::FEATURE_NODE_DOCK));
+ node_tabs->set_tab_hidden(node_tabs->get_tab_idx_from_control(NodeDock::get_singleton()), profile->is_feature_disabled(EditorFeatureProfile::FEATURE_NODE_DOCK));
// The Import dock is useless without the FileSystem dock. Ensure the configuration is valid.
bool fs_dock_disabled = profile->is_feature_disabled(EditorFeatureProfile::FEATURE_FILESYSTEM_DOCK);
- fs_tabs->set_tab_hidden(FileSystemDock::get_singleton()->get_index(), fs_dock_disabled);
- import_tabs->set_tab_hidden(ImportDock::get_singleton()->get_index(), fs_dock_disabled || profile->is_feature_disabled(EditorFeatureProfile::FEATURE_IMPORT_DOCK));
+ fs_tabs->set_tab_hidden(fs_tabs->get_tab_idx_from_control(FileSystemDock::get_singleton()), fs_dock_disabled);
+ import_tabs->set_tab_hidden(import_tabs->get_tab_idx_from_control(ImportDock::get_singleton()), fs_dock_disabled || profile->is_feature_disabled(EditorFeatureProfile::FEATURE_IMPORT_DOCK));
main_editor_buttons[EDITOR_3D]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D));
main_editor_buttons[EDITOR_SCRIPT]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT));
@@ -5665,9 +5679,9 @@ void EditorNode::_feature_profile_changed() {
_editor_select(EDITOR_2D);
}
} else {
- import_tabs->set_tab_hidden(ImportDock::get_singleton()->get_index(), false);
- node_tabs->set_tab_hidden(NodeDock::get_singleton()->get_index(), false);
- fs_tabs->set_tab_hidden(FileSystemDock::get_singleton()->get_index(), false);
+ import_tabs->set_tab_hidden(import_tabs->get_tab_idx_from_control(ImportDock::get_singleton()), false);
+ node_tabs->set_tab_hidden(node_tabs->get_tab_idx_from_control(NodeDock::get_singleton()), false);
+ fs_tabs->set_tab_hidden(fs_tabs->get_tab_idx_from_control(FileSystemDock::get_singleton()), false);
ImportDock::get_singleton()->set_visible(true);
NodeDock::get_singleton()->set_visible(true);
FileSystemDock::get_singleton()->set_visible(true);
@@ -6197,7 +6211,7 @@ EditorNode::EditorNode() {
dock_vb->add_child(dock_float);
- dock_select_popup->set_as_minsize();
+ dock_select_popup->reset_size();
dock_select_rect_over = -1;
dock_popup_selected = -1;
for (int i = 0; i < DOCK_SLOT_MAX; i++) {
@@ -6205,7 +6219,7 @@ EditorNode::EditorNode() {
dock_slot[i]->set_v_size_flags(Control::SIZE_EXPAND_FILL);
dock_slot[i]->set_popup(dock_select_popup);
dock_slot[i]->connect("pre_popup_pressed", callable_mp(this, &EditorNode::_dock_pre_popup), varray(i));
- dock_slot[i]->set_tab_alignment(TabContainer::ALIGNMENT_LEFT);
+ dock_slot[i]->set_tab_alignment(TabBar::ALIGNMENT_LEFT);
dock_slot[i]->set_drag_to_rearrange_enabled(true);
dock_slot[i]->set_tabs_rearrange_group(1);
dock_slot[i]->connect("tab_changed", callable_mp(this, &EditorNode::_dock_tab_changed));
@@ -6714,23 +6728,23 @@ EditorNode::EditorNode() {
// Scene: Top left
dock_slot[DOCK_SLOT_LEFT_UR]->add_child(SceneTreeDock::get_singleton());
- dock_slot[DOCK_SLOT_LEFT_UR]->set_tab_title(SceneTreeDock::get_singleton()->get_index(), TTR("Scene"));
+ dock_slot[DOCK_SLOT_LEFT_UR]->set_tab_title(dock_slot[DOCK_SLOT_LEFT_UR]->get_tab_idx_from_control(SceneTreeDock::get_singleton()), TTR("Scene"));
// Import: Top left, behind Scene
dock_slot[DOCK_SLOT_LEFT_UR]->add_child(ImportDock::get_singleton());
- dock_slot[DOCK_SLOT_LEFT_UR]->set_tab_title(ImportDock::get_singleton()->get_index(), TTR("Import"));
+ dock_slot[DOCK_SLOT_LEFT_UR]->set_tab_title(dock_slot[DOCK_SLOT_LEFT_UR]->get_tab_idx_from_control(ImportDock::get_singleton()), TTR("Import"));
// FileSystem: Bottom left
dock_slot[DOCK_SLOT_LEFT_BR]->add_child(FileSystemDock::get_singleton());
- dock_slot[DOCK_SLOT_LEFT_BR]->set_tab_title(FileSystemDock::get_singleton()->get_index(), TTR("FileSystem"));
+ dock_slot[DOCK_SLOT_LEFT_BR]->set_tab_title(dock_slot[DOCK_SLOT_LEFT_BR]->get_tab_idx_from_control(FileSystemDock::get_singleton()), TTR("FileSystem"));
// Inspector: Full height right
dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(InspectorDock::get_singleton());
- dock_slot[DOCK_SLOT_RIGHT_UL]->set_tab_title(InspectorDock::get_singleton()->get_index(), TTR("Inspector"));
+ dock_slot[DOCK_SLOT_RIGHT_UL]->set_tab_title(dock_slot[DOCK_SLOT_RIGHT_UL]->get_tab_idx_from_control(InspectorDock::get_singleton()), TTR("Inspector"));
// Node: Full height right, behind Inspector
dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(NodeDock::get_singleton());
- dock_slot[DOCK_SLOT_RIGHT_UL]->set_tab_title(NodeDock::get_singleton()->get_index(), TTR("Node"));
+ dock_slot[DOCK_SLOT_RIGHT_UL]->set_tab_title(dock_slot[DOCK_SLOT_RIGHT_UL]->get_tab_idx_from_control(NodeDock::get_singleton()), TTR("Node"));
// Hide unused dock slots and vsplits
dock_slot[DOCK_SLOT_LEFT_UL]->hide();
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 68a3fabe1e..d93d495ff6 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -1185,7 +1185,7 @@ void EditorPropertyLayers::_button_pressed() {
}
Rect2 gp = button->get_screen_rect();
- layers->set_as_minsize();
+ layers->reset_size();
Vector2 popup_pos = gp.position - Vector2(layers->get_contents_minimum_size().x, 0);
layers->set_position(popup_pos);
layers->popup();
@@ -1626,7 +1626,7 @@ void EditorPropertyVector2::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 2; i++) {
- spin[i]->set_custom_label_color(true, colors[i]);
+ spin[i]->add_theme_color_override("label_color", colors[i]);
}
} break;
}
@@ -1720,7 +1720,7 @@ void EditorPropertyRect2::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 4; i++) {
- spin[i]->set_custom_label_color(true, colors[i % 2]);
+ spin[i]->add_theme_color_override("label_color", colors[i % 2]);
}
} break;
}
@@ -1849,7 +1849,7 @@ void EditorPropertyVector3::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 3; i++) {
- spin[i]->set_custom_label_color(true, colors[i]);
+ spin[i]->add_theme_color_override("label_color", colors[i]);
}
} break;
}
@@ -1939,7 +1939,7 @@ void EditorPropertyVector2i::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 2; i++) {
- spin[i]->set_custom_label_color(true, colors[i]);
+ spin[i]->add_theme_color_override("label_color", colors[i]);
}
} break;
}
@@ -2033,7 +2033,7 @@ void EditorPropertyRect2i::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 4; i++) {
- spin[i]->set_custom_label_color(true, colors[i % 2]);
+ spin[i]->add_theme_color_override("label_color", colors[i % 2]);
}
} break;
}
@@ -2135,7 +2135,7 @@ void EditorPropertyVector3i::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 3; i++) {
- spin[i]->set_custom_label_color(true, colors[i]);
+ spin[i]->add_theme_color_override("label_color", colors[i]);
}
} break;
}
@@ -2228,7 +2228,7 @@ void EditorPropertyPlane::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 4; i++) {
- spin[i]->set_custom_label_color(true, colors[i]);
+ spin[i]->add_theme_color_override("label_color", colors[i]);
}
} break;
}
@@ -2322,7 +2322,7 @@ void EditorPropertyQuaternion::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 4; i++) {
- spin[i]->set_custom_label_color(true, colors[i]);
+ spin[i]->add_theme_color_override("label_color", colors[i]);
}
} break;
}
@@ -2419,7 +2419,7 @@ void EditorPropertyAABB::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 6; i++) {
- spin[i]->set_custom_label_color(true, colors[i % 3]);
+ spin[i]->add_theme_color_override("label_color", colors[i % 3]);
}
} break;
}
@@ -2505,9 +2505,9 @@ void EditorPropertyTransform2D::_notification(int p_what) {
for (int i = 0; i < 6; i++) {
// For Transform2D, use the 4th color (cyan) for the origin vector.
if (i % 3 == 2) {
- spin[i]->set_custom_label_color(true, colors[3]);
+ spin[i]->add_theme_color_override("label_color", colors[3]);
} else {
- spin[i]->set_custom_label_color(true, colors[i % 3]);
+ spin[i]->add_theme_color_override("label_color", colors[i % 3]);
}
}
} break;
@@ -2599,7 +2599,7 @@ void EditorPropertyBasis::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 9; i++) {
- spin[i]->set_custom_label_color(true, colors[i % 3]);
+ spin[i]->add_theme_color_override("label_color", colors[i % 3]);
}
} break;
}
@@ -2696,7 +2696,7 @@ void EditorPropertyTransform3D::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 12; i++) {
- spin[i]->set_custom_label_color(true, colors[i % 4]);
+ spin[i]->add_theme_color_override("label_color", colors[i % 4]);
}
} break;
}
diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp
index 61261af608..d354be9af5 100644
--- a/editor/editor_properties_array_dict.cpp
+++ b/editor/editor_properties_array_dict.cpp
@@ -175,7 +175,7 @@ void EditorPropertyArray::_change_type(Object *p_button, int p_index) {
Button *button = Object::cast_to<Button>(p_button);
changing_type_index = p_index;
Rect2 rect = button->get_screen_rect();
- change_type->set_as_minsize();
+ change_type->reset_size();
change_type->set_position(rect.get_end() - Vector2(change_type->get_contents_minimum_size().x, 0));
change_type->popup();
}
@@ -751,7 +751,7 @@ void EditorPropertyDictionary::_change_type(Object *p_button, int p_index) {
Button *button = Object::cast_to<Button>(p_button);
Rect2 rect = button->get_screen_rect();
- change_type->set_as_minsize();
+ change_type->reset_size();
change_type->set_position(rect.get_end() - Vector2(change_type->get_contents_minimum_size().x, 0));
change_type->popup();
changing_type_index = p_index;
diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp
index 2f14667fc0..a7b2a4cfa6 100644
--- a/editor/editor_resource_picker.cpp
+++ b/editor/editor_resource_picker.cpp
@@ -149,7 +149,7 @@ void EditorResourcePicker::_update_menu() {
_update_menu_items();
Rect2 gt = edit_button->get_screen_rect();
- edit_menu->set_as_minsize();
+ edit_menu->reset_size();
int ms = edit_menu->get_contents_minimum_size().width;
Vector2 popup_pos = gt.get_end() - Vector2(ms, 0);
edit_menu->set_position(popup_pos);
@@ -337,7 +337,7 @@ void EditorResourcePicker::_edit_menu_cbk(int p_which) {
// Ensure that the FileSystem dock is visible.
TabContainer *tab_container = (TabContainer *)file_system_dock->get_parent_control();
- tab_container->set_current_tab(file_system_dock->get_index());
+ tab_container->set_current_tab(tab_container->get_tab_idx_from_control(file_system_dock));
} break;
default: {
@@ -476,7 +476,7 @@ void EditorResourcePicker::_button_input(const Ref<InputEvent> &p_event) {
_update_menu_items();
Vector2 pos = get_screen_position() + mb->get_position();
- edit_menu->set_as_minsize();
+ edit_menu->reset_size();
edit_menu->set_position(pos);
edit_menu->popup();
}
@@ -905,7 +905,12 @@ void EditorScriptPicker::set_create_options(Object *p_menu_node) {
}
menu_node->add_icon_item(get_theme_icon(SNAME("ScriptCreate"), SNAME("EditorIcons")), TTR("New Script"), OBJ_MENU_NEW_SCRIPT);
- menu_node->add_icon_item(get_theme_icon(SNAME("ScriptExtend"), SNAME("EditorIcons")), TTR("Extend Script"), OBJ_MENU_EXTEND_SCRIPT);
+ if (script_owner) {
+ Ref<Script> script = script_owner->get_script();
+ if (script.is_valid()) {
+ menu_node->add_icon_item(get_theme_icon(SNAME("ScriptExtend"), SNAME("EditorIcons")), TTR("Extend Script"), OBJ_MENU_EXTEND_SCRIPT);
+ }
+ }
menu_node->add_separator();
}
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 6bd11fcdd6..0135b33bca 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -63,6 +63,7 @@ bool EditorSettings::_set(const StringName &p_name, const Variant &p_value) {
bool changed = _set_only(p_name, p_value);
if (changed) {
+ changed_settings.insert(p_name);
emit_signal(SNAME("settings_changed"));
}
return true;
@@ -941,10 +942,34 @@ void EditorSettings::save() {
if (err != OK) {
ERR_PRINT("Error saving editor settings to " + singleton->config_file_path);
} else {
+ singleton->changed_settings.clear();
print_verbose("EditorSettings: Save OK!");
}
}
+Array EditorSettings::get_changed_settings() const {
+ Array arr;
+ for (const String &setting : changed_settings) {
+ arr.push_back(setting);
+ }
+
+ return arr;
+}
+
+bool EditorSettings::check_changed_settings_in_group(const String &p_setting_prefix) const {
+ for (const String &setting : changed_settings) {
+ if (setting.begins_with(p_setting_prefix)) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void EditorSettings::mark_setting_changed(const String &p_setting) {
+ changed_settings.insert(p_setting);
+}
+
void EditorSettings::destroy() {
if (!singleton.ptr()) {
return;
@@ -1621,6 +1646,10 @@ void EditorSettings::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_builtin_action_override", "name", "actions_list"), &EditorSettings::set_builtin_action_override);
+ ClassDB::bind_method(D_METHOD("check_changed_settings_in_group", "setting_prefix"), &EditorSettings::check_changed_settings_in_group);
+ ClassDB::bind_method(D_METHOD("get_changed_settings"), &EditorSettings::get_changed_settings);
+ ClassDB::bind_method(D_METHOD("mark_setting_changed", "setting"), &EditorSettings::mark_setting_changed);
+
ADD_SIGNAL(MethodInfo("settings_changed"));
BIND_CONSTANT(NOTIFICATION_EDITOR_SETTINGS_CHANGED);
diff --git a/editor/editor_settings.h b/editor/editor_settings.h
index f0fec3acc7..65723a24f8 100644
--- a/editor/editor_settings.h
+++ b/editor/editor_settings.h
@@ -77,6 +77,8 @@ private:
static Ref<EditorSettings> singleton;
+ Set<String> changed_settings;
+
HashMap<String, PropertyInfo> hints;
HashMap<String, VariantContainer> props;
int last_order;
@@ -140,6 +142,9 @@ public:
bool property_can_revert(const String &p_setting);
Variant property_get_revert(const String &p_setting);
void add_property_hint(const PropertyInfo &p_hint);
+ Array get_changed_settings() const;
+ bool check_changed_settings_in_group(const String &p_setting_prefix) const;
+ void mark_setting_changed(const String &p_setting);
void set_resource_clipboard(const Ref<Resource> &p_resource) { clipboard = p_resource; }
Ref<Resource> get_resource_clipboard() const { return clipboard; }
diff --git a/editor/editor_settings_dialog.cpp b/editor/editor_settings_dialog.cpp
index 18324f9971..8ecdcfff65 100644
--- a/editor/editor_settings_dialog.cpp
+++ b/editor/editor_settings_dialog.cpp
@@ -134,9 +134,13 @@ void EditorSettingsDialog::_notification(int p_what) {
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
_update_icons();
- // Update theme colors.
- inspector->update_category_list();
- _update_shortcuts();
+
+ bool update_shortcuts_tab =
+ EditorSettings::get_singleton()->check_changed_settings_in_group("shortcuts") ||
+ EditorSettings::get_singleton()->check_changed_settings_in_group("builtin_action_overrides");
+ if (update_shortcuts_tab) {
+ _update_shortcuts();
+ }
} break;
}
}
@@ -215,6 +219,8 @@ void EditorSettingsDialog::_update_builtin_action(const String &p_name, const Ar
Array old_input_array = EditorSettings::get_singleton()->get_builtin_action_overrides(p_name);
undo_redo->create_action(TTR("Edit Built-in Action") + " '" + p_name + "'");
+ undo_redo->add_do_method(EditorSettings::get_singleton(), "mark_setting_changed", "builtin_action_overrides");
+ undo_redo->add_undo_method(EditorSettings::get_singleton(), "mark_setting_changed", "builtin_action_overrides");
undo_redo->add_do_method(EditorSettings::get_singleton(), "set_builtin_action_override", p_name, p_events);
undo_redo->add_undo_method(EditorSettings::get_singleton(), "set_builtin_action_override", p_name, old_input_array);
undo_redo->add_do_method(this, "_settings_changed");
@@ -230,6 +236,8 @@ void EditorSettingsDialog::_update_shortcut_events(const String &p_path, const A
undo_redo->create_action(TTR("Edit Shortcut") + " '" + p_path + "'");
undo_redo->add_do_method(current_sc.ptr(), "set_events", p_events);
undo_redo->add_undo_method(current_sc.ptr(), "set_events", current_sc->get_events());
+ undo_redo->add_do_method(EditorSettings::get_singleton(), "mark_setting_changed", "shortcuts");
+ undo_redo->add_undo_method(EditorSettings::get_singleton(), "mark_setting_changed", "shortcuts");
undo_redo->add_do_method(this, "_update_shortcuts");
undo_redo->add_undo_method(this, "_update_shortcuts");
undo_redo->add_do_method(this, "_settings_changed");
@@ -662,7 +670,7 @@ EditorSettingsDialog::EditorSettingsDialog() {
undo_redo = memnew(UndoRedo);
tabs = memnew(TabContainer);
- tabs->set_tab_alignment(TabContainer::ALIGNMENT_LEFT);
+ tabs->set_tab_alignment(TabBar::ALIGNMENT_LEFT);
tabs->connect("tab_changed", callable_mp(this, &EditorSettingsDialog::_tabs_tab_changed));
add_child(tabs);
diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp
index a4a9e691a0..509a316ef3 100644
--- a/editor/editor_spin_slider.cpp
+++ b/editor/editor_spin_slider.cpp
@@ -300,12 +300,7 @@ void EditorSpinSlider::_draw_spin_slider() {
int vofs = (size.height - font->get_height(font_size)) / 2 + font->get_ascent(font_size);
Color fc = get_theme_color(is_read_only() ? SNAME("font_uneditable_color") : SNAME("font_color"), SNAME("LineEdit"));
- Color lc;
- if (use_custom_label_color) {
- lc = custom_label_color;
- } else {
- lc = fc;
- }
+ Color lc = get_theme_color(is_read_only() ? SNAME("read_only_label_color") : SNAME("label_color"));
if (flat && !label.is_empty()) {
Color label_bg_color = get_theme_color(SNAME("dark_color_3"), SNAME("Editor"));
@@ -605,11 +600,6 @@ bool EditorSpinSlider::is_flat() const {
return flat;
}
-void EditorSpinSlider::set_custom_label_color(bool p_use_custom_label_color, Color p_custom_label_color) {
- use_custom_label_color = p_use_custom_label_color;
- custom_label_color = p_custom_label_color;
-}
-
void EditorSpinSlider::_focus_entered() {
_ensure_input_popup();
Rect2 gr = get_screen_rect();
@@ -689,5 +679,4 @@ EditorSpinSlider::EditorSpinSlider() {
value_input_just_closed = false;
hide_slider = false;
read_only = false;
- use_custom_label_color = false;
}
diff --git a/editor/editor_spin_slider.h b/editor/editor_spin_slider.h
index 7e3f2051ac..4e52980804 100644
--- a/editor/editor_spin_slider.h
+++ b/editor/editor_spin_slider.h
@@ -76,9 +76,6 @@ class EditorSpinSlider : public Range {
bool hide_slider;
bool flat;
- bool use_custom_label_color;
- Color custom_label_color;
-
void _evaluate_input_text();
void _update_value_input_stylebox();
@@ -112,8 +109,6 @@ public:
void set_flat(bool p_enable);
bool is_flat() const;
- void set_custom_label_color(bool p_use_custom_label_color, Color p_custom_label_color);
-
void setup_and_show() { _focus_entered(); }
LineEdit *get_line_edit();
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 05aa638a4b..a79ced39a3 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -411,9 +411,11 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// Colors
bool dark_theme = EditorSettings::get_singleton()->is_dark_theme();
- const Color dark_color_1 = base_color.lerp(Color(0, 0, 0, 1), contrast);
- const Color dark_color_2 = base_color.lerp(Color(0, 0, 0, 1), contrast * 1.5);
- const Color dark_color_3 = base_color.lerp(Color(0, 0, 0, 1), contrast * 2);
+ // Ensure base colors are in the 0..1 luminance range to avoid 8-bit integer overflow or text rendering issues.
+ // Some places in the editor use 8-bit integer colors.
+ const Color dark_color_1 = base_color.lerp(Color(0, 0, 0, 1), contrast).clamp();
+ const Color dark_color_2 = base_color.lerp(Color(0, 0, 0, 1), contrast * 1.5).clamp();
+ const Color dark_color_3 = base_color.lerp(Color(0, 0, 0, 1), contrast * 2).clamp();
const Color background_color = dark_color_2;
@@ -433,7 +435,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
const Color disabled_color = mono_color.inverted().lerp(base_color, 0.7);
const Color disabled_bg_color = mono_color.inverted().lerp(base_color, 0.9);
- Color icon_hover_color = Color(1, 1, 1) * (dark_theme ? 1.15 : 1.45);
+ const Color icon_normal_color = Color(1, 1, 1);
+ Color icon_hover_color = icon_normal_color * (dark_theme ? 1.15 : 1.45);
icon_hover_color.a = 1.0;
Color icon_focus_color = icon_hover_color;
// Make the pressed icon color overbright because icons are not completely white on a dark theme.
@@ -464,6 +467,14 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_color("axis_y_color", "Editor", Color(0.53, 0.84, 0.01));
theme->set_color("axis_z_color", "Editor", Color(0.16, 0.55, 0.96));
+ const float prop_color_saturation = accent_color.get_s() * 0.75;
+ const float prop_color_value = accent_color.get_v();
+
+ theme->set_color("property_color_x", "Editor", Color().from_hsv(0.0 / 3.0 + 0.05, prop_color_saturation, prop_color_value));
+ theme->set_color("property_color_y", "Editor", Color().from_hsv(1.0 / 3.0 + 0.05, prop_color_saturation, prop_color_value));
+ theme->set_color("property_color_z", "Editor", Color().from_hsv(2.0 / 3.0 + 0.05, prop_color_saturation, prop_color_value));
+ theme->set_color("property_color_w", "Editor", Color().from_hsv(1.5 / 3.0 + 0.05, prop_color_saturation, prop_color_value));
+
theme->set_color("font_color", "Editor", font_color);
theme->set_color("highlighted_font_color", "Editor", font_hover_color);
theme->set_color("disabled_font_color", "Editor", font_disabled_color);
@@ -686,6 +697,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_color("font_focus_color", "Button", font_focus_color);
theme->set_color("font_pressed_color", "Button", accent_color);
theme->set_color("font_disabled_color", "Button", font_disabled_color);
+ theme->set_color("icon_normal_color", "Button", icon_normal_color);
theme->set_color("icon_hover_color", "Button", icon_hover_color);
theme->set_color("icon_focus_color", "Button", icon_focus_color);
theme->set_color("icon_pressed_color", "Button", icon_pressed_color);
@@ -864,6 +876,10 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_color("sub_inspector_property_color", "Editor", dark_theme ? Color(1, 1, 1, 1) : Color(0, 0, 0, 1));
theme->set_constant("sub_inspector_font_offset", "Editor", 4 * EDSCALE);
+ // EditorSpinSlider.
+ theme->set_color("label_color", "EditorSpinSlider", font_color);
+ theme->set_color("read_only_label_color", "EditorSpinSlider", font_readonly_color);
+
Ref<StyleBoxFlat> style_property_bg = style_default->duplicate();
style_property_bg->set_bg_color(highlight_color);
style_property_bg->set_border_width_all(0);
diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp
index 3cad600002..0a8d35aff1 100644
--- a/editor/export_template_manager.cpp
+++ b/editor/export_template_manager.cpp
@@ -645,7 +645,7 @@ Error ExportTemplateManager::install_android_template_from_file(const String &p_
// To support custom Android builds, we install the Java source code and buildsystem
// from android_source.zip to the project's res://android folder.
- DirAccessRef da = DirAccess::open("res://");
+ DirAccessRef da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
ERR_FAIL_COND_V(!da, ERR_CANT_CREATE);
// Make res://android dir (if it does not exist).
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index b41123c0dd..e8a2a46dd2 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -396,12 +396,25 @@ void FileSystemDock::_notification(int p_what) {
}
} else if ((String(dd["type"]) == "files") || (String(dd["type"]) == "files_and_dirs") || (String(dd["type"]) == "resource")) {
tree->set_drop_mode_flags(Tree::DROP_MODE_ON_ITEM | Tree::DROP_MODE_INBETWEEN);
+ } else if ((String(dd["type"]) == "nodes")) {
+ holding_branch = true;
+ TreeItem *item = tree->get_next_selected(tree->get_root());
+ while (item) {
+ tree_items_selected_on_drag_begin.push_back(item);
+ item = tree->get_next_selected(item);
+ }
+ list_items_selected_on_drag_begin = files->get_selected_items();
}
}
} break;
case NOTIFICATION_DRAG_END: {
tree->set_drop_mode_flags(0);
+
+ if (holding_branch) {
+ holding_branch = false;
+ _reselect_items_selected_on_drag_begin(true);
+ }
} break;
case NOTIFICATION_THEME_CHANGED: {
@@ -512,7 +525,7 @@ void FileSystemDock::_navigate_to_path(const String &p_path, bool p_select_in_fa
if (target_path.ends_with("/")) {
target_path = target_path.substr(0, target_path.length() - 1);
}
- DirAccess *dirAccess = DirAccess::open("res://");
+ DirAccess *dirAccess = DirAccess::create(DirAccess::ACCESS_RESOURCES);
if (dirAccess->file_exists(p_path)) {
path = target_path;
} else if (dirAccess->dir_exists(p_path)) {
@@ -2647,8 +2660,79 @@ void FileSystemDock::_file_multi_selected(int p_index, bool p_selected) {
call_deferred(SNAME("_update_import_dock"));
}
+void FileSystemDock::_tree_mouse_exited() {
+ if (holding_branch) {
+ _reselect_items_selected_on_drag_begin();
+ }
+}
+
+void FileSystemDock::_reselect_items_selected_on_drag_begin(bool reset) {
+ TreeItem *selected_item = tree->get_next_selected(tree->get_root());
+ if (selected_item) {
+ selected_item->deselect(0);
+ }
+ if (!tree_items_selected_on_drag_begin.is_empty()) {
+ bool reselected = false;
+ for (TreeItem *item : tree_items_selected_on_drag_begin) {
+ if (item->get_tree()) {
+ item->select(0);
+ reselected = true;
+ }
+ }
+
+ if (reset) {
+ tree_items_selected_on_drag_begin.clear();
+ }
+
+ if (!reselected) {
+ // If couldn't reselect the items selected on drag begin, select the "res://" item.
+ tree->get_root()->get_child(1)->select(0);
+ }
+ }
+
+ files->deselect_all();
+ if (!list_items_selected_on_drag_begin.is_empty()) {
+ for (const int idx : list_items_selected_on_drag_begin) {
+ files->select(idx, false);
+ }
+
+ if (reset) {
+ list_items_selected_on_drag_begin.clear();
+ }
+ }
+}
+
void FileSystemDock::_tree_gui_input(Ref<InputEvent> p_event) {
Ref<InputEventKey> key = p_event;
+
+ Ref<InputEventMouseMotion> mm = p_event;
+ if (mm.is_valid()) {
+ TreeItem *item = tree->get_item_at_position(mm->get_position());
+ if (item && holding_branch) {
+ String fpath = item->get_metadata(0);
+ while (!fpath.ends_with("/") && fpath != "res://" && item->get_parent()) { // Find the parent folder tree item.
+ item = item->get_parent();
+ fpath = item->get_metadata(0);
+ }
+
+ TreeItem *deselect_item = tree->get_next_selected(tree->get_root());
+ while (deselect_item) {
+ deselect_item->deselect(0);
+ deselect_item = tree->get_next_selected(deselect_item);
+ }
+ item->select(0);
+
+ if (display_mode == DisplayMode::DISPLAY_MODE_SPLIT) {
+ files->deselect_all();
+ // Try to select the corresponding file list item.
+ const int files_item_idx = files->find_metadata(fpath);
+ if (files_item_idx != -1) {
+ files->select(files_item_idx);
+ }
+ }
+ }
+ }
+
if (key.is_valid() && key->is_pressed() && !key->is_echo()) {
if (ED_IS_SHORTCUT("filesystem_dock/duplicate", p_event)) {
_tree_rmb_option(FILE_DUPLICATE);
@@ -2669,6 +2753,43 @@ void FileSystemDock::_tree_gui_input(Ref<InputEvent> p_event) {
}
void FileSystemDock::_file_list_gui_input(Ref<InputEvent> p_event) {
+ Ref<InputEventMouseMotion> mm = p_event;
+ if (mm.is_valid() && holding_branch) {
+ const int item_idx = files->get_item_at_position(mm->get_position());
+ if (item_idx != -1) {
+ files->deselect_all();
+ String fpath = files->get_item_metadata(item_idx);
+ if (fpath.ends_with("/") || fpath == "res://") {
+ files->select(item_idx);
+ }
+
+ TreeItem *deselect_item = tree->get_next_selected(tree->get_root());
+ while (deselect_item) {
+ deselect_item->deselect(0);
+ deselect_item = tree->get_next_selected(deselect_item);
+ }
+
+ // Try to select the corresponding tree item.
+ TreeItem *tree_item = tree->get_item_with_text(files->get_item_text(item_idx));
+ if (tree_item) {
+ tree_item->select(0);
+ } else {
+ // Find parent folder.
+ fpath = fpath.substr(0, fpath.rfind("/") + 1);
+ if (fpath.size() > String("res://").size()) {
+ fpath = fpath.left(fpath.size() - 2); // Remove last '/'.
+ const int slash_idx = fpath.rfind("/");
+ fpath = fpath.substr(slash_idx + 1, fpath.size() - slash_idx - 1);
+ }
+
+ tree_item = tree->get_item_with_text(fpath);
+ if (tree_item) {
+ tree_item->select(0);
+ }
+ }
+ }
+ }
+
Ref<InputEventKey> key = p_event;
if (key.is_valid() && key->is_pressed() && !key->is_echo()) {
if (ED_IS_SHORTCUT("filesystem_dock/duplicate", p_event)) {
@@ -2932,6 +3053,7 @@ FileSystemDock::FileSystemDock() {
tree->connect("empty_rmb", callable_mp(this, &FileSystemDock::_tree_rmb_empty));
tree->connect("nothing_selected", callable_mp(this, &FileSystemDock::_tree_empty_selected));
tree->connect("gui_input", callable_mp(this, &FileSystemDock::_tree_gui_input));
+ tree->connect("mouse_exited", callable_mp(this, &FileSystemDock::_tree_mouse_exited));
file_list_vb = memnew(VBoxContainer);
file_list_vb->set_v_size_flags(SIZE_EXPAND_FILL);
diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h
index 21c50beeb2..d457c6acd4 100644
--- a/editor/filesystem_dock.h
+++ b/editor/filesystem_dock.h
@@ -185,6 +185,13 @@ private:
ItemList *files;
bool import_dock_needs_update;
+ bool holding_branch = false;
+ Vector<TreeItem *> tree_items_selected_on_drag_begin;
+ PackedInt32Array list_items_selected_on_drag_begin;
+
+ void _tree_mouse_exited();
+ void _reselect_items_selected_on_drag_begin(bool reset = false);
+
Ref<Texture2D> _get_tree_item_icon(bool p_is_valid, String p_file_type);
bool _create_tree(TreeItem *p_parent, EditorFileSystemDirectory *p_dir, Vector<String> &uncollapsed_paths, bool p_select_in_favorites, bool p_unfold_path = false);
Vector<String> _compute_uncollapsed_paths();
diff --git a/editor/import/dynamic_font_import_settings.cpp b/editor/import/dynamic_font_import_settings.cpp
index ebfb0b32fb..f0a2d7d553 100644
--- a/editor/import/dynamic_font_import_settings.cpp
+++ b/editor/import/dynamic_font_import_settings.cpp
@@ -767,7 +767,6 @@ bool DynamicFontImportSettings::_char_update(int32_t p_char) {
selected_chars.insert(p_char);
return true;
}
- label_glyphs->set_text(TTR("Preloaded glyphs: ") + itos(selected_glyphs.size()));
}
void DynamicFontImportSettings::_range_update(int32_t p_start, int32_t p_end) {
diff --git a/editor/import/resource_importer_layered_texture.cpp b/editor/import/resource_importer_layered_texture.cpp
index 7071042818..d9dd273ed4 100644
--- a/editor/import/resource_importer_layered_texture.cpp
+++ b/editor/import/resource_importer_layered_texture.cpp
@@ -104,16 +104,16 @@ String ResourceImporterLayeredTexture::get_save_extension() const {
String ResourceImporterLayeredTexture::get_resource_type() const {
switch (mode) {
case MODE_CUBEMAP: {
- return "StreamCubemap";
+ return "CompressedCubemap";
} break;
case MODE_2D_ARRAY: {
- return "StreamTexture2DArray";
+ return "CompressedTexture2DArray";
} break;
case MODE_CUBEMAP_ARRAY: {
- return "StreamCubemapArray";
+ return "CompressedCubemapArray";
} break;
case MODE_3D: {
- return "StreamTexture3D";
+ return "CompressedTexture3D";
} break;
}
ERR_FAIL_V(String());
@@ -263,7 +263,7 @@ void ResourceImporterLayeredTexture::_save_tex(Vector<Ref<Image>> p_images, cons
f->store_8('T');
f->store_8('L');
- f->store_32(StreamTextureLayered::FORMAT_VERSION);
+ f->store_32(CompressedTextureLayered::FORMAT_VERSION);
f->store_32(p_images.size()); // For 2d layers or 3d depth.
f->store_32(mode);
f->store_32(0);
diff --git a/editor/import/resource_importer_layered_texture.h b/editor/import/resource_importer_layered_texture.h
index edd981c63d..58e5c47d8d 100644
--- a/editor/import/resource_importer_layered_texture.h
+++ b/editor/import/resource_importer_layered_texture.h
@@ -35,7 +35,7 @@
#include "core/io/resource_importer.h"
#include "core/object/ref_counted.h"
-class StreamTexture2D;
+class CompressedTexture2D;
class LayeredTextureImport : public RefCounted {
GDCLASS(LayeredTextureImport, RefCounted);
diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp
index 35a20e85c1..1561fc788c 100644
--- a/editor/import/resource_importer_texture.cpp
+++ b/editor/import/resource_importer_texture.cpp
@@ -37,7 +37,7 @@
#include "editor/editor_file_system.h"
#include "editor/editor_node.h"
-void ResourceImporterTexture::_texture_reimport_roughness(const Ref<StreamTexture2D> &p_tex, const String &p_normal_path, RS::TextureDetectRoughnessChannel p_channel) {
+void ResourceImporterTexture::_texture_reimport_roughness(const Ref<CompressedTexture2D> &p_tex, const String &p_normal_path, RS::TextureDetectRoughnessChannel p_channel) {
ERR_FAIL_COND(p_tex.is_null());
MutexLock lock(singleton->mutex);
@@ -53,7 +53,7 @@ void ResourceImporterTexture::_texture_reimport_roughness(const Ref<StreamTextur
singleton->make_flags[path].normal_path_for_roughness = p_normal_path;
}
-void ResourceImporterTexture::_texture_reimport_3d(const Ref<StreamTexture2D> &p_tex) {
+void ResourceImporterTexture::_texture_reimport_3d(const Ref<CompressedTexture2D> &p_tex) {
ERR_FAIL_COND(p_tex.is_null());
MutexLock lock(singleton->mutex);
@@ -67,7 +67,7 @@ void ResourceImporterTexture::_texture_reimport_3d(const Ref<StreamTexture2D> &p
singleton->make_flags[path].flags |= MAKE_3D_FLAG;
}
-void ResourceImporterTexture::_texture_reimport_normal(const Ref<StreamTexture2D> &p_tex) {
+void ResourceImporterTexture::_texture_reimport_normal(const Ref<CompressedTexture2D> &p_tex) {
ERR_FAIL_COND(p_tex.is_null());
MutexLock lock(singleton->mutex);
@@ -153,11 +153,11 @@ void ResourceImporterTexture::get_recognized_extensions(List<String> *p_extensio
}
String ResourceImporterTexture::get_save_extension() const {
- return "stex";
+ return "ctex";
}
String ResourceImporterTexture::get_resource_type() const {
- return "StreamTexture2D";
+ return "CompressedTexture2D";
}
bool ResourceImporterTexture::get_option_visibility(const String &p_path, const String &p_option, const Map<StringName, Variant> &p_options) const {
@@ -231,7 +231,7 @@ void ResourceImporterTexture::save_to_stex_format(FileAccess *f, const Ref<Image
bool lossless_force_png = ProjectSettings::get_singleton()->get("rendering/textures/lossless_compression/force_png") ||
!Image::_webp_mem_loader_func; // WebP module disabled.
bool use_webp = !lossless_force_png && p_image->get_width() <= 16383 && p_image->get_height() <= 16383; // WebP has a size limit
- f->store_32(use_webp ? StreamTexture2D::DATA_FORMAT_WEBP : StreamTexture2D::DATA_FORMAT_PNG);
+ f->store_32(use_webp ? CompressedTexture2D::DATA_FORMAT_WEBP : CompressedTexture2D::DATA_FORMAT_PNG);
f->store_16(p_image->get_width());
f->store_16(p_image->get_height());
f->store_32(p_image->get_mipmap_count());
@@ -253,7 +253,7 @@ void ResourceImporterTexture::save_to_stex_format(FileAccess *f, const Ref<Image
} break;
case COMPRESS_LOSSY: {
- f->store_32(StreamTexture2D::DATA_FORMAT_WEBP);
+ f->store_32(CompressedTexture2D::DATA_FORMAT_WEBP);
f->store_16(p_image->get_width());
f->store_16(p_image->get_height());
f->store_32(p_image->get_mipmap_count());
@@ -273,7 +273,7 @@ void ResourceImporterTexture::save_to_stex_format(FileAccess *f, const Ref<Image
image->compress_from_channels(p_compress_format, p_channels, p_lossy_quality);
- f->store_32(StreamTexture2D::DATA_FORMAT_IMAGE);
+ f->store_32(CompressedTexture2D::DATA_FORMAT_IMAGE);
f->store_16(image->get_width());
f->store_16(image->get_height());
f->store_32(image->get_mipmap_count());
@@ -285,7 +285,7 @@ void ResourceImporterTexture::save_to_stex_format(FileAccess *f, const Ref<Image
f->store_buffer(r, dl);
} break;
case COMPRESS_VRAM_UNCOMPRESSED: {
- f->store_32(StreamTexture2D::DATA_FORMAT_IMAGE);
+ f->store_32(CompressedTexture2D::DATA_FORMAT_IMAGE);
f->store_16(p_image->get_width());
f->store_16(p_image->get_height());
f->store_32(p_image->get_mipmap_count());
@@ -299,7 +299,7 @@ void ResourceImporterTexture::save_to_stex_format(FileAccess *f, const Ref<Image
} break;
case COMPRESS_BASIS_UNIVERSAL: {
- f->store_32(StreamTexture2D::DATA_FORMAT_BASIS_UNIVERSAL);
+ f->store_32(CompressedTexture2D::DATA_FORMAT_BASIS_UNIVERSAL);
f->store_16(p_image->get_width());
f->store_16(p_image->get_height());
f->store_32(p_image->get_mipmap_count());
@@ -326,26 +326,26 @@ void ResourceImporterTexture::_save_stex(const Ref<Image> &p_image, const String
f->store_8('2'); //godot streamable texture 2D
//format version
- f->store_32(StreamTexture2D::FORMAT_VERSION);
+ f->store_32(CompressedTexture2D::FORMAT_VERSION);
//texture may be resized later, so original size must be saved first
f->store_32(p_image->get_width());
f->store_32(p_image->get_height());
uint32_t flags = 0;
if (p_streamable) {
- flags |= StreamTexture2D::FORMAT_BIT_STREAM;
+ flags |= CompressedTexture2D::FORMAT_BIT_STREAM;
}
if (p_mipmaps) {
- flags |= StreamTexture2D::FORMAT_BIT_HAS_MIPMAPS; //mipmaps bit
+ flags |= CompressedTexture2D::FORMAT_BIT_HAS_MIPMAPS; //mipmaps bit
}
if (p_detect_3d) {
- flags |= StreamTexture2D::FORMAT_BIT_DETECT_3D;
+ flags |= CompressedTexture2D::FORMAT_BIT_DETECT_3D;
}
if (p_detect_roughness) {
- flags |= StreamTexture2D::FORMAT_BIT_DETECT_ROUGNESS;
+ flags |= CompressedTexture2D::FORMAT_BIT_DETECT_ROUGNESS;
}
if (p_detect_normal) {
- flags |= StreamTexture2D::FORMAT_BIT_DETECT_NORMAL;
+ flags |= CompressedTexture2D::FORMAT_BIT_DETECT_NORMAL;
}
f->store_32(flags);
@@ -540,19 +540,19 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String
if (!bptc_ldr && can_s3tc && is_ldr) {
image_compress_mode = Image::COMPRESS_S3TC;
}
- _save_stex(image, p_save_path + ".s3tc.stex", compress_mode, lossy, image_compress_mode, mipmaps, stream, detect_3d, detect_roughness, detect_normal, force_normal, srgb_friendly_pack, false, mipmap_limit, normal_image, roughness_channel);
+ _save_stex(image, p_save_path + ".s3tc.ctex", compress_mode, lossy, image_compress_mode, mipmaps, stream, detect_3d, detect_roughness, detect_normal, force_normal, srgb_friendly_pack, false, mipmap_limit, normal_image, roughness_channel);
r_platform_variants->push_back("s3tc");
formats_imported.push_back("s3tc");
}
if (ProjectSettings::get_singleton()->get("rendering/textures/vram_compression/import_etc2")) {
- _save_stex(image, p_save_path + ".etc2.stex", compress_mode, lossy, Image::COMPRESS_ETC2, mipmaps, stream, detect_3d, detect_roughness, detect_normal, force_normal, srgb_friendly_pack, true, mipmap_limit, normal_image, roughness_channel);
+ _save_stex(image, p_save_path + ".etc2.ctex", compress_mode, lossy, Image::COMPRESS_ETC2, mipmaps, stream, detect_3d, detect_roughness, detect_normal, force_normal, srgb_friendly_pack, true, mipmap_limit, normal_image, roughness_channel);
r_platform_variants->push_back("etc2");
formats_imported.push_back("etc2");
}
if (ProjectSettings::get_singleton()->get("rendering/textures/vram_compression/import_etc")) {
- _save_stex(image, p_save_path + ".etc.stex", compress_mode, lossy, Image::COMPRESS_ETC, mipmaps, stream, detect_3d, detect_roughness, detect_normal, force_normal, srgb_friendly_pack, true, mipmap_limit, normal_image, roughness_channel);
+ _save_stex(image, p_save_path + ".etc.ctex", compress_mode, lossy, Image::COMPRESS_ETC, mipmaps, stream, detect_3d, detect_roughness, detect_normal, force_normal, srgb_friendly_pack, true, mipmap_limit, normal_image, roughness_channel);
r_platform_variants->push_back("etc");
formats_imported.push_back("etc");
}
@@ -562,7 +562,7 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String
}
} else {
//import normally
- _save_stex(image, p_save_path + ".stex", compress_mode, lossy, Image::COMPRESS_S3TC /*this is ignored */, mipmaps, stream, detect_3d, detect_roughness, detect_normal, force_normal, srgb_friendly_pack, false, mipmap_limit, normal_image, roughness_channel);
+ _save_stex(image, p_save_path + ".ctex", compress_mode, lossy, Image::COMPRESS_S3TC /*this is ignored */, mipmaps, stream, detect_3d, detect_roughness, detect_normal, force_normal, srgb_friendly_pack, false, mipmap_limit, normal_image, roughness_channel);
}
if (r_metadata) {
@@ -638,9 +638,9 @@ ResourceImporterTexture *ResourceImporterTexture::singleton = nullptr;
ResourceImporterTexture::ResourceImporterTexture() {
singleton = this;
- StreamTexture2D::request_3d_callback = _texture_reimport_3d;
- StreamTexture2D::request_roughness_callback = _texture_reimport_roughness;
- StreamTexture2D::request_normal_callback = _texture_reimport_normal;
+ CompressedTexture2D::request_3d_callback = _texture_reimport_3d;
+ CompressedTexture2D::request_roughness_callback = _texture_reimport_roughness;
+ CompressedTexture2D::request_normal_callback = _texture_reimport_normal;
}
ResourceImporterTexture::~ResourceImporterTexture() {
diff --git a/editor/import/resource_importer_texture.h b/editor/import/resource_importer_texture.h
index ea2318fb33..bd43eaef58 100644
--- a/editor/import/resource_importer_texture.h
+++ b/editor/import/resource_importer_texture.h
@@ -37,7 +37,7 @@
#include "scene/resources/texture.h"
#include "servers/rendering_server.h"
-class StreamTexture2D;
+class CompressedTexture2D;
class ResourceImporterTexture : public ResourceImporter {
GDCLASS(ResourceImporterTexture, ResourceImporter);
@@ -67,9 +67,9 @@ protected:
Map<StringName, MakeInfo> make_flags;
- static void _texture_reimport_roughness(const Ref<StreamTexture2D> &p_tex, const String &p_normal_path, RenderingServer::TextureDetectRoughnessChannel p_channel);
- static void _texture_reimport_3d(const Ref<StreamTexture2D> &p_tex);
- static void _texture_reimport_normal(const Ref<StreamTexture2D> &p_tex);
+ static void _texture_reimport_roughness(const Ref<CompressedTexture2D> &p_tex, const String &p_normal_path, RenderingServer::TextureDetectRoughnessChannel p_channel);
+ static void _texture_reimport_3d(const Ref<CompressedTexture2D> &p_tex);
+ static void _texture_reimport_normal(const Ref<CompressedTexture2D> &p_tex);
static ResourceImporterTexture *singleton;
static const char *compression_formats[];
diff --git a/editor/import/scene_import_settings.cpp b/editor/import/scene_import_settings.cpp
index 4e06253041..f500268ad3 100644
--- a/editor/import/scene_import_settings.cpp
+++ b/editor/import/scene_import_settings.cpp
@@ -1269,8 +1269,8 @@ SceneImportSettings::SceneImportSettings() {
item_save_path = memnew(EditorFileDialog);
item_save_path->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
- item_save_path->add_filter("*.tres;Text Resource");
- item_save_path->add_filter("*.res;Binary Resource");
+ item_save_path->add_filter("*.tres; " + TTR("Text Resource"));
+ item_save_path->add_filter("*.res; " + TTR("Binary Resource"));
add_child(item_save_path);
item_save_path->connect("file_selected", callable_mp(this, &SceneImportSettings::_save_path_changed));
diff --git a/editor/localization_editor.cpp b/editor/localization_editor.cpp
index cd9986d527..a766650cd9 100644
--- a/editor/localization_editor.cpp
+++ b/editor/localization_editor.cpp
@@ -477,7 +477,7 @@ LocalizationEditor::LocalizationEditor() {
localization_changed = "localization_changed";
TabContainer *translations = memnew(TabContainer);
- translations->set_tab_alignment(TabContainer::ALIGNMENT_LEFT);
+ translations->set_tab_alignment(TabBar::ALIGNMENT_LEFT);
translations->set_v_size_flags(Control::SIZE_EXPAND_FILL);
add_child(translations);
diff --git a/editor/plugin_config_dialog.cpp b/editor/plugin_config_dialog.cpp
index 48ea3013f7..d5e7c312d9 100644
--- a/editor/plugin_config_dialog.cpp
+++ b/editor/plugin_config_dialog.cpp
@@ -117,7 +117,7 @@ void PluginConfigDialog::_on_required_text_changed(const String &) {
if (name_edit->get_text().is_empty()) {
is_valid = false;
name_validation->set_texture(invalid_icon);
- name_validation->set_tooltip(TTR("Plugin name cannot not be blank."));
+ name_validation->set_tooltip(TTR("Plugin name cannot be blank."));
}
if (script_edit->get_text().get_extension() != ext) {
is_valid = false;
@@ -127,7 +127,7 @@ void PluginConfigDialog::_on_required_text_changed(const String &) {
if (script_edit->get_text().get_basename().is_empty()) {
is_valid = false;
script_validation->set_texture(invalid_icon);
- script_validation->set_tooltip(TTR("Script name cannot not be blank."));
+ script_validation->set_tooltip(TTR("Script name cannot be blank."));
}
if (subfolder_edit->get_text().is_empty()) {
is_valid = false;
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index ad126d28f6..dd166ccd1d 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -547,6 +547,7 @@ void AnimationPlayerEditor::_animation_name_edited() {
Ref<Animation> anim = player->get_animation(current);
Ref<Animation> new_anim = _animation_clone(anim);
+ new_anim->set_name(new_name);
undo_redo->create_action(TTR("Duplicate Animation"));
undo_redo->add_do_method(player, "add_animation", new_name, new_anim);
diff --git a/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp b/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp
index affe10a01d..643a470425 100644
--- a/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp
+++ b/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp
@@ -152,7 +152,7 @@ void GPUParticlesCollisionSDF3DEditorPlugin::_sdf_save_path_and_bake(const Strin
}
config->set_value("remap", "importer", "3d_texture");
- config->set_value("remap", "type", "StreamTexture3D");
+ config->set_value("remap", "type", "CompressedTexture3D");
if (!config->has_section_key("params", "compress/mode")) {
config->set_value("params", "compress/mode", 3); //user may want another compression, so leave it be
}
diff --git a/editor/plugins/lightmap_gi_editor_plugin.cpp b/editor/plugins/lightmap_gi_editor_plugin.cpp
index 5992e52162..aef97f059a 100644
--- a/editor/plugins/lightmap_gi_editor_plugin.cpp
+++ b/editor/plugins/lightmap_gi_editor_plugin.cpp
@@ -138,7 +138,7 @@ LightmapGIEditorPlugin::LightmapGIEditorPlugin() {
file_dialog = memnew(EditorFileDialog);
file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
- file_dialog->add_filter("*.lmbake ; LightMap Bake");
+ file_dialog->add_filter("*.lmbake ; " + TTR("LightMap Bake"));
file_dialog->set_title(TTR("Select lightmap bake file:"));
file_dialog->connect("file_selected", callable_mp(this, &LightmapGIEditorPlugin::_bake_select_file));
bake->add_child(file_dialog);
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index 002c879cdc..17c6457444 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -2037,14 +2037,16 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
if (ED_IS_SHORTCUT("spatial_editor/cancel_transform", p_event) && _edit.mode != TRANSFORM_NONE) {
cancel_transform();
}
- if (ED_IS_SHORTCUT("spatial_editor/instant_translate", p_event)) {
- begin_transform(TRANSFORM_TRANSLATE, true);
- }
- if (ED_IS_SHORTCUT("spatial_editor/instant_rotate", p_event)) {
- begin_transform(TRANSFORM_ROTATE, true);
- }
- if (ED_IS_SHORTCUT("spatial_editor/instant_scale", p_event)) {
- begin_transform(TRANSFORM_SCALE, true);
+ if (!is_freelook_active()) {
+ if (ED_IS_SHORTCUT("spatial_editor/instant_translate", p_event)) {
+ begin_transform(TRANSFORM_TRANSLATE, true);
+ }
+ if (ED_IS_SHORTCUT("spatial_editor/instant_rotate", p_event)) {
+ begin_transform(TRANSFORM_ROTATE, true);
+ }
+ if (ED_IS_SHORTCUT("spatial_editor/instant_scale", p_event)) {
+ begin_transform(TRANSFORM_SCALE, true);
+ }
}
// Freelook doesn't work in orthogonal mode.
@@ -6920,19 +6922,19 @@ void Node3DEditor::_add_environment_to_scene(bool p_already_added_sun) {
}
void Node3DEditor::_update_theme() {
- tool_button[Node3DEditor::TOOL_MODE_SELECT]->set_icon(get_theme_icon(SNAME("ToolSelect"), SNAME("EditorIcons")));
- tool_button[Node3DEditor::TOOL_MODE_MOVE]->set_icon(get_theme_icon(SNAME("ToolMove"), SNAME("EditorIcons")));
- tool_button[Node3DEditor::TOOL_MODE_ROTATE]->set_icon(get_theme_icon(SNAME("ToolRotate"), SNAME("EditorIcons")));
- tool_button[Node3DEditor::TOOL_MODE_SCALE]->set_icon(get_theme_icon(SNAME("ToolScale"), SNAME("EditorIcons")));
- tool_button[Node3DEditor::TOOL_MODE_LIST_SELECT]->set_icon(get_theme_icon(SNAME("ListSelect"), SNAME("EditorIcons")));
- tool_button[Node3DEditor::TOOL_LOCK_SELECTED]->set_icon(get_theme_icon(SNAME("Lock"), SNAME("EditorIcons")));
- tool_button[Node3DEditor::TOOL_UNLOCK_SELECTED]->set_icon(get_theme_icon(SNAME("Unlock"), SNAME("EditorIcons")));
- tool_button[Node3DEditor::TOOL_GROUP_SELECTED]->set_icon(get_theme_icon(SNAME("Group"), SNAME("EditorIcons")));
- tool_button[Node3DEditor::TOOL_UNGROUP_SELECTED]->set_icon(get_theme_icon(SNAME("Ungroup"), SNAME("EditorIcons")));
-
- tool_option_button[Node3DEditor::TOOL_OPT_LOCAL_COORDS]->set_icon(get_theme_icon(SNAME("Object"), SNAME("EditorIcons")));
- tool_option_button[Node3DEditor::TOOL_OPT_USE_SNAP]->set_icon(get_theme_icon(SNAME("Snap"), SNAME("EditorIcons")));
- tool_option_button[Node3DEditor::TOOL_OPT_OVERRIDE_CAMERA]->set_icon(get_theme_icon(SNAME("Camera3D"), SNAME("EditorIcons")));
+ tool_button[TOOL_MODE_SELECT]->set_icon(get_theme_icon(SNAME("ToolSelect"), SNAME("EditorIcons")));
+ tool_button[TOOL_MODE_MOVE]->set_icon(get_theme_icon(SNAME("ToolMove"), SNAME("EditorIcons")));
+ tool_button[TOOL_MODE_ROTATE]->set_icon(get_theme_icon(SNAME("ToolRotate"), SNAME("EditorIcons")));
+ tool_button[TOOL_MODE_SCALE]->set_icon(get_theme_icon(SNAME("ToolScale"), SNAME("EditorIcons")));
+ tool_button[TOOL_MODE_LIST_SELECT]->set_icon(get_theme_icon(SNAME("ListSelect"), SNAME("EditorIcons")));
+ tool_button[TOOL_LOCK_SELECTED]->set_icon(get_theme_icon(SNAME("Lock"), SNAME("EditorIcons")));
+ tool_button[TOOL_UNLOCK_SELECTED]->set_icon(get_theme_icon(SNAME("Unlock"), SNAME("EditorIcons")));
+ tool_button[TOOL_GROUP_SELECTED]->set_icon(get_theme_icon(SNAME("Group"), SNAME("EditorIcons")));
+ tool_button[TOOL_UNGROUP_SELECTED]->set_icon(get_theme_icon(SNAME("Ungroup"), SNAME("EditorIcons")));
+
+ tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_icon(get_theme_icon(SNAME("Object"), SNAME("EditorIcons")));
+ tool_option_button[TOOL_OPT_USE_SNAP]->set_icon(get_theme_icon(SNAME("Snap"), SNAME("EditorIcons")));
+ tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->set_icon(get_theme_icon(SNAME("Camera3D"), SNAME("EditorIcons")));
view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_1_VIEWPORT), get_theme_icon(SNAME("Panels1"), SNAME("EditorIcons")));
view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS), get_theme_icon(SNAME("Panels2"), SNAME("EditorIcons")));
diff --git a/editor/plugins/ot_features_plugin.cpp b/editor/plugins/ot_features_plugin.cpp
index f8e6054848..9cd428a2d4 100644
--- a/editor/plugins/ot_features_plugin.cpp
+++ b/editor/plugins/ot_features_plugin.cpp
@@ -53,7 +53,7 @@ void OpenTypeFeaturesEditor::_notification(int p_what) {
button->set_icon(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")));
button->set_size(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons"))->get_size());
- spin->set_custom_label_color(true, base);
+ spin->add_theme_color_override("label_color", base);
} break;
}
}
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 30c2b12519..43467a6c41 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -407,8 +407,8 @@ void ScriptEditor::_breaked(bool p_breaked, bool p_can_debug) {
return;
}
- for (int i = 0; i < tab_container->get_child_count(); i++) {
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i));
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (!se) {
continue;
}
@@ -447,8 +447,8 @@ void ScriptEditor::_goto_script_line(REF p_script, int p_line) {
void ScriptEditor::_set_execution(REF p_script, int p_line) {
Ref<Script> script = Object::cast_to<Script>(*p_script);
if (script.is_valid() && (script->has_source_code() || script->get_path().is_resource_file())) {
- for (int i = 0; i < tab_container->get_child_count(); i++) {
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i));
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (!se) {
continue;
}
@@ -463,8 +463,8 @@ void ScriptEditor::_set_execution(REF p_script, int p_line) {
void ScriptEditor::_clear_execution(REF p_script) {
Ref<Script> script = Object::cast_to<Script>(*p_script);
if (script.is_valid() && (script->has_source_code() || script->get_path().is_resource_file())) {
- for (int i = 0; i < tab_container->get_child_count(); i++) {
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i));
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (!se) {
continue;
}
@@ -480,8 +480,8 @@ void ScriptEditor::_set_breakpoint(REF p_script, int p_line, bool p_enabled) {
Ref<Script> script = Object::cast_to<Script>(*p_script);
if (script.is_valid() && (script->has_source_code() || script->get_path().is_resource_file())) {
// Update if open.
- for (int i = 0; i < tab_container->get_child_count(); i++) {
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i));
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (se && se->get_edited_resource()->get_path() == script->get_path()) {
se->set_breakpoint(p_line, p_enabled);
return;
@@ -509,8 +509,8 @@ void ScriptEditor::_set_breakpoint(REF p_script, int p_line, bool p_enabled) {
}
void ScriptEditor::_clear_breakpoints() {
- for (int i = 0; i < tab_container->get_child_count(); i++) {
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i));
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (se) {
se->clear_breakpoints();
}
@@ -547,11 +547,11 @@ Array ScriptEditor::_get_cached_breakpoints_for_script(const String &p_path) con
ScriptEditorBase *ScriptEditor::_get_current_editor() const {
int selected = tab_container->get_current_tab();
- if (selected < 0 || selected >= tab_container->get_child_count()) {
+ if (selected < 0 || selected >= tab_container->get_tab_count()) {
return nullptr;
}
- return Object::cast_to<ScriptEditorBase>(tab_container->get_child(selected));
+ return Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(selected));
}
void ScriptEditor::_update_history_arrows() {
@@ -590,7 +590,7 @@ void ScriptEditor::_go_to_tab(int p_idx) {
}
}
- Control *c = Object::cast_to<Control>(tab_container->get_child(p_idx));
+ Control *c = Object::cast_to<Control>(tab_container->get_tab_control(p_idx));
if (!c) {
return;
}
@@ -682,7 +682,7 @@ void ScriptEditor::_update_recent_scripts() {
recent_scripts->add_shortcut(ED_SHORTCUT("script_editor/clear_recent", TTR("Clear Recent Files")));
recent_scripts->set_item_disabled(recent_scripts->get_item_id(recent_scripts->get_item_count() - 1), rc.is_empty());
- recent_scripts->set_as_minsize();
+ recent_scripts->reset_size();
}
void ScriptEditor::_open_recent_script(int p_idx) {
@@ -750,11 +750,11 @@ void ScriptEditor::_show_error_dialog(String p_path) {
void ScriptEditor::_close_tab(int p_idx, bool p_save, bool p_history_back) {
int selected = p_idx;
- if (selected < 0 || selected >= tab_container->get_child_count()) {
+ if (selected < 0 || selected >= tab_container->get_tab_count()) {
return;
}
- Node *tselected = tab_container->get_child(selected);
+ Node *tselected = tab_container->get_tab_control(selected);
ScriptEditorBase *current = Object::cast_to<ScriptEditorBase>(tselected);
if (current) {
@@ -805,12 +805,12 @@ void ScriptEditor::_close_tab(int p_idx, bool p_save, bool p_history_back) {
_save_editor_state(current);
}
memdelete(tselected);
- if (idx >= tab_container->get_child_count()) {
- idx = tab_container->get_child_count() - 1;
+ if (idx >= tab_container->get_tab_count()) {
+ idx = tab_container->get_tab_count() - 1;
}
if (idx >= 0) {
if (history_pos >= 0) {
- idx = history[history_pos].control->get_index();
+ idx = tab_container->get_tab_idx_from_control(history[history_pos].control);
}
tab_container->set_current_tab(idx);
} else {
@@ -836,9 +836,9 @@ void ScriptEditor::_close_discard_current_tab(const String &p_str) {
}
void ScriptEditor::_close_docs_tab() {
- int child_count = tab_container->get_child_count();
+ int child_count = tab_container->get_tab_count();
for (int i = child_count - 1; i >= 0; i--) {
- EditorHelp *se = Object::cast_to<EditorHelp>(tab_container->get_child(i));
+ EditorHelp *se = Object::cast_to<EditorHelp>(tab_container->get_tab_control(i));
if (se) {
_close_tab(i, true, false);
@@ -856,7 +856,7 @@ void ScriptEditor::_copy_script_path() {
void ScriptEditor::_close_other_tabs() {
int current_idx = tab_container->get_current_tab();
- for (int i = tab_container->get_child_count() - 1; i >= 0; i--) {
+ for (int i = tab_container->get_tab_count() - 1; i >= 0; i--) {
if (i != current_idx) {
script_close_queue.push_back(i);
}
@@ -865,7 +865,7 @@ void ScriptEditor::_close_other_tabs() {
}
void ScriptEditor::_close_all_tabs() {
- for (int i = tab_container->get_child_count() - 1; i >= 0; i--) {
+ for (int i = tab_container->get_tab_count() - 1; i >= 0; i--) {
script_close_queue.push_back(i);
}
_queue_close_tabs();
@@ -877,7 +877,7 @@ void ScriptEditor::_queue_close_tabs() {
script_close_queue.pop_front();
tab_container->set_current_tab(idx);
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(idx));
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(idx));
if (se) {
// Maybe there are unsaved changes.
if (se->is_unsaved()) {
@@ -900,8 +900,8 @@ void ScriptEditor::_ask_close_current_unsaved_tab(ScriptEditorBase *current) {
void ScriptEditor::_resave_scripts(const String &p_str) {
apply_scripts();
- for (int i = 0; i < tab_container->get_child_count(); i++) {
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i));
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (!se) {
continue;
}
@@ -941,8 +941,8 @@ void ScriptEditor::_resave_scripts(const String &p_str) {
}
void ScriptEditor::_reload_scripts() {
- for (int i = 0; i < tab_container->get_child_count(); i++) {
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i));
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (!se) {
continue;
}
@@ -985,8 +985,8 @@ void ScriptEditor::_reload_scripts() {
}
void ScriptEditor::_res_saved_callback(const Ref<Resource> &p_res) {
- for (int i = 0; i < tab_container->get_child_count(); i++) {
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i));
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (!se) {
continue;
}
@@ -1004,8 +1004,8 @@ void ScriptEditor::_res_saved_callback(const Ref<Resource> &p_res) {
void ScriptEditor::_scene_saved_callback(const String &p_path) {
// If scene was saved, mark all built-in scripts from that scene as saved.
- for (int i = 0; i < tab_container->get_child_count(); i++) {
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i));
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (!se) {
continue;
}
@@ -1048,8 +1048,8 @@ bool ScriptEditor::_test_script_times_on_disk(RES p_for_script) {
bool need_reload = false;
bool use_autoreload = bool(EDITOR_DEF("text_editor/behavior/files/auto_reload_scripts_on_external_change", false));
- for (int i = 0; i < tab_container->get_child_count(); i++) {
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i));
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (se) {
RES edited_res = se->get_edited_resource();
if (p_for_script.is_valid() && edited_res.is_valid() && p_for_script != edited_res) {
@@ -1429,7 +1429,7 @@ void ScriptEditor::_menu_option(int p_option) {
file_system_dock->navigate_to_path(path);
// Ensure that the FileSystem dock is visible.
TabContainer *tab_container = (TabContainer *)file_system_dock->get_parent_control();
- tab_container->set_current_tab(file_system_dock->get_index());
+ tab_container->set_current_tab(tab_container->get_tab_idx_from_control(file_system_dock));
}
} break;
case CLOSE_DOCS: {
@@ -1449,7 +1449,7 @@ void ScriptEditor::_menu_option(int p_option) {
}
} break;
case WINDOW_MOVE_DOWN: {
- if (tab_container->get_current_tab() < tab_container->get_child_count() - 1) {
+ if (tab_container->get_current_tab() < tab_container->get_tab_count() - 1) {
tab_container->move_child(current, tab_container->get_current_tab() + 1);
tab_container->set_current_tab(tab_container->get_current_tab() + 1);
_update_script_names();
@@ -1495,7 +1495,7 @@ void ScriptEditor::_menu_option(int p_option) {
}
} break;
case WINDOW_MOVE_DOWN: {
- if (tab_container->get_current_tab() < tab_container->get_child_count() - 1) {
+ if (tab_container->get_current_tab() < tab_container->get_tab_count() - 1) {
tab_container->move_child(help, tab_container->get_current_tab() + 1);
tab_container->set_current_tab(tab_container->get_current_tab() + 1);
_update_script_names();
@@ -1545,9 +1545,9 @@ void ScriptEditor::_show_save_theme_as_dialog() {
}
bool ScriptEditor::_has_docs_tab() const {
- const int child_count = tab_container->get_child_count();
+ const int child_count = tab_container->get_tab_count();
for (int i = 0; i < child_count; i++) {
- if (Object::cast_to<EditorHelp>(tab_container->get_child(i))) {
+ if (Object::cast_to<EditorHelp>(tab_container->get_tab_control(i))) {
return true;
}
}
@@ -1555,9 +1555,9 @@ bool ScriptEditor::_has_docs_tab() const {
}
bool ScriptEditor::_has_script_tab() const {
- const int child_count = tab_container->get_child_count();
+ const int child_count = tab_container->get_tab_count();
for (int i = 0; i < child_count; i++) {
- if (Object::cast_to<ScriptEditorBase>(tab_container->get_child(i))) {
+ if (Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i))) {
return true;
}
}
@@ -1581,9 +1581,9 @@ void ScriptEditor::_prepare_file_menu() {
menu->set_item_disabled(menu->get_item_index(WINDOW_PREV), history_pos <= 0);
menu->set_item_disabled(menu->get_item_index(WINDOW_NEXT), history_pos >= history.size() - 1);
- menu->set_item_disabled(menu->get_item_index(FILE_CLOSE), tab_container->get_child_count() < 1);
- menu->set_item_disabled(menu->get_item_index(CLOSE_ALL), tab_container->get_child_count() < 1);
- menu->set_item_disabled(menu->get_item_index(CLOSE_OTHER_TABS), tab_container->get_child_count() <= 1);
+ menu->set_item_disabled(menu->get_item_index(FILE_CLOSE), tab_container->get_tab_count() < 1);
+ menu->set_item_disabled(menu->get_item_index(CLOSE_ALL), tab_container->get_tab_count() < 1);
+ menu->set_item_disabled(menu->get_item_index(CLOSE_OTHER_TABS), tab_container->get_tab_count() <= 1);
menu->set_item_disabled(menu->get_item_index(CLOSE_DOCS), !_has_docs_tab());
menu->set_item_disabled(menu->get_item_index(FILE_RUN), current_is_doc);
@@ -1635,7 +1635,7 @@ void ScriptEditor::_notification(int p_what) {
filename->add_theme_style_override("normal", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("normal"), SNAME("LineEdit")));
- recent_scripts->set_as_minsize();
+ recent_scripts->reset_size();
if (is_inside_tree()) {
_update_script_colors();
@@ -1682,8 +1682,8 @@ bool ScriptEditor::can_take_away_focus() const {
}
void ScriptEditor::close_builtin_scripts_from_scene(const String &p_scene) {
- for (int i = 0; i < tab_container->get_child_count(); i++) {
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i));
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (se) {
Ref<Script> script = se->get_edited_resource();
@@ -1713,8 +1713,8 @@ void ScriptEditor::notify_script_changed(const Ref<Script> &p_script) {
void ScriptEditor::get_breakpoints(List<String> *p_breakpoints) {
Set<String> loaded_scripts;
- for (int i = 0; i < tab_container->get_child_count(); i++) {
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i));
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (!se) {
continue;
}
@@ -1766,7 +1766,7 @@ void ScriptEditor::_members_overview_selected(int p_idx) {
}
void ScriptEditor::_help_overview_selected(int p_idx) {
- Node *current = tab_container->get_child(tab_container->get_current_tab());
+ Node *current = tab_container->get_tab_control(tab_container->get_current_tab());
EditorHelp *se = Object::cast_to<EditorHelp>(current);
if (!se) {
return;
@@ -1782,7 +1782,7 @@ void ScriptEditor::_script_selected(int p_idx) {
}
void ScriptEditor::ensure_select_current() {
- if (tab_container->get_child_count() && tab_container->get_current_tab() >= 0) {
+ if (tab_container->get_tab_count() && tab_container->get_current_tab() >= 0) {
ScriptEditorBase *se = _get_current_editor();
if (se) {
se->enable_editor();
@@ -1893,12 +1893,12 @@ void ScriptEditor::_update_members_overview() {
void ScriptEditor::_update_help_overview_visibility() {
int selected = tab_container->get_current_tab();
- if (selected < 0 || selected >= tab_container->get_child_count()) {
+ if (selected < 0 || selected >= tab_container->get_tab_count()) {
help_overview->set_visible(false);
return;
}
- Node *current = tab_container->get_child(tab_container->get_current_tab());
+ Node *current = tab_container->get_tab_control(tab_container->get_current_tab());
EditorHelp *se = Object::cast_to<EditorHelp>(current);
if (!se) {
help_overview->set_visible(false);
@@ -1920,11 +1920,11 @@ void ScriptEditor::_update_help_overview() {
help_overview->clear();
int selected = tab_container->get_current_tab();
- if (selected < 0 || selected >= tab_container->get_child_count()) {
+ if (selected < 0 || selected >= tab_container->get_tab_count()) {
return;
}
- Node *current = tab_container->get_child(tab_container->get_current_tab());
+ Node *current = tab_container->get_tab_control(tab_container->get_current_tab());
EditorHelp *se = Object::cast_to<EditorHelp>(current);
if (!se) {
return;
@@ -1947,7 +1947,7 @@ void ScriptEditor::_update_script_colors() {
for (int i = 0; i < script_list->get_item_count(); i++) {
int c = script_list->get_item_metadata(i);
- Node *n = tab_container->get_child(c);
+ Node *n = tab_container->get_tab_control(c);
if (!n) {
continue;
}
@@ -1990,8 +1990,8 @@ void ScriptEditor::_update_script_names() {
Vector<_ScriptEditorItemData> sedata;
- for (int i = 0; i < tab_container->get_child_count(); i++) {
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i));
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (se) {
Ref<Texture2D> icon = se->get_theme_icon();
String path = se->get_edited_resource()->get_path();
@@ -2080,7 +2080,7 @@ void ScriptEditor::_update_script_names() {
}
}
- EditorHelp *eh = Object::cast_to<EditorHelp>(tab_container->get_child(i));
+ EditorHelp *eh = Object::cast_to<EditorHelp>(tab_container->get_tab_control(i));
if (eh) {
String name = eh->get_class();
Ref<Texture2D> icon = get_theme_icon(SNAME("Help"), SNAME("EditorIcons"));
@@ -2172,8 +2172,8 @@ void ScriptEditor::_update_script_names() {
}
void ScriptEditor::_update_script_connections() {
- for (int i = 0; i < tab_container->get_child_count(); i++) {
- ScriptTextEditor *ste = Object::cast_to<ScriptTextEditor>(tab_container->get_child(i));
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
+ ScriptTextEditor *ste = Object::cast_to<ScriptTextEditor>(tab_container->get_tab_control(i));
if (!ste) {
continue;
}
@@ -2322,8 +2322,8 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra
WARN_PRINT("Couldn't open external text editor, using internal");
}
- for (int i = 0; i < tab_container->get_child_count(); i++) {
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i));
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (!se) {
continue;
}
@@ -2498,8 +2498,8 @@ void ScriptEditor::save_current_script() {
void ScriptEditor::save_all_scripts() {
Vector<String> scenes_to_save;
- for (int i = 0; i < tab_container->get_child_count(); i++) {
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i));
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (!se) {
continue;
}
@@ -2574,8 +2574,8 @@ void ScriptEditor::save_all_scripts() {
}
void ScriptEditor::apply_scripts() const {
- for (int i = 0; i < tab_container->get_child_count(); i++) {
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i));
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (!se) {
continue;
}
@@ -2624,8 +2624,8 @@ RES ScriptEditor::open_file(const String &p_file) {
}
void ScriptEditor::_editor_stop() {
- for (int i = 0; i < tab_container->get_child_count(); i++) {
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i));
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (!se) {
continue;
}
@@ -2641,8 +2641,8 @@ void ScriptEditor::_add_callback(Object *p_obj, const String &p_function, const
EditorNode::get_singleton()->push_item(script.ptr());
- for (int i = 0; i < tab_container->get_child_count(); i++) {
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i));
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (!se) {
continue;
}
@@ -2712,8 +2712,8 @@ void ScriptEditor::_editor_settings_changed() {
EditorSettings::get_singleton()->load_text_editor_theme();
}
- for (int i = 0; i < tab_container->get_child_count(); i++) {
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i));
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (!se) {
continue;
}
@@ -2751,8 +2751,8 @@ void ScriptEditor::_files_moved(const String &p_old_file, const String &p_new_fi
}
void ScriptEditor::_file_removed(const String &p_removed_file) {
- for (int i = 0; i < tab_container->get_child_count(); i++) {
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i));
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (!se) {
continue;
}
@@ -2815,11 +2815,11 @@ void ScriptEditor::_split_dragged(float) {
}
Variant ScriptEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
- if (tab_container->get_child_count() == 0) {
+ if (tab_container->get_tab_count() == 0) {
return Variant();
}
- Node *cur_node = tab_container->get_child(tab_container->get_current_tab());
+ Node *cur_node = tab_container->get_tab_control(tab_container->get_current_tab());
HBoxContainer *drag_preview = memnew(HBoxContainer);
String preview_name = "";
@@ -2975,7 +2975,7 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co
if (script_list->get_item_count() > 0) {
new_index = script_list->get_item_metadata(script_list->get_item_at_position(p_point));
}
- int num_tabs_before = tab_container->get_child_count();
+ int num_tabs_before = tab_container->get_tab_count();
for (int i = 0; i < files.size(); i++) {
String file = files[i];
if (file.is_empty() || !FileAccess::exists(file)) {
@@ -2988,11 +2988,11 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co
RES res = open_file(file);
if (res.is_valid()) {
- if (tab_container->get_child_count() > num_tabs_before) {
- tab_container->move_child(tab_container->get_child(tab_container->get_child_count() - 1), new_index);
- num_tabs_before = tab_container->get_child_count();
+ if (tab_container->get_tab_count() > num_tabs_before) {
+ tab_container->move_child(tab_container->get_tab_control(tab_container->get_tab_count() - 1), new_index);
+ num_tabs_before = tab_container->get_tab_count();
} else { /* Maybe script was already open */
- tab_container->move_child(tab_container->get_child(tab_container->get_current_tab()), new_index);
+ tab_container->move_child(tab_container->get_tab_control(tab_container->get_current_tab()), new_index);
}
}
}
@@ -3081,11 +3081,11 @@ void ScriptEditor::_make_script_list_context_menu() {
context_menu->clear();
int selected = tab_container->get_current_tab();
- if (selected < 0 || selected >= tab_container->get_child_count()) {
+ if (selected < 0 || selected >= tab_container->get_tab_count()) {
return;
}
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(selected));
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(selected));
if (se) {
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/save"), FILE_SAVE);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/save_as"), FILE_SAVE_AS);
@@ -3113,11 +3113,11 @@ void ScriptEditor::_make_script_list_context_menu() {
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/window_sort"), WINDOW_SORT);
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/toggle_scripts_panel"), TOGGLE_SCRIPTS_PANEL);
- context_menu->set_item_disabled(context_menu->get_item_index(CLOSE_ALL), tab_container->get_child_count() <= 0);
- context_menu->set_item_disabled(context_menu->get_item_index(CLOSE_OTHER_TABS), tab_container->get_child_count() <= 1);
+ context_menu->set_item_disabled(context_menu->get_item_index(CLOSE_ALL), tab_container->get_tab_count() <= 0);
+ context_menu->set_item_disabled(context_menu->get_item_index(CLOSE_OTHER_TABS), tab_container->get_tab_count() <= 1);
context_menu->set_item_disabled(context_menu->get_item_index(WINDOW_MOVE_UP), tab_container->get_current_tab() <= 0);
- context_menu->set_item_disabled(context_menu->get_item_index(WINDOW_MOVE_DOWN), tab_container->get_current_tab() >= tab_container->get_child_count() - 1);
- context_menu->set_item_disabled(context_menu->get_item_index(WINDOW_SORT), tab_container->get_child_count() <= 1);
+ context_menu->set_item_disabled(context_menu->get_item_index(WINDOW_MOVE_DOWN), tab_container->get_current_tab() >= tab_container->get_tab_count() - 1);
+ context_menu->set_item_disabled(context_menu->get_item_index(WINDOW_SORT), tab_container->get_tab_count() <= 1);
context_menu->set_position(get_screen_position() + get_local_mouse_position());
context_menu->reset_size();
@@ -3181,7 +3181,7 @@ void ScriptEditor::set_window_layout(Ref<ConfigFile> p_layout) {
}
if (!script_info.is_empty()) {
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(tab_container->get_tab_count() - 1));
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(tab_container->get_tab_count() - 1));
if (se) {
se->set_edit_state(script_info["state"]);
}
@@ -3196,8 +3196,8 @@ void ScriptEditor::set_window_layout(Ref<ConfigFile> p_layout) {
_help_class_open(path);
}
- for (int i = 0; i < tab_container->get_child_count(); i++) {
- tab_container->get_child(i)->set_meta("__editor_pass", Variant());
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
+ tab_container->get_tab_control(i)->set_meta("__editor_pass", Variant());
}
if (p_layout->has_section_key("ScriptEditor", "script_split_offset")) {
@@ -3237,8 +3237,8 @@ void ScriptEditor::get_window_layout(Ref<ConfigFile> p_layout) {
Array scripts;
Array helps;
- for (int i = 0; i < tab_container->get_child_count(); i++) {
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i));
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (se) {
String path = se->get_edited_resource()->get_path();
if (!path.is_resource_file()) {
@@ -3249,7 +3249,7 @@ void ScriptEditor::get_window_layout(Ref<ConfigFile> p_layout) {
scripts.push_back(path);
}
- EditorHelp *eh = Object::cast_to<EditorHelp>(tab_container->get_child(i));
+ EditorHelp *eh = Object::cast_to<EditorHelp>(tab_container->get_tab_control(i));
if (eh) {
helps.push_back(eh->get_class());
@@ -3270,8 +3270,8 @@ void ScriptEditor::_help_class_open(const String &p_class) {
return;
}
- for (int i = 0; i < tab_container->get_child_count(); i++) {
- EditorHelp *eh = Object::cast_to<EditorHelp>(tab_container->get_child(i));
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
+ EditorHelp *eh = Object::cast_to<EditorHelp>(tab_container->get_tab_control(i));
if (eh && eh->get_class() == p_class) {
_go_to_tab(i);
@@ -3296,8 +3296,8 @@ void ScriptEditor::_help_class_open(const String &p_class) {
void ScriptEditor::_help_class_goto(const String &p_desc) {
String cname = p_desc.get_slice(":", 1);
- for (int i = 0; i < tab_container->get_child_count(); i++) {
- EditorHelp *eh = Object::cast_to<EditorHelp>(tab_container->get_child(i));
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
+ EditorHelp *eh = Object::cast_to<EditorHelp>(tab_container->get_tab_control(i));
if (eh && eh->get_class() == cname) {
_go_to_tab(i);
@@ -3323,8 +3323,8 @@ void ScriptEditor::_help_class_goto(const String &p_desc) {
void ScriptEditor::update_doc(const String &p_name) {
ERR_FAIL_COND(!EditorHelp::get_doc_data()->has_doc(p_name));
- for (int i = 0; i < tab_container->get_child_count(); i++) {
- EditorHelp *eh = Object::cast_to<EditorHelp>(tab_container->get_child(i));
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
+ EditorHelp *eh = Object::cast_to<EditorHelp>(tab_container->get_tab_control(i));
if (eh && eh->get_class() == p_name) {
eh->update_doc();
return;
@@ -3333,10 +3333,10 @@ void ScriptEditor::update_doc(const String &p_name) {
}
void ScriptEditor::_update_selected_editor_menu() {
- for (int i = 0; i < tab_container->get_child_count(); i++) {
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
bool current = tab_container->get_current_tab() == i;
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i));
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (se && se->get_edit_menu()) {
if (current) {
se->get_edit_menu()->show();
@@ -3356,7 +3356,7 @@ void ScriptEditor::_update_selected_editor_menu() {
script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_in_files", TTR("Find in Files"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::F), SEARCH_IN_FILES);
script_search_menu->show();
} else {
- if (tab_container->get_child_count() == 0) {
+ if (tab_container->get_tab_count() == 0) {
script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_in_files", TTR("Find in Files"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::F), SEARCH_IN_FILES);
script_search_menu->show();
} else {
@@ -3376,7 +3376,7 @@ void ScriptEditor::_update_history_pos(int p_new_pos) {
}
history_pos = p_new_pos;
- tab_container->set_current_tab(history[history_pos].control->get_index());
+ tab_container->set_current_tab(tab_container->get_tab_idx_from_control(history[history_pos].control));
n = history[history_pos].control;
@@ -3416,8 +3416,8 @@ void ScriptEditor::_history_back() {
Vector<Ref<Script>> ScriptEditor::get_open_scripts() const {
Vector<Ref<Script>> out_scripts = Vector<Ref<Script>>();
- for (int i = 0; i < tab_container->get_child_count(); i++) {
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i));
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (!se) {
continue;
}
@@ -3433,8 +3433,8 @@ Vector<Ref<Script>> ScriptEditor::get_open_scripts() const {
Array ScriptEditor::_get_open_script_editors() const {
Array script_editors;
- for (int i = 0; i < tab_container->get_child_count(); i++) {
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i));
+ for (int i = 0; i < tab_container->get_tab_count(); i++) {
+ ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (!se) {
continue;
}
diff --git a/editor/plugins/sprite_2d_editor_plugin.cpp b/editor/plugins/sprite_2d_editor_plugin.cpp
index 3489ac2c1e..6a63875324 100644
--- a/editor/plugins/sprite_2d_editor_plugin.cpp
+++ b/editor/plugins/sprite_2d_editor_plugin.cpp
@@ -122,8 +122,8 @@ void Sprite2DEditor::_menu_option(int p_option) {
switch (p_option) {
case MENU_OPTION_CONVERT_TO_MESH_2D: {
- debug_uv_dialog->get_ok_button()->set_text(TTR("Create Mesh2D"));
- debug_uv_dialog->set_title(TTR("Mesh2D Preview"));
+ debug_uv_dialog->get_ok_button()->set_text(TTR("Create MeshInstance2D"));
+ debug_uv_dialog->set_title(TTR("MeshInstance2D Preview"));
_update_mesh_data();
debug_uv_dialog->popup_centered();
@@ -338,7 +338,7 @@ void Sprite2DEditor::_convert_to_mesh_2d_node() {
mesh_instance->set_mesh(mesh);
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
- ur->create_action(TTR("Convert to Mesh2D"));
+ ur->create_action(TTR("Convert to MeshInstance2D"));
ur->add_do_method(SceneTreeDock::get_singleton(), "replace_node", node, mesh_instance, true, false);
ur->add_do_reference(mesh_instance);
ur->add_undo_method(SceneTreeDock::get_singleton(), "replace_node", mesh_instance, node, false, false);
@@ -498,6 +498,20 @@ void Sprite2DEditor::_debug_uv_draw() {
}
}
+void Sprite2DEditor::_notification(int p_what) {
+ switch (p_what) {
+ case NOTIFICATION_ENTER_TREE:
+ case NOTIFICATION_THEME_CHANGED: {
+ options->set_icon(get_theme_icon(SNAME("Sprite2D"), SNAME("EditorIcons")));
+
+ options->get_popup()->set_item_icon(MENU_OPTION_CONVERT_TO_MESH_2D, get_theme_icon(SNAME("MeshInstance2D"), SNAME("EditorIcons")));
+ options->get_popup()->set_item_icon(MENU_OPTION_CONVERT_TO_POLYGON_2D, get_theme_icon(SNAME("Polygon2D"), SNAME("EditorIcons")));
+ options->get_popup()->set_item_icon(MENU_OPTION_CREATE_COLLISION_POLY_2D, get_theme_icon(SNAME("CollisionPolygon2D"), SNAME("EditorIcons")));
+ options->get_popup()->set_item_icon(MENU_OPTION_CREATE_LIGHT_OCCLUDER_2D, get_theme_icon(SNAME("LightOccluder2D"), SNAME("EditorIcons")));
+ } break;
+ }
+}
+
void Sprite2DEditor::_bind_methods() {
ClassDB::bind_method("_add_as_sibling_or_child", &Sprite2DEditor::_add_as_sibling_or_child);
}
@@ -508,9 +522,8 @@ Sprite2DEditor::Sprite2DEditor() {
CanvasItemEditor::get_singleton()->add_control_to_menu_panel(options);
options->set_text(TTR("Sprite2D"));
- options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("Sprite2D"), SNAME("EditorIcons")));
- options->get_popup()->add_item(TTR("Convert to Mesh2D"), MENU_OPTION_CONVERT_TO_MESH_2D);
+ options->get_popup()->add_item(TTR("Convert to MeshInstance2D"), MENU_OPTION_CONVERT_TO_MESH_2D);
options->get_popup()->add_item(TTR("Convert to Polygon2D"), MENU_OPTION_CONVERT_TO_POLYGON_2D);
options->get_popup()->add_item(TTR("Create CollisionPolygon2D Sibling"), MENU_OPTION_CREATE_COLLISION_POLY_2D);
options->get_popup()->add_item(TTR("Create LightOccluder2D Sibling"), MENU_OPTION_CREATE_LIGHT_OCCLUDER_2D);
@@ -522,8 +535,6 @@ Sprite2DEditor::Sprite2DEditor() {
add_child(err_dialog);
debug_uv_dialog = memnew(ConfirmationDialog);
- debug_uv_dialog->get_ok_button()->set_text(TTR("Create Mesh2D"));
- debug_uv_dialog->set_title(TTR("Mesh 2D Preview"));
VBoxContainer *vb = memnew(VBoxContainer);
debug_uv_dialog->add_child(vb);
ScrollContainer *scroll = memnew(ScrollContainer);
diff --git a/editor/plugins/sprite_2d_editor_plugin.h b/editor/plugins/sprite_2d_editor_plugin.h
index 3e4cc17cdd..46953b0937 100644
--- a/editor/plugins/sprite_2d_editor_plugin.h
+++ b/editor/plugins/sprite_2d_editor_plugin.h
@@ -87,6 +87,7 @@ class Sprite2DEditor : public Control {
protected:
void _node_removed(Node *p_node);
+ void _notification(int p_what);
static void _bind_methods();
public:
diff --git a/editor/plugins/texture_editor_plugin.cpp b/editor/plugins/texture_editor_plugin.cpp
index 17fe4fdc50..a7c06ada5c 100644
--- a/editor/plugins/texture_editor_plugin.cpp
+++ b/editor/plugins/texture_editor_plugin.cpp
@@ -64,8 +64,8 @@ void TexturePreview::_update_metadata_label_text() {
String format;
if (Object::cast_to<ImageTexture>(*texture)) {
format = Image::get_format_name(Object::cast_to<ImageTexture>(*texture)->get_format());
- } else if (Object::cast_to<StreamTexture2D>(*texture)) {
- format = Image::get_format_name(Object::cast_to<StreamTexture2D>(*texture)->get_format());
+ } else if (Object::cast_to<CompressedTexture2D>(*texture)) {
+ format = Image::get_format_name(Object::cast_to<CompressedTexture2D>(*texture)->get_format());
} else {
format = texture->get_class();
}
@@ -110,7 +110,7 @@ TexturePreview::TexturePreview(Ref<Texture2D> p_texture, bool p_show_metadata) {
}
bool EditorInspectorPluginTexture::can_handle(Object *p_object) {
- return Object::cast_to<ImageTexture>(p_object) != nullptr || Object::cast_to<AtlasTexture>(p_object) != nullptr || Object::cast_to<StreamTexture2D>(p_object) != nullptr || Object::cast_to<AnimatedTexture>(p_object) != nullptr;
+ return Object::cast_to<ImageTexture>(p_object) != nullptr || Object::cast_to<AtlasTexture>(p_object) != nullptr || Object::cast_to<CompressedTexture2D>(p_object) != nullptr || Object::cast_to<AnimatedTexture>(p_object) != nullptr;
}
void EditorInspectorPluginTexture::parse_begin(Object *p_object) {
diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp
index a03f036b72..d313b98a7f 100644
--- a/editor/plugins/theme_editor_plugin.cpp
+++ b/editor/plugins/theme_editor_plugin.cpp
@@ -1887,7 +1887,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito
theme_type_editor = p_theme_type_editor;
tc = memnew(TabContainer);
- tc->set_tab_alignment(TabContainer::ALIGNMENT_LEFT);
+ tc->set_tab_alignment(TabBar::ALIGNMENT_LEFT);
add_child(tc);
// Edit Items tab.
@@ -2077,7 +2077,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito
List<String> ext;
ResourceLoader::get_recognized_extensions_for_type("Theme", &ext);
for (const String &E : ext) {
- import_another_theme_dialog->add_filter("*." + E + "; Theme Resource");
+ import_another_theme_dialog->add_filter(vformat("*.%s; %s", E, TTR("Theme Resource")));
}
import_another_file_hb->add_child(import_another_theme_dialog);
import_another_theme_dialog->connect("file_selected", callable_mp(this, &ThemeItemEditorDialog::_select_another_theme_cbk));
@@ -3664,7 +3664,7 @@ ThemeEditor::ThemeEditor() {
List<String> ext;
ResourceLoader::get_recognized_extensions_for_type("PackedScene", &ext);
for (const String &E : ext) {
- preview_scene_dialog->add_filter("*." + E + "; Scene");
+ preview_scene_dialog->add_filter(vformat("*.%s; %s", E, TTR("Scene")));
}
main_hs->add_child(preview_scene_dialog);
preview_scene_dialog->connect("file_selected", callable_mp(this, &ThemeEditor::_preview_scene_dialog_cbk));
diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp
index b1d5b348c4..443d5975cd 100644
--- a/editor/plugins/version_control_editor_plugin.cpp
+++ b/editor/plugins/version_control_editor_plugin.cpp
@@ -329,7 +329,7 @@ void VersionControlEditorPlugin::register_editor() {
if (!EditorVCSInterface::get_singleton()) {
EditorNode::get_singleton()->add_control_to_dock(EditorNode::DOCK_SLOT_RIGHT_UL, version_commit_dock);
TabContainer *dock_vbc = (TabContainer *)version_commit_dock->get_parent_control();
- dock_vbc->set_tab_title(version_commit_dock->get_index(), TTR("Commit"));
+ dock_vbc->set_tab_title(dock_vbc->get_tab_idx_from_control(version_commit_dock), TTR("Commit"));
Button *vc = EditorNode::get_singleton()->add_bottom_panel_item(TTR("Version Control"), version_control_dock);
set_version_control_tool_button(vc);
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index 55a4dc2c67..17db955cc7 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -883,7 +883,8 @@ void ProjectExportDialog::_export_project() {
List<String> extension_list = platform->get_binary_extensions(current);
for (int i = 0; i < extension_list.size(); i++) {
- export_project->add_filter("*." + extension_list[i] + " ; " + platform->get_name() + " Export");
+ // TRANSLATORS: This is the name of a project export file format. %s will be replaced by the platform name.
+ export_project->add_filter(vformat("*.%s; %s", extension_list[i], vformat(TTR("%s Export"), platform->get_name())));
}
if (!current->get_export_path().is_empty()) {
@@ -1055,7 +1056,7 @@ ProjectExportDialog::ProjectExportDialog() {
// Subsections.
sections = memnew(TabContainer);
- sections->set_tab_alignment(TabContainer::ALIGNMENT_LEFT);
+ sections->set_tab_alignment(TabBar::ALIGNMENT_LEFT);
sections->set_use_hidden_tabs_for_min_size(true);
settings_vb->add_child(sections);
sections->set_v_size_flags(Control::SIZE_EXPAND_FILL);
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 87d008d144..79aed36eeb 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -2566,7 +2566,7 @@ ProjectManager::ProjectManager() {
tabs = memnew(TabContainer);
center_box->add_child(tabs);
tabs->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
- tabs->set_tab_alignment(TabContainer::ALIGNMENT_LEFT);
+ tabs->set_tab_alignment(TabBar::ALIGNMENT_LEFT);
tabs->connect("tab_changed", callable_mp(this, &ProjectManager::_on_tab_changed));
HBoxContainer *projects_hb = memnew(HBoxContainer);
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index 03179733d5..7059509e72 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -63,7 +63,7 @@ void ProjectSettingsEditor::queue_save() {
}
void ProjectSettingsEditor::set_plugins_page() {
- tab_container->set_current_tab(plugin_settings->get_index());
+ tab_container->set_current_tab(tab_container->get_tab_idx_from_control(plugin_settings));
}
void ProjectSettingsEditor::update_plugins() {
@@ -559,7 +559,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
data = p_data;
tab_container = memnew(TabContainer);
- tab_container->set_tab_alignment(TabContainer::ALIGNMENT_LEFT);
+ tab_container->set_tab_alignment(TabBar::ALIGNMENT_LEFT);
tab_container->set_use_hidden_tabs_for_min_size(true);
add_child(tab_container);
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index cd65ee7ae6..0282504c70 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -228,7 +228,7 @@ void CustomPropertyEditor::_menu_option(int p_which) {
file_system_dock->navigate_to_path(r->get_path());
// Ensure that the FileSystem dock is visible.
TabContainer *tab_container = (TabContainer *)file_system_dock->get_parent_control();
- tab_container->set_current_tab(file_system_dock->get_index());
+ tab_container->set_current_tab(tab_container->get_tab_idx_from_control(file_system_dock));
} break;
default: {
if (p_which >= CONVERT_BASE_ID) {
diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp
index 46751058d0..93c5b9ad4c 100644
--- a/editor/rename_dialog.cpp
+++ b/editor/rename_dialog.cpp
@@ -114,7 +114,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
vbc->add_child(cbut_collapse_features);
tabc_features = memnew(TabContainer);
- tabc_features->set_tab_alignment(TabContainer::ALIGNMENT_LEFT);
+ tabc_features->set_tab_alignment(TabBar::ALIGNMENT_LEFT);
tabc_features->set_use_hidden_tabs_for_min_size(true);
vbc->add_child(tabc_features);
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index ba65828ac1..c6a8a928db 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -135,7 +135,8 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i
set_selected(n);
- NodeDock::get_singleton()->get_parent()->call("set_current_tab", NodeDock::get_singleton()->get_index());
+ TabContainer *tab_container = Object::cast_to<TabContainer>(NodeDock::get_singleton()->get_parent());
+ NodeDock::get_singleton()->get_parent()->call("set_current_tab", tab_container->get_tab_idx_from_control(NodeDock::get_singleton()));
NodeDock::get_singleton()->show_connections();
} else if (p_id == BUTTON_GROUPS) {
@@ -144,7 +145,8 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i
set_selected(n);
- NodeDock::get_singleton()->get_parent()->call("set_current_tab", NodeDock::get_singleton()->get_index());
+ TabContainer *tab_container = Object::cast_to<TabContainer>(NodeDock::get_singleton()->get_parent());
+ NodeDock::get_singleton()->get_parent()->call("set_current_tab", tab_container->get_tab_idx_from_control(NodeDock::get_singleton()));
NodeDock::get_singleton()->show_groups();
}
}