summaryrefslogtreecommitdiff
path: root/editor/editor_node.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-11-17 16:05:44 -0300
committerGitHub <noreply@github.com>2017-11-17 16:05:44 -0300
commitebbe2bd57235fcbd2edb82c05bb9d7d768b3e7ca (patch)
tree8525dd572373c91efe33568f3c1a8663c0ed8d1a /editor/editor_node.cpp
parent0968c8d2f65f7ac6e0d6b3718ee1028b229b3353 (diff)
parentb96ee28acd80230ee56000fad2a3ca15e461d5e2 (diff)
Merge pull request #12930 from vnen/gdscrit-output-print
Make tool scripts print on the editor Output panel
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r--editor/editor_node.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index b3a8490fe9..777aedefd2 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -4552,6 +4552,11 @@ static Node *_resource_get_edited_scene() {
return EditorNode::get_singleton()->get_edited_scene();
}
+void EditorNode::_print_handler(void *p_this, const String &p_string, bool p_error) {
+ EditorNode *en = (EditorNode *)p_this;
+ en->log->add_message(p_string, p_error);
+}
+
EditorNode::EditorNode() {
Resource::_get_local_scene_func = _resource_get_edited_scene;
@@ -5652,6 +5657,10 @@ EditorNode::EditorNode() {
_dim_timer->connect("timeout", this, "_dim_timeout");
add_child(_dim_timer);
+ print_handler.printfunc = _print_handler;
+ print_handler.userdata = this;
+ add_print_handler(&print_handler);
+
ED_SHORTCUT("editor/editor_2d", TTR("Open 2D Editor"), KEY_F1);
ED_SHORTCUT("editor/editor_3d", TTR("Open 3D Editor"), KEY_F2);
ED_SHORTCUT("editor/editor_script", TTR("Open Script Editor"), KEY_F3); //hack neded for script editor F3 search to work :) Assign like this or don't use F3
@@ -5663,6 +5672,7 @@ EditorNode::EditorNode() {
EditorNode::~EditorNode() {
+ remove_print_handler(&print_handler);
memdelete(EditorHelp::get_doc_data());
memdelete(editor_selection);
memdelete(editor_plugins_over);