declaration order sorting
This commit is contained in:
@@ -75,6 +75,8 @@ namespace FlaxEditor.Content
|
||||
}
|
||||
}
|
||||
|
||||
public int MetadataToken => 0;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool HasAttribute(Type attributeType, bool inherit)
|
||||
{
|
||||
@@ -195,6 +197,8 @@ namespace FlaxEditor.Content
|
||||
/// <inheritdoc />
|
||||
public ScriptType ValueType => _returnType;
|
||||
|
||||
public int MetadataToken => 0;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool HasAttribute(Type attributeType, bool inherit)
|
||||
{
|
||||
|
||||
@@ -173,8 +173,16 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
return string.Compare(Display.Group, other.Display.Group, StringComparison.InvariantCulture);
|
||||
}
|
||||
|
||||
// By name
|
||||
return string.Compare(Info.Name, other.Info.Name, StringComparison.InvariantCulture);
|
||||
// By declaration order
|
||||
if (Info.MetadataToken > other.Info.MetadataToken)
|
||||
return 1;
|
||||
else if (Info.MetadataToken < other.Info.MetadataToken)
|
||||
return -1;
|
||||
else
|
||||
{
|
||||
// By name
|
||||
return string.Compare(Info.Name, other.Info.Name, StringComparison.InvariantCulture);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -40,6 +40,22 @@ namespace FlaxEditor.Scripting
|
||||
/// </summary>
|
||||
public string Name => _managed?.Name ?? _custom?.Name;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a metadata token for sorting so it may not be the actual token.
|
||||
/// </summary>
|
||||
public int MetadataToken
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_managed != null && IsProperty)
|
||||
{
|
||||
ScriptMemberInfo finfo = DeclaringType.GetField(string.Format("<{0}>k__BackingField", Name), BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
return finfo.MetadataToken;
|
||||
}
|
||||
return _managed?.MetadataToken ?? _custom?.MetadataToken ?? 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the type is declared public.
|
||||
/// </summary>
|
||||
@@ -1444,6 +1460,11 @@ namespace FlaxEditor.Scripting
|
||||
/// </summary>
|
||||
string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a metadata token for sorting so it may not be the actual token.
|
||||
/// </summary>
|
||||
int MetadataToken { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the type is declared public.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user