diff options
Diffstat (limited to 'editor')
22 files changed, 53 insertions, 109 deletions
diff --git a/editor/collada/collada.cpp b/editor/collada/collada.cpp index edd59f3057..aea7f461f1 100644 --- a/editor/collada/collada.cpp +++ b/editor/collada/collada.cpp @@ -1903,8 +1903,7 @@ void Collada::_parse_animation(XMLParser &parser) { Vector<float> &output = float_sources[output_id]; - ERR_EXPLAIN("Wrong number of keys in output"); - ERR_CONTINUE((output.size() / stride) != key_count); + ERR_CONTINUE_MSG((output.size() / stride) != key_count, "Wrong number of keys in output."); for (int j = 0; j < key_count; j++) { track.keys.write[j].data.resize(output_len); @@ -2447,8 +2446,7 @@ void Collada::_find_morph_nodes(VisualScene *p_vscene, Node *p_node) { state.morph_ownership_map[base] = nj->id; break; } else { - ERR_EXPLAIN("Invalid scene"); - ERR_FAIL(); + ERR_FAIL_MSG("Invalid scene."); } } } diff --git a/editor/doc/doc_data.cpp b/editor/doc/doc_data.cpp index 5b8c8fffb8..0f99e2ba1e 100644 --- a/editor/doc/doc_data.cpp +++ b/editor/doc/doc_data.cpp @@ -720,8 +720,7 @@ static Error _parse_methods(Ref<XMLParser> &parser, Vector<DocData::MethodDoc> & methods.push_back(method); } else { - ERR_EXPLAIN("Invalid tag in doc file: " + parser->get_node_name()); - ERR_FAIL_V(ERR_FILE_CORRUPT); + ERR_FAIL_V_MSG(ERR_FILE_CORRUPT, "Invalid tag in doc file: " + parser->get_node_name() + "."); } } else if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END && parser->get_node_name() == section) @@ -841,8 +840,7 @@ Error DocData::_load(Ref<XMLParser> parser) { if (parser->get_node_type() == XMLParser::NODE_TEXT) c.tutorials.push_back(parser->get_node_data().strip_edges()); } else { - ERR_EXPLAIN("Invalid tag in doc file: " + name3); - ERR_FAIL_V(ERR_FILE_CORRUPT); + ERR_FAIL_V_MSG(ERR_FILE_CORRUPT, "Invalid tag in doc file: " + name3 + "."); } } else if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END && parser->get_node_name() == "tutorials") break; //end of <tutorials> @@ -883,8 +881,7 @@ Error DocData::_load(Ref<XMLParser> parser) { prop2.description = parser->get_node_data(); c.properties.push_back(prop2); } else { - ERR_EXPLAIN("Invalid tag in doc file: " + name3); - ERR_FAIL_V(ERR_FILE_CORRUPT); + ERR_FAIL_V_MSG(ERR_FILE_CORRUPT, "Invalid tag in doc file: " + name3 + "."); } } else if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END && parser->get_node_name() == "members") @@ -912,8 +909,7 @@ Error DocData::_load(Ref<XMLParser> parser) { prop2.description = parser->get_node_data(); c.theme_properties.push_back(prop2); } else { - ERR_EXPLAIN("Invalid tag in doc file: " + name3); - ERR_FAIL_V(ERR_FILE_CORRUPT); + ERR_FAIL_V_MSG(ERR_FILE_CORRUPT, "Invalid tag in doc file: " + name3 + "."); } } else if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END && parser->get_node_name() == "theme_items") @@ -943,8 +939,7 @@ Error DocData::_load(Ref<XMLParser> parser) { constant2.description = parser->get_node_data(); c.constants.push_back(constant2); } else { - ERR_EXPLAIN("Invalid tag in doc file: " + name3); - ERR_FAIL_V(ERR_FILE_CORRUPT); + ERR_FAIL_V_MSG(ERR_FILE_CORRUPT, "Invalid tag in doc file: " + name3 + "."); } } else if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END && parser->get_node_name() == "constants") @@ -953,8 +948,7 @@ Error DocData::_load(Ref<XMLParser> parser) { } else { - ERR_EXPLAIN("Invalid tag in doc file: " + name2); - ERR_FAIL_V(ERR_FILE_CORRUPT); + ERR_FAIL_V_MSG(ERR_FILE_CORRUPT, "Invalid tag in doc file: " + name2 + "."); } } else if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END && parser->get_node_name() == "class") @@ -991,10 +985,8 @@ Error DocData::save_classes(const String &p_default_path, const Map<String, Stri Error err; String save_file = save_path.plus_file(c.name + ".xml"); FileAccessRef f = FileAccess::open(save_file, FileAccess::WRITE, &err); - if (err) { - ERR_EXPLAIN("Can't write doc file: " + save_file); - ERR_CONTINUE(err); - } + + ERR_CONTINUE_MSG(err != OK, "Can't write doc file: " + save_file + "."); _write_string(f, 0, "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"); diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp index 7210211d90..555a7f99c8 100644 --- a/editor/editor_autoload_settings.cpp +++ b/editor/editor_autoload_settings.cpp @@ -315,8 +315,7 @@ void EditorAutoloadSettings::_autoload_file_callback(const String &p_path) { Node *EditorAutoloadSettings::_create_autoload(const String &p_path) { RES res = ResourceLoader::load(p_path); - ERR_EXPLAIN("Can't autoload: " + p_path); - ERR_FAIL_COND_V(res.is_null(), NULL); + ERR_FAIL_COND_V_MSG(res.is_null(), NULL, "Can't autoload: " + p_path + "."); Node *n = NULL; if (res->is_class("PackedScene")) { Ref<PackedScene> ps = res; @@ -325,20 +324,17 @@ Node *EditorAutoloadSettings::_create_autoload(const String &p_path) { Ref<Script> s = res; StringName ibt = s->get_instance_base_type(); bool valid_type = ClassDB::is_parent_class(ibt, "Node"); - ERR_EXPLAIN("Script does not inherit a Node: " + p_path); - ERR_FAIL_COND_V(!valid_type, NULL); + ERR_FAIL_COND_V_MSG(!valid_type, NULL, "Script does not inherit a Node: " + p_path + "."); Object *obj = ClassDB::instance(ibt); - ERR_EXPLAIN("Cannot instance script for autoload, expected 'Node' inheritance, got: " + String(ibt)); - ERR_FAIL_COND_V(obj == NULL, NULL); + ERR_FAIL_COND_V_MSG(obj == NULL, NULL, "Cannot instance script for autoload, expected 'Node' inheritance, got: " + String(ibt) + "."); n = Object::cast_to<Node>(obj); n->set_script(s.get_ref_ptr()); } - ERR_EXPLAIN("Path in autoload not a node or script: " + p_path); - ERR_FAIL_COND_V(!n, NULL); + ERR_FAIL_COND_V_MSG(!n, NULL, "Path in autoload not a node or script: " + p_path + "."); return n; } diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index e1f2635275..cb1754bb10 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -1011,7 +1011,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_file_system.cpp b/editor/editor_file_system.cpp index be3df2815e..6d3377a85b 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -1930,8 +1930,7 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) { Error err = da->make_dir(".import"); if (err) { memdelete(da); - ERR_EXPLAIN("Failed to create 'res://.import' folder."); - ERR_FAIL(); + ERR_FAIL_MSG("Failed to create 'res://.import' folder."); } } memdelete(da); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index bc2ac01af8..1b0ffd4c89 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -2795,8 +2795,7 @@ void EditorNode::select_editor_by_name(const String &p_name) { } } - ERR_EXPLAIN("The editor name '" + p_name + "' was not found."); - ERR_FAIL(); + ERR_FAIL_MSG("The editor name '" + p_name + "' was not found."); } void EditorNode::add_editor_plugin(EditorPlugin *p_editor, bool p_config_changed) { @@ -4797,8 +4796,7 @@ void EditorNode::remove_control_from_dock(Control *p_control) { } } - ERR_EXPLAIN("Control was not in dock"); - ERR_FAIL_COND(!dock); + ERR_FAIL_COND_MSG(!dock, "Control was not in dock."); dock->remove_child(p_control); _update_dock_slots_visibility(); diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp index 327e61cea3..4a7a9fb863 100644 --- a/editor/editor_resource_preview.cpp +++ b/editor/editor_resource_preview.cpp @@ -46,8 +46,7 @@ bool EditorResourcePreviewGenerator::handles(const String &p_type) const { if (get_script_instance() && get_script_instance()->has_method("handles")) { return get_script_instance()->call("handles", p_type); } - ERR_EXPLAIN("EditorResourcePreviewGenerator::handles needs to be overridden"); - ERR_FAIL_V(false); + ERR_FAIL_V_MSG(false, "EditorResourcePreviewGenerator::handles needs to be overridden."); } Ref<Texture> EditorResourcePreviewGenerator::generate(const RES &p_from, const Size2 &p_size) const { @@ -55,8 +54,7 @@ Ref<Texture> EditorResourcePreviewGenerator::generate(const RES &p_from, const S if (get_script_instance() && get_script_instance()->has_method("generate")) { return get_script_instance()->call("generate", p_from, p_size); } - ERR_EXPLAIN("EditorResourcePreviewGenerator::generate needs to be overridden"); - ERR_FAIL_V(Ref<Texture>()); + ERR_FAIL_V_MSG(Ref<Texture>(), "EditorResourcePreviewGenerator::generate needs to be overridden."); } Ref<Texture> EditorResourcePreviewGenerator::generate_from_path(const String &p_path, const Size2 &p_size) const { diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index c4166c97fd..cb3bfa3a49 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -1451,10 +1451,7 @@ void EditorSettings::add_shortcut(const String &p_name, Ref<ShortCut> &p_shortcu bool EditorSettings::is_shortcut(const String &p_name, const Ref<InputEvent> &p_event) const { const Map<String, Ref<ShortCut> >::Element *E = shortcuts.find(p_name); - if (!E) { - ERR_EXPLAIN("Unknown Shortcut: " + p_name); - ERR_FAIL_V(false); - } + ERR_FAIL_COND_V_MSG(!E, false, "Unknown Shortcut: " + p_name + "."); return E->get()->is_shortcut(p_event); } @@ -1483,10 +1480,8 @@ Ref<ShortCut> ED_GET_SHORTCUT(const String &p_path) { } Ref<ShortCut> sc = EditorSettings::get_singleton()->get_shortcut(p_path); - if (!sc.is_valid()) { - ERR_EXPLAIN("Used ED_GET_SHORTCUT with invalid shortcut: " + p_path); - ERR_FAIL_COND_V(!sc.is_valid(), sc); - } + + ERR_FAIL_COND_V_MSG(!sc.is_valid(), sc, "Used ED_GET_SHORTCUT with invalid shortcut: " + p_path + "."); return sc; } diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp index 72a4b43737..68e859966c 100644 --- a/editor/export_template_manager.cpp +++ b/editor/export_template_manager.cpp @@ -321,8 +321,7 @@ bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_ if (!f) { ret = unzGoToNextFile(pkg); fc++; - ERR_EXPLAIN("Can't open file from path: " + String(to_write)); - ERR_CONTINUE(true); + ERR_CONTINUE_MSG(true, "Can't open file from path: " + String(to_write) + "."); } f->store_buffer(data.ptr(), data.size()); @@ -591,8 +590,7 @@ Error ExportTemplateManager::install_android_template() { zlib_filefunc_def io = zipio_create_io_from_file(&src_f); unzFile pkg = unzOpen2(source_zip.utf8().get_data(), &io); - ERR_EXPLAIN("Android sources not in zip format"); - ERR_FAIL_COND_V(!pkg, ERR_CANT_OPEN); + ERR_FAIL_COND_V_MSG(!pkg, ERR_CANT_OPEN, "Android sources not in zip format."); int ret = unzGoToFirstFile(pkg); diff --git a/editor/file_type_cache.cpp b/editor/file_type_cache.cpp index 1bcbc45d3b..746d38f2b5 100644 --- a/editor/file_type_cache.cpp +++ b/editor/file_type_cache.cpp @@ -83,11 +83,8 @@ void FileTypeCache::save() { GLOBAL_LOCK_FUNCTION String project = ProjectSettings::get_singleton()->get_resource_path(); FileAccess *f = FileAccess::open(project + "/file_type_cache.cch", FileAccess::WRITE); - if (!f) { - ERR_EXPLAIN(TTR("Can't open file_type_cache.cch for writing, not saving file type cache!")); - ERR_FAIL(); - } + ERR_FAIL_COND_MSG(!f, "Can't open file_type_cache.cch for writing, not saving file type cache!"); const String *K = NULL; diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 341b945791..e4823c7745 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -453,8 +453,7 @@ void FileSystemDock::_navigate_to_path(const String &p_path, bool p_select_in_fa path = target_path + "/"; } else { memdelete(dirAccess); - ERR_EXPLAIN(vformat(TTR("Cannot navigate to '%s' as it has not been found in the file system!"), p_path)); - ERR_FAIL(); + ERR_FAIL_MSG(vformat("Cannot navigate to '%s' as it has not been found in the file system!", p_path)); } memdelete(dirAccess); } diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp index 1c4a8c43a9..37713c7f1b 100644 --- a/editor/import/editor_import_collada.cpp +++ b/editor/import/editor_import_collada.cpp @@ -1204,10 +1204,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres } } - if (ngsource != "") { - ERR_EXPLAIN("Controller Instance Source '" + ngsource + "' is neither skin or morph!"); - ERR_FAIL_V(ERR_INVALID_DATA); - } + ERR_FAIL_COND_V_MSG(ngsource != "", ERR_INVALID_DATA, "Controller instance source '" + ngsource + "' is neither skin or morph!"); } else { meshid = ng2->source; @@ -1608,7 +1605,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones } if (xform_idx == -1) { - WARN_PRINTS("Collada: Couldn't find matching node " + at.target + " xform for track " + at.param); + WARN_PRINTS("Collada: Couldn't find matching node " + at.target + " xform for track " + at.param + "."); continue; } @@ -1630,8 +1627,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones } else if (data.size() == xf.data.size()) { xf.data = data; } else { - ERR_EXPLAIN("Component " + at.component + " has datasize " + itos(data.size()) + ", xfdatasize " + itos(xf.data.size())); - ERR_CONTINUE(data.size() != xf.data.size()); + ERR_CONTINUE_MSG(data.size() != xf.data.size(), "Component " + at.component + " has datasize " + itos(data.size()) + ", xfdatasize " + itos(xf.data.size()) + "."); } } diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp index c9c5b3818f..84dd1aa866 100644 --- a/editor/import/editor_scene_importer_gltf.cpp +++ b/editor/import/editor_scene_importer_gltf.cpp @@ -1544,8 +1544,7 @@ Error EditorSceneImporterGLTF::_parse_cameras(GLTFState &state) { camera.fov_size = 10; } } else { - ERR_EXPLAIN("Camera should be in 'orthographic' or 'perspective'"); - ERR_FAIL_V(ERR_PARSE_ERROR); + ERR_FAIL_V_MSG(ERR_PARSE_ERROR, "Camera should be in 'orthographic' or 'perspective'"); } state.cameras.push_back(camera); diff --git a/editor/import/resource_importer_csv_translation.cpp b/editor/import/resource_importer_csv_translation.cpp index cfcdbc8de4..301422a25a 100644 --- a/editor/import/resource_importer_csv_translation.cpp +++ b/editor/import/resource_importer_csv_translation.cpp @@ -101,8 +101,7 @@ Error ResourceImporterCSVTranslation::import(const String &p_source_file, const for (int i = 1; i < line.size(); i++) { String locale = line[i]; - ERR_EXPLAIN("Error importing CSV translation: '" + locale + "' is not a valid locale"); - ERR_FAIL_COND_V(!TranslationServer::is_locale_valid(locale), ERR_PARSE_ERROR); + ERR_FAIL_COND_V_MSG(!TranslationServer::is_locale_valid(locale), ERR_PARSE_ERROR, "Error importing CSV translation: '" + locale + "' is not a valid locale."); locales.push_back(locale); Ref<Translation> translation; diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp index 868f67fd77..9061c92f6e 100644 --- a/editor/import/resource_importer_obj.cpp +++ b/editor/import/resource_importer_obj.cpp @@ -45,8 +45,7 @@ uint32_t EditorOBJImporter::get_import_flags() const { static Error _parse_material_library(const String &p_path, Map<String, Ref<SpatialMaterial> > &material_map, List<String> *r_missing_deps) { FileAccessRef f = FileAccess::open(p_path, FileAccess::READ); - ERR_EXPLAIN(vformat("Couldn't open MTL file '%s', it may not exist or not be readable.", p_path)); - ERR_FAIL_COND_V(!f, ERR_CANT_OPEN); + ERR_FAIL_COND_V_MSG(!f, ERR_CANT_OPEN, vformat("Couldn't open MTL file '%s', it may not exist or not be readable.", p_path)); Ref<SpatialMaterial> current; String current_name; @@ -207,8 +206,7 @@ static Error _parse_material_library(const String &p_path, Map<String, Ref<Spati static Error _parse_obj(const String &p_path, List<Ref<Mesh> > &r_meshes, bool p_single_mesh, bool p_generate_tangents, bool p_optimize, Vector3 p_scale_mesh, List<String> *r_missing_deps) { FileAccessRef f = FileAccess::open(p_path, FileAccess::READ); - ERR_EXPLAIN(vformat("Couldn't open OBJ file '%s', it may not exist or not be readable.", p_path)); - ERR_FAIL_COND_V(!f, ERR_CANT_OPEN); + ERR_FAIL_COND_V_MSG(!f, ERR_CANT_OPEN, vformat("Couldn't open OBJ file '%s', it may not exist or not be readable.", p_path)); Ref<ArrayMesh> mesh; mesh.instance(); diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp index d267b29224..4fd4ab2f2e 100644 --- a/editor/import/resource_importer_wav.cpp +++ b/editor/import/resource_importer_wav.cpp @@ -123,8 +123,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s file->close(); memdelete(file); - ERR_EXPLAIN("Not a WAV file (no WAVE RIFF Header)"); - ERR_FAIL_V(ERR_FILE_UNRECOGNIZED); + ERR_FAIL_V_MSG(ERR_FILE_UNRECOGNIZED, "Not a WAV file (no WAVE RIFF header)."); } int format_bits = 0; @@ -166,16 +165,14 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s if (compression_code != 1 && compression_code != 3) { file->close(); memdelete(file); - ERR_EXPLAIN("Format not supported for WAVE file (not PCM). Save WAVE files as uncompressed PCM instead."); - ERR_FAIL_V(ERR_INVALID_DATA); + ERR_FAIL_V_MSG(ERR_INVALID_DATA, "Format not supported for WAVE file (not PCM). Save WAVE files as uncompressed PCM instead."); } format_channels = file->get_16(); if (format_channels != 1 && format_channels != 2) { file->close(); memdelete(file); - ERR_EXPLAIN("Format not supported for WAVE file (not stereo or mono)."); - ERR_FAIL_V(ERR_INVALID_DATA); + ERR_FAIL_V_MSG(ERR_INVALID_DATA, "Format not supported for WAVE file (not stereo or mono)."); } format_freq = file->get_32(); //sampling rate @@ -187,8 +184,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s if (format_bits % 8 || format_bits == 0) { file->close(); memdelete(file); - ERR_EXPLAIN("Invalid amount of bits in the sample (should be one of 8, 16, 24 or 32)."); - ERR_FAIL_V(ERR_INVALID_DATA); + ERR_FAIL_V_MSG(ERR_INVALID_DATA, "Invalid amount of bits in the sample (should be one of 8, 16, 24 or 32)."); } /* Don't need anything else, continue */ @@ -258,8 +254,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s if (file->eof_reached()) { file->close(); memdelete(file); - ERR_EXPLAIN("Premature end of file."); - ERR_FAIL_V(ERR_FILE_CORRUPT); + ERR_FAIL_V_MSG(ERR_FILE_CORRUPT, "Premature end of file."); } } diff --git a/editor/plugins/cpu_particles_2d_editor_plugin.cpp b/editor/plugins/cpu_particles_2d_editor_plugin.cpp index 7c2116f06b..9d625af959 100644 --- a/editor/plugins/cpu_particles_2d_editor_plugin.cpp +++ b/editor/plugins/cpu_particles_2d_editor_plugin.cpp @@ -87,8 +87,7 @@ void CPUParticles2DEditorPlugin::_generate_emission_mask() { Ref<Image> img; img.instance(); Error err = ImageLoader::load_image(source_emission_file, img); - ERR_EXPLAIN(TTR("Error loading image:") + " " + source_emission_file); - ERR_FAIL_COND(err != OK); + ERR_FAIL_COND_MSG(err != OK, "Error loading image: " + source_emission_file + "."); if (img->is_compressed()) { img->decompress(); @@ -196,8 +195,7 @@ void CPUParticles2DEditorPlugin::_generate_emission_mask() { valid_normals.resize(vpc); } - ERR_EXPLAIN(TTR("No pixels with transparency > 128 in image...")); - ERR_FAIL_COND(valid_positions.size() == 0); + ERR_FAIL_COND_MSG(valid_positions.size() == 0, "No pixels with transparency > 128 in image..."); if (capture_colors) { PoolColorArray pca; diff --git a/editor/plugins/multimesh_editor_plugin.cpp b/editor/plugins/multimesh_editor_plugin.cpp index d59efe49e7..3ea014a38d 100644 --- a/editor/plugins/multimesh_editor_plugin.cpp +++ b/editor/plugins/multimesh_editor_plugin.cpp @@ -147,9 +147,8 @@ void MultiMeshEditor::_populate() { w.release(); PoolVector<Face3> faces = geometry; - ERR_EXPLAIN(TTR("Parent has no solid faces to populate.")); int facecount = faces.size(); - ERR_FAIL_COND(!facecount); + ERR_FAIL_COND_MSG(!facecount, "Parent has no solid faces to populate."); PoolVector<Face3>::Read r = faces.read(); @@ -164,10 +163,8 @@ void MultiMeshEditor::_populate() { area_accum += area; } - ERR_EXPLAIN(TTR("Couldn't map area.")); - ERR_FAIL_COND(triangle_area_map.size() == 0); - ERR_EXPLAIN(TTR("Couldn't map area.")); - ERR_FAIL_COND(area_accum == 0); + ERR_FAIL_COND_MSG(triangle_area_map.size() == 0, "Couldn't map area."); + ERR_FAIL_COND_MSG(area_accum == 0, "Couldn't map area."); Ref<MultiMesh> multimesh = memnew(MultiMesh); multimesh->set_mesh(mesh); diff --git a/editor/plugins/particles_2d_editor_plugin.cpp b/editor/plugins/particles_2d_editor_plugin.cpp index e68bca55cb..8025e12885 100644 --- a/editor/plugins/particles_2d_editor_plugin.cpp +++ b/editor/plugins/particles_2d_editor_plugin.cpp @@ -160,8 +160,7 @@ void Particles2DEditorPlugin::_generate_emission_mask() { Ref<Image> img; img.instance(); Error err = ImageLoader::load_image(source_emission_file, img); - ERR_EXPLAIN(TTR("Error loading image:") + " " + source_emission_file); - ERR_FAIL_COND(err != OK); + ERR_FAIL_COND_MSG(err != OK, "Error loading image: " + source_emission_file + "."); if (img->is_compressed()) { img->decompress(); @@ -269,8 +268,7 @@ void Particles2DEditorPlugin::_generate_emission_mask() { valid_normals.resize(vpc); } - ERR_EXPLAIN(TTR("No pixels with transparency > 128 in image...")); - ERR_FAIL_COND(valid_positions.size() == 0); + ERR_FAIL_COND_MSG(valid_positions.size() == 0, "No pixels with transparency > 128 in image..."); PoolVector<uint8_t> texdata; diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index 56357f298a..3055a9382c 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -191,11 +191,9 @@ void ThemeEditor::_save_template_cbk(String fname) { } FileAccess *file = FileAccess::open(filename, FileAccess::WRITE); - if (!file) { - ERR_EXPLAIN(TTR("Can't save theme to file:") + " " + filename); - return; - } + ERR_FAIL_COND_MSG(!file, "Can't save theme to file: " + filename + "."); + file->store_line("; ******************* "); file->store_line("; Template Theme File "); file->store_line("; ******************* "); diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index 1a27e749e2..c1e85788f8 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -646,8 +646,7 @@ void TileSetEditor::_on_textures_added(const PoolStringArray &p_paths) { for (int i = 0; i < p_paths.size(); i++) { Ref<Texture> t = Ref<Texture>(ResourceLoader::load(p_paths[i])); - ERR_EXPLAIN("'" + p_paths[i] + "' is not a valid texture."); - ERR_CONTINUE(!t.is_valid()); + ERR_CONTINUE_MSG(!t.is_valid(), "'" + p_paths[i] + "' is not a valid texture."); if (texture_map.has(t->get_rid())) { invalid_count++; diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 032b3a19a6..f1eb7adbd2 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -986,9 +986,10 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { } else { new_node = Object::cast_to<Node>(ClassDB::instance(selected_favorite_root)); } + if (!new_node) { - ERR_EXPLAIN("Creating root from favorite '" + selected_favorite_root + "' failed. Creating 'Node' instead."); new_node = memnew(Node); + ERR_PRINTS("Creating root from favorite '" + selected_favorite_root + "' failed. Creating 'Node' instead."); } } else { switch (p_tool) { @@ -1537,10 +1538,7 @@ void SceneTreeDock::_do_reparent(Node *p_new_parent, int p_position_in_parent, V Node *validate = new_parent; while (validate) { - if (p_nodes.find(validate) != -1) { - ERR_EXPLAIN("Selection changed at some point.. can't reparent"); - ERR_FAIL(); - } + ERR_FAIL_COND_MSG(p_nodes.find(validate) != -1, "Selection changed at some point.. can't reparent."); validate = validate->get_parent(); } //ok all valid @@ -2253,8 +2251,7 @@ void SceneTreeDock::_normalize_drop(Node *&to_node, int &to_pos, int p_type) { //drop at above selected node if (to_node == EditorNode::get_singleton()->get_edited_scene()) { to_node = NULL; - ERR_EXPLAIN("Cannot perform drop above the root node!"); - ERR_FAIL(); + ERR_FAIL_MSG("Cannot perform drop above the root node!"); } to_pos = to_node->get_index(); |