Skip to content

Commit b7b215d

Browse files
authored
Merge pull request #10333 from Calinou/bbcode-in-richtextlabel-print-rich
Add a page on the Output bottom panel
2 parents eb34d1f + 806a4fc commit b7b215d

File tree

6 files changed

+108
-3
lines changed

6 files changed

+108
-3
lines changed
13.3 KB
Loading

tutorials/scripting/debug/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Debug
88
:name: toc-learn-features-debug
99

1010
overview_of_debugging_tools
11+
output_panel
1112
debugger_panel
1213
the_profiler
1314
custom_performance_monitors
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
.. _doc_output_panel:
2+
3+
Output panel
4+
============
5+
6+
The output panel is found at the bottom of the screen. Click on **Output** to open it.
7+
8+
.. image:: img/overview_output.webp
9+
10+
The output panel provides several features to make viewing text printed by the
11+
project (and editor) easier.
12+
13+
.. note::
14+
15+
The output panel automatically opens when running a project by default.
16+
You can control this behavior by changing the **Run > Bottom Panel > Action on Play**
17+
editor setting.
18+
19+
Message categories
20+
------------------
21+
22+
Four message categories are available:
23+
24+
- **Log:** Standard messages printed by the project. Displayed in white or black
25+
(depending on the editor theme).
26+
- **Error:** Messages printed by the project or editor that report important
27+
information, but do not indicate a failure. Displayed in yellow.
28+
- **Warning:** Messages printed by the project or editor that indicate a failure
29+
of some kind. Displayed in red.
30+
- **Editor:** Messages printed by the editor, typically intended to be traces of
31+
undo/redo actions. Displayed in gray.
32+
33+
Filtering messages
34+
------------------
35+
36+
By clicking on the buttons on the right, you can hide certain message categories.
37+
This can make it easier to find specific messages you're looking for.
38+
39+
You can also filter messages by their text content using the **Filter Messages** box
40+
at the bottom of the Output panel.
41+
42+
Clearing messages
43+
-----------------
44+
45+
When running the project, existing messages are automatically cleared by default. This
46+
is controlled by the **Run > Output > Always Clear Output on Play** editor setting.
47+
Additionally, you can manually clear messages by clicking the "cleaning brush" icon
48+
in the top-right corner of the Output panel.
49+
50+
Printing messages
51+
-----------------
52+
53+
Several methods are available to print messages:
54+
55+
- :ref:`print() <class_@GlobalScope_method_print>`: Prints a message.
56+
This method accepts multiple arguments which are concatenated together upon printing.
57+
- :ref:`print_rich() <class_@GlobalScope_method_print_rich>`: Same as ``print()``,
58+
but BBCode can be used to format the text that is printed (see below).
59+
- :ref:`push_error() <class_@GlobalScope_method_push_error>`: Prints an error message.
60+
When an error is printed in a running project, it's displayed in the **Debugger > Errors**
61+
tab instead.
62+
- :ref:`push_warning() <class_@GlobalScope_method_push_warning>`: Prints a warning message.
63+
When a warning is printed in a running project, it's displayed in the **Debugger > Errors**
64+
tab instead.
65+
66+
To get more advanced formatting capabilities, consider using
67+
:ref:`doc_gdscript_printf` along with the above printing functions.
68+
69+
.. _doc_output_panel_printing_rich_text:
70+
71+
Printing rich text
72+
^^^^^^^^^^^^^^^^^^
73+
74+
Using :ref:`print_rich() <class_@GlobalScope_method_print_rich>`, you can print
75+
rich text to the editor Output panel and standard output (visible when the user
76+
runs the project from a terminal). This works by converting the BBCode to
77+
`ANSI escape codes <https://en.wikipedia.org/wiki/ANSI_escape_code>`__ that the
78+
terminal understands.
79+
80+
In the editor output, all BBCode tags are recognized as usual. In the terminal
81+
output, only a subset of BBCode tags will work, as documented in the linked
82+
``print_rich()`` method description above. In the terminal, the colors will look
83+
different depending on the user's theme, while colors in the editor will use the
84+
same colors as they would in the project.
85+
86+
.. note::
87+
88+
ANSI escape code support varies across terminal emulators. On Windows, only
89+
Windows 10 and later can display ANSI escape codes in its default terminal
90+
application.
91+
92+
The exact colors displayed in terminal output also depend on the terminal
93+
theme chosen by the user.

tutorials/scripting/debug/overview_of_debugging_tools.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ in the running game.
1414
Finally, you have options to debug the game running on a remote device
1515
and to reload changes to your scenes or your code while the game is running.
1616

17+
Output Panel
18+
--------------
19+
20+
The output panel allows you to see text printed by the project, but also by the editor (e.g. from ``@tool`` scripts).
21+
You can find information about in :ref:`doc_output_panel`.
22+
1723
Debugger Panel
1824
--------------
1925

@@ -251,7 +257,7 @@ GDScript
251257
++++++++
252258

253259
These settings allow you to toggle specific GDScript warnings, such as for
254-
unused variables. You can also turn off warnings completely. See
260+
unused variables. You can also turn off warnings completely. See
255261
:ref:`doc_gdscript_warning_system` for more information.
256262

257263
Shader Language

tutorials/scripting/gdscript/gdscript_documentation_comments.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ This can be especially useful for plugin and library creators.
223223
While technically you can use both ``@deprecated`` and ``@experimental`` tags on the same
224224
class/member, this is not recommended as it is against common conventions.
225225

226+
.. _doc_gdscript_documentation_comments_bbcode_and_class_reference:
227+
226228
BBCode and class reference
227229
--------------------------
228230

tutorials/ui/bbcode_in_richtextlabel.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ scrollbar is automatically displayed if the text does not fit within the
2121
control's size. The scrollbar can be disabled by unchecking the
2222
**Scroll Active** property in the RichTextLabel inspector.
2323

24-
Note that the BBCode tags can also be used to some extent in the XML source of
25-
the class reference. For more information, see :ref:`doc_class_reference_primer`.
24+
Note that the BBCode tags can also be used to some extent for other use cases:
25+
26+
- BBCode can be used to :ref:`format comments in the XML source of the class reference <doc_class_reference_bbcode>`.
27+
- BBCode can be used in :ref:`GDScript documentation comments <doc_gdscript_documentation_comments_bbcode_and_class_reference>`.
28+
- BBCode can be used when :ref:`printing rich text to the Output bottom panel <doc_output_panel_printing_rich_text>`.
2629

2730
.. seealso::
2831

0 commit comments

Comments
 (0)