GUICurves.generated.cs 7.9 KB

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