From 8f76fe40498c014318d22f45c3ce644544eeeaa6 Mon Sep 17 00:00:00 2001 From: Ruan Lucas <79365912+RuanLucasGD@users.noreply.github.com> Date: Fri, 9 Jun 2023 22:14:33 -0400 Subject: [PATCH 1/3] don't let rename source/content folders --- Source/Editor/Content/Items/ContentFolder.cs | 11 ++++++++++- Source/Editor/ProjectInfo.cs | 12 ++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Source/Editor/Content/Items/ContentFolder.cs b/Source/Editor/Content/Items/ContentFolder.cs index 86c374fee..f3c698782 100644 --- a/Source/Editor/Content/Items/ContentFolder.cs +++ b/Source/Editor/Content/Items/ContentFolder.cs @@ -113,7 +113,16 @@ namespace FlaxEditor.Content public override ContentItemSearchFilter SearchFilter => ContentItemSearchFilter.Other; /// - public override bool CanRename => ParentFolder != null; // Deny rename action for root folders + public override bool CanRename + { + get + { + var hasParentFolder = ParentFolder != null; + var isContentFolder = IsFolder && Path == Editor.Instance.GameProject.ContentFolderPath; + var isSourceFolder = IsFolder && Path == Editor.Instance.GameProject.SourceFolderPath; + return hasParentFolder && !isContentFolder && !isSourceFolder; + } + } /// public override bool CanDrag => ParentFolder != null; // Deny rename action for root folders diff --git a/Source/Editor/ProjectInfo.cs b/Source/Editor/ProjectInfo.cs index bc55a9c05..62402b0d8 100644 --- a/Source/Editor/ProjectInfo.cs +++ b/Source/Editor/ProjectInfo.cs @@ -55,6 +55,16 @@ namespace FlaxEditor [NonSerialized] public string ProjectFolderPath; + /// + /// The content assets folder + /// + public string ContentFolderPath; + + /// + /// The source files folder path + /// + public string SourceFolderPath; + /// /// The project version. /// @@ -157,6 +167,8 @@ namespace FlaxEditor var project = JsonConvert.DeserializeObject(contents); project.ProjectPath = path; project.ProjectFolderPath = StringUtils.NormalizePath(Path.GetDirectoryName(path)); + project.ContentFolderPath = StringUtils.NormalizePath(project.ProjectFolderPath + "/Content"); + project.SourceFolderPath = StringUtils.NormalizePath(project.ProjectFolderPath + "/Source"); // Process project data if (string.IsNullOrEmpty(project.Name)) From 164670cceb4b7bdc654b928e1da771a286e312d1 Mon Sep 17 00:00:00 2001 From: Ruan Lucas <79365912+RuanLucasGD@users.noreply.github.com> Date: Mon, 12 Jun 2023 20:04:32 -0400 Subject: [PATCH 2/3] change content folder detection mode on "CanRename" --- Source/Editor/Content/Items/ContentFolder.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Source/Editor/Content/Items/ContentFolder.cs b/Source/Editor/Content/Items/ContentFolder.cs index f3c698782..57e55d3fe 100644 --- a/Source/Editor/Content/Items/ContentFolder.cs +++ b/Source/Editor/Content/Items/ContentFolder.cs @@ -118,9 +118,8 @@ namespace FlaxEditor.Content get { var hasParentFolder = ParentFolder != null; - var isContentFolder = IsFolder && Path == Editor.Instance.GameProject.ContentFolderPath; - var isSourceFolder = IsFolder && Path == Editor.Instance.GameProject.SourceFolderPath; - return hasParentFolder && !isContentFolder && !isSourceFolder; + var isContentFolder = Node is MainContentTreeNode; + return hasParentFolder && !isContentFolder; } } From 020b0a90d76a58dce1d3dbceedff6fe5b7c1addf Mon Sep 17 00:00:00 2001 From: Ruan Lucas <79365912+RuanLucasGD@users.noreply.github.com> Date: Tue, 27 Jun 2023 00:22:12 -0400 Subject: [PATCH 3/3] remove unecessary code --- Source/Editor/ProjectInfo.cs | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/Source/Editor/ProjectInfo.cs b/Source/Editor/ProjectInfo.cs index 62402b0d8..bc55a9c05 100644 --- a/Source/Editor/ProjectInfo.cs +++ b/Source/Editor/ProjectInfo.cs @@ -55,16 +55,6 @@ namespace FlaxEditor [NonSerialized] public string ProjectFolderPath; - /// - /// The content assets folder - /// - public string ContentFolderPath; - - /// - /// The source files folder path - /// - public string SourceFolderPath; - /// /// The project version. /// @@ -167,8 +157,6 @@ namespace FlaxEditor var project = JsonConvert.DeserializeObject(contents); project.ProjectPath = path; project.ProjectFolderPath = StringUtils.NormalizePath(Path.GetDirectoryName(path)); - project.ContentFolderPath = StringUtils.NormalizePath(project.ProjectFolderPath + "/Content"); - project.SourceFolderPath = StringUtils.NormalizePath(project.ProjectFolderPath + "/Source"); // Process project data if (string.IsNullOrEmpty(project.Name))