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.cpp100
1 files changed, 88 insertions, 12 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index a32ade3b71..b5c7187b81 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -289,6 +289,7 @@ void EditorNode::_notification(int p_what) {
_editor_select(EDITOR_3D);
_update_debug_options();
+ _load_docks();
}
if (p_what == MainLoop::NOTIFICATION_WM_FOCUS_IN) {
@@ -1392,6 +1393,14 @@ void EditorNode::_property_editor_back() {
_edit_current();
}
+void EditorNode::_menu_collapseall() {
+ property_editor->collapse_all_parent_nodes();
+}
+
+void EditorNode::_menu_expandall() {
+ property_editor->expand_all_parent_nodes();
+}
+
void EditorNode::_save_default_environment() {
Ref<Environment> fallback = get_tree()->get_root()->get_world()->get_fallback_environment();
@@ -1466,6 +1475,7 @@ void EditorNode::_edit_current() {
object_menu->set_disabled(true);
bool capitalize = bool(EDITOR_DEF("interface/editor/capitalize_properties", true));
+ bool expandall = bool(EDITOR_DEF("interface/editor/expand_all_properties", true));
bool is_resource = current_obj->is_class("Resource");
bool is_node = current_obj->is_class("Node");
resource_save_button->set_disabled(!is_resource);
@@ -1537,6 +1547,10 @@ void EditorNode::_edit_current() {
property_editor->set_enable_capitalize_paths(capitalize);
}
+ if (property_editor->is_expand_all_properties_enabled() != expandall) {
+ property_editor->set_use_folding(expandall == false);
+ }
+
/* Take care of PLUGIN EDITOR */
EditorPlugin *main_plugin = editor_data.get_editor(current_obj);
@@ -1596,6 +1610,9 @@ void EditorNode::_edit_current() {
PopupMenu *p = object_menu->get_popup();
p->clear();
+ p->add_shortcut(ED_SHORTCUT("property_editor/expand_all", TTR("Expand all properties")), EXPAND_ALL);
+ p->add_shortcut(ED_SHORTCUT("property_editor/collapse_all", TTR("Collapse all properties")), COLLAPSE_ALL);
+ p->add_separator();
p->add_shortcut(ED_SHORTCUT("property_editor/copy_params", TTR("Copy Params")), OBJECT_COPY_PARAMS);
p->add_shortcut(ED_SHORTCUT("property_editor/paste_params", TTR("Paste Params")), OBJECT_PASTE_PARAMS);
p->add_separator();
@@ -2226,6 +2243,14 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
_set_editing_top_editors(current);
} break;
+ case COLLAPSE_ALL: {
+ _menu_collapseall();
+
+ } break;
+ case EXPAND_ALL: {
+ _menu_expandall();
+
+ } break;
case RUN_PLAY: {
_menu_option_confirm(RUN_STOP, true);
_run(false);
@@ -3110,6 +3135,10 @@ Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, b
push_item(new_scene);
+ if (!restoring_scenes) {
+ save_layout();
+ }
+
return OK;
}
@@ -3630,6 +3659,7 @@ void EditorNode::_save_docks() {
config.instance();
_save_docks_to_config(config, "docks");
+ _save_open_scenes_to_config(config, "EditorNode");
editor_data.get_plugin_window_layout(config);
config->save(EditorSettings::get_singleton()->get_project_settings_dir().plus_file("editor_layout.cfg"));
@@ -3680,6 +3710,18 @@ void EditorNode::_save_docks_to_config(Ref<ConfigFile> p_layout, const String &p
}
}
+void EditorNode::_save_open_scenes_to_config(Ref<ConfigFile> p_layout, const String &p_section) {
+ Array scenes;
+ for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
+ String path = editor_data.get_scene_path(i);
+ if (path == "") {
+ continue;
+ }
+ scenes.push_back(path);
+ }
+ p_layout->set_value(p_section, "open_scenes", scenes);
+}
+
void EditorNode::save_layout() {
dock_drag_timer->start();
@@ -3704,6 +3746,7 @@ void EditorNode::_load_docks() {
}
_load_docks_from_config(config, "docks");
+ _load_open_scenes_from_config(config, "EditorNode");
editor_data.set_plugin_window_layout(config);
}
@@ -3850,6 +3893,25 @@ void EditorNode::_load_docks_from_config(Ref<ConfigFile> p_layout, const String
}
}
+void EditorNode::_load_open_scenes_from_config(Ref<ConfigFile> p_layout, const String &p_section) {
+ if (!bool(EDITOR_DEF("interface/scene_tabs/restore_scenes_on_load", false))) {
+ return;
+ }
+
+ if (!p_layout->has_section(p_section) || !p_layout->has_section_key(p_section, "open_scenes")) {
+ return;
+ }
+
+ restoring_scenes = true;
+
+ Array scenes = p_layout->get_value(p_section, "open_scenes");
+ for (int i = 0; i < scenes.size(); i++) {
+ load_scene(scenes[i]);
+ }
+
+ restoring_scenes = false;
+}
+
void EditorNode::_update_layouts_menu() {
editor_layouts->clear();
@@ -3948,6 +4010,8 @@ void EditorNode::_scene_tab_closed(int p_tab) {
} else {
_discard_changes();
}
+
+ save_layout();
_update_scene_tabs();
}
@@ -4645,6 +4709,7 @@ EditorNode::EditorNode() {
changing_scene = false;
_initializing_addons = false;
docks_visible = true;
+ restoring_scenes = false;
scene_distraction = false;
script_distraction = false;
@@ -5262,13 +5327,14 @@ EditorNode::EditorNode() {
}
scene_tree_dock = memnew(SceneTreeDock(this, scene_root, editor_selection, editor_data));
- scene_tree_dock->set_name(TTR("Scene"));
dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(scene_tree_dock);
+ dock_slot[DOCK_SLOT_RIGHT_UL]->set_tab_title(scene_tree_dock->get_index(), TTR("Scene"));
dock_slot[DOCK_SLOT_LEFT_BR]->hide();
VBoxContainer *prop_editor_base = memnew(VBoxContainer);
- prop_editor_base->set_name(TTR("Inspector")); // Properties?
+ prop_editor_base->set_name("Inspector");
dock_slot[DOCK_SLOT_RIGHT_BL]->add_child(prop_editor_base);
+ dock_slot[DOCK_SLOT_RIGHT_BL]->set_tab_title(prop_editor_base->get_index(), TTR("Inspector"));
HBoxContainer *prop_editor_hb = memnew(HBoxContainer);
@@ -5376,11 +5442,11 @@ EditorNode::EditorNode() {
property_editor = memnew(PropertyEditor);
property_editor->set_autoclear(true);
property_editor->set_show_categories(true);
- property_editor->set_use_folding(true);
property_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
property_editor->set_use_doc_hints(true);
property_editor->set_hide_script(false);
property_editor->set_enable_capitalize_paths(bool(EDITOR_DEF("interface/editor/capitalize_properties", true)));
+ property_editor->set_use_folding(bool(EDITOR_DEF("interface/editor/expand_all_properties", false)) == false);
property_editor->hide_top_label();
property_editor->register_text_enter(search_box);
@@ -5391,28 +5457,31 @@ EditorNode::EditorNode() {
import_dock = memnew(ImportDock);
dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(import_dock);
- import_dock->set_name(TTR("Import"));
+ dock_slot[DOCK_SLOT_RIGHT_UL]->set_tab_title(import_dock->get_index(), TTR("Import"));
bool use_single_dock_column = (OS::get_singleton()->get_screen_size(OS::get_singleton()->get_current_screen()).x < 1200);
node_dock = memnew(NodeDock);
if (use_single_dock_column) {
dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(node_dock);
+ dock_slot[DOCK_SLOT_RIGHT_UL]->set_tab_title(node_dock->get_index(), TTR("Node"));
} else {
dock_slot[DOCK_SLOT_RIGHT_BL]->add_child(node_dock);
+ dock_slot[DOCK_SLOT_RIGHT_BL]->set_tab_title(node_dock->get_index(), TTR("Node"));
}
filesystem_dock = memnew(FileSystemDock(this));
- filesystem_dock->set_name(TTR("FileSystem"));
filesystem_dock->set_display_mode(int(EditorSettings::get_singleton()->get("docks/filesystem/display_mode")));
if (use_single_dock_column) {
dock_slot[DOCK_SLOT_RIGHT_BL]->add_child(filesystem_dock);
+ dock_slot[DOCK_SLOT_RIGHT_BL]->set_tab_title(filesystem_dock->get_index(), TTR("FileSystem"));
left_r_vsplit->hide();
dock_slot[DOCK_SLOT_LEFT_UR]->hide();
dock_slot[DOCK_SLOT_LEFT_BR]->hide();
} else {
dock_slot[DOCK_SLOT_LEFT_UR]->add_child(filesystem_dock);
+ dock_slot[DOCK_SLOT_LEFT_UR]->set_tab_title(filesystem_dock->get_index(), TTR("FileSystem"));
}
filesystem_dock->connect("open", this, "open_request");
filesystem_dock->connect("instance", this, "_instance_request");
@@ -5421,9 +5490,9 @@ EditorNode::EditorNode() {
overridden_default_layout = -1;
default_layout.instance();
- default_layout->set_value(docks_section, "dock_3", TTR("FileSystem"));
- default_layout->set_value(docks_section, "dock_5", TTR("Scene") + "," + TTR("Import"));
- default_layout->set_value(docks_section, "dock_6", TTR("Inspector") + "," + TTR("Node"));
+ default_layout->set_value(docks_section, "dock_3", "FileSystem");
+ default_layout->set_value(docks_section, "dock_5", "Scene,Import");
+ default_layout->set_value(docks_section, "dock_6", "Inspector,Node");
for (int i = 0; i < DOCK_SLOT_MAX / 2; i++)
default_layout->set_value(docks_section, "dock_hsplit_" + itos(i + 1), 0);
@@ -5624,6 +5693,7 @@ EditorNode::EditorNode() {
editor_plugin_screen = NULL;
editor_plugins_over = memnew(EditorPluginList);
+ editor_plugins_force_over = memnew(EditorPluginList);
editor_plugins_force_input_forwarding = memnew(EditorPluginList);
_edit_current();
@@ -5716,8 +5786,6 @@ EditorNode::EditorNode() {
_initializing_addons = false;
}
- _load_docks();
-
FileAccess::set_file_close_fail_notify_callback(_file_access_close_error_notify);
waiting_for_first_scan = true;
@@ -5748,6 +5816,7 @@ EditorNode::~EditorNode() {
memdelete(EditorHelp::get_doc_data());
memdelete(editor_selection);
memdelete(editor_plugins_over);
+ memdelete(editor_plugins_force_over);
memdelete(editor_plugins_force_input_forwarding);
memdelete(file_server);
memdelete(progress_hb);
@@ -5801,10 +5870,17 @@ bool EditorPluginList::forward_spatial_gui_input(Camera *p_camera, const Ref<Inp
return discard;
}
-void EditorPluginList::forward_draw_over_canvas(Control *p_canvas) {
+void EditorPluginList::forward_draw_over_viewport(Control *p_overlay) {
+
+ for (int i = 0; i < plugins_list.size(); i++) {
+ plugins_list[i]->forward_draw_over_viewport(p_overlay);
+ }
+}
+
+void EditorPluginList::forward_force_draw_over_viewport(Control *p_overlay) {
for (int i = 0; i < plugins_list.size(); i++) {
- plugins_list[i]->forward_draw_over_canvas(p_canvas);
+ plugins_list[i]->forward_force_draw_over_viewport(p_overlay);
}
}