Print the class when using Node's print_tree()/print_tree_pretty()#50346
Print the class when using Node's print_tree()/print_tree_pretty()#50346Calinou wants to merge 1 commit intogodotengine:masterfrom
print_tree()/print_tree_pretty()#50346Conversation
|
Yeah it's noisy. It would probably work well with colors though. BTW, I think space before the colon is much cleaner; Name :Type. The colon denotes a type, so it should be next to the type - not the name. I write it like that in all languages I use. Most people probably disagree because they're used to the other way, but oh well. |
Unfortunately, we can't use colors in the Output panel until #33541 is merged. That said, #33541 would require an ANSI conversion routine (or at least a BBCode tag stripping routine) for console output to remain readable.
I'd prefer to use something that looks like the recommended type hinting syntax in the GDScript style guide. |
|
I use |
|
Can this be made to use colors now? |
This should be possible with Edit: I modified this PR to use |
79a1115 to
8af1615
Compare
|
Rebased and tweaked to follow @kleonc's comment. The
It's even possible to use BBCode in either of these if you feel like it. It will display correctly in the editor Output panel and console output: |
8af1615 to
e6df395
Compare
5777ac2 to
abb8780
Compare
…etty()` The class name may not always be obvious, especially when nodes are renamed from their default names. `_to_string()` is called if overridden in the node's script. By default, the node type and instance ID are displayed. This also adds rich formatting, including for `_to_string()` handlers if displayed within `print_tree()` or `print_tree_pretty()`.
abb8780 to
6fdd1b3
Compare



The class name may not always be obvious, especially when nodes are renamed from their default names.
_to_string()is called if overridden in the node's script. By default, the node type and instance ID are displayed.This also adds rich formatting, including for
_to_string()handlers if displayed withinprint_tree()orprint_tree_pretty().See godotengine/godot-proposals#2953 (comment).
Preview (outdated)
print_tree()Before
After
Screenshot from the Visual Studio Code terminal.
print_tree_pretty()Before
After
Screenshot from the Visual Studio Code terminal.