Merge remote-tracking branch 'origin/master' into 1.7

This commit is contained in:
Wojtek Figat
2023-09-19 21:42:53 +02:00
49 changed files with 1684 additions and 1336 deletions

View File

@@ -632,7 +632,8 @@ namespace FlaxEditor.Modules
/// Deletes the specified item.
/// </summary>
/// <param name="item">The item.</param>
public void Delete(ContentItem item)
/// <param name="deletedByUser">If the file was deleted by the user and not outside the editor.</param>
public void Delete(ContentItem item, bool deletedByUser = false)
{
if (item == null)
throw new ArgumentNullException();
@@ -656,12 +657,12 @@ namespace FlaxEditor.Modules
var children = folder.Children.ToArray();
for (int i = 0; i < children.Length; i++)
{
Delete(children[i]);
Delete(children[i], deletedByUser);
}
}
// Remove directory
if (Directory.Exists(path))
if (deletedByUser && Directory.Exists(path))
{
try
{
@@ -689,7 +690,7 @@ namespace FlaxEditor.Modules
// Delete asset by using content pool
FlaxEngine.Content.DeleteAsset(path);
}
else
else if (deletedByUser)
{
// Delete file
if (File.Exists(path))
@@ -835,7 +836,7 @@ namespace FlaxEditor.Modules
Editor.Log(string.Format($"Content item \'{child.Path}\' has been removed"));
// Destroy it
Delete(child);
Delete(child, false);
i--;
}