summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/collada/collada.cpp4
-rw-r--r--editor/editor_data.cpp2
-rw-r--r--editor/editor_dir_dialog.cpp2
-rw-r--r--editor/editor_export.cpp4
-rw-r--r--editor/editor_feature_profile.cpp10
-rw-r--r--editor/editor_file_system.cpp25
-rw-r--r--editor/editor_inspector.cpp2
-rw-r--r--editor/editor_node.cpp6
-rw-r--r--editor/editor_properties.cpp2
-rw-r--r--editor/editor_resource_preview.cpp4
-rw-r--r--editor/editor_settings.cpp8
-rw-r--r--editor/export_template_manager.cpp2
-rw-r--r--editor/file_type_cache.cpp2
-rw-r--r--editor/filesystem_dock.cpp4
-rw-r--r--editor/find_in_files.cpp4
-rw-r--r--editor/import/editor_import_collada.cpp8
-rw-r--r--editor/import/editor_scene_importer_gltf.cpp4
-rw-r--r--editor/import/resource_importer_csv_translation.cpp2
-rw-r--r--editor/import/resource_importer_image.cpp3
-rw-r--r--editor/import/resource_importer_obj.cpp2
-rw-r--r--editor/import/resource_importer_scene.cpp8
-rw-r--r--editor/import/resource_importer_wav.cpp2
-rw-r--r--editor/plugin_config_dialog.cpp2
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp4
-rw-r--r--editor/plugins/cpu_particles_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/curve_editor_plugin.cpp2
-rw-r--r--editor/plugins/mesh_library_editor_plugin.cpp2
-rw-r--r--editor/plugins/particles_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/script_editor_plugin.cpp7
-rw-r--r--editor/plugins/theme_editor_plugin.cpp2
-rw-r--r--editor/progress_dialog.cpp4
31 files changed, 69 insertions, 68 deletions
diff --git a/editor/collada/collada.cpp b/editor/collada/collada.cpp
index e38171eef9..843d1006d7 100644
--- a/editor/collada/collada.cpp
+++ b/editor/collada/collada.cpp
@@ -2514,7 +2514,7 @@ Error Collada::load(const String &p_path, int p_flags) {
Ref<XMLParser> parserr = memnew(XMLParser);
XMLParser &parser = *parserr.ptr();
Error err = parser.open(p_path);
- ERR_FAIL_COND_V(err, err);
+ ERR_FAIL_COND_V_MSG(err, err, "Cannot open Collada file '" + p_path + "'.");
state.local_path = ProjectSettings::get_singleton()->localize_path(p_path);
state.import_flags = p_flags;
@@ -2530,7 +2530,7 @@ Error Collada::load(const String &p_path, int p_flags) {
}
}
- ERR_FAIL_COND_V(err != OK, ERR_FILE_CORRUPT);
+ ERR_FAIL_COND_V_MSG(err != OK, ERR_FILE_CORRUPT, "Corrupted Collada file '" + p_path + "'.");
/* Start loading Collada */
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp
index c98635d16b..777eda2170 100644
--- a/editor/editor_data.cpp
+++ b/editor/editor_data.cpp
@@ -481,7 +481,7 @@ EditorPlugin *EditorData::get_editor_plugin(int p_idx) {
void EditorData::add_custom_type(const String &p_type, const String &p_inherits, const Ref<Script> &p_script, const Ref<Texture> &p_icon) {
- ERR_FAIL_COND(p_script.is_null());
+ ERR_FAIL_COND_MSG(p_script.is_null(), "It's not a reference to a valid Script object.");
CustomType ct;
ct.name = p_type;
ct.icon = p_icon;
diff --git a/editor/editor_dir_dialog.cpp b/editor/editor_dir_dialog.cpp
index 7733ecb9da..0636ae3aea 100644
--- a/editor/editor_dir_dialog.cpp
+++ b/editor/editor_dir_dialog.cpp
@@ -151,7 +151,7 @@ void EditorDirDialog::_make_dir_confirm() {
String dir = ti->get_metadata(0);
DirAccessRef d = DirAccess::open(dir);
- ERR_FAIL_COND(!d);
+ ERR_FAIL_COND_MSG(!d, "Cannot open directory '" + dir + "'.");
Error err = d->make_dir(makedirname->get_text());
if (err != OK) {
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index e58c7c992a..90f54df485 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -913,7 +913,7 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c
String tmppath = EditorSettings::get_singleton()->get_cache_dir().plus_file("packtmp");
FileAccess *ftmp = FileAccess::open(tmppath, FileAccess::WRITE);
- ERR_FAIL_COND_V(!ftmp, ERR_CANT_CREATE);
+ ERR_FAIL_COND_V_MSG(!ftmp, ERR_CANT_CREATE, "Cannot create file '" + tmppath + "'.");
PackData pd;
pd.ep = &ep;
@@ -1017,7 +1017,7 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c
if (!ftmp) {
memdelete(f);
DirAccess::remove_file_or_error(tmppath);
- ERR_FAIL_V_MSG(ERR_CANT_CREATE, "Can't open file to read from path: " + String(tmppath) + ".");
+ ERR_FAIL_V_MSG(ERR_CANT_CREATE, "Can't open file to read from path '" + String(tmppath) + "'.");
}
const int bufsize = 16384;
diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp
index ee533d13c4..0182c3b4a2 100644
--- a/editor/editor_feature_profile.cpp
+++ b/editor/editor_feature_profile.cpp
@@ -165,7 +165,7 @@ Error EditorFeatureProfile::save_to_file(const String &p_path) {
json["disabled_features"] = dis_features;
FileAccessRef f = FileAccess::open(p_path, FileAccess::WRITE);
- ERR_FAIL_COND_V(!f, ERR_CANT_OPEN);
+ ERR_FAIL_COND_V_MSG(!f, ERR_CANT_CREATE, "Cannot create file '" + p_path + "'.");
String text = JSON::print(json, "\t");
f->store_string(text);
@@ -326,7 +326,8 @@ void EditorFeatureProfileManager::_update_profile_list(const String &p_select_pr
Vector<String> profiles;
DirAccessRef d = DirAccess::open(EditorSettings::get_singleton()->get_feature_profiles_dir());
- ERR_FAIL_COND(!d);
+ ERR_FAIL_COND_MSG(!d, "Cannot open directory '" + EditorSettings::get_singleton()->get_feature_profiles_dir() + "'.");
+
d->list_dir_begin();
while (true) {
String f = d->get_next();
@@ -433,7 +434,8 @@ void EditorFeatureProfileManager::_erase_selected_profile() {
String selected = _get_selected_profile();
ERR_FAIL_COND(selected == String());
DirAccessRef da = DirAccess::open(EditorSettings::get_singleton()->get_feature_profiles_dir());
- ERR_FAIL_COND(!da);
+ ERR_FAIL_COND_MSG(!da, "Cannot open directory '" + EditorSettings::get_singleton()->get_feature_profiles_dir() + "'.");
+
da->remove(selected + ".profile");
if (selected == current_profile) {
_profile_action(PROFILE_CLEAR);
@@ -672,7 +674,7 @@ void EditorFeatureProfileManager::_update_selected_profile() {
//reload edited, if different from current
edited.instance();
Error err = edited->load_from_file(EditorSettings::get_singleton()->get_feature_profiles_dir().plus_file(profile + ".profile"));
- ERR_FAIL_COND(err != OK);
+ ERR_FAIL_COND_MSG(err != OK, "Error when loading EditorSettings from file '" + EditorSettings::get_singleton()->get_feature_profiles_dir().plus_file(profile + ".profile") + "'.");
}
updating_features = true;
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index 6d3377a85b..3663bdee27 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -326,7 +326,7 @@ void EditorFileSystem::_save_filesystem_cache() {
FileAccess *f = FileAccess::open(fscache, FileAccess::WRITE);
if (f == NULL) {
- ERR_PRINTS("Error writing fscache: " + fscache);
+ ERR_PRINTS("Error writing fscache '" + fscache + "'.");
} else {
f->store_line(filesystem_settings_version_for_import);
_save_filesystem_cache(filesystem, f);
@@ -389,7 +389,7 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo
if (err == ERR_FILE_EOF) {
break;
} else if (err != OK) {
- ERR_PRINTS("ResourceFormatImporter::load - " + p_path + ".import:" + itos(lines) + " error: " + error_text);
+ ERR_PRINTS("ResourceFormatImporter::load - '" + p_path + ".import:" + itos(lines) + "' error '" + error_text + "'.");
memdelete(f);
return false; //parse error, try reimport manually (Avoid reimport loop on broken file)
}
@@ -437,7 +437,7 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo
if (err == ERR_FILE_EOF) {
break;
} else if (err != OK) {
- ERR_PRINTS("ResourceFormatImporter::load - " + p_path + ".import.md5:" + itos(lines) + " error: " + error_text);
+ ERR_PRINTS("ResourceFormatImporter::load - '" + p_path + ".import.md5:" + itos(lines) + "' error '" + error_text + "'.");
memdelete(md5s);
return false; // parse error
}
@@ -736,7 +736,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess
da->change_dir("..");
}
} else {
- ERR_PRINTS("Cannot go into subdir: " + E->get());
+ ERR_PRINTS("Cannot go into subdir '" + E->get() + "'.");
}
p_progress.update(idx, total);
@@ -1555,7 +1555,7 @@ Error EditorFileSystem::_reimport_group(const String &p_group_file, const Vector
ERR_CONTINUE(file_importer_name == String());
if (importer_name != String() && importer_name != file_importer_name) {
- print_line("one importer: " + importer_name + " the other: " + file_importer_name);
+ print_line("one importer '" + importer_name + "' the other '" + file_importer_name + "'.");
EditorNode::get_singleton()->show_warning(vformat(TTR("There are multiple importers for different types pointing to file %s, import aborted"), p_group_file));
ERR_FAIL_V(ERR_FILE_CORRUPT);
}
@@ -1599,7 +1599,7 @@ Error EditorFileSystem::_reimport_group(const String &p_group_file, const Vector
const String &file = E->key();
String base_path = ResourceFormatImporter::get_singleton()->get_import_base_path(file);
FileAccessRef f = FileAccess::open(file + ".import", FileAccess::WRITE);
- ERR_FAIL_COND_V(!f, ERR_FILE_CANT_OPEN);
+ ERR_FAIL_COND_V_MSG(!f, ERR_FILE_CANT_OPEN, "Cannot open import file '" + file + ".import'.");
//write manually, as order matters ([remap] has to go first for performance).
f->store_line("[remap]");
@@ -1660,7 +1660,7 @@ Error EditorFileSystem::_reimport_group(const String &p_group_file, const Vector
// Store the md5's of the various files. These are stored separately so that the .import files can be version controlled.
FileAccessRef md5s = FileAccess::open(base_path + ".md5", FileAccess::WRITE);
- ERR_FAIL_COND_V(!md5s, ERR_FILE_CANT_OPEN);
+ ERR_FAIL_COND_V_MSG(!md5s, ERR_FILE_CANT_OPEN, "Cannot open MD5 file '" + base_path + ".md5'.");
md5s->store_line("source_md5=\"" + FileAccess::get_md5(file) + "\"");
if (dest_paths.size()) {
@@ -1671,7 +1671,7 @@ Error EditorFileSystem::_reimport_group(const String &p_group_file, const Vector
EditorFileSystemDirectory *fs = NULL;
int cpos = -1;
bool found = _find_file(file, &fs, cpos);
- ERR_FAIL_COND_V(!found, ERR_UNCONFIGURED);
+ ERR_FAIL_COND_V_MSG(!found, ERR_UNCONFIGURED, "Can't find file '" + file + "'.");
//update modified times, to avoid reimport
fs->files[cpos]->modified_time = FileAccess::get_modified_time(file);
@@ -1705,7 +1705,7 @@ void EditorFileSystem::_reimport_file(const String &p_file) {
EditorFileSystemDirectory *fs = NULL;
int cpos = -1;
bool found = _find_file(p_file, &fs, cpos);
- ERR_FAIL_COND(!found);
+ ERR_FAIL_COND_MSG(!found, "Can't find file '" + p_file + "'.");
//try to obtain existing params
@@ -1781,13 +1781,13 @@ void EditorFileSystem::_reimport_file(const String &p_file) {
Error err = importer->import(p_file, base_path, params, &import_variants, &gen_files, &metadata);
if (err != OK) {
- ERR_PRINTS("Error importing: " + p_file);
+ ERR_PRINTS("Error importing '" + p_file + "'.");
}
//as import is complete, save the .import file
FileAccess *f = FileAccess::open(p_file + ".import", FileAccess::WRITE);
- ERR_FAIL_COND(!f);
+ ERR_FAIL_COND_MSG(!f, "Cannot open file from path '" + p_file + ".import'.");
//write manually, as order matters ([remap] has to go first for performance).
f->store_line("[remap]");
@@ -1872,7 +1872,8 @@ void EditorFileSystem::_reimport_file(const String &p_file) {
// Store the md5's of the various files. These are stored separately so that the .import files can be version controlled.
FileAccess *md5s = FileAccess::open(base_path + ".md5", FileAccess::WRITE);
- ERR_FAIL_COND(!md5s);
+ ERR_FAIL_COND_MSG(!md5s, "Cannot open MD5 file '" + base_path + ".md5'.");
+
md5s->store_line("source_md5=\"" + FileAccess::get_md5(p_file) + "\"");
if (dest_paths.size()) {
md5s->store_line("dest_md5=\"" + FileAccess::get_multiple_md5(dest_paths) + "\"\n");
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 8d5858a10d..b29417b4c3 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -1289,7 +1289,7 @@ void EditorInspector::remove_inspector_plugin(const Ref<EditorInspectorPlugin> &
}
}
- ERR_FAIL_COND(idx == -1);
+ ERR_FAIL_COND_MSG(idx == -1, "Trying to remove nonexistent inspector plugin.");
for (int i = idx; i < inspector_plugin_count - 1; i++) {
inspector_plugins[i] = inspector_plugins[i + 1];
}
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 1196a26882..df1e8005ed 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -903,7 +903,7 @@ void EditorNode::_set_scene_metadata(const String &p_file, int p_idx) {
}
Error err = cf->save(path);
- ERR_FAIL_COND(err != OK);
+ ERR_FAIL_COND_MSG(err != OK, "Cannot save config file to '" + path + "'.");
}
bool EditorNode::_find_and_save_resource(RES p_res, Map<RES, bool> &processed, int32_t flags) {
@@ -2597,7 +2597,7 @@ void EditorNode::_save_screenshot(NodePath p_path) {
img->flip_y();
viewport->set_clear_mode(Viewport::CLEAR_MODE_ALWAYS);
Error error = img->save_png(p_path);
- ERR_FAIL_COND(error != OK);
+ ERR_FAIL_COND_MSG(error != OK, "Cannot save screenshot to file '" + p_path + "'.");
}
void EditorNode::_tool_menu_option(int p_idx) {
@@ -3683,7 +3683,7 @@ Ref<Texture> EditorNode::get_object_icon(const Object *p_object, const String &p
}
Ref<Texture> EditorNode::get_class_icon(const String &p_class, const String &p_fallback) const {
- ERR_FAIL_COND_V(p_class.empty(), NULL);
+ ERR_FAIL_COND_V_MSG(p_class.empty(), NULL, "Class name cannot be empty.");
if (gui_base->has_icon(p_class, "EditorIcons")) {
return gui_base->get_icon(p_class, "EditorIcons");
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index f456cf7233..690b7a8ec4 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -2061,7 +2061,7 @@ void EditorPropertyResource::_file_selected(const String &p_path) {
RES res = ResourceLoader::load(p_path);
- ERR_FAIL_COND(res.is_null());
+ ERR_FAIL_COND_MSG(res.is_null(), "Cannot load resource from path '" + p_path + "'.");
List<PropertyInfo> prop_list;
get_edited_object()->get_property_list(&prop_list);
diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp
index 77e9220b6d..65a1704770 100644
--- a/editor/editor_resource_preview.cpp
+++ b/editor/editor_resource_preview.cpp
@@ -203,7 +203,7 @@ void EditorResourcePreview::_generate_preview(Ref<ImageTexture> &r_texture, Ref<
}
Error err;
FileAccess *f = FileAccess::open(cache_base + ".txt", FileAccess::WRITE, &err);
- ERR_FAIL_COND(err != OK);
+ ERR_FAIL_COND_MSG(err != OK, "Cannot create file '" + cache_base + ".txt'.");
f->store_line(itos(thumbnail_size));
f->store_line(itos(has_small_texture));
f->store_line(itos(FileAccess::get_modified_time(p_item.path)));
@@ -450,7 +450,7 @@ void EditorResourcePreview::check_for_invalidation(const String &p_path) {
}
void EditorResourcePreview::start() {
- ERR_FAIL_COND(thread);
+ ERR_FAIL_COND_MSG(thread, "Thread already started.");
thread = Thread::create(_thread_func, this);
}
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 479fe5f0cb..9d24e443c4 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -793,13 +793,13 @@ void EditorSettings::create() {
self_contained = true;
Error err = extra_config->load(exe_path + "/._sc_");
if (err != OK) {
- ERR_PRINTS("Can't load config from path: " + exe_path + "/._sc_");
+ ERR_PRINTS("Can't load config from path '" + exe_path + "/._sc_'.");
}
} else if (d->file_exists(exe_path + "/_sc_")) {
self_contained = true;
Error err = extra_config->load(exe_path + "/_sc_");
if (err != OK) {
- ERR_PRINTS("Can't load config from path: " + exe_path + "/_sc_");
+ ERR_PRINTS("Can't load config from path '" + exe_path + "/_sc_'.");
}
}
memdelete(d);
@@ -1235,10 +1235,10 @@ void EditorSettings::set_project_metadata(const String &p_section, const String
String path = get_project_settings_dir().plus_file("project_metadata.cfg");
Error err;
err = cf->load(path);
- ERR_FAIL_COND(err != OK && err != ERR_FILE_NOT_FOUND);
+ ERR_FAIL_COND_MSG(err != OK && err != ERR_FILE_NOT_FOUND, "Cannot load editor settings from file '" + path + "'.");
cf->set_value(p_section, p_key, p_data);
err = cf->save(path);
- ERR_FAIL_COND(err != OK);
+ ERR_FAIL_COND_MSG(err != OK, "Cannot save editor settings to file '" + path + "'.");
}
Variant EditorSettings::get_project_metadata(const String &p_section, const String &p_key, Variant p_default) const {
diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp
index 202b554be4..1cdf9848ef 100644
--- a/editor/export_template_manager.cpp
+++ b/editor/export_template_manager.cpp
@@ -321,7 +321,7 @@ bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_
if (!f) {
ret = unzGoToNextFile(pkg);
fc++;
- ERR_CONTINUE_MSG(true, "Can't open file from path: " + String(to_write) + ".");
+ ERR_CONTINUE_MSG(true, "Can't open file from path '" + String(to_write) + "'.");
}
f->store_buffer(data.ptr(), data.size());
diff --git a/editor/file_type_cache.cpp b/editor/file_type_cache.cpp
index 746d38f2b5..602906cb8d 100644
--- a/editor/file_type_cache.cpp
+++ b/editor/file_type_cache.cpp
@@ -99,6 +99,6 @@ void FileTypeCache::save() {
FileTypeCache::FileTypeCache() {
- ERR_FAIL_COND(singleton);
+ ERR_FAIL_COND_MSG(singleton, "FileTypeCache singleton already exist.");
singleton = this;
}
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index a729befe8e..426ea8f196 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -1709,7 +1709,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
reimport.push_back(p_selected[i]);
}
- ERR_FAIL_COND(reimport.size() == 0);
+ ERR_FAIL_COND_MSG(reimport.size() == 0, "You need to select files to reimport them.");
} break;
case FILE_NEW_FOLDER: {
@@ -2087,7 +2087,7 @@ void FileSystemDock::_get_drag_target_folder(String &target, bool &target_favori
void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<String> p_paths, bool p_display_path_dependent_options) {
// Add options for files and folders.
- ERR_FAIL_COND(p_paths.empty());
+ ERR_FAIL_COND_MSG(p_paths.empty(), "Path cannot be empty.");
Vector<String> filenames;
Vector<String> foldernames;
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp
index def22d07de..752e49a932 100644
--- a/editor/find_in_files.cpp
+++ b/editor/find_in_files.cpp
@@ -829,7 +829,7 @@ void FindInFilesPanel::apply_replaces_in_file(String fpath, const Vector<Result>
// however that means either losing changes or losing replaces.
FileAccess *f = FileAccess::open(fpath, FileAccess::READ);
- ERR_FAIL_COND(f == NULL);
+ ERR_FAIL_COND_MSG(f == NULL, "Cannot open file from path '" + fpath + "'.");
String buffer;
int current_line = 1;
@@ -876,7 +876,7 @@ void FindInFilesPanel::apply_replaces_in_file(String fpath, const Vector<Result>
// Now the modified contents are in the buffer, rewrite the file with our changes
Error err = f->reopen(fpath, FileAccess::WRITE);
- ERR_FAIL_COND(err != OK);
+ ERR_FAIL_COND_MSG(err != OK, "Cannot create file in path '" + fpath + "'.");
f->store_string(buffer);
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index adfdfee603..d604a95320 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -1207,7 +1207,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
const Collada::MeshData &meshdata = collada.state.mesh_data_map[meshid];
mesh->set_name(meshdata.name);
Error err = _create_mesh_surfaces(morphs.size() == 0, mesh, ng2->material_map, meshdata, apply_xform, bone_remap, skin, morph, morphs, p_use_compression, use_mesh_builtin_materials);
- ERR_FAIL_COND_V(err, err);
+ ERR_FAIL_COND_V_MSG(err, err, "Cannot create mesh surface.");
mesh_cache[meshid] = mesh;
} else {
@@ -1259,7 +1259,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
Error ColladaImport::load(const String &p_path, int p_flags, bool p_force_make_tangents, bool p_use_compression) {
Error err = collada.load(p_path, p_flags);
- ERR_FAIL_COND_V(err, err);
+ ERR_FAIL_COND_V_MSG(err, err, "Cannot load file '" + p_path + "'.");
force_make_tangents = p_force_make_tangents;
ERR_FAIL_COND_V(!collada.state.visual_scene_map.has(collada.state.root_visual_scene), ERR_INVALID_DATA);
@@ -1777,7 +1777,7 @@ Node *EditorSceneImporterCollada::import_scene(const String &p_path, uint32_t p_
Error err = state.load(p_path, flags, p_flags & EditorSceneImporter::IMPORT_GENERATE_TANGENT_ARRAYS, p_flags & EditorSceneImporter::IMPORT_USE_COMPRESSION);
- ERR_FAIL_COND_V(err != OK, NULL);
+ ERR_FAIL_COND_V_MSG(err != OK, NULL, "Cannot load scene from file '" + p_path + "'.");
if (state.missing_textures.size()) {
@@ -1830,7 +1830,7 @@ Ref<Animation> EditorSceneImporterCollada::import_animation(const String &p_path
state.use_mesh_builtin_materials = false;
Error err = state.load(p_path, Collada::IMPORT_FLAG_ANIMATION, p_flags & EditorSceneImporter::IMPORT_GENERATE_TANGENT_ARRAYS);
- ERR_FAIL_COND_V(err != OK, RES());
+ ERR_FAIL_COND_V_MSG(err != OK, RES(), "Cannot load animation from file '" + p_path + "'.");
state.create_animations(p_flags & EditorSceneImporter::IMPORT_ANIMATION_FORCE_ALL_TRACKS_IN_ALL_CLIPS, p_flags & EditorSceneImporter::IMPORT_ANIMATION_KEEP_VALUE_TRACKS);
if (state.scene)
diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp
index 3da4b6439a..df5511f540 100644
--- a/editor/import/editor_scene_importer_gltf.cpp
+++ b/editor/import/editor_scene_importer_gltf.cpp
@@ -2411,14 +2411,14 @@ Error EditorSceneImporterGLTF::_parse_animations(GLTFState &state) {
track->weight_tracks.write[k] = cf;
}
} else {
- WARN_PRINTS("Invalid path: " + path);
+ WARN_PRINTS("Invalid path '" + path + "'.");
}
}
state.animations.push_back(animation);
}
- print_verbose("glTF: Total animations: " + itos(state.animations.size()));
+ print_verbose("glTF: Total animations '" + itos(state.animations.size()) + "'.");
return OK;
}
diff --git a/editor/import/resource_importer_csv_translation.cpp b/editor/import/resource_importer_csv_translation.cpp
index 301422a25a..d988e1dcc3 100644
--- a/editor/import/resource_importer_csv_translation.cpp
+++ b/editor/import/resource_importer_csv_translation.cpp
@@ -90,7 +90,7 @@ Error ResourceImporterCSVTranslation::import(const String &p_source_file, const
FileAccessRef f = FileAccess::open(p_source_file, FileAccess::READ);
- ERR_FAIL_COND_V(!f, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V_MSG(!f, ERR_INVALID_PARAMETER, "Cannot open file from path '" + p_source_file + "'.");
Vector<String> line = f->get_csv_line(delimiter);
ERR_FAIL_COND_V(line.size() <= 1, ERR_PARSE_ERROR);
diff --git a/editor/import/resource_importer_image.cpp b/editor/import/resource_importer_image.cpp
index ed8ea5497a..3d7663ba8f 100644
--- a/editor/import/resource_importer_image.cpp
+++ b/editor/import/resource_importer_image.cpp
@@ -78,7 +78,7 @@ Error ResourceImporterImage::import(const String &p_source_file, const String &p
FileAccess *f = FileAccess::open(p_source_file, FileAccess::READ);
- ERR_FAIL_COND_V(!f, ERR_CANT_OPEN);
+ ERR_FAIL_COND_V_MSG(!f, ERR_CANT_OPEN, "Cannot open file from path '" + p_source_file + "'.");
size_t len = f->get_len();
@@ -90,6 +90,7 @@ Error ResourceImporterImage::import(const String &p_source_file, const String &p
memdelete(f);
f = FileAccess::open(p_save_path + ".image", FileAccess::WRITE);
+ ERR_FAIL_COND_V_MSG(!f, ERR_CANT_CREATE, "Cannot create file in path '" + p_save_path + ".image'.");
//save the header GDIM
const uint8_t header[4] = { 'G', 'D', 'I', 'M' };
diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp
index 9061c92f6e..31a099ef83 100644
--- a/editor/import/resource_importer_obj.cpp
+++ b/editor/import/resource_importer_obj.cpp
@@ -509,7 +509,7 @@ Error ResourceImporterOBJ::import(const String &p_source_file, const String &p_s
err = ResourceSaver::save(save_path, meshes.front()->get());
- ERR_FAIL_COND_V(err != OK, err);
+ ERR_FAIL_COND_V_MSG(err != OK, err, "Cannot save Mesh to file '" + save_path + "'.");
r_gen_files->push_back(save_path);
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index b111750992..760388d616 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -1418,7 +1418,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
DirAccess *da = DirAccess::open(base_path);
Error err2 = da->make_dir(subdir_name);
memdelete(da);
- ERR_FAIL_COND_V(err2 != OK && err2 != ERR_ALREADY_EXISTS, err2);
+ ERR_FAIL_COND_V_MSG(err2 != OK && err2 != ERR_ALREADY_EXISTS, err2, "Cannot make directory '" + subdir_name + "'.");
base_path = base_path.plus_file(subdir_name);
}
}
@@ -1514,7 +1514,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
Ref<PackedScene> packer = memnew(PackedScene);
packer->pack(child);
err = ResourceSaver::save(path, packer); //do not take over, let the changed files reload themselves
- ERR_FAIL_COND_V(err != OK, err);
+ ERR_FAIL_COND_V_MSG(err != OK, err, "Cannot save scene to file '" + path + "'.");
}
}
@@ -1522,7 +1522,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
packer->pack(scene);
print_verbose("Saving scene to: " + p_save_path + ".scn");
err = ResourceSaver::save(p_save_path + ".scn", packer); //do not take over, let the changed files reload themselves
- ERR_FAIL_COND_V(err != OK, err);
+ ERR_FAIL_COND_V_MSG(err != OK, err, "Cannot save scene to file '" + p_save_path + ".scn'.");
memdelete(scene);
@@ -1549,7 +1549,7 @@ Node *EditorSceneImporterESCN::import_scene(const String &p_path, uint32_t p_fla
Error error;
Ref<PackedScene> ps = ResourceFormatLoaderText::singleton->load(p_path, p_path, &error);
- ERR_FAIL_COND_V(!ps.is_valid(), NULL);
+ ERR_FAIL_COND_V_MSG(!ps.is_valid(), NULL, "Cannot load scene as text resource from path '" + p_path + "'.");
Node *scene = ps->instance();
ERR_FAIL_COND_V(!scene, NULL);
diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp
index f1de71e25e..74586a4100 100644
--- a/editor/import/resource_importer_wav.cpp
+++ b/editor/import/resource_importer_wav.cpp
@@ -96,7 +96,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
Error err;
FileAccess *file = FileAccess::open(p_source_file, FileAccess::READ, &err);
- ERR_FAIL_COND_V(err != OK, ERR_CANT_OPEN);
+ ERR_FAIL_COND_V_MSG(err != OK, ERR_CANT_OPEN, "Cannot open file '" + p_source_file + "'.");
/* CHECK RIFF */
char riff[5];
diff --git a/editor/plugin_config_dialog.cpp b/editor/plugin_config_dialog.cpp
index 23056d25c0..971e746509 100644
--- a/editor/plugin_config_dialog.cpp
+++ b/editor/plugin_config_dialog.cpp
@@ -131,7 +131,7 @@ void PluginConfigDialog::config(const String &p_config_path) {
if (p_config_path.length()) {
Ref<ConfigFile> cf = memnew(ConfigFile);
Error err = cf->load(p_config_path);
- ERR_FAIL_COND(err != OK);
+ ERR_FAIL_COND_MSG(err != OK, "Cannot load config file from path '" + p_config_path + "'.");
name_edit->set_text(cf->get_value("plugin", "name", ""));
subfolder_edit->set_text(p_config_path.get_base_dir().get_basename().get_file());
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index d7451849a1..831b1434f3 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -736,8 +736,8 @@ void AnimationPlayerEditor::_dialog_action(String p_file) {
ERR_FAIL_COND(!player);
Ref<Resource> res = ResourceLoader::load(p_file, "Animation");
- ERR_FAIL_COND(res.is_null());
- ERR_FAIL_COND(!res->is_class("Animation"));
+ ERR_FAIL_COND_MSG(res.is_null(), "Cannot load Animation from file '" + p_file + "'.");
+ ERR_FAIL_COND_MSG(!res->is_class("Animation"), "Loaded resource from file '" + p_file + "' is not Animation.");
if (p_file.find_last("/") != -1) {
p_file = p_file.substr(p_file.find_last("/") + 1, p_file.length());
diff --git a/editor/plugins/cpu_particles_2d_editor_plugin.cpp b/editor/plugins/cpu_particles_2d_editor_plugin.cpp
index 9d625af959..374900d4c7 100644
--- a/editor/plugins/cpu_particles_2d_editor_plugin.cpp
+++ b/editor/plugins/cpu_particles_2d_editor_plugin.cpp
@@ -87,7 +87,7 @@ void CPUParticles2DEditorPlugin::_generate_emission_mask() {
Ref<Image> img;
img.instance();
Error err = ImageLoader::load_image(source_emission_file, img);
- ERR_FAIL_COND_MSG(err != OK, "Error loading image: " + source_emission_file + ".");
+ ERR_FAIL_COND_MSG(err != OK, "Error loading image '" + source_emission_file + "'.");
if (img->is_compressed()) {
img->decompress();
diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp
index c2b6031e60..98db911799 100644
--- a/editor/plugins/curve_editor_plugin.cpp
+++ b/editor/plugins/curve_editor_plugin.cpp
@@ -779,7 +779,7 @@ bool CurvePreviewGenerator::handles(const String &p_type) const {
Ref<Texture> CurvePreviewGenerator::generate(const Ref<Resource> &p_from, const Size2 &p_size) const {
Ref<Curve> curve_ref = p_from;
- ERR_FAIL_COND_V(curve_ref.is_null(), Ref<Texture>());
+ ERR_FAIL_COND_V_MSG(curve_ref.is_null(), Ref<Texture>(), "It's not a reference to a valid Resource object.");
Curve &curve = **curve_ref;
// FIXME: Should be ported to use p_size as done in b2633a97
diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp
index 1fc6dae978..7fbb35e565 100644
--- a/editor/plugins/mesh_library_editor_plugin.cpp
+++ b/editor/plugins/mesh_library_editor_plugin.cpp
@@ -201,7 +201,7 @@ void MeshLibraryEditor::_import_scene_cbk(const String &p_str) {
ERR_FAIL_COND(ps.is_null());
Node *scene = ps->instance();
- ERR_FAIL_COND(!scene);
+ ERR_FAIL_COND_MSG(!scene, "Cannot create an instance from PackedScene '" + p_str + "'.");
_import_scene(scene, mesh_library, option == MENU_OPTION_UPDATE_FROM_SCENE);
diff --git a/editor/plugins/particles_2d_editor_plugin.cpp b/editor/plugins/particles_2d_editor_plugin.cpp
index 8025e12885..957ce42304 100644
--- a/editor/plugins/particles_2d_editor_plugin.cpp
+++ b/editor/plugins/particles_2d_editor_plugin.cpp
@@ -160,7 +160,7 @@ void Particles2DEditorPlugin::_generate_emission_mask() {
Ref<Image> img;
img.instance();
Error err = ImageLoader::load_image(source_emission_file, img);
- ERR_FAIL_COND_MSG(err != OK, "Error loading image: " + source_emission_file + ".");
+ ERR_FAIL_COND_MSG(err != OK, "Error loading image '" + source_emission_file + "'.");
if (img->is_compressed()) {
img->decompress();
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 4c22138a20..80b0f0738a 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -1973,7 +1973,7 @@ Ref<TextFile> ScriptEditor::_load_text_file(const String &p_path, Error *r_error
Ref<TextFile> text_res(text_file);
Error err = text_file->load_text(path);
- ERR_FAIL_COND_V(err != OK, RES());
+ ERR_FAIL_COND_V_MSG(err != OK, RES(), "Cannot load text file '" + path + "'.");
text_file->set_file_path(local_path);
text_file->set_path(local_path, true);
@@ -1998,10 +1998,7 @@ Error ScriptEditor::_save_text_file(Ref<TextFile> p_text_file, const String &p_p
Error err;
FileAccess *file = FileAccess::open(p_path, FileAccess::WRITE, &err);
- if (err) {
-
- ERR_FAIL_COND_V(err, err);
- }
+ ERR_FAIL_COND_V_MSG(err, err, "Cannot save text file '" + p_path + "'.");
file->store_string(source);
if (file->get_error() != OK && file->get_error() != ERR_FILE_EOF) {
diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp
index 3055a9382c..d501a04016 100644
--- a/editor/plugins/theme_editor_plugin.cpp
+++ b/editor/plugins/theme_editor_plugin.cpp
@@ -192,7 +192,7 @@ void ThemeEditor::_save_template_cbk(String fname) {
FileAccess *file = FileAccess::open(filename, FileAccess::WRITE);
- ERR_FAIL_COND_MSG(!file, "Can't save theme to file: " + filename + ".");
+ ERR_FAIL_COND_MSG(!file, "Can't save theme to file '" + filename + "'.");
file->store_line("; ******************* ");
file->store_line("; Template Theme File ");
diff --git a/editor/progress_dialog.cpp b/editor/progress_dialog.cpp
index 8dac5fa6b5..04b863f3aa 100644
--- a/editor/progress_dialog.cpp
+++ b/editor/progress_dialog.cpp
@@ -38,7 +38,7 @@
void BackgroundProgress::_add_task(const String &p_task, const String &p_label, int p_steps) {
_THREAD_SAFE_METHOD_
- ERR_FAIL_COND(tasks.has(p_task));
+ ERR_FAIL_COND_MSG(tasks.has(p_task), "Task '" + p_task + "' already exists.");
BackgroundProgress::Task t;
t.hb = memnew(HBoxContainer);
Label *l = memnew(Label);
@@ -172,7 +172,7 @@ void ProgressDialog::add_task(const String &p_task, const String &p_label, int p
return;
}
- ERR_FAIL_COND(tasks.has(p_task));
+ ERR_FAIL_COND_MSG(tasks.has(p_task), "Task '" + p_task + "' already exists.");
ProgressDialog::Task t;
t.vb = memnew(VBoxContainer);
VBoxContainer *vb2 = memnew(VBoxContainer);