Merge remote-tracking branch 'origin/master' into navigation-features

# Conflicts:
#	Source/Editor/Content/Settings/NavigationSettings.cs
#	Source/Engine/Engine/PhysicalMaterial.cs
#	Source/Tools/Flax.Build/Bindings/BindingsGenerator.Api.cs
This commit is contained in:
Wojtek Figat
2021-01-04 14:31:56 +01:00
2425 changed files with 4606 additions and 30937 deletions

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2012-2020 Wojciech Figat. All rights reserved.
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
#include "Content.h"
#include "JsonAsset.h"
@@ -574,17 +574,21 @@ bool Content::RenameAsset(const StringView& oldPath, const StringView& newPath)
Asset* newAsset = GetAsset(newPath);
// Validate name
if (newAsset != nullptr || FileSystem::FileExists(newPath))
if (newAsset != nullptr && newAsset != oldAsset)
{
LOG(Error, "Invalid name '{0}' when trying to rename '{1}'.", newPath, oldPath);
return true;
}
// Check if is create
// Ensure asset is ready for renaming
if (oldAsset)
{
// Wait for data loaded
oldAsset->WaitForLoaded();
if (oldAsset->WaitForLoaded())
{
LOG(Error, "Failed to load asset '{0}'.", oldAsset->ToString());
return true;
}
// Unload
// Don't unload asset fully, only release ref to file, don't call OnUnload so managed asset and all refs will remain alive