Now its an editor option

This commit is contained in:
honzapatCZ
2021-03-07 11:30:18 +01:00
parent d09bd12e5b
commit 406db6704f
2 changed files with 33 additions and 8 deletions

View File

@@ -173,16 +173,16 @@ namespace FlaxEditor.CustomEditors.Editors
return string.Compare(Display.Group, other.Display.Group, StringComparison.InvariantCulture);
}
// By declaration order
if (Info.MetadataToken > other.Info.MetadataToken)
return 1;
else if (Info.MetadataToken < other.Info.MetadataToken)
return -1;
else
if(Editor.Instance.Options.Options.General.ScritpMembersOrder == Options.GeneralOptions.MembersOrder.Declaration)
{
// 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;
}
// By name
return string.Compare(Info.Name, other.Info.Name, StringComparison.InvariantCulture);
}
return 0;

View File

@@ -68,6 +68,24 @@ namespace FlaxEditor.Options
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>
/// Gets or sets the scene to load on editor startup.
/// </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.")]
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", "Scritp Members Order"), EditorOrder(503), Tooltip("Sets the order of script properties/fields")]
public MembersOrder ScritpMembersOrder { get; set; } = MembersOrder.Alphabetical;
/// <summary>
/// Gets or sets a value indicating whether automatically save the Visual Script asset editors when starting the play mode in editor.
/// </summary>