Merge pull request #13298 from YeldhamDev/translation_layout

Fix not being able to select an editor layout created in another language
This commit is contained in:
Rémi Verschelde 2017-11-26 19:47:17 +01:00 committed by GitHub
commit ade39f5771
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 8 deletions

View File

@ -5262,13 +5262,14 @@ EditorNode::EditorNode() {
} }
scene_tree_dock = memnew(SceneTreeDock(this, scene_root, editor_selection, editor_data)); 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]->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(); dock_slot[DOCK_SLOT_LEFT_BR]->hide();
VBoxContainer *prop_editor_base = memnew(VBoxContainer); 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]->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); HBoxContainer *prop_editor_hb = memnew(HBoxContainer);
@ -5391,28 +5392,31 @@ EditorNode::EditorNode() {
import_dock = memnew(ImportDock); import_dock = memnew(ImportDock);
dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(import_dock); 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); bool use_single_dock_column = (OS::get_singleton()->get_screen_size(OS::get_singleton()->get_current_screen()).x < 1200);
node_dock = memnew(NodeDock); node_dock = memnew(NodeDock);
if (use_single_dock_column) { if (use_single_dock_column) {
dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(node_dock); 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 { } else {
dock_slot[DOCK_SLOT_RIGHT_BL]->add_child(node_dock); 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 = memnew(FileSystemDock(this));
filesystem_dock->set_name(TTR("FileSystem"));
filesystem_dock->set_display_mode(int(EditorSettings::get_singleton()->get("docks/filesystem/display_mode"))); filesystem_dock->set_display_mode(int(EditorSettings::get_singleton()->get("docks/filesystem/display_mode")));
if (use_single_dock_column) { if (use_single_dock_column) {
dock_slot[DOCK_SLOT_RIGHT_BL]->add_child(filesystem_dock); 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(); left_r_vsplit->hide();
dock_slot[DOCK_SLOT_LEFT_UR]->hide(); dock_slot[DOCK_SLOT_LEFT_UR]->hide();
dock_slot[DOCK_SLOT_LEFT_BR]->hide(); dock_slot[DOCK_SLOT_LEFT_BR]->hide();
} else { } else {
dock_slot[DOCK_SLOT_LEFT_UR]->add_child(filesystem_dock); 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("open", this, "open_request");
filesystem_dock->connect("instance", this, "_instance_request"); filesystem_dock->connect("instance", this, "_instance_request");
@ -5421,9 +5425,9 @@ EditorNode::EditorNode() {
overridden_default_layout = -1; overridden_default_layout = -1;
default_layout.instance(); default_layout.instance();
default_layout->set_value(docks_section, "dock_3", TTR("FileSystem")); default_layout->set_value(docks_section, "dock_3", "FileSystem");
default_layout->set_value(docks_section, "dock_5", TTR("Scene") + "," + TTR("Import")); default_layout->set_value(docks_section, "dock_5", "Scene,Import");
default_layout->set_value(docks_section, "dock_6", TTR("Inspector") + "," + TTR("Node")); default_layout->set_value(docks_section, "dock_6", "Inspector,Node");
for (int i = 0; i < DOCK_SLOT_MAX / 2; i++) for (int i = 0; i < DOCK_SLOT_MAX / 2; i++)
default_layout->set_value(docks_section, "dock_hsplit_" + itos(i + 1), 0); default_layout->set_value(docks_section, "dock_hsplit_" + itos(i + 1), 0);

View File

@ -1565,6 +1565,7 @@ void FileSystemDock::_bind_methods() {
FileSystemDock::FileSystemDock(EditorNode *p_editor) { FileSystemDock::FileSystemDock(EditorNode *p_editor) {
set_name("FileSystem");
editor = p_editor; editor = p_editor;
path = "res://"; path = "res://";

View File

@ -403,6 +403,7 @@ void ImportDock::initialize_import_options() const {
ImportDock::ImportDock() { ImportDock::ImportDock() {
set_name("Import");
imported = memnew(Label); imported = memnew(Label);
imported->add_style_override("normal", EditorNode::get_singleton()->get_gui_base()->get_stylebox("normal", "LineEdit")); imported->add_style_override("normal", EditorNode::get_singleton()->get_gui_base()->get_stylebox("normal", "LineEdit"));
add_child(imported); add_child(imported);

View File

@ -93,9 +93,10 @@ void NodeDock::set_node(Node *p_node) {
} }
NodeDock::NodeDock() { NodeDock::NodeDock() {
singleton = this; singleton = this;
set_name(TTR("Node")); set_name("Node");
mode_hb = memnew(HBoxContainer); mode_hb = memnew(HBoxContainer);
add_child(mode_hb); add_child(mode_hb);
mode_hb->hide(); mode_hb->hide();

View File

@ -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) { SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSelection *p_editor_selection, EditorData &p_editor_data) {
set_name("Scene");
editor = p_editor; editor = p_editor;
edited_scene = NULL; edited_scene = NULL;
editor_data = &p_editor_data; editor_data = &p_editor_data;