summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsjtxietian <jsjtxietian@outlook.com>2023-11-06 16:22:32 +0800
committerjsjtxietian <jsjtxietian@outlook.com>2023-11-06 16:22:32 +0800
commit8f6e8ef0d7b3ae91cd8719f05761cc35e1c9cd13 (patch)
treebcdc463ca44c1e52c4ba61f4088907cff977c2c5
parent5ee983188de97ae027f9b9c1443438063f708a7e (diff)
downloadredot-engine-8f6e8ef0d7b3ae91cd8719f05761cc35e1c9cd13.tar.gz
clean unnecessay copy detected by clang-tidy
-rw-r--r--core/io/resource_saver.cpp5
-rw-r--r--editor/import/resource_importer_scene.cpp3
2 files changed, 3 insertions, 5 deletions
diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp
index 564a54b913..0462e24b9e 100644
--- a/core/io/resource_saver.cpp
+++ b/core/io/resource_saver.cpp
@@ -120,9 +120,8 @@ Error ResourceSaver::save(const Ref<Resource> &p_resource, const String &p_path,
String local_path = ProjectSettings::get_singleton()->localize_path(path);
- Ref<Resource> rwcopy = p_resource;
if (p_flags & FLAG_CHANGE_PATH) {
- rwcopy->set_path(local_path);
+ p_resource->set_path(local_path);
}
err = saver[i]->save(p_resource, path, p_flags);
@@ -139,7 +138,7 @@ Error ResourceSaver::save(const Ref<Resource> &p_resource, const String &p_path,
#endif
if (p_flags & FLAG_CHANGE_PATH) {
- rwcopy->set_path(old_path);
+ p_resource->set_path(old_path);
}
if (save_callback && path.begins_with("res://")) {
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index 8e277a8b6c..6fd91deab9 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -2369,9 +2369,8 @@ Node *ResourceImporterScene::pre_import(const String &p_source_file, const HashM
ERR_FAIL_COND_V(!importer.is_valid(), nullptr);
Error err = OK;
- HashMap<StringName, Variant> options_dupe = p_options;
- Node *scene = importer->import_scene(p_source_file, EditorSceneFormatImporter::IMPORT_ANIMATION | EditorSceneFormatImporter::IMPORT_GENERATE_TANGENT_ARRAYS | EditorSceneFormatImporter::IMPORT_FORCE_DISABLE_MESH_COMPRESSION, options_dupe, nullptr, &err);
+ Node *scene = importer->import_scene(p_source_file, EditorSceneFormatImporter::IMPORT_ANIMATION | EditorSceneFormatImporter::IMPORT_GENERATE_TANGENT_ARRAYS | EditorSceneFormatImporter::IMPORT_FORCE_DISABLE_MESH_COMPRESSION, p_options, nullptr, &err);
if (!scene || err != OK) {
return nullptr;
}