From 607505a31653aaba31b15d1f0433f2c3ba6a452a Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Thu, 29 Dec 2022 15:11:07 -0600 Subject: [PATCH 1/3] Always capitalize the first letter of a property name label --- Source/Editor/CustomEditors/GUI/PropertyNameLabel.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/Editor/CustomEditors/GUI/PropertyNameLabel.cs b/Source/Editor/CustomEditors/GUI/PropertyNameLabel.cs index b050e60c3..18bc1878d 100644 --- a/Source/Editor/CustomEditors/GUI/PropertyNameLabel.cs +++ b/Source/Editor/CustomEditors/GUI/PropertyNameLabel.cs @@ -51,6 +51,9 @@ namespace FlaxEditor.CustomEditors.GUI /// The name. public PropertyNameLabel(string name) { + // Format name with capital first letter + name = name[0].ToString().ToUpper() + name.Substring(1); + Text = name; HorizontalAlignment = TextAlignment.Near; VerticalAlignment = TextAlignment.Center; From 9d3b8eeeaff18ebc186e5ba7b3573196bad99aeb Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Thu, 29 Dec 2022 15:21:48 -0600 Subject: [PATCH 2/3] changed to change it in property UI --- Source/Editor/CustomEditors/GUI/PropertyNameLabel.cs | 3 --- Source/Editor/Utilities/Utils.cs | 6 ++++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Source/Editor/CustomEditors/GUI/PropertyNameLabel.cs b/Source/Editor/CustomEditors/GUI/PropertyNameLabel.cs index 18bc1878d..b050e60c3 100644 --- a/Source/Editor/CustomEditors/GUI/PropertyNameLabel.cs +++ b/Source/Editor/CustomEditors/GUI/PropertyNameLabel.cs @@ -51,9 +51,6 @@ namespace FlaxEditor.CustomEditors.GUI /// The name. public PropertyNameLabel(string name) { - // Format name with capital first letter - name = name[0].ToString().ToUpper() + name.Substring(1); - Text = name; HorizontalAlignment = TextAlignment.Near; VerticalAlignment = TextAlignment.Center; diff --git a/Source/Editor/Utilities/Utils.cs b/Source/Editor/Utilities/Utils.cs index ea7f44efc..c89d824e7 100644 --- a/Source/Editor/Utilities/Utils.cs +++ b/Source/Editor/Utilities/Utils.cs @@ -912,6 +912,12 @@ namespace FlaxEditor.Utilities { var c = name[i]; + if (i == 0) + { + sb.Append(char.ToUpper(c)); + continue; + } + // Space before word starting with uppercase letter if (char.IsUpper(c) && i > 0) { From 5f83918c06d0b3717eef6ce2903803fe02374dbe Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Thu, 29 Dec 2022 15:25:12 -0600 Subject: [PATCH 3/3] small fix --- Source/Editor/Utilities/Utils.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/Editor/Utilities/Utils.cs b/Source/Editor/Utilities/Utils.cs index c89d824e7..e4c06fd9b 100644 --- a/Source/Editor/Utilities/Utils.cs +++ b/Source/Editor/Utilities/Utils.cs @@ -906,13 +906,16 @@ namespace FlaxEditor.Utilities if (name.StartsWith("g_") || name.StartsWith("m_")) startIndex = 2; + if (name.StartsWith("_")) + startIndex = 1; + // Filter text var lastChar = '\0'; for (int i = startIndex; i < length; i++) { var c = name[i]; - if (i == 0) + if (i == startIndex) { sb.Append(char.ToUpper(c)); continue;