-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Add built-in GUI to display license notices #79599
base: master
Are you sure you want to change the base?
Conversation
dfff79d
to
7ec3b9e
Compare
7ec3b9e
to
f8a5afd
Compare
Instead of basing the new node-type on |
Any reason the new class is exposed? It doesn't need to, the relevant documentation can be inside |
How about using |
Ah for some reason I though the method is used for the shortcut. Yeah, it can be replaced with a plain AcceptDialog. If you need to do something extra in |
SVG for the dialog that's 1 kB smaller:
|
I thought I was required to expose it, but it looks like it works fine if it's not exposed. I've unexposed the class as a result.
It requires advanced GUI functionality, which is disabled when building Godot with These are the nodes that are unavailable when building with godot/scene/register_scene_types.cpp Lines 414 to 452 in 57919be
Window and Popup base classes are available though.
Thanks 🙂 I've incorporated it and added you as a co-author. |
085fed9
to
3e201fe
Compare
Then it could be a Window. Although it doesn't really matter if the class is not exposed. |
b85fa26
to
201064e
Compare
Pretty sure they are both as fast, but RTL is shaped in thread. If you could divide the whole text into smaller labels, you could add them one by one inside |
201064e
to
7b66d8b
Compare
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.
7b66d8b
to
d8c25a8
Compare
d8c25a8
to
7338f11
Compare
RTL processes text as multiple separate paragraphs, Label as a single paragraph, this is likely the reason. It should not be too hard to fix, but I'm not sure if huge text is an intended use of Label. Since Label does not have a scrollbar of its own, a vbox with multiple Labels might work as a workaround (split text at two consecutive line breaks). |
7338f11
to
3a53622
Compare
I don't know why I wrote this comment (xd), but as noted by Sauermann, the class could be changed to inherit Window instead, to ensure that it appears on top. Although it's probably not relevant for most games. |
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.
Looks fine code-wise.
3a53622
to
29be92e
Compare
29be92e
to
47ad666
Compare
Rebased and tested again, it works as expected. It compiles with Here are Linux x86_64 release export template binary sizes with
Excluding the files entirely from compilation would likely reduce binary size further, while preventing you from accidentally using the classes in C++ when you're not supposed to. Either way, it means this PR is technically mergeable now, but the increase in binary size is an issue I'd like to have resolved first. @bruvzg Do you know if you could make Label process text on a per-paragraph basis? Intuitively, I think most people would expect Label to be as fast or faster than RichTextLabel for rendering text. |
47ad666
to
acd42d3
Compare
I'll take a look tomorrow, currently it can use only a single paragraph, but changing it to use multiple should not be hard. |
Press Ctrl/Cmd + Shift + L (`ui_toggle_licenses_dialog` built-in action) to show/hide the notices dialog. The dialog can be shown via script using `SceneTree.licenses_dialog_visible = true|false`. Co-authored-by: MewPurPur <[email protected]>
acd42d3
to
158b224
Compare
Press Ctrl/Cmd + Shift + L (
ui_toggle_licenses_dialog
built-in action) to show/hide the notices dialog.The dialog can be shown via script using
SceneTree.licenses_dialog_visible = true|false
. Since the default shortcut is not usable on mobile platforms, it is recommended to create a button that setsSceneTree.licenses_dialog_visible
totrue
when pressed in your project's menus.PS: I believe this is the first built-in high-level GUI component we make available in projects. It'll be interesting to see what can be done in the future with this approach.
Fun fact: This is the first time I add a new node to Godot in C++ 🙂
Testing project: test_licenses_dialog.zip
Preview
TODO
disable_advanced_gui=yes
. I've purposefully avoided advanced GUI nodes for this dialog, but had to switch to RichTextLabel because Label was extremely slow to shape the text.