Merge pull request #2316 from StraToN/clearconsole

Clear output console (Button + clear on Play)
This commit is contained in:
Juan Linietsky 2015-08-08 11:07:36 -03:00
commit b3dff195e0
3 changed files with 27 additions and 3 deletions

View file

@ -104,6 +104,17 @@ void EditorLog::_close_request() {
}
void EditorLog::_clear_request() {
log->clear();
}
void EditorLog::clear() {
_clear_request();
}
void EditorLog::add_message(const String& p_msg,bool p_error) {
@ -167,9 +178,12 @@ 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() {
@ -198,6 +212,11 @@ EditorLog::EditorLog() {
//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);
tb->connect("pressed",this,"_close_request");
@ -241,8 +260,8 @@ void EditorLog::deinit() {
}
EditorLog::~EditorLog() {
}

View file

@ -45,6 +45,7 @@ class EditorLog : public PanelContainer {
OBJ_TYPE( EditorLog, PanelContainer );
ToolButton *button;
Button *clearbutton;
Label *title;
RichTextLabel *log;
TextureButton *tb;
@ -58,10 +59,10 @@ class EditorLog : public PanelContainer {
Thread::ID current;
// 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:
@ -73,6 +74,7 @@ public:
void deinit();
ToolButton *get_button();
void clear();
EditorLog();
~EditorLog();
};

View file

@ -1587,7 +1587,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..");
@ -1668,6 +1667,10 @@ 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))) {
log->clear();
}
List<String> breakpoints;
editor_data.get_editor_breakpoints(&breakpoints);