Merge pull request #12930 from vnen/gdscrit-output-print

Make tool scripts print on the editor Output panel
This commit is contained in:
Juan Linietsky 2017-11-17 16:05:44 -03:00 committed by GitHub
commit ebbe2bd572
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 39 additions and 6 deletions

View file

@ -82,7 +82,25 @@ void print_line(String p_string) {
PrintHandlerList *l = print_handler_list;
while (l) {
l->printfunc(l->userdata, p_string);
l->printfunc(l->userdata, p_string, false);
l = l->next;
}
_global_unlock();
}
void print_error(String p_string) {
if (!_print_error_enabled)
return;
OS::get_singleton()->printerr("%s\n", p_string.utf8().get_data());
_global_lock();
PrintHandlerList *l = print_handler_list;
while (l) {
l->printfunc(l->userdata, p_string, true);
l = l->next;
}

View file

@ -34,7 +34,7 @@
extern void (*_print_func)(String);
typedef void (*PrintHandlerFunc)(void *, const String &p_string);
typedef void (*PrintHandlerFunc)(void *, const String &p_string, bool p_error);
struct PrintHandlerList {
@ -56,5 +56,6 @@ void remove_print_handler(PrintHandlerList *p_handler);
extern bool _print_line_enabled;
extern bool _print_error_enabled;
extern void print_line(String p_string);
extern void print_error(String p_string);
#endif

View file

@ -832,7 +832,7 @@ void ScriptDebuggerRemote::send_message(const String &p_message, const Array &p_
mutex->unlock();
}
void ScriptDebuggerRemote::_print_handler(void *p_this, const String &p_string) {
void ScriptDebuggerRemote::_print_handler(void *p_this, const String &p_string, bool p_error) {
ScriptDebuggerRemote *sdr = (ScriptDebuggerRemote *)p_this;

View file

@ -94,7 +94,7 @@ class ScriptDebuggerRemote : public ScriptDebugger {
uint64_t msec_count;
bool locking; //hack to avoid a deadloop
static void _print_handler(void *p_this, const String &p_string);
static void _print_handler(void *p_this, const String &p_string, bool p_error);
PrintHandlerList phl;