BoneData.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /******************************************************************************
  2. * Spine Runtimes License Agreement
  3. * Last updated January 1, 2020. Replaces all prior versions.
  4. *
  5. * Copyright (c) 2013-2020, Esoteric Software LLC
  6. *
  7. * Integration of the Spine Runtimes into software or otherwise creating
  8. * derivative works of the Spine Runtimes is permitted under the terms and
  9. * conditions of Section 2 of the Spine Editor License Agreement:
  10. * http://esotericsoftware.com/spine-editor-license
  11. *
  12. * Otherwise, it is permitted to integrate the Spine Runtimes into software
  13. * or otherwise create derivative works of the Spine Runtimes (collectively,
  14. * "Products"), provided that each user of the Products must obtain their own
  15. * Spine Editor license and redistribution of the Products in any form must
  16. * include this license and copyright notice.
  17. *
  18. * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
  19. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  20. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  21. * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
  22. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  23. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
  24. * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
  25. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  26. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  27. * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. *****************************************************************************/
  29. #ifndef Spine_BoneData_h
  30. #define Spine_BoneData_h
  31. #include <spine/TransformMode.h>
  32. #include <spine/SpineObject.h>
  33. #include <spine/SpineString.h>
  34. namespace spine {
  35. class SP_API BoneData : public SpineObject {
  36. friend class SkeletonBinary;
  37. friend class SkeletonJson;
  38. friend class AnimationState;
  39. friend class RotateTimeline;
  40. friend class ScaleTimeline;
  41. friend class ShearTimeline;
  42. friend class TranslateTimeline;
  43. public:
  44. BoneData(int index, const String &name, BoneData *parent = NULL);
  45. /// The index of the bone in Skeleton.Bones
  46. int getIndex();
  47. /// The name of the bone, which is unique within the skeleton.
  48. const String &getName();
  49. /// May be NULL.
  50. BoneData *getParent();
  51. float getLength();
  52. void setLength(float inValue);
  53. /// Local X translation.
  54. float getX();
  55. void setX(float inValue);
  56. /// Local Y translation.
  57. float getY();
  58. void setY(float inValue);
  59. /// Local rotation.
  60. float getRotation();
  61. void setRotation(float inValue);
  62. /// Local scaleX.
  63. float getScaleX();
  64. void setScaleX(float inValue);
  65. /// Local scaleY.
  66. float getScaleY();
  67. void setScaleY(float inValue);
  68. /// Local shearX.
  69. float getShearX();
  70. void setShearX(float inValue);
  71. /// Local shearY.
  72. float getShearY();
  73. void setShearY(float inValue);
  74. /// The transform mode for how parent world transforms affect this bone.
  75. TransformMode getTransformMode();
  76. void setTransformMode(TransformMode inValue);
  77. bool isSkinRequired();
  78. void setSkinRequired(bool inValue);
  79. private:
  80. const int _index;
  81. const String _name;
  82. BoneData *_parent;
  83. float _length;
  84. float _x, _y, _rotation, _scaleX, _scaleY, _shearX, _shearY;
  85. TransformMode _transformMode;
  86. bool _skinRequired;
  87. };
  88. }
  89. #endif /* Spine_BoneData_h */