Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix not being able to select an editor layout created in another language #13298

Merged
merged 1 commit into from
Nov 26, 2017

Conversation

YeldhamDev
Copy link
Member

Turns out the problem was that the dock nodes were being named directly using translated strings, and being that layout configurations are saved using the name of the nodes, this caused them to be unrecognizable to any other language besides the one used to create them.

Now, the nodes are always named in english, and the tabs themselves are named after whatever the current language is.

Fixes #10325

@YeldhamDev YeldhamDev changed the title Fix not being able to select a editor layout created in another language Fix not being able to select an editor layout created in another language Nov 26, 2017
@@ -5262,13 +5262,15 @@ EditorNode::EditorNode() {
}

scene_tree_dock = memnew(SceneTreeDock(this, scene_root, editor_selection, editor_data));
scene_tree_dock->set_name(TTR("Scene"));
scene_tree_dock->set_name("Scene");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That name should likely be set directly in SceneTreeDock's constructor no? Same for others.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the Node dock was set in the constructor before, but if you want them all to be, sure.

dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(scene_tree_dock);
dock_slot[DOCK_SLOT_RIGHT_UL]->set_tab_title(dock_slot[DOCK_SLOT_RIGHT_UL]->get_child_count() - 1, TTR("Scene"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the fix, though I'm not sure about using get_child_count() -1 to get the right tab.. seems a bit hacky and would break if two docks were on the same slot.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested this with various dock combinations and everything seemed to work correctly, but I am open to suggestions of better ways to get the tabs.

@YeldhamDev
Copy link
Member Author

YeldhamDev commented Nov 26, 2017

@akien-mga Changes made.

Nodes are named in their constructors and the tab indexes are indicated directly by their node's index.

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"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, nice that there was get_index() for this :D

@akien-mga akien-mga merged commit ade39f5 into godotengine:master Nov 26, 2017
@YeldhamDev YeldhamDev deleted the translation_layout branch November 26, 2017 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants