summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-06-26 15:37:04 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-06-26 15:37:39 -0300
commit33f1204dc4e919660bd923f366897349a9f9fdbb (patch)
tree30107c050f467e160482aba7c4d703e55c4e7ae2 /tools
parent66d513bb2ab86ab75d727cce031cfb226501cab4 (diff)
Fix error reporting when a scene is not imported properly, closes #3968
Diffstat (limited to 'tools')
-rw-r--r--tools/editor/editor_node.cpp19
-rw-r--r--tools/editor/editor_node.h4
-rw-r--r--tools/editor/io_plugins/editor_scene_import_plugin.cpp7
3 files changed, 18 insertions, 12 deletions
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index f9bedc7660..c02da178dc 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -3540,7 +3540,7 @@ void EditorNode::fix_dependencies(const String& p_for_file) {
dependency_fixer->edit(p_for_file);
}
-Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps,bool p_set_inherited) {
+Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps,bool p_set_inherited,bool p_clear_errors) {
if (!is_inside_tree()) {
defer_load_scene = p_scene;
@@ -3559,7 +3559,9 @@ Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps,bo
}
- load_errors->clear();
+ if (p_clear_errors)
+ load_errors->clear();
+
String lpath = Globals::get_singleton()->localize_path(p_scene);
if (!lpath.begins_with("res://")) {
@@ -3996,15 +3998,17 @@ bool EditorNode::_find_editing_changed_scene(Node *p_from) {
void EditorNode::add_io_error(const String& p_error) {
- CharString err_ut = p_error.utf8();
- ERR_PRINT(err_ut.get_data());
+ //CharString err_ut = p_error.utf8();
+ //ERR_PRINT(!err_ut.get_data());
_load_error_notify(singleton,p_error);
}
void EditorNode::_load_error_notify(void* p_ud,const String& p_text) {
+
EditorNode*en=(EditorNode*)p_ud;
- en->load_errors->set_text(en->load_errors->get_text()+p_text+"\n");
+ en->load_errors->add_image(en->gui_base->get_icon("Error","EditorIcons"));
+ en->load_errors->add_text(p_text+"\n");
en->load_error_dialog->popup_centered_ratio(0.5);
}
@@ -6421,8 +6425,9 @@ EditorNode::EditorNode() {
set_process_unhandled_input(true);
_playing_edited=false;
- load_errors = memnew( TextEdit );
- load_errors->set_readonly(true);
+ Panel *errors = memnew( Panel );
+ load_errors = memnew( RichTextLabel );
+// load_errors->set_readonly(true);
load_error_dialog = memnew( AcceptDialog );
load_error_dialog->add_child(load_errors);
load_error_dialog->set_title(TTR("Load Errors"));
diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h
index bea973a357..75565118bc 100644
--- a/tools/editor/editor_node.h
+++ b/tools/editor/editor_node.h
@@ -261,7 +261,7 @@ private:
TextureProgress *audio_vu;
//MenuButton *fileserver_menu;
- TextEdit *load_errors;
+ RichTextLabel *load_errors;
AcceptDialog *load_error_dialog;
//Control *scene_root_base;
@@ -652,7 +652,7 @@ public:
void fix_dependencies(const String& p_for_file);
void clear_scene() { _cleanup_scene(); }
- Error load_scene(const String& p_scene, bool p_ignore_broken_deps=false, bool p_set_inherited=false);
+ Error load_scene(const String& p_scene, bool p_ignore_broken_deps=false, bool p_set_inherited=false, bool p_clear_errors=true);
Error load_resource(const String& p_scene);
bool is_scene_open(const String& p_path);
diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp
index c7d92a9658..d5d0fac2b6 100644
--- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp
@@ -822,7 +822,7 @@ void EditorSceneImportDialog::_import(bool p_and_open) {
return;
}
if (wip_open)
- EditorNode::get_singleton()->load_scene(save_file);
+ EditorNode::get_singleton()->load_scene(save_file,false,false,false);
}
@@ -867,7 +867,7 @@ void EditorSceneImportDialog::_import_confirm() {
}
if (wip_open)
- EditorNode::get_singleton()->load_scene(wip_save_file);
+ EditorNode::get_singleton()->load_scene(wip_save_file,false,false,false);
wip_open=false;
wip_save_file="";
@@ -2680,8 +2680,9 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c
post_import_script = Ref<EditorScenePostImport>( memnew( EditorScenePostImport ) );
post_import_script->set_script(scr.get_ref_ptr());
if (!post_import_script->get_script_instance()) {
- EditorNode::add_io_error(TTR("Invalid/broken script for post-import:")+" "+post_import_script_path);
+ EditorNode::add_io_error(TTR("Invalid/broken script for post-import (check console):")+" "+post_import_script_path);
post_import_script.unref();
+ return ERR_CANT_CREATE;
}
}
}