-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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 dump()
and dump_string()
global scope methods
#77290
base: master
Are you sure you want to change the base?
Conversation
I find it a bit inconsistent that both functions have 'dump' in their name while they behave so differently. Maybe Aside, in order not to bloat the core, we could consider making these trivial in non-debug builds. |
9ac4a8b
to
db21777
Compare
I've updated this PR with the following improvements:
That makes sense, especially if we add a non-rich
This PR surprisingly appears to have a significant impact on binary size (about 50 KB on a stripped Linux editor build without LTO). I wonder if I'm doing something wrong and this impact could be reduced on debug builds. I guess putting more code in a template function doesn't help 🙁 I guess we could redirect Edit: Disregard the accidental close/reopen below. |
db21777
to
cfab6a1
Compare
Hey, what is missing for this PR? |
cfab6a1
to
bb4f5c4
Compare
I've pushed changes that make Binary size for the Linux editor (with |
`dump()` prints a value with formatting and additional information while returning the value. This makes for more convenient debugging. `dump_string()` returns the formatted string as BBCode, which can be displayed in a RichTextLabel node or with a `print_rich()` statement. In release builds, `dump()` acts like `print()` and `dump_string()` acts like `str()`.
bb4f5c4
to
fe1c4bb
Compare
dump()
prints a value with formatting and additional information while returning the value. This makes for more convenient debugging.dump_string()
returns the formatted string as BBCode, which can be displayed in a RichTextLabel node or with aprint_rich()
statement.In release builds,
dump()
acts likeprint()
anddump_string()
acts likestr()
.A non-rich
dump_string()
variant could be added for display in Label and Label3D, but thisis best done with #78310 as to avoid code duplication.
Testing project: test_dump.zip
Preview
RichTextLabel
Terminal output (VS Code)
Editor Output panel
print_rich()
output #77114.