From f46e340ab541f3fb7c34ebaabbe60c06e842ca1c Mon Sep 17 00:00:00 2001 From: Julian Murgia - StraToN Date: Wed, 29 Jul 2015 00:41:24 +0200 Subject: Added "Clear" button top right of output debug console in editor --- tools/editor/editor_log.cpp | 14 ++++++++++++++ tools/editor/editor_log.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/tools/editor/editor_log.cpp b/tools/editor/editor_log.cpp index 8d49655960..875f9d2fee 100644 --- a/tools/editor/editor_log.cpp +++ b/tools/editor/editor_log.cpp @@ -104,6 +104,13 @@ void EditorLog::_close_request() { } +void EditorLog::_clear_request() { + + log->clear(); + +} + + void EditorLog::add_message(const String& p_msg,bool p_error) { @@ -167,9 +174,11 @@ void EditorLog::_bind_methods() { ObjectTypeDB::bind_method(_MD("_close_request"),&EditorLog::_close_request ); ObjectTypeDB::bind_method(_MD("_flip_request"),&EditorLog::_flip_request ); + ObjectTypeDB::bind_method(_MD("_clear_request"),&EditorLog::_clear_request ); //ObjectTypeDB::bind_method(_MD("_dragged"),&EditorLog::_dragged ); ADD_SIGNAL( MethodInfo("close_request")); ADD_SIGNAL( MethodInfo("show_request")); + ADD_SIGNAL( MethodInfo("clear_request")); } EditorLog::EditorLog() { @@ -197,6 +206,11 @@ EditorLog::EditorLog() { //hb->add_child(pd); //pd->connect("dragged",this,"_dragged"); //pd->set_default_cursor_shape(Control::CURSOR_MOVE); + + clearbutton = memnew( Button ); + hb->add_child(clearbutton); + clearbutton->set_text("Clear"); + clearbutton->connect("pressed", this,"_clear_request"); tb = memnew( TextureButton ); hb->add_child(tb); diff --git a/tools/editor/editor_log.h b/tools/editor/editor_log.h index 1141d03911..56bdb2a366 100644 --- a/tools/editor/editor_log.h +++ b/tools/editor/editor_log.h @@ -45,6 +45,7 @@ class EditorLog : public PanelContainer { OBJ_TYPE( EditorLog, PanelContainer ); ToolButton *button; + Button *clearbutton; Label *title; RichTextLabel *log; TextureButton *tb; @@ -62,6 +63,7 @@ class EditorLog : public PanelContainer { // void _dragged(const Point2& p_ofs); void _close_request(); void _flip_request(); + void _clear_request(); static void _undo_redo_cbk(void *p_self,const String& p_name); protected: -- cgit v1.2.3 From 4ad590b92f02efc95bd2a06a9f4ab3d1ac6d5973 Mon Sep 17 00:00:00 2001 From: Julian Murgia - StraToN Date: Thu, 30 Jul 2015 00:03:25 +0200 Subject: Added automatic clear output on Play in Godot Settings --- tools/editor/editor_log.cpp | 13 +++++++++---- tools/editor/editor_log.h | 4 +++- tools/editor/editor_node.cpp | 6 +++++- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/tools/editor/editor_log.cpp b/tools/editor/editor_log.cpp index 875f9d2fee..2d26490a8a 100644 --- a/tools/editor/editor_log.cpp +++ b/tools/editor/editor_log.cpp @@ -107,7 +107,11 @@ void EditorLog::_close_request() { void EditorLog::_clear_request() { log->clear(); - + +} + +void EditorLog::clear() { + _clear_request(); } @@ -175,10 +179,11 @@ void EditorLog::_bind_methods() { ObjectTypeDB::bind_method(_MD("_close_request"),&EditorLog::_close_request ); ObjectTypeDB::bind_method(_MD("_flip_request"),&EditorLog::_flip_request ); ObjectTypeDB::bind_method(_MD("_clear_request"),&EditorLog::_clear_request ); + //ObjectTypeDB::bind_method(_MD("_dragged"),&EditorLog::_dragged ); ADD_SIGNAL( MethodInfo("close_request")); ADD_SIGNAL( MethodInfo("show_request")); - ADD_SIGNAL( MethodInfo("clear_request")); + ADD_SIGNAL( MethodInfo("clear_request")); } EditorLog::EditorLog() { @@ -206,7 +211,7 @@ EditorLog::EditorLog() { //hb->add_child(pd); //pd->connect("dragged",this,"_dragged"); //pd->set_default_cursor_shape(Control::CURSOR_MOVE); - + clearbutton = memnew( Button ); hb->add_child(clearbutton); clearbutton->set_text("Clear"); @@ -255,8 +260,8 @@ void EditorLog::deinit() { } + EditorLog::~EditorLog() { } - diff --git a/tools/editor/editor_log.h b/tools/editor/editor_log.h index 56bdb2a366..2398089799 100644 --- a/tools/editor/editor_log.h +++ b/tools/editor/editor_log.h @@ -33,6 +33,7 @@ #include "scene/gui/label.h" #include "scene/gui/rich_text_label.h" #include "scene/gui/texture_button.h" +#include "scene/gui/check_button.h" //#include "scene/gui/empty_control.h" #include "scene/gui/box_container.h" #include "scene/gui/panel_container.h" @@ -59,11 +60,11 @@ class EditorLog : public PanelContainer { Thread::ID current; - // void _dragged(const Point2& p_ofs); void _close_request(); void _flip_request(); void _clear_request(); + void _clearonplay_request(); static void _undo_redo_cbk(void *p_self,const String& p_name); protected: @@ -75,6 +76,7 @@ public: void deinit(); ToolButton *get_button(); + void clear(); EditorLog(); ~EditorLog(); }; diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 7b44f2cad9..3f30e85272 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -1564,7 +1564,6 @@ void EditorNode::_run(bool p_current,const String& p_custom) { Node *scene = editor_data.get_edited_scene_root(); if (!scene) { - current_option=-1; //accept->get_cancel()->hide(); accept->get_ok()->set_text("I see.."); @@ -1645,6 +1644,11 @@ void EditorNode::_run(bool p_current,const String& p_custom) { editor_data.save_editor_external_data(); } + if (bool(EDITOR_DEF("run/always_clear_output_on_play", true))) { + print_line("Setting option was set to ON -> clearing"); + log->clear(); + } + List breakpoints; editor_data.get_editor_breakpoints(&breakpoints); -- cgit v1.2.3 From c5941ab57aa2c8004d6d8a725cb52c6e0b26b4b2 Mon Sep 17 00:00:00 2001 From: Julian Murgia - StraToN Date: Thu, 30 Jul 2015 00:05:37 +0200 Subject: include not necessary anymore --- tools/editor/editor_log.h | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/editor/editor_log.h b/tools/editor/editor_log.h index 2398089799..a7c12ecb74 100644 --- a/tools/editor/editor_log.h +++ b/tools/editor/editor_log.h @@ -33,7 +33,6 @@ #include "scene/gui/label.h" #include "scene/gui/rich_text_label.h" #include "scene/gui/texture_button.h" -#include "scene/gui/check_button.h" //#include "scene/gui/empty_control.h" #include "scene/gui/box_container.h" #include "scene/gui/panel_container.h" -- cgit v1.2.3 From 6e608bd4995a632a2ca62abcf502c1a55edd6808 Mon Sep 17 00:00:00 2001 From: Julian Murgia - StraToN Date: Thu, 30 Jul 2015 00:08:11 +0200 Subject: forgot to remove a method declaration... --- tools/editor/editor_log.h | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/editor/editor_log.h b/tools/editor/editor_log.h index a7c12ecb74..6950ffa1a0 100644 --- a/tools/editor/editor_log.h +++ b/tools/editor/editor_log.h @@ -63,7 +63,6 @@ class EditorLog : public PanelContainer { void _close_request(); void _flip_request(); void _clear_request(); - void _clearonplay_request(); static void _undo_redo_cbk(void *p_self,const String& p_name); protected: -- cgit v1.2.3 From e6a711282ad9b918cb9dd9965abff75a7c3b6b43 Mon Sep 17 00:00:00 2001 From: Julian Murgia - StraToN Date: Thu, 30 Jul 2015 00:10:21 +0200 Subject: Damnit, forgot one more debug line >< --- tools/editor/editor_node.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 3f30e85272..7d8261dac6 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -1645,7 +1645,6 @@ void EditorNode::_run(bool p_current,const String& p_custom) { } if (bool(EDITOR_DEF("run/always_clear_output_on_play", true))) { - print_line("Setting option was set to ON -> clearing"); log->clear(); } -- cgit v1.2.3