From c920b75142d99a3cccbbec622d0c35de72a76041 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Mon, 24 Apr 2023 17:47:19 -0500 Subject: [PATCH 1/2] Fix collision assets creation in non asset folders. --- Source/Editor/Content/Proxy/CollisionDataProxy.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Source/Editor/Content/Proxy/CollisionDataProxy.cs b/Source/Editor/Content/Proxy/CollisionDataProxy.cs index 55e8c6327..e4a2381f0 100644 --- a/Source/Editor/Content/Proxy/CollisionDataProxy.cs +++ b/Source/Editor/Content/Proxy/CollisionDataProxy.cs @@ -141,7 +141,13 @@ namespace FlaxEditor.Content }); }; var initialName = (modelItem?.ShortName ?? Path.GetFileNameWithoutExtension(model.Path)) + " Collision"; - Editor.Instance.Windows.ContentWin.NewItem(this, null, create, initialName, withRenaming); + + // If folder can not have assets then move to folder with the model and create asset + var contentWin = Editor.Instance.Windows.ContentWin; + if (!contentWin.CurrentViewFolder.CanHaveAssets) + contentWin.Navigate(modelItem?.ParentFolder?.Node); + + contentWin.NewItem(this, null, create, initialName, withRenaming); } } } From 95d798f49e8f94eeb3eca257d8e35c9532132531 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Fri, 5 May 2023 08:30:17 -0500 Subject: [PATCH 2/2] Standardize to changing the folder for any proxy that can not be created in the current view. --- Source/Editor/Content/Proxy/CollisionDataProxy.cs | 8 +------- Source/Editor/Windows/ContentWindow.cs | 5 +++++ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Source/Editor/Content/Proxy/CollisionDataProxy.cs b/Source/Editor/Content/Proxy/CollisionDataProxy.cs index e4a2381f0..55e8c6327 100644 --- a/Source/Editor/Content/Proxy/CollisionDataProxy.cs +++ b/Source/Editor/Content/Proxy/CollisionDataProxy.cs @@ -141,13 +141,7 @@ namespace FlaxEditor.Content }); }; var initialName = (modelItem?.ShortName ?? Path.GetFileNameWithoutExtension(model.Path)) + " Collision"; - - // If folder can not have assets then move to folder with the model and create asset - var contentWin = Editor.Instance.Windows.ContentWin; - if (!contentWin.CurrentViewFolder.CanHaveAssets) - contentWin.Navigate(modelItem?.ParentFolder?.Node); - - contentWin.NewItem(this, null, create, initialName, withRenaming); + Editor.Instance.Windows.ContentWin.NewItem(this, null, create, initialName, withRenaming); } } } diff --git a/Source/Editor/Windows/ContentWindow.cs b/Source/Editor/Windows/ContentWindow.cs index 43fd6b648..6a59cb218 100644 --- a/Source/Editor/Windows/ContentWindow.cs +++ b/Source/Editor/Windows/ContentWindow.cs @@ -656,6 +656,11 @@ namespace FlaxEditor.Windows throw new ArgumentNullException(nameof(proxy)); string name = initialName ?? proxy.NewItemName; + + // If the proxy can not be created in the current folder, then navigate to the content folder + if (!proxy.CanCreate(CurrentViewFolder)) + Navigate(Editor.Instance.ContentDatabase.Game.Content); + ContentFolder parentFolder = CurrentViewFolder; string parentFolderPath = parentFolder.Path;