GUICurves.generated.cs 7.9 KB

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