//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
//**************** Copyright (c) 2016 Marko Pintera (marko.pintera@gmail.com). All rights reserved. **********************//
using System;
namespace bs.Editor
{
///
/// Contains boolean information about a field style.
///
[Flags]
public enum InspectableFieldStyleFlags
{
None = 0,
///
/// Floating point field should be represented as a slider rather than a plain input field.
///
AsSlider = 1 << 0,
///
/// Integer field should be represented as a layer mask drop down instead of a plain integer input field.
///
AsLayerMask = 1 << 1,
///
/// Object accessed by the inspectable field is passed as a copy. This means modifications to the object returned by
/// the property getter will not be registered until the object is re-assigned to the property. Similarly,
/// modifications to the object passed to the setter, after the setter has been called, will not be registered by
/// the field. Only relevant if a field type is a reference type.
///
CopiedAsValue = 1 << 2,
///
/// Object returned by the inspectable field will never be null, and null should never be passed to the field. Only
/// relevant if a field type is a reference type.
///
NotNull = 1 << 3,
///
/// Field represents a property that wraps a native object. Getters and setters of such a property issue calls into
/// native code to update the native object.
///
NativeWrapper = 1 << 4,
///
/// When a field changes those changes need to be applied to the parent object by calling the field setter. Only
/// applicable to properties containing reference types.
///
ApplyOnDirty = 1 << 5,
///
/// When a quaternion is displayed in the inspector, by default it will be displayed as converted into euler angles.
/// Use this flag to force it to be displayed as a quaternion (4D value) with no conversion instead.
///
AsQuaternion = 1 << 6,
///
/// Singifies that the field containing a class/struct should display the child fields of that objects as if they
/// were part of the parent class in the inspector.
///
Inline = 1 << 7,
///
/// Signifies that a should be loaded when assigned to field through the inspector.
///
LoadOnAssign = 1 << 8
}
///
/// Contains all the information about a field style.
///
public class InspectableFieldStyleInfo
{
///
/// Information about the field range.
///
public InspectableFieldRangeStyle RangeStyle;
///
/// Information about the field stepping.
///
public InspectableFieldStepStyle StepStyle;
///
/// Determines the category to place the field in. If null field will be placed in the default category.
///
public InspectableFieldCategoryStyle CategoryStyle;
///
/// Determines the order of the field displayed in the inspector, relative to other fields.
///
public InspectableFieldOrderStyle OrderStyle;
///
/// Boolean information about the field.
///
public InspectableFieldStyleFlags StyleFlags;
///
/// Creates an empty set of information about a field style.
///
public InspectableFieldStyleInfo()
{
}
///
/// Makes a deep copy of this object.
///
public InspectableFieldStyleInfo Clone()
{
InspectableFieldStyleInfo style = new InspectableFieldStyleInfo();
style.StyleFlags = StyleFlags;
if(RangeStyle != null)
style.RangeStyle = new InspectableFieldRangeStyle(RangeStyle.Min, RangeStyle.Max, RangeStyle.Slider);
if(StepStyle != null)
style.StepStyle = new InspectableFieldStepStyle(StepStyle.Step);
if(CategoryStyle != null)
style.CategoryStyle = new InspectableFieldCategoryStyle(CategoryStyle.Category);
if(OrderStyle != null)
style.OrderStyle = new InspectableFieldOrderStyle(OrderStyle.Index);
return style;
}
}
}