[Core] Add Engine.print_to_stout
setting to control printing
Also added notes to the related project settings pointing to the `Engine` properties.
This commit is contained in:
parent
e4e024ab88
commit
d49ec39d63
7 changed files with 33 additions and 3 deletions
|
@ -267,6 +267,14 @@ bool Engine::is_extra_gpu_memory_tracking_enabled() const {
|
|||
return extra_gpu_memory_tracking;
|
||||
}
|
||||
|
||||
void Engine::set_print_to_stdout(bool p_enabled) {
|
||||
CoreGlobals::print_line_enabled = p_enabled;
|
||||
}
|
||||
|
||||
bool Engine::is_printing_to_stdout() const {
|
||||
return CoreGlobals::print_line_enabled;
|
||||
}
|
||||
|
||||
void Engine::set_print_error_messages(bool p_enabled) {
|
||||
CoreGlobals::print_error_enabled = p_enabled;
|
||||
}
|
||||
|
|
|
@ -128,6 +128,9 @@ public:
|
|||
void set_time_scale(double p_scale);
|
||||
double get_time_scale() const;
|
||||
|
||||
void set_print_to_stdout(bool p_enabled);
|
||||
bool is_printing_to_stdout() const;
|
||||
|
||||
void set_print_error_messages(bool p_enabled);
|
||||
bool is_printing_error_messages() const;
|
||||
void print_header(const String &p_string) const;
|
||||
|
|
|
@ -1848,6 +1848,14 @@ String Engine::get_write_movie_path() const {
|
|||
return ::Engine::get_singleton()->get_write_movie_path();
|
||||
}
|
||||
|
||||
void Engine::set_print_to_stdout(bool p_enabled) {
|
||||
::Engine::get_singleton()->set_print_to_stdout(p_enabled);
|
||||
}
|
||||
|
||||
bool Engine::is_printing_to_stdout() const {
|
||||
return ::Engine::get_singleton()->is_printing_to_stdout();
|
||||
}
|
||||
|
||||
void Engine::set_print_error_messages(bool p_enabled) {
|
||||
::Engine::get_singleton()->set_print_error_messages(p_enabled);
|
||||
}
|
||||
|
@ -1916,10 +1924,14 @@ void Engine::_bind_methods() {
|
|||
|
||||
ClassDB::bind_method(D_METHOD("get_write_movie_path"), &Engine::get_write_movie_path);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_print_to_stdout", "enabled"), &Engine::set_print_to_stdout);
|
||||
ClassDB::bind_method(D_METHOD("is_printing_to_stdout"), &Engine::is_printing_to_stdout);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_print_error_messages", "enabled"), &Engine::set_print_error_messages);
|
||||
ClassDB::bind_method(D_METHOD("is_printing_error_messages"), &Engine::is_printing_error_messages);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "print_error_messages"), "set_print_error_messages", "is_printing_error_messages");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "print_to_stdout"), "set_print_to_stdout", "is_printing_to_stdout");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "physics_ticks_per_second"), "set_physics_ticks_per_second", "get_physics_ticks_per_second");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "max_physics_steps_per_frame"), "set_max_physics_steps_per_frame", "get_max_physics_steps_per_frame");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "max_fps"), "set_max_fps", "get_max_fps");
|
||||
|
|
|
@ -567,6 +567,9 @@ public:
|
|||
// `set_write_movie_path()` is not exposed to the scripting API as changing it at run-time has no effect.
|
||||
String get_write_movie_path() const;
|
||||
|
||||
void set_print_to_stdout(bool p_enabled);
|
||||
bool is_printing_to_stdout() const;
|
||||
|
||||
void set_print_error_messages(bool p_enabled);
|
||||
bool is_printing_error_messages() const;
|
||||
|
||||
|
|
|
@ -856,7 +856,7 @@
|
|||
GD.Print("a", "b", a); // Prints ab[1, 2, 3]
|
||||
[/csharp]
|
||||
[/codeblocks]
|
||||
[b]Note:[/b] Consider using [method push_error] and [method push_warning] to print error and warning messages instead of [method print] or [method print_rich]. This distinguishes them from print messages used for debugging purposes, while also displaying a stack trace when an error or warning is printed.
|
||||
[b]Note:[/b] Consider using [method push_error] and [method push_warning] to print error and warning messages instead of [method print] or [method print_rich]. This distinguishes them from print messages used for debugging purposes, while also displaying a stack trace when an error or warning is printed. See also [member Engine.print_to_stdout] and [member ProjectSettings.application/run/disable_stdout].
|
||||
</description>
|
||||
</method>
|
||||
<method name="print_rich" qualifiers="vararg">
|
||||
|
|
|
@ -337,6 +337,10 @@
|
|||
[b]Note:[/b] This property does not impact the editor's Errors tab when running a project from the editor.
|
||||
[b]Warning:[/b] If set to [code]false[/code] anywhere in the project, important error messages may be hidden even if they are emitted from other scripts. In a [code]@tool[/code] script, this will also impact the editor itself. Do [i]not[/i] report bugs before ensuring error messages are enabled (as they are by default).
|
||||
</member>
|
||||
<member name="print_to_stdout" type="bool" setter="set_print_to_stdout" getter="is_printing_to_stdout" default="true">
|
||||
If [code]false[/code], stops printing messages (for example using [method @GlobalScope.print]) to the console, log files, and editor Output log. This property is equivalent to the [member ProjectSettings.application/run/disable_stdout] project setting.
|
||||
[b]Note:[/b] This does not stop printing errors or warnings produced by scripts to the console or log files, for more details see [member print_error_messages].
|
||||
</member>
|
||||
<member name="time_scale" type="float" setter="set_time_scale" getter="get_time_scale" default="1.0">
|
||||
The speed multiplier at which the in-game clock updates, compared to real time. For example, if set to [code]2.0[/code] the game runs twice as fast, and if set to [code]0.5[/code] the game runs half as fast.
|
||||
This value affects [Timer], [SceneTreeTimer], and all other simulations that make use of [code]delta[/code] time (such as [method Node._process] and [method Node._physics_process]).
|
||||
|
|
|
@ -314,11 +314,11 @@
|
|||
</member>
|
||||
<member name="application/run/disable_stderr" type="bool" setter="" getter="" default="false">
|
||||
If [code]true[/code], disables printing to standard error. If [code]true[/code], this also hides error and warning messages printed by [method @GlobalScope.push_error] and [method @GlobalScope.push_warning]. See also [member application/run/disable_stdout].
|
||||
Changes to this setting will only be applied upon restarting the application.
|
||||
Changes to this setting will only be applied upon restarting the application. To control this at runtime, use [member Engine.print_error_messages].
|
||||
</member>
|
||||
<member name="application/run/disable_stdout" type="bool" setter="" getter="" default="false">
|
||||
If [code]true[/code], disables printing to standard output. This is equivalent to starting the editor or project with the [code]--quiet[/code] [url=$DOCS_URL/tutorials/editor/command_line_tutorial.html]command line argument[/url]. See also [member application/run/disable_stderr].
|
||||
Changes to this setting will only be applied upon restarting the application.
|
||||
Changes to this setting will only be applied upon restarting the application. To control this at runtime, use [member Engine.print_to_stdout].
|
||||
</member>
|
||||
<member name="application/run/enable_alt_space_menu" type="bool" setter="" getter="" default="false">
|
||||
If [code]true[/code], allows the [kbd]Alt + Space[/kbd] keys to display the window menu. This menu allows the user to perform various window management operations such as moving, resizing, or minimizing the window.
|
||||
|
|
Loading…
Reference in a new issue