Skip to content

Commit

Permalink
[ue4] Fixed up spine-cpp for use in UE4.
Browse files Browse the repository at this point in the history
  • Loading branch information
badlogic committed Jun 6, 2018
1 parent 7899277 commit 1454f8a
Show file tree
Hide file tree
Showing 103 changed files with 571 additions and 347 deletions.
2 changes: 1 addition & 1 deletion spine-cpp/spine-cpp/include/spine/Animation.h
Expand Up @@ -35,7 +35,7 @@
#include <spine/MixBlend.h>
#include <spine/MixDirection.h>
#include <spine/SpineObject.h>
#include <spine/String.h>
#include <spine/SpineString.h>

namespace spine {
class Timeline;
Expand Down
5 changes: 4 additions & 1 deletion spine-cpp/spine-cpp/include/spine/AnimationState.h
Expand Up @@ -35,7 +35,7 @@
#include <spine/Pool.h>
#include <spine/MixBlend.h>
#include <spine/SpineObject.h>
#include <spine/String.h>
#include <spine/SpineString.h>
#include <spine/HasRendererObject.h>

namespace spine {
Expand Down Expand Up @@ -381,6 +381,9 @@ namespace spine {
void setTimeScale(float inValue);

void setListener(AnimationStateListener listener);

void disableQueue();
void enableQueue();

private:
static const int Subsequent, First, Dip, DipMix;
Expand Down
2 changes: 1 addition & 1 deletion spine-cpp/spine-cpp/include/spine/AnimationStateData.h
Expand Up @@ -33,7 +33,7 @@

#include <spine/HashMap.h>
#include <spine/SpineObject.h>
#include <spine/String.h>
#include <spine/SpineString.h>

#include <assert.h>

Expand Down
4 changes: 3 additions & 1 deletion spine-cpp/spine-cpp/include/spine/Atlas.h
Expand Up @@ -34,7 +34,7 @@
#include <spine/Vector.h>
#include <spine/Extension.h>
#include <spine/SpineObject.h>
#include <spine/String.h>
#include <spine/SpineString.h>
#include <spine/HasRendererObject.h>

namespace spine {
Expand Down Expand Up @@ -114,6 +114,8 @@ class Atlas : public SpineObject {
/// @return The region, or NULL.
AtlasRegion *findRegion(const String &name);

Vector<AtlasPage*> &getPages();

private:
Vector<AtlasPage *> _pages;
Vector<AtlasRegion *> _regions;
Expand Down
2 changes: 1 addition & 1 deletion spine-cpp/spine-cpp/include/spine/AtlasAttachmentLoader.h
Expand Up @@ -33,7 +33,7 @@

#include <spine/AttachmentLoader.h>
#include <spine/Vector.h>
#include <spine/String.h>
#include <spine/SpineString.h>


namespace spine {
Expand Down
2 changes: 1 addition & 1 deletion spine-cpp/spine-cpp/include/spine/Attachment.h
Expand Up @@ -33,7 +33,7 @@

#include <spine/RTTI.h>
#include <spine/SpineObject.h>
#include <spine/String.h>
#include <spine/SpineString.h>

namespace spine {
class Attachment : public SpineObject {
Expand Down
2 changes: 1 addition & 1 deletion spine-cpp/spine-cpp/include/spine/AttachmentLoader.h
Expand Up @@ -33,7 +33,7 @@

#include <spine/RTTI.h>
#include <spine/SpineObject.h>
#include <spine/String.h>
#include <spine/SpineString.h>

namespace spine {
class Skin;
Expand Down
2 changes: 1 addition & 1 deletion spine-cpp/spine-cpp/include/spine/AttachmentTimeline.h
Expand Up @@ -36,7 +36,7 @@
#include <spine/Vector.h>
#include <spine/MixBlend.h>
#include <spine/MixDirection.h>
#include <spine/String.h>
#include <spine/SpineString.h>

namespace spine {
class Skeleton;
Expand Down
3 changes: 3 additions & 0 deletions spine-cpp/spine-cpp/include/spine/Bone.h
Expand Up @@ -221,6 +221,9 @@ RTTI_DECL
/// Returns the magnitide (always positive) of the world scale Y.
float getWorldScaleY();

bool isAppliedValid();
void setAppliedValid(bool valid);

private:
static bool yDown;

Expand Down
2 changes: 1 addition & 1 deletion spine-cpp/spine-cpp/include/spine/BoneData.h
Expand Up @@ -33,7 +33,7 @@

#include <spine/TransformMode.h>
#include <spine/SpineObject.h>
#include <spine/String.h>
#include <spine/SpineString.h>

namespace spine {
class BoneData : public SpineObject {
Expand Down
2 changes: 1 addition & 1 deletion spine-cpp/spine-cpp/include/spine/ContainerUtil.h
Expand Up @@ -35,7 +35,7 @@
#include <spine/Vector.h>
#include <spine/HashMap.h>
#include <spine/SpineObject.h>
#include <spine/String.h>
#include <spine/SpineString.h>

#include <assert.h>

Expand Down
2 changes: 1 addition & 1 deletion spine-cpp/spine-cpp/include/spine/Debug.h
Expand Up @@ -58,7 +58,7 @@ class DebugExtension : public SpineExtension {
for (std::map<void*, Allocation>::iterator it = _allocated.begin(); it != _allocated.end(); it++) {
printf("\"%s:%i (%zu bytes at %p)\n", it->second.fileName, it->second.line, it->second.size, it->second.address);
}
printf("allocations: %lu, reallocations: %lu, frees: %lu\n", _allocations, _reallocations, _frees);
printf("allocations: %zu, reallocations: %zu, frees: %zu\n", _allocations, _reallocations, _frees);
if (_allocated.empty()) printf("No leaks detected");
}

Expand Down
2 changes: 1 addition & 1 deletion spine-cpp/spine-cpp/include/spine/Event.h
Expand Up @@ -32,7 +32,7 @@
#define Spine_Event_h

#include <spine/SpineObject.h>
#include <spine/String.h>
#include <spine/SpineString.h>

namespace spine {
class EventData;
Expand Down
2 changes: 1 addition & 1 deletion spine-cpp/spine-cpp/include/spine/EventData.h
Expand Up @@ -32,7 +32,7 @@
#define Spine_EventData_h

#include <spine/SpineObject.h>
#include <spine/String.h>
#include <spine/SpineString.h>

namespace spine {
/// Stores the setup pose values for an Event.
Expand Down
2 changes: 1 addition & 1 deletion spine-cpp/spine-cpp/include/spine/IkConstraintData.h
Expand Up @@ -33,7 +33,7 @@

#include <spine/Vector.h>
#include <spine/SpineObject.h>
#include <spine/String.h>
#include <spine/SpineString.h>

namespace spine {
class BoneData;
Expand Down
2 changes: 1 addition & 1 deletion spine-cpp/spine-cpp/include/spine/LinkedMesh.h
Expand Up @@ -32,7 +32,7 @@
#define Spine_LinkedMesh_h

#include <spine/SpineObject.h>
#include <spine/String.h>
#include <spine/SpineString.h>

namespace spine {
class MeshAttachment;
Expand Down
11 changes: 6 additions & 5 deletions spine-cpp/spine-cpp/include/spine/MathUtil.h
Expand Up @@ -37,15 +37,16 @@
#include <string.h>

namespace spine {
static const float PI = 3.1415926535897932385f;
static const float PI_2 = PI * 2;
static const float DEG_RAD = (PI / 180.0f);
static const float RAD_DEG = (180.0f / PI);
float PI = 3.1415926535897932385f;
float PI_2 = PI * 2;
float DEG_RAD = (PI / 180.0f);
float RAD_DEG = (180.0f / PI);

class MathUtil : public SpineObject {
public:
private:
MathUtil();

public:
template<typename T>
static inline T min(T a, T b) { return a < b ? a : b; }

Expand Down
2 changes: 1 addition & 1 deletion spine-cpp/spine-cpp/include/spine/PathConstraintData.h
Expand Up @@ -36,7 +36,7 @@
#include <spine/RotateMode.h>
#include <spine/Vector.h>
#include <spine/SpineObject.h>
#include <spine/String.h>
#include <spine/SpineString.h>

namespace spine {
class BoneData;
Expand Down
2 changes: 1 addition & 1 deletion spine-cpp/spine-cpp/include/spine/Skeleton.h
Expand Up @@ -34,7 +34,7 @@
#include <spine/Vector.h>
#include <spine/MathUtil.h>
#include <spine/SpineObject.h>
#include <spine/String.h>
#include <spine/SpineString.h>
#include <spine/Color.h>

#include <limits> // std::numeric_limits
Expand Down
2 changes: 1 addition & 1 deletion spine-cpp/spine-cpp/include/spine/SkeletonBinary.h
Expand Up @@ -34,7 +34,7 @@
#include <spine/TransformMode.h>
#include <spine/Vector.h>
#include <spine/SpineObject.h>
#include <spine/String.h>
#include <spine/SpineString.h>
#include <spine/Color.h>

namespace spine {
Expand Down
6 changes: 3 additions & 3 deletions spine-cpp/spine-cpp/include/spine/SkeletonData.h
Expand Up @@ -32,7 +32,7 @@
#define Spine_SkeletonData_h

#include <spine/Vector.h>
#include <spine/String.h>
#include <spine/SpineString.h>

namespace spine {
class BoneData;
Expand Down Expand Up @@ -82,7 +82,7 @@ class SkeletonData : public SpineObject {
Skin *findSkin(const String &skinName);

/// @return May be NULL.
EventData *findEvent(const String &eventDataName);
spine::EventData *findEvent(const String &eventDataName);

/// @return May be NULL.
Animation *findAnimation(const String &animationName);
Expand Down Expand Up @@ -119,7 +119,7 @@ class SkeletonData : public SpineObject {

void setDefaultSkin(Skin *inValue);

Vector<EventData *> &getEvents();
Vector<spine::EventData *> &getEvents();

Vector<Animation *> &getAnimations();

Expand Down
2 changes: 1 addition & 1 deletion spine-cpp/spine-cpp/include/spine/SkeletonJson.h
Expand Up @@ -33,7 +33,7 @@

#include <spine/Vector.h>
#include <spine/SpineObject.h>
#include <spine/String.h>
#include <spine/SpineString.h>

namespace spine {
class CurveTimeline;
Expand Down
2 changes: 1 addition & 1 deletion spine-cpp/spine-cpp/include/spine/Skin.h
Expand Up @@ -32,7 +32,7 @@
#define Spine_Skin_h

#include <spine/Vector.h>
#include <spine/String.h>
#include <spine/SpineString.h>

namespace spine {
class Attachment;
Expand Down
2 changes: 1 addition & 1 deletion spine-cpp/spine-cpp/include/spine/SlotData.h
Expand Up @@ -33,7 +33,7 @@

#include <spine/BlendMode.h>
#include <spine/SpineObject.h>
#include <spine/String.h>
#include <spine/SpineString.h>
#include <spine/Color.h>

namespace spine {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion spine-cpp/spine-cpp/include/spine/TextureLoader.h
Expand Up @@ -32,7 +32,7 @@
#define Spine_TextureLoader_h

#include <spine/SpineObject.h>
#include <spine/String.h>
#include <spine/SpineString.h>

namespace spine {
class AtlasPage;
Expand Down
Expand Up @@ -33,7 +33,7 @@

#include <spine/Vector.h>
#include <spine/SpineObject.h>
#include <spine/String.h>
#include <spine/SpineString.h>

namespace spine {
class BoneData;
Expand Down
2 changes: 1 addition & 1 deletion spine-cpp/spine-cpp/include/spine/Vector.h
Expand Up @@ -33,7 +33,7 @@

#include <spine/Extension.h>
#include <spine/SpineObject.h>
#include <spine/String.h>
#include <spine/SpineString.h>
#include <stdlib.h>
#include <memory>
#include <assert.h>
Expand Down
7 changes: 5 additions & 2 deletions spine-cpp/spine-cpp/include/spine/spine.h
Expand Up @@ -50,22 +50,24 @@
#include <spine/Constraint.h>
#include <spine/ContainerUtil.h>
#include <spine/CurveTimeline.h>
#include <spine/Debug.h>
#include <spine/DeformTimeline.h>
#include <spine/DrawOrderTimeline.h>
#include <spine/Event.h>
#include <spine/EventData.h>
#include <spine/EventTimeline.h>
#include <spine/Extension.h>
#include <spine/HashMap.h>
#include <spine/HasRendererObject.h>
#include <spine/IkConstraint.h>
#include <spine/IkConstraintData.h>
#include <spine/IkConstraintTimeline.h>
#include <spine/Json.h>
#include <spine/LinkedMesh.h>
#include <spine/MathUtil.h>
#include <spine/MeshAttachment.h>
#include <spine/MixDirection.h>
#include <spine/MixBlend.h>
#include <spine/MixDirection.h>
#include <spine/PathAttachment.h>
#include <spine/PathConstraint.h>
#include <spine/PathConstraintData.h>
Expand All @@ -90,8 +92,9 @@
#include <spine/Skin.h>
#include <spine/Slot.h>
#include <spine/SlotData.h>
#include <spine/SpacingMode.h>
#include <spine/SpineObject.h>
#include <spine/String.h>
#include <spine/SpineString.h>
#include <spine/TextureLoader.h>
#include <spine/Timeline.h>
#include <spine/TimelineType.h>
Expand Down
5 changes: 4 additions & 1 deletion spine-cpp/spine-cpp/src/spine/Animation.cpp
Expand Up @@ -28,8 +28,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/

#include <spine/Animation.h>
#ifdef SPINE_UE4
#include "SpinePluginPrivatePCH.h"
#endif

#include <spine/Animation.h>
#include <spine/Timeline.h>
#include <spine/Skeleton.h>
#include <spine/Event.h>
Expand Down
13 changes: 11 additions & 2 deletions spine-cpp/spine-cpp/src/spine/AnimationState.cpp
Expand Up @@ -28,14 +28,16 @@
* POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/

#include <spine/AnimationState.h>
#ifdef SPINE_UE4
#include "SpinePluginPrivatePCH.h"
#endif

#include <spine/AnimationState.h>
#include <spine/Animation.h>
#include <spine/Event.h>
#include <spine/AnimationStateData.h>
#include <spine/Skeleton.h>
#include <spine/RotateTimeline.h>

#include <spine/SkeletonData.h>
#include <spine/Bone.h>
#include <spine/BoneData.h>
Expand Down Expand Up @@ -659,6 +661,13 @@ void AnimationState::setListener(AnimationStateListener inValue) {
_listener = inValue;
}

void AnimationState::disableQueue() {
_queue->_drainDisabled = true;
}
void AnimationState::enableQueue() {
_queue->_drainDisabled = false;
}

Animation *AnimationState::getEmptyAnimation() {
static Vector<Timeline *> timelines;
static Animation ret(String("<empty>"), timelines, 0);
Expand Down
5 changes: 4 additions & 1 deletion spine-cpp/spine-cpp/src/spine/AnimationStateData.cpp
Expand Up @@ -28,8 +28,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/

#include <spine/AnimationStateData.h>
#ifdef SPINE_UE4
#include "SpinePluginPrivatePCH.h"
#endif

#include <spine/AnimationStateData.h>
#include <spine/SkeletonData.h>
#include <spine/Animation.h>

Expand Down

0 comments on commit 1454f8a

Please sign in to comment.