Skip to content

Commit

Permalink
clean unnecessay copy detected by clang-tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
jsjtxietian committed Nov 6, 2023
1 parent 5ee9831 commit 8f6e8ef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 2 additions & 3 deletions core/io/resource_saver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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://")) {
Expand Down
3 changes: 1 addition & 2 deletions editor/import/resource_importer_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 8f6e8ef

Please sign in to comment.