GUICurves.generated.cs 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //************** Copyright (c) 2016-2019 Marko Pintera ([email protected]). All rights reserved. *******************//
  3. using System;
  4. using System.Runtime.CompilerServices;
  5. using System.Runtime.InteropServices;
  6. using bs;
  7. namespace bs.Editor
  8. {
  9. /** @addtogroup GUIEditor
  10. * @{
  11. */
  12. /// <summary>GUI element that displays one or multiple curves.</summary>
  13. [ShowInInspector]
  14. public partial class GUICurves : GUITimeline
  15. {
  16. private GUICurves(bool __dummy0) { }
  17. protected GUICurves() { }
  18. /// <summary>Creates a new GUI element.</summary>
  19. /// <param name="styleName">
  20. /// Optional style to use for the element. Style will be retrieved from GUISkin of the GUIWidget the element is used on.
  21. /// If not specified default style is used.
  22. /// </param>
  23. public GUICurves(string styleName = "")
  24. {
  25. Internal_create(this, styleName);
  26. }
  27. /// <summary>Creates a new GUI element.</summary>
  28. /// <param name="drawOptions">Options that control which additional elements to draw.</param>
  29. /// <param name="styleName">
  30. /// Optional style to use for the element. Style will be retrieved from GUISkin of the GUIWidget the element is used on.
  31. /// If not specified default style is used.
  32. /// </param>
  33. public GUICurves(CurveDrawOptions drawOptions, string styleName = "")
  34. {
  35. Internal_create0(this, drawOptions, styleName);
  36. }
  37. /// <summary>Animation curves to display.</summary>
  38. [ShowInInspector]
  39. [NativeWrapper]
  40. public CurveDrawInfo[] Curves
  41. {
  42. get { return Internal_getCurves(mCachedPtr); }
  43. set { Internal_setCurves(mCachedPtr, value); }
  44. }
  45. /// <summary>Triggered when the user clicks on the GUI element.</summary>
  46. partial void Callback_OnClicked();
  47. /// <summary>Changes the visible range that the GUI element displays.</summary>
  48. /// <param name="xRange">Range of the horizontal area. Displayed area will range from [0, xRange].</param>
  49. /// <param name="yRange">Range of the vertical area. Displayed area will range from [-yRange * 0.5, yRange * 0.5]</param>
  50. public void SetRange(float xRange, float yRange)
  51. {
  52. Internal_setRange(mCachedPtr, xRange, yRange);
  53. }
  54. /// <summary>Returns the offset at which the displayed timeline values start at.</summary>
  55. /// <param name="offset">Value to start the timeline values at, where x = time, y = value.</param>
  56. public void SetOffset(Vector2 offset)
  57. {
  58. Internal_setOffset(mCachedPtr, ref offset);
  59. }
  60. /// <summary>Centers and zooms the view to fully display the provided set of curves.</summary>
  61. public void CenterAndZoom()
  62. {
  63. Internal_centerAndZoom(mCachedPtr);
  64. }
  65. /// <summary>Converts pixel coordinates into coordinates in curve space.</summary>
  66. /// <param name="pixelCoords">Coordinates relative to this GUI element, in pixels.</param>
  67. /// <param name="curveCoords">
  68. /// Curve coordinates within the range as specified by setRange(). Only valid when function returns true.
  69. /// </param>
  70. /// <param name="padding">Determines should coordinates over the area reserved for padding be registered.</param>
  71. /// <returns>True if the coordinates are within the curve area, false otherwise.</returns>
  72. public bool PixelToCurveSpace(Vector2I pixelCoords, out Vector2 curveCoords, bool padding = false)
  73. {
  74. return Internal_pixelToCurveSpace(mCachedPtr, ref pixelCoords, out curveCoords, padding);
  75. }
  76. /// <summary>
  77. /// Converts coordinate in curve space (time, value) into pixel coordinates relative to this element&apos;s origin.
  78. /// </summary>
  79. /// <param name="curveCoords">Time and value of the location to convert.</param>
  80. /// <returns>Coordinates relative to this element&apos;s origin, in pixels.</returns>
  81. public Vector2I CurveToPixelSpace(Vector2 curveCoords)
  82. {
  83. Vector2I temp;
  84. Internal_curveToPixelSpace(mCachedPtr, ref curveCoords, out temp);
  85. return temp;
  86. }
  87. /// <summary>Attempts to find a curve under the provided coordinates.</summary>
  88. /// <param name="pixelCoords">Coordinates relative to this GUI element in pixels.</param>
  89. /// <returns>Index of the curve, or -1 if none found.</returns>
  90. public int FindCurve(Vector2I pixelCoords)
  91. {
  92. return Internal_findCurve(mCachedPtr, ref pixelCoords);
  93. }
  94. /// <summary>Attempts to find a keyframe under the provided coordinates.</summary>
  95. /// <param name="pixelCoords">Coordinates relative to this GUI element in pixels.</param>
  96. /// <param name="keyframe">
  97. /// Output object containing keyframe index and index of the curve it belongs to. Only valid if method returns true.
  98. /// </param>
  99. /// <returns>True if there is a keyframe under the coordinates, false otherwise.</returns>
  100. public bool FindKeyFrame(Vector2I pixelCoords, out KeyframeRef keyframe)
  101. {
  102. return Internal_findKeyFrame(mCachedPtr, ref pixelCoords, out keyframe);
  103. }
  104. /// <summary>Attempts to find a a tangent handle under the provided coordinates.</summary>
  105. /// <param name="pixelCoords">Coordinates relative to this GUI element in pixels.</param>
  106. /// <param name="tangent">
  107. /// Output object containing keyframe information and tangent type. Only valid if method returns true.
  108. /// </param>
  109. /// <returns>True if there is a tangent handle under the coordinates, false otherwise.</returns>
  110. public bool FindTangent(Vector2I pixelCoords, out TangentRef tangent)
  111. {
  112. return Internal_findTangent(mCachedPtr, ref pixelCoords, out tangent);
  113. }
  114. /// <summary>Marks the specified key-frame as selected, changing the way it is displayed.</summary>
  115. /// <param name="keyframeRef">Keyframe reference containing the curve and keyframe index.</param>
  116. /// <param name="tangentMode">Type of tangent to display on the selected keyframe.</param>
  117. /// <param name="selected">True to select it, false to deselect it.</param>
  118. public void SelectKeyframe(KeyframeRef keyframeRef, TangentMode tangentMode, bool selected)
  119. {
  120. Internal_selectKeyframe(mCachedPtr, ref keyframeRef, tangentMode, selected);
  121. }
  122. /// <summary>Clears any key-frames that were marked as selected.</summary>
  123. public void ClearSelectedKeyframes()
  124. {
  125. Internal_clearSelectedKeyframes(mCachedPtr);
  126. }
  127. [MethodImpl(MethodImplOptions.InternalCall)]
  128. private static extern void Internal_setCurves(IntPtr thisPtr, CurveDrawInfo[] curves);
  129. [MethodImpl(MethodImplOptions.InternalCall)]
  130. private static extern CurveDrawInfo[] Internal_getCurves(IntPtr thisPtr);
  131. [MethodImpl(MethodImplOptions.InternalCall)]
  132. private static extern void Internal_setRange(IntPtr thisPtr, float xRange, float yRange);
  133. [MethodImpl(MethodImplOptions.InternalCall)]
  134. private static extern void Internal_setOffset(IntPtr thisPtr, ref Vector2 offset);
  135. [MethodImpl(MethodImplOptions.InternalCall)]
  136. private static extern void Internal_centerAndZoom(IntPtr thisPtr);
  137. [MethodImpl(MethodImplOptions.InternalCall)]
  138. private static extern bool Internal_pixelToCurveSpace(IntPtr thisPtr, ref Vector2I pixelCoords, out Vector2 curveCoords, bool padding);
  139. [MethodImpl(MethodImplOptions.InternalCall)]
  140. private static extern void Internal_curveToPixelSpace(IntPtr thisPtr, ref Vector2 curveCoords, out Vector2I __output);
  141. [MethodImpl(MethodImplOptions.InternalCall)]
  142. private static extern int Internal_findCurve(IntPtr thisPtr, ref Vector2I pixelCoords);
  143. [MethodImpl(MethodImplOptions.InternalCall)]
  144. private static extern bool Internal_findKeyFrame(IntPtr thisPtr, ref Vector2I pixelCoords, out KeyframeRef keyframe);
  145. [MethodImpl(MethodImplOptions.InternalCall)]
  146. private static extern bool Internal_findTangent(IntPtr thisPtr, ref Vector2I pixelCoords, out TangentRef tangent);
  147. [MethodImpl(MethodImplOptions.InternalCall)]
  148. private static extern void Internal_selectKeyframe(IntPtr thisPtr, ref KeyframeRef keyframeRef, TangentMode tangentMode, bool selected);
  149. [MethodImpl(MethodImplOptions.InternalCall)]
  150. private static extern void Internal_clearSelectedKeyframes(IntPtr thisPtr);
  151. [MethodImpl(MethodImplOptions.InternalCall)]
  152. private static extern void Internal_create(GUICurves managedInstance, string styleName);
  153. [MethodImpl(MethodImplOptions.InternalCall)]
  154. private static extern void Internal_create0(GUICurves managedInstance, CurveDrawOptions drawOptions, string styleName);
  155. private void Internal_onClicked()
  156. {
  157. Callback_OnClicked();
  158. }
  159. }
  160. /** @} */
  161. }