Merge branch 'patch-declarationSort' of git://github.com/honzapatCZ/FlaxEngine into honzapatCZ-patch-declarationSort
This commit is contained in:
@@ -75,6 +75,8 @@ namespace FlaxEditor.Content
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int MetadataToken => 0;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public bool HasAttribute(Type attributeType, bool inherit)
|
public bool HasAttribute(Type attributeType, bool inherit)
|
||||||
{
|
{
|
||||||
@@ -195,6 +197,8 @@ namespace FlaxEditor.Content
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public ScriptType ValueType => _returnType;
|
public ScriptType ValueType => _returnType;
|
||||||
|
|
||||||
|
public int MetadataToken => 0;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public bool HasAttribute(Type attributeType, bool inherit)
|
public bool HasAttribute(Type attributeType, bool inherit)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -173,6 +173,14 @@ namespace FlaxEditor.CustomEditors.Editors
|
|||||||
return string.Compare(Display.Group, other.Display.Group, StringComparison.InvariantCulture);
|
return string.Compare(Display.Group, other.Display.Group, StringComparison.InvariantCulture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Editor.Instance.Options.Options.General.ScriptMembersOrder == Options.GeneralOptions.MembersOrder.Declaration)
|
||||||
|
{
|
||||||
|
// By declaration order
|
||||||
|
if (Info.MetadataToken > other.Info.MetadataToken)
|
||||||
|
return 1;
|
||||||
|
else if (Info.MetadataToken < other.Info.MetadataToken)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
// By name
|
// By name
|
||||||
return string.Compare(Info.Name, other.Info.Name, StringComparison.InvariantCulture);
|
return string.Compare(Info.Name, other.Info.Name, StringComparison.InvariantCulture);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,6 +68,24 @@ namespace FlaxEditor.Options
|
|||||||
CompileScripts,
|
CompileScripts,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Order of script members show in editor
|
||||||
|
/// </summary>
|
||||||
|
public enum MembersOrder
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Shows properties/fields in alphabetical order
|
||||||
|
/// </summary>
|
||||||
|
[Tooltip("Shows properties/fields in alphabetical order")]
|
||||||
|
Alphabetical,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Shows properties/fields in declaration order
|
||||||
|
/// </summary>
|
||||||
|
[Tooltip("Shows properties/fields in declaration order")]
|
||||||
|
Declaration
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the scene to load on editor startup.
|
/// Gets or sets the scene to load on editor startup.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -116,6 +134,13 @@ namespace FlaxEditor.Options
|
|||||||
[EditorDisplay("Scripting", "Force Script Compilation On Startup"), EditorOrder(501), Tooltip("Determines whether automatically compile game scripts before starting the editor.")]
|
[EditorDisplay("Scripting", "Force Script Compilation On Startup"), EditorOrder(501), Tooltip("Determines whether automatically compile game scripts before starting the editor.")]
|
||||||
public bool ForceScriptCompilationOnStartup { get; set; } = true;
|
public bool ForceScriptCompilationOnStartup { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether automatically save the Visual Script asset editors when starting the play mode in editor.
|
||||||
|
/// </summary>
|
||||||
|
[DefaultValue(true)]
|
||||||
|
[EditorDisplay("Scripting", "Script Members Order"), EditorOrder(503), Tooltip("Sets the order of script properties/fields")]
|
||||||
|
public MembersOrder ScriptMembersOrder { get; set; } = MembersOrder.Alphabetical;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether automatically save the Visual Script asset editors when starting the play mode in editor.
|
/// Gets or sets a value indicating whether automatically save the Visual Script asset editors when starting the play mode in editor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -40,6 +40,27 @@ namespace FlaxEditor.Scripting
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name => _managed?.Name ?? _custom?.Name;
|
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
|
||||||
|
{
|
||||||
|
int standardToken = _managed?.MetadataToken ?? _custom?.MetadataToken ?? 0;
|
||||||
|
if (_managed != null && IsProperty)
|
||||||
|
{
|
||||||
|
ScriptMemberInfo finfo = DeclaringType.GetField(string.Format("<{0}>k__BackingField", Name), BindingFlags.Instance | BindingFlags.NonPublic);
|
||||||
|
if(finfo.MetadataToken == 0)
|
||||||
|
{
|
||||||
|
return standardToken;
|
||||||
|
}
|
||||||
|
return finfo.MetadataToken;
|
||||||
|
}
|
||||||
|
return standardToken;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether the type is declared public.
|
/// Gets a value indicating whether the type is declared public.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1444,6 +1465,11 @@ namespace FlaxEditor.Scripting
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
string Name { get; }
|
string Name { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a metadata token for sorting so it may not be the actual token.
|
||||||
|
/// </summary>
|
||||||
|
int MetadataToken { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether the type is declared public.
|
/// Gets a value indicating whether the type is declared public.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user