From 8987f932d64e35c7209cee8f492747f775813055 Mon Sep 17 00:00:00 2001 From: Michael Alexsander Silva Dias Date: Sat, 25 Nov 2017 23:59:31 -0200 Subject: [PATCH] Fix not being able to select an editor layout created in another language. --- editor/editor_node.cpp | 18 +++++++++++------- editor/filesystem_dock.cpp | 1 + editor/import_dock.cpp | 1 + editor/node_dock.cpp | 3 ++- editor/scene_tree_dock.cpp | 1 + 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index a32ade3b71d..378b0630ade 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -5262,13 +5262,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); @@ -5391,28 +5392,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 +5425,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); diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 2ddfea00e37..a5445ca153d 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -1565,6 +1565,7 @@ void FileSystemDock::_bind_methods() { FileSystemDock::FileSystemDock(EditorNode *p_editor) { + set_name("FileSystem"); editor = p_editor; path = "res://"; diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp index 84d55b4d14a..8a16f125b77 100644 --- a/editor/import_dock.cpp +++ b/editor/import_dock.cpp @@ -403,6 +403,7 @@ void ImportDock::initialize_import_options() const { ImportDock::ImportDock() { + set_name("Import"); imported = memnew(Label); imported->add_style_override("normal", EditorNode::get_singleton()->get_gui_base()->get_stylebox("normal", "LineEdit")); add_child(imported); diff --git a/editor/node_dock.cpp b/editor/node_dock.cpp index 20392a67a75..366230be51d 100644 --- a/editor/node_dock.cpp +++ b/editor/node_dock.cpp @@ -93,9 +93,10 @@ void NodeDock::set_node(Node *p_node) { } NodeDock::NodeDock() { + singleton = this; - set_name(TTR("Node")); + set_name("Node"); mode_hb = memnew(HBoxContainer); add_child(mode_hb); mode_hb->hide(); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index b23d914b887..4d86030e7d6 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -1903,6 +1903,7 @@ void SceneTreeDock::_bind_methods() { SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSelection *p_editor_selection, EditorData &p_editor_data) { + set_name("Scene"); editor = p_editor; edited_scene = NULL; editor_data = &p_editor_data;