Add Engine.print_error_messages property to disable printing errors

This can be used during unit test suite runs to hide error and warning
messages.

Care should be taken when using this feature, as it can hide important
information if used wrongly.
This commit is contained in:
Hugo Locurcio 2021-05-01 23:09:48 +02:00
parent 33a0fb6e02
commit 0eb9b414c1
No known key found for this signature in database
GPG key ID: 39E8F8BE30B0A49C
6 changed files with 32 additions and 1 deletions

View file

@ -2321,6 +2321,14 @@ bool _Engine::is_editor_hint() const {
return Engine::get_singleton()->is_editor_hint();
}
void _Engine::set_print_error_messages(bool p_enabled) {
Engine::get_singleton()->set_print_error_messages(p_enabled);
}
bool _Engine::is_printing_error_messages() const {
return Engine::get_singleton()->is_printing_error_messages();
}
void _Engine::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_iterations_per_second", "iterations_per_second"), &_Engine::set_iterations_per_second);
ClassDB::bind_method(D_METHOD("get_iterations_per_second"), &_Engine::get_iterations_per_second);
@ -2355,7 +2363,11 @@ void _Engine::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_editor_hint", "enabled"), &_Engine::set_editor_hint);
ClassDB::bind_method(D_METHOD("is_editor_hint"), &_Engine::is_editor_hint);
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, "editor_hint"), "set_editor_hint", "is_editor_hint");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "print_error_messages"), "set_print_error_messages", "is_printing_error_messages");
ADD_PROPERTY(PropertyInfo(Variant::INT, "iterations_per_second"), "set_iterations_per_second", "get_iterations_per_second");
ADD_PROPERTY(PropertyInfo(Variant::INT, "target_fps"), "set_target_fps", "get_target_fps");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "time_scale"), "set_time_scale", "get_time_scale");