summaryrefslogtreecommitdiff
path: root/editor/import
diff options
context:
space:
mode:
Diffstat (limited to 'editor/import')
-rw-r--r--editor/import/collada.cpp26
-rw-r--r--editor/import/dynamicfont_import_settings.cpp26
-rw-r--r--editor/import/editor_import_collada.cpp50
-rw-r--r--editor/import/resource_importer_csv_translation.cpp2
-rw-r--r--editor/import/resource_importer_obj.cpp8
-rw-r--r--editor/import/resource_importer_scene.cpp15
-rw-r--r--editor/import/scene_import_settings.cpp6
7 files changed, 67 insertions, 66 deletions
diff --git a/editor/import/collada.cpp b/editor/import/collada.cpp
index c34379f1ec..c1f577f176 100644
--- a/editor/import/collada.cpp
+++ b/editor/import/collada.cpp
@@ -1362,7 +1362,7 @@ Collada::Node *Collada::_parse_visual_instance_geometry(XMLParser &parser) {
} else if (parser.get_node_name() == "skeleton") {
parser.read();
String uri = _uri_to_id(parser.get_node_data());
- if (uri != "") {
+ if (!uri.is_empty()) {
geom->skeletons.push_back(uri);
}
}
@@ -1464,7 +1464,7 @@ Collada::Node *Collada::_parse_visual_scene_node(XMLParser &parser) {
bool found_name = false;
- if (id == "") {
+ if (id.is_empty()) {
id = "%NODEID%" + itos(Math::rand());
} else {
@@ -1479,7 +1479,7 @@ Collada::Node *Collada::_parse_visual_scene_node(XMLParser &parser) {
Node *node = nullptr;
name = parser.has_attribute("name") ? parser.get_attribute_value_safe("name") : parser.get_attribute_value_safe("id");
- if (name == "") {
+ if (name.is_empty()) {
name = id;
} else {
found_name = true;
@@ -1499,7 +1499,7 @@ Collada::Node *Collada::_parse_visual_scene_node(XMLParser &parser) {
joint->sid = parser.get_attribute_value_safe("name");
}
- if (joint->sid != "") {
+ if (!joint->sid.is_empty()) {
state.sid_to_node_map[joint->sid] = id;
}
@@ -1696,16 +1696,16 @@ void Collada::_parse_animation(XMLParser &parser) {
source_param_types[current_source] = Vector<String>();
} else if (name == "float_array") {
- if (current_source != "") {
+ if (!current_source.is_empty()) {
float_sources[current_source] = _read_float_array(parser);
}
} else if (name == "Name_array") {
- if (current_source != "") {
+ if (!current_source.is_empty()) {
string_sources[current_source] = _read_string_array(parser);
}
} else if (name == "accessor") {
- if (current_source != "" && parser.has_attribute("stride")) {
+ if (!current_source.is_empty() && parser.has_attribute("stride")) {
source_strides[current_source] = parser.get_attribute_value("stride").to_int();
}
} else if (name == "sampler") {
@@ -1725,7 +1725,7 @@ void Collada::_parse_animation(XMLParser &parser) {
}
} else if (name == "input") {
- if (current_sampler != "") {
+ if (!current_sampler.is_empty()) {
samplers[current_sampler][parser.get_attribute_value("semantic")] = parser.get_attribute_value("source");
}
@@ -1838,7 +1838,7 @@ void Collada::_parse_animation(XMLParser &parser) {
track.component = track.param.get_slice(".", 1).to_upper();
}
track.param = track.param.get_slice(".", 0);
- if (names.size() > 1 && track.component == "") {
+ if (names.size() > 1 && track.component.is_empty()) {
//this is a guess because the collada spec is ambiguous here...
//i suppose if you have many names (outputs) you can't use a component and i should abide to that.
track.component = name;
@@ -1855,7 +1855,7 @@ void Collada::_parse_animation(XMLParser &parser) {
state.referenced_tracks[target].push_back(state.animation_tracks.size() - 1);
- if (id != "") {
+ if (!id.is_empty()) {
if (!state.by_id_tracks.has(id)) {
state.by_id_tracks[id] = Vector<int>();
}
@@ -1953,10 +1953,10 @@ void Collada::_parse_library(XMLParser &parser) {
while (parser.read() == OK) {
if (parser.get_node_type() == XMLParser::NODE_ELEMENT) {
if (parser.get_node_name() == "mesh") {
- state.mesh_name_map[id] = (name2 != "") ? name2 : id;
+ state.mesh_name_map[id] = (!name2.is_empty()) ? name2 : id;
_parse_mesh_geometry(parser, id, name2);
} else if (parser.get_node_name() == "spline") {
- state.mesh_name_map[id] = (name2 != "") ? name2 : id;
+ state.mesh_name_map[id] = (!name2.is_empty()) ? name2 : id;
_parse_curve_geometry(parser, id, name2);
} else if (!parser.is_empty()) {
parser.skip_section();
@@ -2286,7 +2286,7 @@ void Collada::_find_morph_nodes(VisualScene *p_vscene, Node *p_node) {
if (nj->controller) {
String base = nj->source;
- while (base != "" && !state.mesh_data_map.has(base)) {
+ while (!base.is_empty() && !state.mesh_data_map.has(base)) {
if (state.skin_controller_data_map.has(base)) {
SkinControllerData &sk = state.skin_controller_data_map[base];
base = sk.base;
diff --git a/editor/import/dynamicfont_import_settings.cpp b/editor/import/dynamicfont_import_settings.cpp
index 45937e20bc..b63c2bf350 100644
--- a/editor/import/dynamicfont_import_settings.cpp
+++ b/editor/import/dynamicfont_import_settings.cpp
@@ -1083,7 +1083,7 @@ void DynamicFontImportSettings::_edit_range(int32_t p_start, int32_t p_end) {
item = glyph_table->create_item(root);
ERR_FAIL_NULL(item);
item->set_text(0, _pad_zeros(String::num_int64(c, 16)));
- item->set_text_align(0, TreeItem::ALIGN_LEFT);
+ item->set_text_alignment(0, HORIZONTAL_ALIGNMENT_LEFT);
item->set_selectable(0, false);
item->set_custom_bg_color(0, glyph_table->get_theme_color("dark_color_3", "Editor"));
}
@@ -1101,7 +1101,7 @@ void DynamicFontImportSettings::_edit_range(int32_t p_start, int32_t p_end) {
item->set_custom_bg_color(col + 1, glyph_table->get_theme_color("dark_color_2", "Editor"));
}
item->set_metadata(col + 1, c);
- item->set_text_align(col + 1, TreeItem::ALIGN_CENTER);
+ item->set_text_alignment(col + 1, HORIZONTAL_ALIGNMENT_CENTER);
item->set_selectable(col + 1, true);
item->set_custom_font(col + 1, font_main);
item->set_custom_font_size(col + 1, get_theme_font_size("font_size") * 2);
@@ -1159,7 +1159,7 @@ void DynamicFontImportSettings::_range_update(int32_t p_start, int32_t p_end) {
/*************************************************************************/
void DynamicFontImportSettings::_lang_add() {
- menu_langs->set_position(lang_list->get_screen_transform().xform(lang_list->get_local_mouse_position()));
+ menu_langs->set_position(lang_list->get_screen_position() + lang_list->get_local_mouse_position());
menu_langs->reset_size();
menu_langs->popup();
}
@@ -1186,7 +1186,7 @@ void DynamicFontImportSettings::_lang_remove(Object *p_item, int p_column, int p
}
void DynamicFontImportSettings::_script_add() {
- menu_scripts->set_position(script_list->get_screen_transform().xform(script_list->get_local_mouse_position()));
+ menu_scripts->set_position(script_list->get_screen_position() + script_list->get_local_mouse_position());
menu_scripts->reset_size();
menu_scripts->popup();
}
@@ -1597,7 +1597,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() {
menu_langs = memnew(PopupMenu);
menu_langs->set_name("Language");
- for (int i = 0; langs[i].name != String(); i++) {
+ for (int i = 0; !langs[i].name.is_empty(); i++) {
if (langs[i].name == "-") {
menu_langs->add_separator();
} else {
@@ -1609,7 +1609,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() {
menu_scripts = memnew(PopupMenu);
menu_scripts->set_name("Script");
- for (int i = 0; scripts[i].name != String(); i++) {
+ for (int i = 0; !scripts[i].name.is_empty(); i++) {
if (scripts[i].name == "-") {
menu_scripts->add_separator();
} else {
@@ -1632,7 +1632,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() {
root_vb->add_child(main_pages);
label_warn = memnew(Label);
- label_warn->set_align(Label::ALIGN_CENTER);
+ label_warn->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
label_warn->set_text("");
root_vb->add_child(label_warn);
label_warn->add_theme_color_override("font_color", warn_color);
@@ -1656,8 +1656,8 @@ DynamicFontImportSettings::DynamicFontImportSettings() {
font_preview_label = memnew(Label);
font_preview_label->add_theme_font_size_override("font_size", 200 * EDSCALE);
- font_preview_label->set_align(Label::ALIGN_CENTER);
- font_preview_label->set_valign(Label::VALIGN_CENTER);
+ font_preview_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
+ font_preview_label->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
font_preview_label->set_autowrap_mode(Label::AUTOWRAP_ARBITRARY);
font_preview_label->set_clip_text(true);
font_preview_label->set_v_size_flags(Control::SIZE_EXPAND_FILL);
@@ -1694,7 +1694,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() {
label_vars = memnew(Label);
page2_hb_vars->add_child(label_vars);
- label_vars->set_align(Label::ALIGN_CENTER);
+ label_vars->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
label_vars->set_h_size_flags(Control::SIZE_EXPAND_FILL);
label_vars->set_text(TTR("Configuration:"));
@@ -1826,7 +1826,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() {
glyph_tree->connect("item_selected", callable_mp(this, &DynamicFontImportSettings::_range_selected));
glyph_tree->set_v_size_flags(Control::SIZE_EXPAND_FILL);
glyph_root = glyph_tree->create_item();
- for (int i = 0; unicode_ranges[i].name != String(); i++) {
+ for (int i = 0; !unicode_ranges[i].name.is_empty(); i++) {
_add_glyph_range_item(unicode_ranges[i].start, unicode_ranges[i].end, unicode_ranges[i].name);
}
@@ -1845,7 +1845,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() {
page5_vb->add_child(hb_lang);
label_langs = memnew(Label);
- label_langs->set_align(Label::ALIGN_CENTER);
+ label_langs->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
label_langs->set_h_size_flags(Control::SIZE_EXPAND_FILL);
label_langs->set_text(TTR("Language support overrides"));
hb_lang->add_child(label_langs);
@@ -1873,7 +1873,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() {
page5_vb->add_child(hb_script);
label_script = memnew(Label);
- label_script->set_align(Label::ALIGN_CENTER);
+ label_script->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
label_script->set_h_size_flags(Control::SIZE_EXPAND_FILL);
label_script->set_text(TTR("Script support overrides"));
hb_script->add_child(label_script);
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index 076c0cc62b..91f8e5b910 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -303,7 +303,7 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Node3D *p_parent) {
} break;
}
- if (p_node->name != "") {
+ if (!p_node->name.is_empty()) {
node->set_name(p_node->name);
}
NodeMap nm;
@@ -317,7 +317,7 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Node3D *p_parent) {
p_parent->add_child(node, true);
node->set_owner(scene);
- if (p_node->empty_draw_type != "") {
+ if (!p_node->empty_draw_type.is_empty()) {
node->set_meta("empty_draw_type", Variant(p_node->empty_draw_type));
}
@@ -340,9 +340,9 @@ Error ColladaImport::_create_material(const String &p_target) {
Ref<StandardMaterial3D> material = memnew(StandardMaterial3D);
String base_name;
- if (src_mat.name != "") {
+ if (!src_mat.name.is_empty()) {
base_name = src_mat.name;
- } else if (effect.name != "") {
+ } else if (!effect.name.is_empty()) {
base_name = effect.name;
} else {
base_name = "Material";
@@ -360,9 +360,9 @@ Error ColladaImport::_create_material(const String &p_target) {
// DIFFUSE
- if (effect.diffuse.texture != "") {
+ if (!effect.diffuse.texture.is_empty()) {
String texfile = effect.get_texture_path(effect.diffuse.texture, collada);
- if (texfile != "") {
+ if (!texfile.is_empty()) {
if (texfile.begins_with("/")) {
texfile = texfile.replace_first("/", "res://");
}
@@ -381,9 +381,9 @@ Error ColladaImport::_create_material(const String &p_target) {
// SPECULAR
- if (effect.specular.texture != "") {
+ if (!effect.specular.texture.is_empty()) {
String texfile = effect.get_texture_path(effect.specular.texture, collada);
- if (texfile != "") {
+ if (!texfile.is_empty()) {
if (texfile.begins_with("/")) {
texfile = texfile.replace_first("/", "res://");
}
@@ -406,9 +406,9 @@ Error ColladaImport::_create_material(const String &p_target) {
// EMISSION
- if (effect.emission.texture != "") {
+ if (!effect.emission.texture.is_empty()) {
String texfile = effect.get_texture_path(effect.emission.texture, collada);
- if (texfile != "") {
+ if (!texfile.is_empty()) {
if (texfile.begins_with("/")) {
texfile = texfile.replace_first("/", "res://");
}
@@ -433,9 +433,9 @@ Error ColladaImport::_create_material(const String &p_target) {
// NORMAL
- if (effect.bump.texture != "") {
+ if (!effect.bump.texture.is_empty()) {
String texfile = effect.get_texture_path(effect.bump.texture, collada);
- if (texfile != "") {
+ if (!texfile.is_empty()) {
if (texfile.begins_with("/")) {
texfile = texfile.replace_first("/", "res://");
}
@@ -525,7 +525,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ImporterMesh> &p
normal_ofs = vertex_ofs;
}
- if (normal_source_id != "") {
+ if (!normal_source_id.is_empty()) {
ERR_FAIL_COND_V(!meshdata.sources.has(normal_source_id), ERR_INVALID_DATA);
normal_src = &meshdata.sources[normal_source_id];
}
@@ -545,7 +545,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ImporterMesh> &p
binormal_ofs = vertex_ofs;
}
- if (binormal_source_id != "") {
+ if (!binormal_source_id.is_empty()) {
ERR_FAIL_COND_V(!meshdata.sources.has(binormal_source_id), ERR_INVALID_DATA);
binormal_src = &meshdata.sources[binormal_source_id];
}
@@ -565,7 +565,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ImporterMesh> &p
tangent_ofs = vertex_ofs;
}
- if (tangent_source_id != "") {
+ if (!tangent_source_id.is_empty()) {
ERR_FAIL_COND_V(!meshdata.sources.has(tangent_source_id), ERR_INVALID_DATA);
tangent_src = &meshdata.sources[tangent_source_id];
}
@@ -585,7 +585,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ImporterMesh> &p
uv_ofs = vertex_ofs;
}
- if (uv_source_id != "") {
+ if (!uv_source_id.is_empty()) {
ERR_FAIL_COND_V(!meshdata.sources.has(uv_source_id), ERR_INVALID_DATA);
uv_src = &meshdata.sources[uv_source_id];
}
@@ -605,7 +605,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ImporterMesh> &p
uv2_ofs = vertex_ofs;
}
- if (uv2_source_id != "") {
+ if (!uv2_source_id.is_empty()) {
ERR_FAIL_COND_V(!meshdata.sources.has(uv2_source_id), ERR_INVALID_DATA);
uv2_src = &meshdata.sources[uv2_source_id];
}
@@ -625,7 +625,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ImporterMesh> &p
color_ofs = vertex_ofs;
}
- if (color_source_id != "") {
+ if (!color_source_id.is_empty()) {
ERR_FAIL_COND_V(!meshdata.sources.has(color_source_id), ERR_INVALID_DATA);
color_src = &meshdata.sources[color_source_id];
}
@@ -914,7 +914,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ImporterMesh> &p
material = material_cache[target];
}
- } else if (p.material != "") {
+ } else if (!p.material.is_empty()) {
WARN_PRINT("Collada: Unreferenced material in geometry instance: " + p.material);
}
}
@@ -1198,7 +1198,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
}
}
- ERR_FAIL_COND_V_MSG(ngsource != "", ERR_INVALID_DATA, "Controller instance source '" + ngsource + "' is neither skin or morph!");
+ ERR_FAIL_COND_V_MSG(!ngsource.is_empty(), ERR_INVALID_DATA, "Controller instance source '" + ngsource + "' is neither skin or morph!");
} else {
meshid = ng2->source;
@@ -1215,13 +1215,13 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
mesh = Ref<ImporterMesh>(memnew(ImporterMesh));
const Collada::MeshData &meshdata = collada.state.mesh_data_map[meshid];
String name = meshdata.name;
- if (name == "") {
+ if (name.is_empty()) {
name = "Mesh";
}
int counter = 2;
while (mesh_unique_names.has(name)) {
name = meshdata.name;
- if (name == "") {
+ if (name.is_empty()) {
name = "Mesh";
}
name += itos(counter++);
@@ -1261,7 +1261,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
}
mi->set_surface_material(i, material);
- } else if (matname != "") {
+ } else if (!matname.is_empty()) {
WARN_PRINT("Collada: Unreferenced material in geometry instance: " + matname);
}
}
@@ -1343,7 +1343,7 @@ void ColladaImport::_fix_param_animation_tracks() {
// test source(s)
String source = ng->source;
- while (source != "") {
+ while (!source.is_empty()) {
if (collada.state.skin_controller_data_map.has(source)) {
const Collada::SkinControllerData &skin = collada.state.skin_controller_data_map[source];
@@ -1796,7 +1796,7 @@ Node *EditorSceneFormatImporterCollada::import_scene(const String &p_path, uint3
AnimationPlayer *ap = memnew(AnimationPlayer);
for (int i = 0; i < state.animations.size(); i++) {
String name;
- if (state.animations[i]->get_name() == "") {
+ if (state.animations[i]->get_name().is_empty()) {
name = "default";
} else {
name = state.animations[i]->get_name();
diff --git a/editor/import/resource_importer_csv_translation.cpp b/editor/import/resource_importer_csv_translation.cpp
index 7948d9e577..7a226802f2 100644
--- a/editor/import/resource_importer_csv_translation.cpp
+++ b/editor/import/resource_importer_csv_translation.cpp
@@ -113,7 +113,7 @@ Error ResourceImporterCSVTranslation::import(const String &p_source_file, const
while (line.size() == locales.size() + 1) {
String key = line[0];
- if (key != "") {
+ if (!key.is_empty()) {
for (int i = 1; i < line.size(); i++) {
translations.write[i - 1]->add_message(key, line[i].c_unescape());
}
diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp
index bb68de99b1..9e3cdbdeff 100644
--- a/editor/import/resource_importer_obj.cpp
+++ b/editor/import/resource_importer_obj.cpp
@@ -235,7 +235,7 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh>> &r_meshes, bool p_
while (l.length() && l[l.length() - 1] == '\\') {
String add = f->get_line().strip_edges();
l += add;
- if (add == String()) {
+ if (add.is_empty()) {
break;
}
}
@@ -301,7 +301,7 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh>> &r_meshes, bool p_
surf_tool->set_normal(normals[norm]);
}
- if (face[idx].size() >= 2 && face[idx][1] != String()) {
+ if (face[idx].size() >= 2 && !face[idx][1].is_empty()) {
int uv = face[idx][1].to_int() - 1;
if (uv < 0) {
uv += uvs.size() + 1;
@@ -363,9 +363,9 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh>> &r_meshes, bool p_
mesh = surf_tool->commit(mesh, mesh_flags);
- if (current_material != String()) {
+ if (!current_material.is_empty()) {
mesh->surface_set_name(mesh->get_surface_count() - 1, current_material.get_basename());
- } else if (current_group != String()) {
+ } else if (!current_group.is_empty()) {
mesh->surface_set_name(mesh->get_surface_count() - 1, current_group);
}
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index a25b694a60..c7eb6181ba 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -481,7 +481,7 @@ Node *ResourceImporterScene::_pre_fix_node(Node *p_node, Node *p_root, Map<Ref<I
fixed_name = _fixstr(name, "convcolonly");
}
- ERR_FAIL_COND_V(fixed_name == String(), nullptr);
+ ERR_FAIL_COND_V(fixed_name.is_empty(), nullptr);
if (shapes.size()) {
StaticBody3D *col = memnew(StaticBody3D);
@@ -577,7 +577,7 @@ Node *ResourceImporterScene::_pre_fix_node(Node *p_node, Node *p_root, Map<Ref<I
fixed_name = _fixstr(name, "convcol");
}
- if (fixed_name != String()) {
+ if (!fixed_name.is_empty()) {
if (mi->get_parent() && !mi->get_parent()->has_node(fixed_name)) {
mi->set_name(fixed_name);
}
@@ -710,7 +710,7 @@ Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, Map<Ref<
mat_id = mat->get_name();
}
- if (mat_id != String() && p_material_data.has(mat_id)) {
+ if (!mat_id.is_empty() && p_material_data.has(mat_id)) {
Dictionary matdata = p_material_data[mat_id];
for (int j = 0; j < post_importer_plugins.size(); j++) {
@@ -1015,6 +1015,7 @@ Ref<Animation> ResourceImporterScene::_save_animation_to_file(Ref<Animation> ani
void ResourceImporterScene::_create_clips(AnimationPlayer *anim, const Array &p_clips, bool p_bake_all) {
if (!anim->has_animation("default")) {
+ ERR_FAIL_COND_MSG(p_clips.size() > 0, "To create clips, animations must be named \"default\".");
return;
}
@@ -1433,7 +1434,7 @@ void ResourceImporterScene::get_import_options(const String &p_path, List<Import
String script_ext_hint;
for (const String &E : script_extentions) {
- if (script_ext_hint != "") {
+ if (!script_ext_hint.is_empty()) {
script_ext_hint += ",";
}
script_ext_hint += "*." + E;
@@ -1559,7 +1560,7 @@ void ResourceImporterScene::_generate_meshes(Node *p_node, const Dictionary &p_m
mesh_id = src_mesh_node->get_mesh()->get_name();
}
- if (mesh_id != String() && p_mesh_data.has(mesh_id)) {
+ if (!mesh_id.is_empty() && p_mesh_data.has(mesh_id)) {
Dictionary mesh_settings = p_mesh_data[mesh_id];
if (mesh_settings.has("generate/shadow_meshes")) {
@@ -1649,7 +1650,7 @@ void ResourceImporterScene::_generate_meshes(Node *p_node, const Dictionary &p_m
}
}
- if (save_to_file != String()) {
+ if (!save_to_file.is_empty()) {
Ref<Mesh> existing = Ref<Resource>(ResourceCache::get(save_to_file));
if (existing.is_valid()) {
//if somehow an existing one is useful, create
@@ -2051,7 +2052,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
String post_import_script_path = p_options["import_script/path"];
Ref<EditorScenePostImport> post_import_script;
- if (post_import_script_path != "") {
+ if (!post_import_script_path.is_empty()) {
Ref<Script> scr = ResourceLoader::load(post_import_script_path);
if (!scr.is_valid()) {
EditorNode::add_io_error(TTR("Couldn't load post-import script:") + " " + post_import_script_path);
diff --git a/editor/import/scene_import_settings.cpp b/editor/import/scene_import_settings.cpp
index 5690d49a55..a376596f9b 100644
--- a/editor/import/scene_import_settings.cpp
+++ b/editor/import/scene_import_settings.cpp
@@ -92,7 +92,7 @@ void SceneImportSettings::_fill_material(Tree *p_tree, const Ref<Material> &p_ma
if (p_material->has_meta("import_id")) {
import_id = p_material->get_meta("import_id");
has_import_id = true;
- } else if (p_material->get_name() != "") {
+ } else if (!p_material->get_name().is_empty()) {
import_id = p_material->get_name();
has_import_id = true;
} else {
@@ -148,7 +148,7 @@ void SceneImportSettings::_fill_mesh(Tree *p_tree, const Ref<Mesh> &p_mesh, Tree
if (p_mesh->has_meta("import_id")) {
import_id = p_mesh->get_meta("import_id");
has_import_id = true;
- } else if (p_mesh->get_name() != String()) {
+ } else if (!p_mesh->get_name().is_empty()) {
import_id = p_mesh->get_name();
has_import_id = true;
} else {
@@ -414,7 +414,7 @@ void SceneImportSettings::_update_camera() {
float rot_y = cam_rot_y;
float zoom = cam_zoom;
- if (selected_type == "Node" || selected_type == "") {
+ if (selected_type == "Node" || selected_type.is_empty()) {
camera_aabb = contents_aabb;
} else {
if (mesh_preview->get_mesh().is_valid()) {