Rename NumberCategoryAttribute to ValueCategoryAttribute

#2213
This commit is contained in:
Wojtek Figat
2024-03-19 18:30:02 +01:00
parent 911251cb20
commit 35d1d97840
5 changed files with 13 additions and 14 deletions

View File

@@ -26,8 +26,8 @@ namespace FlaxEditor.CustomEditors.Editors
// Try get limit attribute for value min/max range setting and slider speed
var attributes = Values.GetAttributes();
var categoryAttribute = attributes.FirstOrDefault(x => x is NumberCategoryAttribute);
var valueCategory = ((NumberCategoryAttribute)categoryAttribute)?.Category ?? Utils.ValueCategory.None;
var categoryAttribute = attributes.FirstOrDefault(x => x is ValueCategoryAttribute);
var valueCategory = ((ValueCategoryAttribute)categoryAttribute)?.Category ?? Utils.ValueCategory.None;
if (attributes != null)
{
var limit = attributes.FirstOrDefault(x => x is LimitAttribute);

View File

@@ -32,8 +32,8 @@ namespace FlaxEditor.CustomEditors.Editors
// Try get limit attribute for value min/max range setting and slider speed
var attributes = Values.GetAttributes();
var categoryAttribute = attributes.FirstOrDefault(x => x is NumberCategoryAttribute);
var valueCategory = ((NumberCategoryAttribute)categoryAttribute)?.Category ?? Utils.ValueCategory.None;
var categoryAttribute = attributes.FirstOrDefault(x => x is ValueCategoryAttribute);
var valueCategory = ((ValueCategoryAttribute)categoryAttribute)?.Category ?? Utils.ValueCategory.None;
if (attributes != null)
{
var range = attributes.FirstOrDefault(x => x is RangeAttribute);

View File

@@ -75,7 +75,7 @@ namespace FlaxEditor.CustomEditors.Editors
if (attributes != null)
{
limit = (LimitAttribute)attributes.FirstOrDefault(x => x is LimitAttribute);
var categoryAttribute = (NumberCategoryAttribute)attributes.FirstOrDefault(x => x is NumberCategoryAttribute);
var categoryAttribute = (ValueCategoryAttribute)attributes.FirstOrDefault(x => x is ValueCategoryAttribute);
if (categoryAttribute != null)
category = categoryAttribute.Category;
}
@@ -273,7 +273,7 @@ namespace FlaxEditor.CustomEditors.Editors
if (attributes != null)
{
limit = (LimitAttribute)attributes.FirstOrDefault(x => x is LimitAttribute);
var categoryAttribute = (NumberCategoryAttribute)attributes.FirstOrDefault(x => x is NumberCategoryAttribute);
var categoryAttribute = (ValueCategoryAttribute)attributes.FirstOrDefault(x => x is ValueCategoryAttribute);
if (categoryAttribute != null)
category = categoryAttribute.Category;
}

View File

@@ -18,13 +18,13 @@ API_STRUCT() struct FLAXENGINE_API Transform
/// <summary>
/// The translation vector of the transform.
/// </summary>
API_FIELD(Attributes="EditorOrder(10), EditorDisplay(null, \"Position\"), NumberCategory(Utils.ValueCategory.Distance)")
API_FIELD(Attributes="EditorOrder(10), EditorDisplay(null, \"Position\"), ValueCategory(Utils.ValueCategory.Distance)")
Vector3 Translation;
/// <summary>
/// The rotation of the transform.
/// </summary>
API_FIELD(Attributes="EditorOrder(20), EditorDisplay(null, \"Rotation\"), NumberCategory(Utils.ValueCategory.Angle)")
API_FIELD(Attributes="EditorOrder(20), EditorDisplay(null, \"Rotation\"), ValueCategory(Utils.ValueCategory.Angle)")
Quaternion Orientation;
/// <summary>

View File

@@ -5,29 +5,28 @@ using System;
namespace FlaxEngine
{
/// <summary>
/// Used to specify the value category of a numeric value as either as-is (a scalar), a distance (formatted as cm/m/km)
/// or an angle (formatted with a degree sign).
/// Used to specify the value category of a numeric value as either as-is (a scalar), a distance (formatted as cm/m/km) or an angle (formatted with a degree sign).
/// </summary>
/// <seealso cref="System.Attribute" />
[Serializable]
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
public sealed class NumberCategoryAttribute : Attribute
public sealed class ValueCategoryAttribute : Attribute
{
/// <summary>
/// The value category used for formatting.
/// </summary>
public Utils.ValueCategory Category;
private NumberCategoryAttribute()
private ValueCategoryAttribute()
{
Category = Utils.ValueCategory.None;
}
/// <summary>
/// Initializes a new instance of the <see cref="NumberCategoryAttribute"/> class.
/// Initializes a new instance of the <see cref="ValueCategoryAttribute"/> class.
/// </summary>
/// <param name="category">The value category.</param>
public NumberCategoryAttribute(Utils.ValueCategory category)
public ValueCategoryAttribute(Utils.ValueCategory category)
{
Category = category;
}