summaryrefslogtreecommitdiff
path: root/editor/editor_node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r--editor/editor_node.cpp83
1 files changed, 39 insertions, 44 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index ddb9c93f04..17b219f8dc 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -90,6 +90,7 @@
#include "editor/editor_paths.h"
#include "editor/editor_plugin.h"
#include "editor/editor_properties.h"
+#include "editor/editor_property_name_processor.h"
#include "editor/editor_resource_picker.h"
#include "editor/editor_resource_preview.h"
#include "editor/editor_run.h"
@@ -701,31 +702,34 @@ 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);
- if (EDITOR_GET("interface/scene_tabs/resize_if_many_tabs")) {
- scene_tabs->set_min_width(int(EDITOR_GET("interface/scene_tabs/minimum_width")) * EDSCALE);
- } else {
- scene_tabs->set_min_width(0);
+ 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")));
}
+
+ scene_tabs->set_max_tab_width(int(EDITOR_GET("interface/scene_tabs/maximum_width")) * EDSCALE);
_update_scene_tabs();
- recent_scenes->set_as_minsize();
+ recent_scenes->reset_size();
// debugger area
if (EditorDebuggerNode::get_singleton()->is_visible()) {
@@ -800,10 +804,6 @@ void EditorNode::_notification(int p_what) {
_update_update_spinner();
} break;
-
- case Control::NOTIFICATION_RESIZED: {
- _update_scene_tabs();
- } break;
}
}
@@ -3784,7 +3784,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() {
@@ -3859,18 +3859,18 @@ void EditorNode::register_editor_types() {
GDREGISTER_CLASS(EditorScript);
GDREGISTER_CLASS(EditorSelection);
GDREGISTER_CLASS(EditorFileDialog);
- GDREGISTER_VIRTUAL_CLASS(EditorSettings);
+ GDREGISTER_ABSTRACT_CLASS(EditorSettings);
GDREGISTER_CLASS(EditorNode3DGizmo);
GDREGISTER_CLASS(EditorNode3DGizmoPlugin);
- GDREGISTER_VIRTUAL_CLASS(EditorResourcePreview);
+ GDREGISTER_ABSTRACT_CLASS(EditorResourcePreview);
GDREGISTER_CLASS(EditorResourcePreviewGenerator);
- GDREGISTER_VIRTUAL_CLASS(EditorFileSystem);
+ GDREGISTER_ABSTRACT_CLASS(EditorFileSystem);
GDREGISTER_CLASS(EditorFileSystemDirectory);
GDREGISTER_CLASS(EditorVCSInterface);
- GDREGISTER_VIRTUAL_CLASS(ScriptEditor);
- GDREGISTER_VIRTUAL_CLASS(ScriptEditorBase);
+ GDREGISTER_ABSTRACT_CLASS(ScriptEditor);
+ GDREGISTER_ABSTRACT_CLASS(ScriptEditorBase);
GDREGISTER_CLASS(EditorSyntaxHighlighter);
- GDREGISTER_VIRTUAL_CLASS(EditorInterface);
+ GDREGISTER_ABSTRACT_CLASS(EditorInterface);
GDREGISTER_CLASS(EditorExportPlugin);
GDREGISTER_CLASS(EditorResourceConversionPlugin);
GDREGISTER_CLASS(EditorSceneFormatImporter);
@@ -3885,7 +3885,7 @@ void EditorNode::register_editor_types() {
GDREGISTER_CLASS(EditorResourcePicker);
GDREGISTER_CLASS(EditorScriptPicker);
- GDREGISTER_VIRTUAL_CLASS(FileSystemDock);
+ GDREGISTER_ABSTRACT_CLASS(FileSystemDock);
// FIXME: Is this stuff obsolete, or should it be ported to new APIs?
GDREGISTER_CLASS(EditorScenePostImport);
@@ -5425,7 +5425,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;
}
}
@@ -5489,7 +5489,7 @@ void EditorNode::_add_dropped_files_recursive(const Vector<String> &p_files, Str
}
void EditorNode::_file_access_close_error_notify(const String &p_str) {
- add_io_error("Unable to write to file '" + p_str + "', file in use, locked or lacking permissions.");
+ add_io_error(vformat(TTR("Unable to write to file '%s', file in use, locked or lacking permissions."), p_str));
}
void EditorNode::reload_scene(const String &p_path) {
@@ -5804,6 +5804,9 @@ void EditorNode::notify_settings_changed() {
}
EditorNode::EditorNode() {
+ EditorPropertyNameProcessor *epnp = memnew(EditorPropertyNameProcessor);
+ add_child(epnp);
+
Input::get_singleton()->set_use_accumulated_input(true);
Resource::_get_local_scene_func = _resource_get_edited_scene;
@@ -6023,18 +6026,11 @@ EditorNode::EditorNode() {
// defs here, use EDITOR_GET in logic
EDITOR_DEF_RST("interface/scene_tabs/always_show_close_button", false);
- EDITOR_DEF_RST("interface/scene_tabs/resize_if_many_tabs", true);
- EDITOR_DEF_RST("interface/scene_tabs/minimum_width", 50);
- EDITOR_DEF("run/output/always_clear_output_on_play", true);
- EDITOR_DEF("run/output/always_open_output_on_play", true);
- EDITOR_DEF("run/output/always_close_output_on_stop", true);
- EDITOR_DEF("run/auto_save/save_before_running", true);
EDITOR_DEF("interface/editor/save_on_focus_loss", false);
- EDITOR_DEF_RST("interface/editor/save_each_scene_on_quit", true);
EDITOR_DEF("interface/editor/show_update_spinner", false);
EDITOR_DEF("interface/editor/update_continuously", false);
+ EDITOR_DEF("interface/editor/translate_properties", true);
EDITOR_DEF_RST("interface/scene_tabs/restore_scenes_on_load", true);
- EDITOR_DEF_RST("interface/scene_tabs/show_thumbnail_on_hover", true);
EDITOR_DEF_RST("interface/inspector/capitalize_properties", true);
EDITOR_DEF_RST("interface/inspector/default_float_step", 0.001);
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::FLOAT, "interface/inspector/default_float_step", PROPERTY_HINT_RANGE, "0,1,0"));
@@ -6048,7 +6044,6 @@ EditorNode::EditorNode() {
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "interface/inspector/default_color_picker_mode", PROPERTY_HINT_ENUM, "RGB,HSV,RAW", PROPERTY_USAGE_DEFAULT));
EDITOR_DEF("interface/inspector/default_color_picker_shape", (int32_t)ColorPicker::SHAPE_VHS_CIRCLE);
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "interface/inspector/default_color_picker_shape", PROPERTY_HINT_ENUM, "HSV Rectangle,HSV Rectangle Wheel,VHS Circle", PROPERTY_USAGE_DEFAULT));
- EDITOR_DEF("run/auto_save/save_before_running", true);
ED_SHORTCUT("canvas_item_editor/pan_view", TTR("Pan View"), Key::SPACE);
@@ -6204,7 +6199,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++) {
@@ -6256,8 +6251,8 @@ EditorNode::EditorNode() {
scene_tabs->set_select_with_rmb(true);
scene_tabs->add_tab("unsaved");
scene_tabs->set_tab_alignment(TabBar::ALIGNMENT_LEFT);
- scene_tabs->set_tab_close_display_policy((bool(EDITOR_DEF("interface/scene_tabs/always_show_close_button", false)) ? TabBar::CLOSE_BUTTON_SHOW_ALWAYS : TabBar::CLOSE_BUTTON_SHOW_ACTIVE_ONLY));
- scene_tabs->set_min_width(int(EDITOR_DEF("interface/scene_tabs/minimum_width", 50)) * EDSCALE);
+ 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));
+ scene_tabs->set_max_tab_width(int(EDITOR_GET("interface/scene_tabs/maximum_width")) * EDSCALE);
scene_tabs->set_drag_to_rearrange_enabled(true);
scene_tabs->connect("tab_changed", callable_mp(this, &EditorNode::_scene_tab_changed));
scene_tabs->connect("tab_button_pressed", callable_mp(this, &EditorNode::_scene_tab_script_edited));