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

Not possible to set TabContainer title in the editor without changing node names #26194

Open
Zylann opened this issue Feb 23, 2019 · 1 comment

Comments

@Zylann
Copy link
Contributor

Zylann commented Feb 23, 2019

Godot 3.0.6
Godot 3.1 beta6

Currently, TabContainer and Tabs don't expose any option to choose the title of their tabs in the editor. The only way is to rename child nodes. This might work out somehow, but I find it inconvenient because nodes have naming restrictions, and they are more identifiers rather than user-facing strings. As such, that's different use cases which I don't want to mix.
For example, I make an app which has a ScriptEditor scene and CharacterEditor scene as child of a tab container. This causes tab titles to be "ScriptEditor" and "CharacterEditor", but I want them to be "Script" and "Character" instead.
My only options for now is to set this by script with set_tab_title(), or somehow abuse localization system in a way it translates "ScriptEditor" into "Script", which is not what I want either.

@tom-jk
Copy link

tom-jk commented Jul 29, 2020

There is a slightly convoluted workaround: use the connection editor window to connect the tabs tree_entered signal to the tabcontainers set_tab_title function, binding an int and string for tab index and title.

This sets the tab title when the game starts but moreover, I found (quite by accident) that it will also set it in the editor (reload the scene to see). I didn't know it could that! In fact, once you've done that and saved the scene, you can disconnect the signal and the name persists. There'll be something like this in the scene .tscn file:

[node name="PanelContainer" type="PanelContainer" parent="TabContainer"]
...
__meta__ = {
"_tab_name": "I have a new name now! :)"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants