InspectableFieldStyleInfo.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. using System;
  4. namespace BansheeEditor
  5. {
  6. /// <summary>
  7. /// Contains boolean information about a field style.
  8. /// </summary>
  9. [Flags]
  10. public enum InspectableFieldStyleFlags
  11. {
  12. None = 0,
  13. /// <summary>
  14. /// Floating point field should be represented as a slider rather than a plain input field.
  15. /// </summary>
  16. UseSlider = 1 << 0,
  17. /// <summary>
  18. /// Integer field should be represented as a layer mask drop down instead of a plain integer input field.
  19. /// </summary>
  20. UseLayerMask = 1 << 1,
  21. /// <summary>
  22. /// Object accessed by the inspectable field is passed as a copy. This means modifications to the object returned by
  23. /// the property getter will not be registered until the object is re-assigned to the property. Similarly,
  24. /// modifications to the object passed to the setter, after the setter has been called, will not be registered by
  25. /// the field. Only relevant if a field type is a reference type.
  26. /// </summary>
  27. CopiedAsValue = 1 << 2,
  28. /// <summary>
  29. /// Object returned by the inspectable field will never be null, and null should never be passed to the field. Only
  30. /// relevant if a field type is a reference type.
  31. /// </summary>
  32. NotNull = 1 << 3,
  33. /// <summary>
  34. /// Field represents a property that wraps a native object. Getters and setters of such a property issue calls into
  35. /// native code to update the native object.
  36. /// </summary>
  37. NativeWrapper = 1 << 4,
  38. /// <summary>
  39. /// When a field changes those changes need to be applied to the parent object by calling the field setter. Only
  40. /// applicable to properties containing reference types.
  41. /// </summary>
  42. ApplyOnDirty = 1 << 5,
  43. /// <summary>
  44. /// When a quaternion is displayed in the inspector, by default it will be displayed as converted into euler angles.
  45. /// Use this flag to force it to be displayed as a quaternion (4D value) with no conversion instead.
  46. /// </summary>
  47. AsQuaternion = 1 << 6,
  48. }
  49. /// <summary>
  50. /// Contains all the information about a field style.
  51. /// </summary>
  52. public class InspectableFieldStyleInfo
  53. {
  54. /// <summary>
  55. /// Information about the field range.
  56. /// </summary>
  57. public InspectableFieldRangeStyle RangeStyle;
  58. /// <summary>
  59. /// Information about the field stepping.
  60. /// </summary>
  61. public InspectableFieldStepStyle StepStyle;
  62. /// <summary>
  63. /// Boolean information about the field.
  64. /// </summary>
  65. public InspectableFieldStyleFlags StyleFlags;
  66. /// <summary>
  67. /// Creates an empty set of information about a field style.
  68. /// </summary>
  69. public InspectableFieldStyleInfo()
  70. {
  71. }
  72. /// <summary>
  73. /// Makes a deep copy of this object.
  74. /// </summary>
  75. public InspectableFieldStyleInfo Clone()
  76. {
  77. InspectableFieldStyleInfo style = new InspectableFieldStyleInfo();
  78. style.StyleFlags = StyleFlags;
  79. if(RangeStyle != null)
  80. style.RangeStyle = new InspectableFieldRangeStyle(RangeStyle.Min, RangeStyle.Max, RangeStyle.Slider);
  81. if(StepStyle != null)
  82. style.StepStyle = new InspectableFieldStepStyle(StepStyle.Step);
  83. return style;
  84. }
  85. }
  86. }