-
-
Notifications
You must be signed in to change notification settings - Fork 21.8k
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
Conversation
2c952b8
to
3b8ba19
Compare
editor/editor_node.cpp
Outdated
@@ -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"); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
editor/editor_node.cpp
Outdated
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")); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
3b8ba19
to
8987f93
Compare
@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")); |
There was a problem hiding this comment.
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
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