Add Default auto-generated member to scripting structures and improve deserialization
This commit is contained in:
@@ -6,11 +6,6 @@ namespace FlaxEngine
|
||||
{
|
||||
partial struct D6JointDrive
|
||||
{
|
||||
/// <summary>
|
||||
/// The default <see cref="D6JointDrive"/> structure.
|
||||
/// </summary>
|
||||
public static readonly D6JointDrive Default = new D6JointDrive(0.0f, 0.0f, float.MaxValue, false);
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="D6JointDrive"/> struct.
|
||||
/// </summary>
|
||||
|
||||
@@ -4,11 +4,6 @@ namespace FlaxEngine
|
||||
{
|
||||
partial struct HingeJointDrive
|
||||
{
|
||||
/// <summary>
|
||||
/// The default <see cref="HingeJointDrive"/> structure.
|
||||
/// </summary>
|
||||
public static readonly HingeJointDrive Default = new HingeJointDrive(0.0f, float.MaxValue, 1.0f, false);
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="HingeJointDrive"/> struct.
|
||||
/// </summary>
|
||||
|
||||
@@ -4,11 +4,6 @@ namespace FlaxEngine
|
||||
{
|
||||
partial struct SpringParameters
|
||||
{
|
||||
/// <summary>
|
||||
/// The default <see cref="SpringParameters"/> structure.
|
||||
/// </summary>
|
||||
public static readonly SpringParameters Default = new SpringParameters(0.0f, 0.0f);
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a spring.
|
||||
/// </summary>
|
||||
@@ -23,11 +18,6 @@ namespace FlaxEngine
|
||||
|
||||
partial struct LimitLinearRange
|
||||
{
|
||||
/// <summary>
|
||||
/// The default <see cref="LimitLinearRange"/> structure with empty limit.
|
||||
/// </summary>
|
||||
public static readonly LimitLinearRange Default = new LimitLinearRange(0.0f, 0.0f);
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a hard limit. Once the limit is reached the movement of the attached bodies will come to a stop.
|
||||
/// </summary>
|
||||
@@ -62,11 +52,6 @@ namespace FlaxEngine
|
||||
|
||||
partial struct LimitLinear
|
||||
{
|
||||
/// <summary>
|
||||
/// The default <see cref="LimitLinear"/> structure with empty limit.
|
||||
/// </summary>
|
||||
public static readonly LimitLinear Default = new LimitLinear(0.0f);
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a hard limit. Once the limit is reached the movement of the attached bodies will come to a stop.
|
||||
/// </summary>
|
||||
@@ -97,11 +82,6 @@ namespace FlaxEngine
|
||||
|
||||
partial struct LimitAngularRange
|
||||
{
|
||||
/// <summary>
|
||||
/// The default <see cref="LimitAngularRange"/> structure with empty limit.
|
||||
/// </summary>
|
||||
public static readonly LimitAngularRange Default = new LimitAngularRange(0.0f, 0.0f);
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a hard limit. Once the limit is reached the movement of the attached bodies will come to a stop.
|
||||
/// </summary>
|
||||
@@ -136,11 +116,6 @@ namespace FlaxEngine
|
||||
|
||||
partial struct LimitConeRange
|
||||
{
|
||||
/// <summary>
|
||||
/// The default <see cref="LimitConeRange"/> structure with a 45 degree cone limit.
|
||||
/// </summary>
|
||||
public static readonly LimitConeRange Default = new LimitConeRange(90.0f, 90.0f);
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a hard limit. Once the limit is reached the movement of the attached bodies will come to a stop.
|
||||
/// </summary>
|
||||
|
||||
@@ -29,7 +29,7 @@ API_ENUM() enum class WindowStartPosition
|
||||
/// <summary>
|
||||
/// Settings for new window.
|
||||
/// </summary>
|
||||
API_STRUCT() struct CreateWindowSettings
|
||||
API_STRUCT(NoDefault) struct CreateWindowSettings
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(CreateWindowSettings);
|
||||
|
||||
|
||||
@@ -16,33 +16,8 @@ namespace FlaxEditor.Content.Settings
|
||||
/// </summary>
|
||||
public GraphicsSettings()
|
||||
{
|
||||
// Initialize PostFx settings with default options (C# structs doesn't support it)
|
||||
// Initialize PostFx settings with default options (C# structs don't support it)
|
||||
PostProcessSettings = FlaxEngine.PostProcessSettings.Default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace FlaxEngine
|
||||
{
|
||||
partial struct PostProcessSettings
|
||||
{
|
||||
private static PostProcessSettings _default;
|
||||
|
||||
/// <summary>
|
||||
/// The default <see cref="PostProcessSettings"/>.
|
||||
/// </summary>
|
||||
public static PostProcessSettings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!_default.AmbientOcclusion.Enabled)
|
||||
{
|
||||
object obj = _default;
|
||||
Utils.InitStructure(obj, typeof(PostProcessSettings));
|
||||
_default = (PostProcessSettings)obj;
|
||||
}
|
||||
return _default;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ API_ENUM() enum class TextWrapping
|
||||
/// <summary>
|
||||
/// Structure which describes text layout properties.
|
||||
/// </summary>
|
||||
API_STRUCT() struct TextLayoutOptions
|
||||
API_STRUCT(NoDefault) struct TextLayoutOptions
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(TextLayoutOptions);
|
||||
|
||||
|
||||
@@ -928,7 +928,12 @@ namespace FlaxEngine
|
||||
stream.Write(0);
|
||||
}
|
||||
|
||||
internal static void InitStructure(object obj, Type type)
|
||||
/// <summary>
|
||||
/// Initializes the structure (value type) by inflating it with values from <see cref="System.ComponentModel.DefaultValueAttribute"/> (recursive).
|
||||
/// </summary>
|
||||
/// <param name="obj">The object to initialize.</param>
|
||||
/// <param name="type">The structure type.</param>
|
||||
public static void InitStructure(object obj, Type type)
|
||||
{
|
||||
var fields = type.GetFields(BindingFlags.Default | BindingFlags.Instance | BindingFlags.Public);
|
||||
for (var i = 0; i < fields.Length; i++)
|
||||
|
||||
Reference in New Issue
Block a user