diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-05-06 07:43:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-06 07:43:52 +0200 |
commit | 89449bd0e30f036f0aa21b2cb11d302bad9052be (patch) | |
tree | d08d774fa53fc3368b13a23c0c3b5a9cd6327d57 /editor/import | |
parent | 066692b6d081f1577bc0ebcd84da204339218ec6 (diff) | |
parent | 1dc7bcc83c81b32c3651f3fa869055a0cce22085 (diff) |
Merge pull request #59804 from KoBeWi/sponsored_by_Meta
Cleanup metadata usage
Diffstat (limited to 'editor/import')
-rw-r--r-- | editor/import/resource_importer_scene.cpp | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index 34079d0a4b..06a84ff23c 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -715,13 +715,7 @@ Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, Map<Ref< bool isroot = p_node == p_root; - String import_id; - - if (p_node->has_meta("import_id")) { - import_id = p_node->get_meta("import_id"); - } else { - import_id = "PATH:" + p_root->get_path_to(p_node); - } + String import_id = p_node->get_meta("import_id", "PATH:" + p_root->get_path_to(p_node)); Dictionary node_settings; if (p_node_data.has(import_id)) { @@ -763,12 +757,7 @@ Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, Map<Ref< for (int i = 0; i < m->get_surface_count(); i++) { Ref<Material> mat = m->get_surface_material(i); if (mat.is_valid()) { - String mat_id; - if (mat->has_meta("import_id")) { - mat_id = mat->get_meta("import_id"); - } else { - mat_id = mat->get_name(); - } + String mat_id = mat->get_meta("import_id", mat->get_name()); if (!mat_id.is_empty() && p_material_data.has(mat_id)) { Dictionary matdata = p_material_data[mat_id]; @@ -1591,13 +1580,7 @@ void ResourceImporterScene::_generate_meshes(Node *p_node, const Dictionary &p_m bool bake_lightmaps = p_light_bake_mode == LIGHT_BAKE_STATIC_LIGHTMAPS; String save_to_file; - String mesh_id; - - if (src_mesh_node->get_mesh()->has_meta("import_id")) { - mesh_id = src_mesh_node->get_mesh()->get_meta("import_id"); - } else { - mesh_id = src_mesh_node->get_mesh()->get_name(); - } + String mesh_id = src_mesh_node->get_mesh()->get_meta("import_id", src_mesh_node->get_mesh()->get_name()); if (!mesh_id.is_empty() && p_mesh_data.has(mesh_id)) { Dictionary mesh_settings = p_mesh_data[mesh_id]; |