BsScriptGUICurves.generated.cpp 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //************** Copyright (c) 2016-2019 Marko Pintera ([email protected]). All rights reserved. *******************//
  3. #include "BsScriptGUICurves.generated.h"
  4. #include "BsMonoMethod.h"
  5. #include "BsMonoClass.h"
  6. #include "BsMonoUtil.h"
  7. #include "../../EditorCore/GUI/BsGUICurves.h"
  8. #include "BsScriptKeyframeRef.generated.h"
  9. #include "BsScriptCurveDrawInfo.generated.h"
  10. #include "../../EditorCore/GUI/BsGUICurves.h"
  11. #include "Wrappers/BsScriptVector.h"
  12. #include "BsScriptTangentRef.generated.h"
  13. #include "Wrappers/BsScriptVector2I.h"
  14. namespace bs
  15. {
  16. ScriptGUICurves::onClickedThunkDef ScriptGUICurves::onClickedThunk;
  17. ScriptGUICurves::ScriptGUICurves(MonoObject* managedInstance, GUICurves* value)
  18. :TScriptGUIElement(managedInstance, value)
  19. {
  20. value->onClicked.connect(std::bind(&ScriptGUICurves::onClicked, this));
  21. }
  22. void ScriptGUICurves::initRuntimeData()
  23. {
  24. metaData.scriptClass->addInternalCall("Internal_setCurves", (void*)&ScriptGUICurves::Internal_setCurves);
  25. metaData.scriptClass->addInternalCall("Internal_getCurves", (void*)&ScriptGUICurves::Internal_getCurves);
  26. metaData.scriptClass->addInternalCall("Internal_setRange", (void*)&ScriptGUICurves::Internal_setRange);
  27. metaData.scriptClass->addInternalCall("Internal_setOffset", (void*)&ScriptGUICurves::Internal_setOffset);
  28. metaData.scriptClass->addInternalCall("Internal_centerAndZoom", (void*)&ScriptGUICurves::Internal_centerAndZoom);
  29. metaData.scriptClass->addInternalCall("Internal_pixelToCurveSpace", (void*)&ScriptGUICurves::Internal_pixelToCurveSpace);
  30. metaData.scriptClass->addInternalCall("Internal_curveToPixelSpace", (void*)&ScriptGUICurves::Internal_curveToPixelSpace);
  31. metaData.scriptClass->addInternalCall("Internal_findCurve", (void*)&ScriptGUICurves::Internal_findCurve);
  32. metaData.scriptClass->addInternalCall("Internal_findKeyFrame", (void*)&ScriptGUICurves::Internal_findKeyFrame);
  33. metaData.scriptClass->addInternalCall("Internal_findTangent", (void*)&ScriptGUICurves::Internal_findTangent);
  34. metaData.scriptClass->addInternalCall("Internal_selectKeyframe", (void*)&ScriptGUICurves::Internal_selectKeyframe);
  35. metaData.scriptClass->addInternalCall("Internal_clearSelectedKeyframes", (void*)&ScriptGUICurves::Internal_clearSelectedKeyframes);
  36. metaData.scriptClass->addInternalCall("Internal_create", (void*)&ScriptGUICurves::Internal_create);
  37. metaData.scriptClass->addInternalCall("Internal_create0", (void*)&ScriptGUICurves::Internal_create0);
  38. onClickedThunk = (onClickedThunkDef)metaData.scriptClass->getMethodExact("Internal_onClicked", "")->getThunk();
  39. }
  40. void ScriptGUICurves::onClicked()
  41. {
  42. MonoUtil::invokeThunk(onClickedThunk, getManagedInstance());
  43. }
  44. void ScriptGUICurves::Internal_setCurves(ScriptGUICurves* thisPtr, MonoArray* curves)
  45. {
  46. Vector<CurveDrawInfo> veccurves;
  47. if(curves != nullptr)
  48. {
  49. ScriptArray arraycurves(curves);
  50. veccurves.resize(arraycurves.size());
  51. for(int i = 0; i < (int)arraycurves.size(); i++)
  52. {
  53. veccurves[i] = ScriptCurveDrawInfo::fromInterop(arraycurves.get<__CurveDrawInfoInterop>(i));
  54. }
  55. }
  56. static_cast<GUICurves*>(thisPtr->getGUIElement())->setCurves(veccurves);
  57. }
  58. MonoArray* ScriptGUICurves::Internal_getCurves(ScriptGUICurves* thisPtr)
  59. {
  60. Vector<CurveDrawInfo> vec__output;
  61. vec__output = static_cast<GUICurves*>(thisPtr->getGUIElement())->getCurves();
  62. MonoArray* __output;
  63. int arraySize__output = (int)vec__output.size();
  64. ScriptArray array__output = ScriptArray::create<ScriptCurveDrawInfo>(arraySize__output);
  65. for(int i = 0; i < arraySize__output; i++)
  66. {
  67. array__output.set(i, ScriptCurveDrawInfo::toInterop(vec__output[i]));
  68. }
  69. __output = array__output.getInternal();
  70. return __output;
  71. }
  72. void ScriptGUICurves::Internal_setRange(ScriptGUICurves* thisPtr, float xRange, float yRange)
  73. {
  74. static_cast<GUICurves*>(thisPtr->getGUIElement())->setRange(xRange, yRange);
  75. }
  76. void ScriptGUICurves::Internal_setOffset(ScriptGUICurves* thisPtr, Vector2* offset)
  77. {
  78. static_cast<GUICurves*>(thisPtr->getGUIElement())->setOffset(*offset);
  79. }
  80. void ScriptGUICurves::Internal_centerAndZoom(ScriptGUICurves* thisPtr)
  81. {
  82. static_cast<GUICurves*>(thisPtr->getGUIElement())->centerAndZoom();
  83. }
  84. bool ScriptGUICurves::Internal_pixelToCurveSpace(ScriptGUICurves* thisPtr, Vector2I* pixelCoords, Vector2* curveCoords, bool padding)
  85. {
  86. bool tmp__output;
  87. tmp__output = static_cast<GUICurves*>(thisPtr->getGUIElement())->pixelToCurveSpace(*pixelCoords, *curveCoords, padding);
  88. bool __output;
  89. __output = tmp__output;
  90. return __output;
  91. }
  92. void ScriptGUICurves::Internal_curveToPixelSpace(ScriptGUICurves* thisPtr, Vector2* curveCoords, Vector2I* __output)
  93. {
  94. Vector2I tmp__output;
  95. tmp__output = static_cast<GUICurves*>(thisPtr->getGUIElement())->curveToPixelSpace(*curveCoords);
  96. *__output = tmp__output;
  97. }
  98. uint32_t ScriptGUICurves::Internal_findCurve(ScriptGUICurves* thisPtr, Vector2I* pixelCoords)
  99. {
  100. uint32_t tmp__output;
  101. tmp__output = static_cast<GUICurves*>(thisPtr->getGUIElement())->findCurve(*pixelCoords);
  102. uint32_t __output;
  103. __output = tmp__output;
  104. return __output;
  105. }
  106. bool ScriptGUICurves::Internal_findKeyFrame(ScriptGUICurves* thisPtr, Vector2I* pixelCoords, KeyframeRef* keyframe)
  107. {
  108. bool tmp__output;
  109. tmp__output = static_cast<GUICurves*>(thisPtr->getGUIElement())->findKeyFrame(*pixelCoords, *keyframe);
  110. bool __output;
  111. __output = tmp__output;
  112. return __output;
  113. }
  114. bool ScriptGUICurves::Internal_findTangent(ScriptGUICurves* thisPtr, Vector2I* pixelCoords, __TangentRefInterop* tangent)
  115. {
  116. bool tmp__output;
  117. TangentRef tmptangent;
  118. tmp__output = static_cast<GUICurves*>(thisPtr->getGUIElement())->findTangent(*pixelCoords, tmptangent);
  119. bool __output;
  120. __output = tmp__output;
  121. __TangentRefInterop interoptangent;
  122. interoptangent = ScriptTangentRef::toInterop(tmptangent);
  123. MonoUtil::valueCopy(tangent, &interoptangent, ScriptTangentRef::getMetaData()->scriptClass->_getInternalClass());
  124. return __output;
  125. }
  126. void ScriptGUICurves::Internal_selectKeyframe(ScriptGUICurves* thisPtr, KeyframeRef* keyframeRef, TangentModeBits tangentMode, bool selected)
  127. {
  128. static_cast<GUICurves*>(thisPtr->getGUIElement())->selectKeyframe(*keyframeRef, tangentMode, selected);
  129. }
  130. void ScriptGUICurves::Internal_clearSelectedKeyframes(ScriptGUICurves* thisPtr)
  131. {
  132. static_cast<GUICurves*>(thisPtr->getGUIElement())->clearSelectedKeyframes();
  133. }
  134. void ScriptGUICurves::Internal_create(MonoObject* managedInstance, MonoString* styleName)
  135. {
  136. String tmpstyleName;
  137. tmpstyleName = MonoUtil::monoToString(styleName);
  138. GUICurves* instance = GUICurves::create(tmpstyleName);
  139. new (bs_alloc<ScriptGUICurves>())ScriptGUICurves(managedInstance, instance);
  140. }
  141. void ScriptGUICurves::Internal_create0(MonoObject* managedInstance, CurveDrawOption drawOptions, MonoString* styleName)
  142. {
  143. String tmpstyleName;
  144. tmpstyleName = MonoUtil::monoToString(styleName);
  145. GUICurves* instance = GUICurves::create(drawOptions, tmpstyleName);
  146. new (bs_alloc<ScriptGUICurves>())ScriptGUICurves(managedInstance, instance);
  147. }
  148. }