@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user