diff --git a/CHANGELOG.md b/CHANGELOG.md index b7067f497..9dfb9fea3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ * Removed `spBone_worldToLocalRotationX` and `spBone_worldToLocalRotationY`. Replaced by `spBone_worldToLocalRotation` (rotation given relative to x-axis, counter-clockwise, in degrees). * Replaced `r`, `g`, `b`, `a` fields with instances of new `spColor` struct in `spRegionAttachment`, `spMeshAttachment`, `spSkeleton`, `spSkeletonData`, `spSlot` and `spSlotData`. * Removed `spVertexIndex`from public API. + * Listeners on `spAnimationState` or `spTrackEntry` will now be also called in case a track entry is disposed as part of dispoing the `spAnimationState`. * **Additions** * Added support for local and relative transform constraint calculation, including additional fields in `spTransformConstraintData`. * Added `spPointAttachment`, additional method `spAtlasAttachmentLoadeR_newPointAttachment`. @@ -51,6 +52,7 @@ * `Animation#apply` and `Timeline#apply`` now take enums `MixPose` and `MixDirection` instead of booleans * Added `spVertexEffect` and corresponding implementations `spJitterVertexEffect` and `spSwirlVertexEffect`. Create/dispose through the corresponding `spXXXVertexEffect_create()/dispose()` functions. Set on framework/engine specific renderer. See changes for spine-c based frameworks/engines below. * Functions in `extension.h` are not prefixed with `_sp` instead of just `_` to avoid interference with other libraries. + * Introduced `SP_API` macro. Every spine-c function is prefixed with this macro. By default, it is an empty string. Can be used to markup spine-c functions with e.g. ``__declspec` when compiling to a dll or linking to that dll. ### Cocos2d-X * Fixed renderer to work with 3.6 changes @@ -80,6 +82,7 @@ * Switched from built-in ProceduralMeshComponent to RuntimeMeshComponent by Koderz (https://github.com/Koderz/UE4RuntimeMeshComponent, MIT). Needed for more flexibility regarding vertex format, should not have an impact on existing code/assets. You need to copy the RuntimeMeshComponentPlugin from our repository in `spine-ue4\Plugins\` to your project as well! * Added support for two color tinting. All base materials, e.g. SpineUnlitNormalMaterial, now do proper two color tinting. No material parameters have changed. * Updated to Unreal Engine 4.16.1. Note that 4.16 has a regression which will make it impossible to compile plain .c files! + * spine-c is now exposed from the plugin shared library on Windows via __declspec. ## C# * **Breaking changes** diff --git a/spine-c/spine-c/include/spine/Animation.h b/spine-c/spine-c/include/spine/Animation.h index b0de4a9bc..e47a835ce 100644 --- a/spine-c/spine-c/include/spine/Animation.h +++ b/spine-c/spine-c/include/spine/Animation.h @@ -31,6 +31,7 @@ #ifndef SPINE_ANIMATION_H_ #define SPINE_ANIMATION_H_ +#include #include #include @@ -69,13 +70,13 @@ typedef enum { SP_MIX_DIRECTION_OUT } spMixDirection; -spAnimation* spAnimation_create (const char* name, int timelinesCount); -void spAnimation_dispose (spAnimation* self); +SP_API spAnimation* spAnimation_create (const char* name, int timelinesCount); +SP_API void spAnimation_dispose (spAnimation* self); /** Poses the skeleton at the specified time for this animation. * @param lastTime The last time the animation was applied. * @param events Any triggered events are added. May be null.*/ -void spAnimation_apply (const spAnimation* self, struct spSkeleton* skeleton, float lastTime, float time, int loop, +SP_API void spAnimation_apply (const spAnimation* self, struct spSkeleton* skeleton, float lastTime, float time, int loop, spEvent** events, int* eventsCount, float alpha, spMixPose pose, spMixDirection direction); #ifdef SPINE_SHORT_NAMES @@ -117,10 +118,10 @@ struct spTimeline { #endif }; -void spTimeline_dispose (spTimeline* self); -void spTimeline_apply (const spTimeline* self, struct spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents, +SP_API void spTimeline_dispose (spTimeline* self); +SP_API void spTimeline_apply (const spTimeline* self, struct spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents, int* eventsCount, float alpha, spMixPose pose, spMixDirection direction); -int spTimeline_getPropertyId (const spTimeline* self); +SP_API int spTimeline_getPropertyId (const spTimeline* self); #ifdef SPINE_SHORT_NAMES typedef spTimeline Timeline; @@ -149,14 +150,14 @@ typedef struct spCurveTimeline { #endif } spCurveTimeline; -void spCurveTimeline_setLinear (spCurveTimeline* self, int frameIndex); -void spCurveTimeline_setStepped (spCurveTimeline* self, int frameIndex); +SP_API void spCurveTimeline_setLinear (spCurveTimeline* self, int frameIndex); +SP_API void spCurveTimeline_setStepped (spCurveTimeline* self, int frameIndex); /* Sets the control handle positions for an interpolation bezier curve used to transition from this keyframe to the next. * cx1 and cx2 are from 0 to 1, representing the percent of time between the two keyframes. cy1 and cy2 are the percent of * the difference between the keyframe's values. */ -void spCurveTimeline_setCurve (spCurveTimeline* self, int frameIndex, float cx1, float cy1, float cx2, float cy2); -float spCurveTimeline_getCurvePercent (const spCurveTimeline* self, int frameIndex, float percent); +SP_API void spCurveTimeline_setCurve (spCurveTimeline* self, int frameIndex, float cx1, float cy1, float cx2, float cy2); +SP_API float spCurveTimeline_getCurvePercent (const spCurveTimeline* self, int frameIndex, float percent); #ifdef SPINE_SHORT_NAMES typedef spCurveTimeline CurveTimeline; @@ -192,9 +193,9 @@ static const int ROTATE_ENTRIES = 2; typedef struct spBaseTimeline spRotateTimeline; -spRotateTimeline* spRotateTimeline_create (int framesCount); +SP_API spRotateTimeline* spRotateTimeline_create (int framesCount); -void spRotateTimeline_setFrame (spRotateTimeline* self, int frameIndex, float time, float angle); +SP_API void spRotateTimeline_setFrame (spRotateTimeline* self, int frameIndex, float time, float angle); #ifdef SPINE_SHORT_NAMES typedef spRotateTimeline RotateTimeline; @@ -208,9 +209,9 @@ static const int TRANSLATE_ENTRIES = 3; typedef struct spBaseTimeline spTranslateTimeline; -spTranslateTimeline* spTranslateTimeline_create (int framesCount); +SP_API spTranslateTimeline* spTranslateTimeline_create (int framesCount); -void spTranslateTimeline_setFrame (spTranslateTimeline* self, int frameIndex, float time, float x, float y); +SP_API void spTranslateTimeline_setFrame (spTranslateTimeline* self, int frameIndex, float time, float x, float y); #ifdef SPINE_SHORT_NAMES typedef spTranslateTimeline TranslateTimeline; @@ -222,9 +223,9 @@ typedef spTranslateTimeline TranslateTimeline; typedef struct spBaseTimeline spScaleTimeline; -spScaleTimeline* spScaleTimeline_create (int framesCount); +SP_API spScaleTimeline* spScaleTimeline_create (int framesCount); -void spScaleTimeline_setFrame (spScaleTimeline* self, int frameIndex, float time, float x, float y); +SP_API void spScaleTimeline_setFrame (spScaleTimeline* self, int frameIndex, float time, float x, float y); #ifdef SPINE_SHORT_NAMES typedef spScaleTimeline ScaleTimeline; @@ -236,9 +237,9 @@ typedef spScaleTimeline ScaleTimeline; typedef struct spBaseTimeline spShearTimeline; -spShearTimeline* spShearTimeline_create (int framesCount); +SP_API spShearTimeline* spShearTimeline_create (int framesCount); -void spShearTimeline_setFrame (spShearTimeline* self, int frameIndex, float time, float x, float y); +SP_API void spShearTimeline_setFrame (spShearTimeline* self, int frameIndex, float time, float x, float y); #ifdef SPINE_SHORT_NAMES typedef spShearTimeline ShearTimeline; @@ -266,9 +267,9 @@ typedef struct spColorTimeline { #endif } spColorTimeline; -spColorTimeline* spColorTimeline_create (int framesCount); +SP_API spColorTimeline* spColorTimeline_create (int framesCount); -void spColorTimeline_setFrame (spColorTimeline* self, int frameIndex, float time, float r, float g, float b, float a); +SP_API void spColorTimeline_setFrame (spColorTimeline* self, int frameIndex, float time, float r, float g, float b, float a); #ifdef SPINE_SHORT_NAMES typedef spColorTimeline ColorTimeline; @@ -296,9 +297,9 @@ typedef struct spTwoColorTimeline { #endif } spTwoColorTimeline; -spTwoColorTimeline* spTwoColorTimeline_create (int framesCount); +SP_API spTwoColorTimeline* spTwoColorTimeline_create (int framesCount); -void spTwoColorTimeline_setFrame (spTwoColorTimeline* self, int frameIndex, float time, float r, float g, float b, float a, float r2, float g2, float b2); +SP_API void spTwoColorTimeline_setFrame (spTwoColorTimeline* self, int frameIndex, float time, float r, float g, float b, float a, float r2, float g2, float b2); #ifdef SPINE_SHORT_NAMES typedef spTwoColorTimeline TwoColorTimeline; @@ -326,10 +327,10 @@ typedef struct spAttachmentTimeline { #endif } spAttachmentTimeline; -spAttachmentTimeline* spAttachmentTimeline_create (int framesCount); +SP_API spAttachmentTimeline* spAttachmentTimeline_create (int framesCount); /* @param attachmentName May be 0. */ -void spAttachmentTimeline_setFrame (spAttachmentTimeline* self, int frameIndex, float time, const char* attachmentName); +SP_API void spAttachmentTimeline_setFrame (spAttachmentTimeline* self, int frameIndex, float time, const char* attachmentName); #ifdef SPINE_SHORT_NAMES typedef spAttachmentTimeline AttachmentTimeline; @@ -355,9 +356,9 @@ typedef struct spEventTimeline { #endif } spEventTimeline; -spEventTimeline* spEventTimeline_create (int framesCount); +SP_API spEventTimeline* spEventTimeline_create (int framesCount); -void spEventTimeline_setFrame (spEventTimeline* self, int frameIndex, spEvent* event); +SP_API void spEventTimeline_setFrame (spEventTimeline* self, int frameIndex, spEvent* event); #ifdef SPINE_SHORT_NAMES typedef spEventTimeline EventTimeline; @@ -385,9 +386,9 @@ typedef struct spDrawOrderTimeline { #endif } spDrawOrderTimeline; -spDrawOrderTimeline* spDrawOrderTimeline_create (int framesCount, int slotsCount); +SP_API spDrawOrderTimeline* spDrawOrderTimeline_create (int framesCount, int slotsCount); -void spDrawOrderTimeline_setFrame (spDrawOrderTimeline* self, int frameIndex, float time, const int* drawOrder); +SP_API void spDrawOrderTimeline_setFrame (spDrawOrderTimeline* self, int frameIndex, float time, const int* drawOrder); #ifdef SPINE_SHORT_NAMES typedef spDrawOrderTimeline DrawOrderTimeline; @@ -418,9 +419,9 @@ typedef struct spDeformTimeline { #endif } spDeformTimeline; -spDeformTimeline* spDeformTimeline_create (int framesCount, int frameVerticesCount); +SP_API spDeformTimeline* spDeformTimeline_create (int framesCount, int frameVerticesCount); -void spDeformTimeline_setFrame (spDeformTimeline* self, int frameIndex, float time, float* vertices); +SP_API void spDeformTimeline_setFrame (spDeformTimeline* self, int frameIndex, float time, float* vertices); #ifdef SPINE_SHORT_NAMES typedef spDeformTimeline DeformTimeline; @@ -448,9 +449,9 @@ typedef struct spIkConstraintTimeline { #endif } spIkConstraintTimeline; -spIkConstraintTimeline* spIkConstraintTimeline_create (int framesCount); +SP_API spIkConstraintTimeline* spIkConstraintTimeline_create (int framesCount); -void spIkConstraintTimeline_setFrame (spIkConstraintTimeline* self, int frameIndex, float time, float mix, int bendDirection); +SP_API void spIkConstraintTimeline_setFrame (spIkConstraintTimeline* self, int frameIndex, float time, float mix, int bendDirection); #ifdef SPINE_SHORT_NAMES typedef spIkConstraintTimeline IkConstraintTimeline; @@ -478,9 +479,9 @@ typedef struct spTransformConstraintTimeline { #endif } spTransformConstraintTimeline; -spTransformConstraintTimeline* spTransformConstraintTimeline_create (int framesCount); +SP_API spTransformConstraintTimeline* spTransformConstraintTimeline_create (int framesCount); -void spTransformConstraintTimeline_setFrame (spTransformConstraintTimeline* self, int frameIndex, float time, float rotateMix, float translateMix, float scaleMix, float shearMix); +SP_API void spTransformConstraintTimeline_setFrame (spTransformConstraintTimeline* self, int frameIndex, float time, float rotateMix, float translateMix, float scaleMix, float shearMix); #ifdef SPINE_SHORT_NAMES typedef spTransformConstraintTimeline TransformConstraintTimeline; @@ -508,9 +509,9 @@ typedef struct spPathConstraintPositionTimeline { #endif } spPathConstraintPositionTimeline; -spPathConstraintPositionTimeline* spPathConstraintPositionTimeline_create (int framesCount); +SP_API spPathConstraintPositionTimeline* spPathConstraintPositionTimeline_create (int framesCount); -void spPathConstraintPositionTimeline_setFrame (spPathConstraintPositionTimeline* self, int frameIndex, float time, float value); +SP_API void spPathConstraintPositionTimeline_setFrame (spPathConstraintPositionTimeline* self, int frameIndex, float time, float value); #ifdef SPINE_SHORT_NAMES typedef spPathConstraintPositionTimeline PathConstraintPositionTimeline; @@ -538,9 +539,9 @@ typedef struct spPathConstraintSpacingTimeline { #endif } spPathConstraintSpacingTimeline; -spPathConstraintSpacingTimeline* spPathConstraintSpacingTimeline_create (int framesCount); +SP_API spPathConstraintSpacingTimeline* spPathConstraintSpacingTimeline_create (int framesCount); -void spPathConstraintSpacingTimeline_setFrame (spPathConstraintSpacingTimeline* self, int frameIndex, float time, float value); +SP_API void spPathConstraintSpacingTimeline_setFrame (spPathConstraintSpacingTimeline* self, int frameIndex, float time, float value); #ifdef SPINE_SHORT_NAMES typedef spPathConstraintSpacingTimeline PathConstraintSpacingTimeline; @@ -568,9 +569,9 @@ typedef struct spPathConstraintMixTimeline { #endif } spPathConstraintMixTimeline; -spPathConstraintMixTimeline* spPathConstraintMixTimeline_create (int framesCount); +SP_API spPathConstraintMixTimeline* spPathConstraintMixTimeline_create (int framesCount); -void spPathConstraintMixTimeline_setFrame (spPathConstraintMixTimeline* self, int frameIndex, float time, float rotateMix, float translateMix); +SP_API void spPathConstraintMixTimeline_setFrame (spPathConstraintMixTimeline* self, int frameIndex, float time, float rotateMix, float translateMix); #ifdef SPINE_SHORT_NAMES typedef spPathConstraintMixTimeline PathConstraintMixTimeline; diff --git a/spine-c/spine-c/include/spine/AnimationState.h b/spine-c/spine-c/include/spine/AnimationState.h index 6df64edb1..fe6ae515a 100644 --- a/spine-c/spine-c/include/spine/AnimationState.h +++ b/spine-c/spine-c/include/spine/AnimationState.h @@ -31,6 +31,7 @@ #ifndef SPINE_ANIMATIONSTATE_H_ #define SPINE_ANIMATIONSTATE_H_ +#include #include #include #include @@ -116,38 +117,38 @@ struct spAnimationState { }; /* @param data May be 0 for no mixing. */ -spAnimationState* spAnimationState_create (spAnimationStateData* data); -void spAnimationState_dispose (spAnimationState* self); +SP_API spAnimationState* spAnimationState_create (spAnimationStateData* data); +SP_API void spAnimationState_dispose (spAnimationState* self); -void spAnimationState_update (spAnimationState* self, float delta); -int /**bool**/ spAnimationState_apply (spAnimationState* self, struct spSkeleton* skeleton); +SP_API void spAnimationState_update (spAnimationState* self, float delta); +SP_API int /**bool**/ spAnimationState_apply (spAnimationState* self, struct spSkeleton* skeleton); -void spAnimationState_clearTracks (spAnimationState* self); -void spAnimationState_clearTrack (spAnimationState* self, int trackIndex); +SP_API void spAnimationState_clearTracks (spAnimationState* self); +SP_API void spAnimationState_clearTrack (spAnimationState* self, int trackIndex); /** Set the current animation. Any queued animations are cleared. */ -spTrackEntry* spAnimationState_setAnimationByName (spAnimationState* self, int trackIndex, const char* animationName, +SP_API spTrackEntry* spAnimationState_setAnimationByName (spAnimationState* self, int trackIndex, const char* animationName, int/*bool*/loop); -spTrackEntry* spAnimationState_setAnimation (spAnimationState* self, int trackIndex, spAnimation* animation, int/*bool*/loop); +SP_API spTrackEntry* spAnimationState_setAnimation (spAnimationState* self, int trackIndex, spAnimation* animation, int/*bool*/loop); /** Adds an animation to be played delay seconds after the current or last queued animation, taking into account any mix * duration. */ -spTrackEntry* spAnimationState_addAnimationByName (spAnimationState* self, int trackIndex, const char* animationName, +SP_API spTrackEntry* spAnimationState_addAnimationByName (spAnimationState* self, int trackIndex, const char* animationName, int/*bool*/loop, float delay); -spTrackEntry* spAnimationState_addAnimation (spAnimationState* self, int trackIndex, spAnimation* animation, int/*bool*/loop, +SP_API spTrackEntry* spAnimationState_addAnimation (spAnimationState* self, int trackIndex, spAnimation* animation, int/*bool*/loop, float delay); -spTrackEntry* spAnimationState_setEmptyAnimation(spAnimationState* self, int trackIndex, float mixDuration); -spTrackEntry* spAnimationState_addEmptyAnimation(spAnimationState* self, int trackIndex, float mixDuration, float delay); -void spAnimationState_setEmptyAnimations(spAnimationState* self, float mixDuration); +SP_API spTrackEntry* spAnimationState_setEmptyAnimation(spAnimationState* self, int trackIndex, float mixDuration); +SP_API spTrackEntry* spAnimationState_addEmptyAnimation(spAnimationState* self, int trackIndex, float mixDuration, float delay); +SP_API void spAnimationState_setEmptyAnimations(spAnimationState* self, float mixDuration); -spTrackEntry* spAnimationState_getCurrent (spAnimationState* self, int trackIndex); +SP_API spTrackEntry* spAnimationState_getCurrent (spAnimationState* self, int trackIndex); -void spAnimationState_clearListenerNotifications(spAnimationState* self); +SP_API void spAnimationState_clearListenerNotifications(spAnimationState* self); -float spTrackEntry_getAnimationTime (spTrackEntry* entry); +SP_API float spTrackEntry_getAnimationTime (spTrackEntry* entry); /** Use this to dispose static memory before your app exits to appease your memory leak detector*/ -void spAnimationState_disposeStatics (); +SP_API void spAnimationState_disposeStatics (); #ifdef SPINE_SHORT_NAMES typedef spEventType EventType; diff --git a/spine-c/spine-c/include/spine/AnimationStateData.h b/spine-c/spine-c/include/spine/AnimationStateData.h index 063f7fdeb..95f936e80 100644 --- a/spine-c/spine-c/include/spine/AnimationStateData.h +++ b/spine-c/spine-c/include/spine/AnimationStateData.h @@ -31,6 +31,7 @@ #ifndef SPINE_ANIMATIONSTATEDATA_H_ #define SPINE_ANIMATIONSTATEDATA_H_ +#include #include #include @@ -52,13 +53,13 @@ typedef struct spAnimationStateData { #endif } spAnimationStateData; -spAnimationStateData* spAnimationStateData_create (spSkeletonData* skeletonData); -void spAnimationStateData_dispose (spAnimationStateData* self); +SP_API spAnimationStateData* spAnimationStateData_create (spSkeletonData* skeletonData); +SP_API void spAnimationStateData_dispose (spAnimationStateData* self); -void spAnimationStateData_setMixByName (spAnimationStateData* self, const char* fromName, const char* toName, float duration); -void spAnimationStateData_setMix (spAnimationStateData* self, spAnimation* from, spAnimation* to, float duration); +SP_API void spAnimationStateData_setMixByName (spAnimationStateData* self, const char* fromName, const char* toName, float duration); +SP_API void spAnimationStateData_setMix (spAnimationStateData* self, spAnimation* from, spAnimation* to, float duration); /* Returns 0 if there is no mixing between the animations. */ -float spAnimationStateData_getMix (spAnimationStateData* self, spAnimation* from, spAnimation* to); +SP_API float spAnimationStateData_getMix (spAnimationStateData* self, spAnimation* from, spAnimation* to); #ifdef SPINE_SHORT_NAMES typedef spAnimationStateData AnimationStateData; diff --git a/spine-c/spine-c/include/spine/Array.h b/spine-c/spine-c/include/spine/Array.h index 8f29eb9ea..3beb08325 100644 --- a/spine-c/spine-c/include/spine/Array.h +++ b/spine-c/spine-c/include/spine/Array.h @@ -31,24 +31,26 @@ #ifndef SPINE_ARRAY_H #define SPINE_ARRAY_H +#include + #ifdef __cplusplus extern "C" { #endif #define _SP_ARRAY_DECLARE_TYPE(name, itemType) \ typedef struct name { int size; int capacity; itemType* items; } name; \ - name* name##_create(int initialCapacity); \ - void name##_dispose(name* self); \ - void name##_clear(name* self); \ - name* name##_setSize(name* self, int newSize); \ - void name##_ensureCapacity(name* self, int newCapacity); \ - void name##_add(name* self, itemType value); \ - void name##_addAll(name* self, name* other); \ - void name##_addAllValues(name* self, itemType* values, int offset, int count); \ - void name##_removeAt(name* self, int index); \ - int name##_contains(name* self, itemType value); \ - itemType name##_pop(name* self); \ - itemType name##_peek(name* self); + SP_API name* name##_create(int initialCapacity); \ + SP_API void name##_dispose(name* self); \ + SP_API void name##_clear(name* self); \ + SP_API name* name##_setSize(name* self, int newSize); \ + SP_API void name##_ensureCapacity(name* self, int newCapacity); \ + SP_API void name##_add(name* self, itemType value); \ + SP_API void name##_addAll(name* self, name* other); \ + SP_API void name##_addAllValues(name* self, itemType* values, int offset, int count); \ + SP_API void name##_removeAt(name* self, int index); \ + SP_API int name##_contains(name* self, itemType value); \ + SP_API itemType name##_pop(name* self); \ + SP_API itemType name##_peek(name* self); #define _SP_ARRAY_IMPLEMENT_TYPE(name, itemType) \ name* name##_create(int initialCapacity) { \ diff --git a/spine-c/spine-c/include/spine/Atlas.h b/spine-c/spine-c/include/spine/Atlas.h index 392e498df..7812e0440 100644 --- a/spine-c/spine-c/include/spine/Atlas.h +++ b/spine-c/spine-c/include/spine/Atlas.h @@ -31,6 +31,8 @@ #ifndef SPINE_ATLAS_H_ #define SPINE_ATLAS_H_ +#include + #ifdef __cplusplus extern "C" { #endif @@ -79,8 +81,8 @@ struct spAtlasPage { spAtlasPage* next; }; -spAtlasPage* spAtlasPage_create (spAtlas* atlas, const char* name); -void spAtlasPage_dispose (spAtlasPage* self); +SP_API spAtlasPage* spAtlasPage_create (spAtlas* atlas, const char* name); +SP_API void spAtlasPage_dispose (spAtlasPage* self); #ifdef SPINE_SHORT_NAMES typedef spAtlasFormat AtlasFormat; @@ -130,8 +132,8 @@ struct spAtlasRegion { spAtlasRegion* next; }; -spAtlasRegion* spAtlasRegion_create (); -void spAtlasRegion_dispose (spAtlasRegion* self); +SP_API spAtlasRegion* spAtlasRegion_create (); +SP_API void spAtlasRegion_dispose (spAtlasRegion* self); #ifdef SPINE_SHORT_NAMES typedef spAtlasRegion AtlasRegion; @@ -149,13 +151,13 @@ struct spAtlas { }; /* Image files referenced in the atlas file will be prefixed with dir. */ -spAtlas* spAtlas_create (const char* data, int length, const char* dir, void* rendererObject); +SP_API spAtlas* spAtlas_create (const char* data, int length, const char* dir, void* rendererObject); /* Image files referenced in the atlas file will be prefixed with the directory containing the atlas file. */ -spAtlas* spAtlas_createFromFile (const char* path, void* rendererObject); -void spAtlas_dispose (spAtlas* atlas); +SP_API spAtlas* spAtlas_createFromFile (const char* path, void* rendererObject); +SP_API void spAtlas_dispose (spAtlas* atlas); /* Returns 0 if the region was not found. */ -spAtlasRegion* spAtlas_findRegion (const spAtlas* self, const char* name); +SP_API spAtlasRegion* spAtlas_findRegion (const spAtlas* self, const char* name); #ifdef SPINE_SHORT_NAMES typedef spAtlas Atlas; diff --git a/spine-c/spine-c/include/spine/AtlasAttachmentLoader.h b/spine-c/spine-c/include/spine/AtlasAttachmentLoader.h index 3ea864e13..6b9ed688e 100644 --- a/spine-c/spine-c/include/spine/AtlasAttachmentLoader.h +++ b/spine-c/spine-c/include/spine/AtlasAttachmentLoader.h @@ -31,6 +31,7 @@ #ifndef SPINE_ATLASATTACHMENTLOADER_H_ #define SPINE_ATLASATTACHMENTLOADER_H_ +#include #include #include @@ -43,7 +44,7 @@ typedef struct spAtlasAttachmentLoader { spAtlas* atlas; } spAtlasAttachmentLoader; -spAtlasAttachmentLoader* spAtlasAttachmentLoader_create (spAtlas* atlas); +SP_API spAtlasAttachmentLoader* spAtlasAttachmentLoader_create (spAtlas* atlas); #ifdef SPINE_SHORT_NAMES typedef spAtlasAttachmentLoader AtlasAttachmentLoader; diff --git a/spine-c/spine-c/include/spine/Attachment.h b/spine-c/spine-c/include/spine/Attachment.h index f67b65af5..286a8bec4 100644 --- a/spine-c/spine-c/include/spine/Attachment.h +++ b/spine-c/spine-c/include/spine/Attachment.h @@ -31,6 +31,8 @@ #ifndef SPINE_ATTACHMENT_H_ #define SPINE_ATTACHMENT_H_ +#include + #ifdef __cplusplus extern "C" { #endif diff --git a/spine-c/spine-c/include/spine/AttachmentLoader.h b/spine-c/spine-c/include/spine/AttachmentLoader.h index 7111c45a0..f0f556553 100644 --- a/spine-c/spine-c/include/spine/AttachmentLoader.h +++ b/spine-c/spine-c/include/spine/AttachmentLoader.h @@ -31,6 +31,7 @@ #ifndef SPINE_ATTACHMENTLOADER_H_ #define SPINE_ATTACHMENTLOADER_H_ +#include #include #include @@ -52,16 +53,16 @@ typedef struct spAttachmentLoader { #endif } spAttachmentLoader; -void spAttachmentLoader_dispose (spAttachmentLoader* self); +SP_API void spAttachmentLoader_dispose (spAttachmentLoader* self); /* Called to create each attachment. Returns 0 to not load an attachment. If 0 is returned and _spAttachmentLoader_setError was * called, an error occurred. */ -spAttachment* spAttachmentLoader_createAttachment (spAttachmentLoader* self, spSkin* skin, spAttachmentType type, const char* name, +SP_API spAttachment* spAttachmentLoader_createAttachment (spAttachmentLoader* self, spSkin* skin, spAttachmentType type, const char* name, const char* path); /* Called after the attachment has been fully configured. */ -void spAttachmentLoader_configureAttachment (spAttachmentLoader* self, spAttachment* attachment); +SP_API void spAttachmentLoader_configureAttachment (spAttachmentLoader* self, spAttachment* attachment); /* Called just before the attachment is disposed. This can release allocations made in spAttachmentLoader_configureAttachment. */ -void spAttachmentLoader_disposeAttachment (spAttachmentLoader* self, spAttachment* attachment); +SP_API void spAttachmentLoader_disposeAttachment (spAttachmentLoader* self, spAttachment* attachment); #ifdef SPINE_SHORT_NAMES typedef spAttachmentLoader AttachmentLoader; diff --git a/spine-c/spine-c/include/spine/Bone.h b/spine-c/spine-c/include/spine/Bone.h index 2335fd3af..12b2af928 100644 --- a/spine-c/spine-c/include/spine/Bone.h +++ b/spine-c/spine-c/include/spine/Bone.h @@ -31,6 +31,7 @@ #ifndef SPINE_BONE_H_ #define SPINE_BONE_H_ +#include #include #ifdef __cplusplus @@ -73,30 +74,30 @@ struct spBone { #endif }; -void spBone_setYDown (int/*bool*/yDown); -int/*bool*/spBone_isYDown (); +SP_API void spBone_setYDown (int/*bool*/yDown); +SP_API int/*bool*/spBone_isYDown (); /* @param parent May be 0. */ -spBone* spBone_create (spBoneData* data, struct spSkeleton* skeleton, spBone* parent); -void spBone_dispose (spBone* self); +SP_API spBone* spBone_create (spBoneData* data, struct spSkeleton* skeleton, spBone* parent); +SP_API void spBone_dispose (spBone* self); -void spBone_setToSetupPose (spBone* self); +SP_API void spBone_setToSetupPose (spBone* self); -void spBone_updateWorldTransform (spBone* self); -void spBone_updateWorldTransformWith (spBone* self, float x, float y, float rotation, float scaleX, float scaleY, float shearX, float shearY); +SP_API void spBone_updateWorldTransform (spBone* self); +SP_API void spBone_updateWorldTransformWith (spBone* self, float x, float y, float rotation, float scaleX, float scaleY, float shearX, float shearY); -float spBone_getWorldRotationX (spBone* self); -float spBone_getWorldRotationY (spBone* self); -float spBone_getWorldScaleX (spBone* self); -float spBone_getWorldScaleY (spBone* self); +SP_API float spBone_getWorldRotationX (spBone* self); +SP_API float spBone_getWorldRotationY (spBone* self); +SP_API float spBone_getWorldScaleX (spBone* self); +SP_API float spBone_getWorldScaleY (spBone* self); -void spBone_updateAppliedTransform (spBone* self); +SP_API void spBone_updateAppliedTransform (spBone* self); -void spBone_worldToLocal (spBone* self, float worldX, float worldY, float* localX, float* localY); -void spBone_localToWorld (spBone* self, float localX, float localY, float* worldX, float* worldY); -float spBone_worldToLocalRotation (spBone* self, float worldRotation); -float spBone_localToWorldRotation (spBone* self, float localRotation); -void spBone_rotateWorld (spBone* self, float degrees); +SP_API void spBone_worldToLocal (spBone* self, float worldX, float worldY, float* localX, float* localY); +SP_API void spBone_localToWorld (spBone* self, float localX, float localY, float* worldX, float* worldY); +SP_API float spBone_worldToLocalRotation (spBone* self, float worldRotation); +SP_API float spBone_localToWorldRotation (spBone* self, float localRotation); +SP_API void spBone_rotateWorld (spBone* self, float degrees); #ifdef SPINE_SHORT_NAMES typedef spBone Bone; diff --git a/spine-c/spine-c/include/spine/BoneData.h b/spine-c/spine-c/include/spine/BoneData.h index 244a50e0d..d73162b2b 100644 --- a/spine-c/spine-c/include/spine/BoneData.h +++ b/spine-c/spine-c/include/spine/BoneData.h @@ -31,6 +31,8 @@ #ifndef SPINE_BONEDATA_H_ #define SPINE_BONEDATA_H_ +#include + #ifdef __cplusplus extern "C" { #endif @@ -67,8 +69,8 @@ struct spBoneData { #endif }; -spBoneData* spBoneData_create (int index, const char* name, spBoneData* parent); -void spBoneData_dispose (spBoneData* self); +SP_API spBoneData* spBoneData_create (int index, const char* name, spBoneData* parent); +SP_API void spBoneData_dispose (spBoneData* self); #ifdef SPINE_SHORT_NAMES typedef spBoneData BoneData; diff --git a/spine-c/spine-c/include/spine/BoundingBoxAttachment.h b/spine-c/spine-c/include/spine/BoundingBoxAttachment.h index e2895800c..2c9194b69 100644 --- a/spine-c/spine-c/include/spine/BoundingBoxAttachment.h +++ b/spine-c/spine-c/include/spine/BoundingBoxAttachment.h @@ -31,6 +31,7 @@ #ifndef SPINE_BOUNDINGBOXATTACHMENT_H_ #define SPINE_BOUNDINGBOXATTACHMENT_H_ +#include #include #include #include @@ -44,7 +45,7 @@ typedef struct spBoundingBoxAttachment { spVertexAttachment super; } spBoundingBoxAttachment; -spBoundingBoxAttachment* spBoundingBoxAttachment_create (const char* name); +SP_API spBoundingBoxAttachment* spBoundingBoxAttachment_create (const char* name); #ifdef SPINE_SHORT_NAMES typedef spBoundingBoxAttachment BoundingBoxAttachment; diff --git a/spine-c/spine-c/include/spine/ClippingAttachment.h b/spine-c/spine-c/include/spine/ClippingAttachment.h index 33e5dc875..8683437c7 100644 --- a/spine-c/spine-c/include/spine/ClippingAttachment.h +++ b/spine-c/spine-c/include/spine/ClippingAttachment.h @@ -31,6 +31,7 @@ #ifndef SPINE_CLIPPINGATTACHMENT_H_ #define SPINE_CLIPPINGATTACHMENT_H_ +#include #include #include #include @@ -45,8 +46,8 @@ typedef struct spClippingAttachment { spSlotData* endSlot; } spClippingAttachment; -void _spClippingAttachment_dispose(spAttachment* self); -spClippingAttachment* spClippingAttachment_create (const char* name); +SP_API void _spClippingAttachment_dispose(spAttachment* self); +SP_API spClippingAttachment* spClippingAttachment_create (const char* name); #ifdef SPINE_SHORT_NAMES typedef spClippingAttachment ClippingAttachment; diff --git a/spine-c/spine-c/include/spine/Color.h b/spine-c/spine-c/include/spine/Color.h index 4c2384a41..272ba9552 100644 --- a/spine-c/spine-c/include/spine/Color.h +++ b/spine-c/spine-c/include/spine/Color.h @@ -31,6 +31,8 @@ #ifndef SPINE_COLOR_H_ #define SPINE_COLOR_H_ +#include + #ifdef __cplusplus extern "C" { #endif @@ -50,13 +52,13 @@ typedef struct spColor { } spColor; /* @param attachmentName May be 0 for no setup pose attachment. */ -spColor* spColor_create(); -void spColor_dispose(spColor* self); -void spColor_setFromFloats(spColor* color, float r, float g, float b, float a); -void spColor_setFromColor(spColor* color, spColor* otherColor); -void spColor_addFloats(spColor* color, float r, float g, float b, float a); -void spColor_addColor(spColor* color, spColor* otherColor); -void spColor_clamp(spColor* color); +SP_API spColor* spColor_create(); +SP_API void spColor_dispose(spColor* self); +SP_API void spColor_setFromFloats(spColor* color, float r, float g, float b, float a); +SP_API void spColor_setFromColor(spColor* color, spColor* otherColor); +SP_API void spColor_addFloats(spColor* color, float r, float g, float b, float a); +SP_API void spColor_addColor(spColor* color, spColor* otherColor); +SP_API void spColor_clamp(spColor* color); #ifdef SPINE_SHORT_NAMES typedef spColor color; diff --git a/spine-c/spine-c/include/spine/Event.h b/spine-c/spine-c/include/spine/Event.h index a943c454f..c92b713de 100644 --- a/spine-c/spine-c/include/spine/Event.h +++ b/spine-c/spine-c/include/spine/Event.h @@ -31,6 +31,7 @@ #ifndef SPINE_EVENT_H_ #define SPINE_EVENT_H_ +#include #include #ifdef __cplusplus @@ -55,8 +56,8 @@ typedef struct spEvent { #endif } spEvent; -spEvent* spEvent_create (float time, spEventData* data); -void spEvent_dispose (spEvent* self); +SP_API spEvent* spEvent_create (float time, spEventData* data); +SP_API void spEvent_dispose (spEvent* self); #ifdef SPINE_SHORT_NAMES typedef spEvent Event; diff --git a/spine-c/spine-c/include/spine/EventData.h b/spine-c/spine-c/include/spine/EventData.h index 050bee158..70b955071 100644 --- a/spine-c/spine-c/include/spine/EventData.h +++ b/spine-c/spine-c/include/spine/EventData.h @@ -31,6 +31,8 @@ #ifndef SPINE_EVENTDATA_H_ #define SPINE_EVENTDATA_H_ +#include + #ifdef __cplusplus extern "C" { #endif @@ -51,8 +53,8 @@ typedef struct spEventData { #endif } spEventData; -spEventData* spEventData_create (const char* name); -void spEventData_dispose (spEventData* self); +SP_API spEventData* spEventData_create (const char* name); +SP_API void spEventData_dispose (spEventData* self); #ifdef SPINE_SHORT_NAMES typedef spEventData EventData; diff --git a/spine-c/spine-c/include/spine/IkConstraint.h b/spine-c/spine-c/include/spine/IkConstraint.h index aef3c26a8..e5b0f7b72 100644 --- a/spine-c/spine-c/include/spine/IkConstraint.h +++ b/spine-c/spine-c/include/spine/IkConstraint.h @@ -31,6 +31,7 @@ #ifndef SPINE_IKCONSTRAINT_H_ #define SPINE_IKCONSTRAINT_H_ +#include #include #include @@ -62,13 +63,13 @@ typedef struct spIkConstraint { #endif } spIkConstraint; -spIkConstraint* spIkConstraint_create (spIkConstraintData* data, const struct spSkeleton* skeleton); -void spIkConstraint_dispose (spIkConstraint* self); +SP_API spIkConstraint* spIkConstraint_create (spIkConstraintData* data, const struct spSkeleton* skeleton); +SP_API void spIkConstraint_dispose (spIkConstraint* self); -void spIkConstraint_apply (spIkConstraint* self); +SP_API void spIkConstraint_apply (spIkConstraint* self); -void spIkConstraint_apply1 (spBone* bone, float targetX, float targetY, float alpha); -void spIkConstraint_apply2 (spBone* parent, spBone* child, float targetX, float targetY, int bendDirection, float alpha); +SP_API void spIkConstraint_apply1 (spBone* bone, float targetX, float targetY, float alpha); +SP_API void spIkConstraint_apply2 (spBone* parent, spBone* child, float targetX, float targetY, int bendDirection, float alpha); #ifdef SPINE_SHORT_NAMES typedef spIkConstraint IkConstraint; diff --git a/spine-c/spine-c/include/spine/IkConstraintData.h b/spine-c/spine-c/include/spine/IkConstraintData.h index 65c2f08b7..fc3f3cc09 100644 --- a/spine-c/spine-c/include/spine/IkConstraintData.h +++ b/spine-c/spine-c/include/spine/IkConstraintData.h @@ -31,6 +31,7 @@ #ifndef SPINE_IKCONSTRAINTDATA_H_ #define SPINE_IKCONSTRAINTDATA_H_ +#include #include #ifdef __cplusplus @@ -59,8 +60,8 @@ typedef struct spIkConstraintData { #endif } spIkConstraintData; -spIkConstraintData* spIkConstraintData_create (const char* name); -void spIkConstraintData_dispose (spIkConstraintData* self); +SP_API spIkConstraintData* spIkConstraintData_create (const char* name); +SP_API void spIkConstraintData_dispose (spIkConstraintData* self); #ifdef SPINE_SHORT_NAMES typedef spIkConstraintData IkConstraintData; diff --git a/spine-c/spine-c/include/spine/MeshAttachment.h b/spine-c/spine-c/include/spine/MeshAttachment.h index 91254e789..2876abfd5 100644 --- a/spine-c/spine-c/include/spine/MeshAttachment.h +++ b/spine-c/spine-c/include/spine/MeshAttachment.h @@ -31,6 +31,7 @@ #ifndef SPINE_MESHATTACHMENT_H_ #define SPINE_MESHATTACHMENT_H_ +#include #include #include #include @@ -72,9 +73,9 @@ struct spMeshAttachment { float width, height; }; -spMeshAttachment* spMeshAttachment_create (const char* name); -void spMeshAttachment_updateUVs (spMeshAttachment* self); -void spMeshAttachment_setParentMesh (spMeshAttachment* self, spMeshAttachment* parentMesh); +SP_API spMeshAttachment* spMeshAttachment_create (const char* name); +SP_API void spMeshAttachment_updateUVs (spMeshAttachment* self); +SP_API void spMeshAttachment_setParentMesh (spMeshAttachment* self, spMeshAttachment* parentMesh); #ifdef SPINE_SHORT_NAMES typedef spMeshAttachment MeshAttachment; diff --git a/spine-c/spine-c/include/spine/PathAttachment.h b/spine-c/spine-c/include/spine/PathAttachment.h index fe529d70b..a953924a1 100644 --- a/spine-c/spine-c/include/spine/PathAttachment.h +++ b/spine-c/spine-c/include/spine/PathAttachment.h @@ -31,6 +31,7 @@ #ifndef SPINE_PATHATTACHMENT_H_ #define SPINE_PATHATTACHMENT_H_ +#include #include #include #include @@ -47,7 +48,7 @@ typedef struct spPathAttachment { int/*bool*/ closed, constantSpeed; } spPathAttachment; -spPathAttachment* spPathAttachment_create (const char* name); +SP_API spPathAttachment* spPathAttachment_create (const char* name); #ifdef SPINE_SHORT_NAMES typedef spPathAttachment PathAttachment; diff --git a/spine-c/spine-c/include/spine/PathConstraint.h b/spine-c/spine-c/include/spine/PathConstraint.h index 836708ae2..9d0ec10be 100644 --- a/spine-c/spine-c/include/spine/PathConstraint.h +++ b/spine-c/spine-c/include/spine/PathConstraint.h @@ -31,6 +31,7 @@ #ifndef SPINE_PATHCONSTRAINT_H_ #define SPINE_PATHCONSTRAINT_H_ +#include #include #include #include @@ -92,11 +93,11 @@ typedef struct spPathConstraint { #define SP_PATHCONSTRAINT_ -spPathConstraint* spPathConstraint_create (spPathConstraintData* data, const struct spSkeleton* skeleton); -void spPathConstraint_dispose (spPathConstraint* self); +SP_API spPathConstraint* spPathConstraint_create (spPathConstraintData* data, const struct spSkeleton* skeleton); +SP_API void spPathConstraint_dispose (spPathConstraint* self); -void spPathConstraint_apply (spPathConstraint* self); -float* spPathConstraint_computeWorldPositions(spPathConstraint* self, spPathAttachment* path, int spacesCount, int/*bool*/ tangents, int/*bool*/percentPosition, int/**/percentSpacing); +SP_API void spPathConstraint_apply (spPathConstraint* self); +SP_API float* spPathConstraint_computeWorldPositions(spPathConstraint* self, spPathAttachment* path, int spacesCount, int/*bool*/ tangents, int/*bool*/percentPosition, int/**/percentSpacing); #ifdef SPINE_SHORT_NAMES typedef spPathConstraint PathConstraint; diff --git a/spine-c/spine-c/include/spine/PathConstraintData.h b/spine-c/spine-c/include/spine/PathConstraintData.h index 31c9fad20..5a24cc37f 100644 --- a/spine-c/spine-c/include/spine/PathConstraintData.h +++ b/spine-c/spine-c/include/spine/PathConstraintData.h @@ -31,6 +31,7 @@ #ifndef SPINE_PATHCONSTRAINTDATA_H_ #define SPINE_PATHCONSTRAINTDATA_H_ +#include #include #include @@ -80,8 +81,8 @@ typedef struct spPathConstraintData { #endif } spPathConstraintData; -spPathConstraintData* spPathConstraintData_create (const char* name); -void spPathConstraintData_dispose (spPathConstraintData* self); +SP_API spPathConstraintData* spPathConstraintData_create (const char* name); +SP_API void spPathConstraintData_dispose (spPathConstraintData* self); #ifdef SPINE_SHORT_NAMES typedef spPathConstraintData PathConstraintData; diff --git a/spine-c/spine-c/include/spine/PointAttachment.h b/spine-c/spine-c/include/spine/PointAttachment.h index bfbda8fd8..da8df6cbb 100644 --- a/spine-c/spine-c/include/spine/PointAttachment.h +++ b/spine-c/spine-c/include/spine/PointAttachment.h @@ -31,6 +31,7 @@ #ifndef SPINE_POINTATTACHMENT_H_ #define SPINE_POINTATTACHMENT_H_ +#include #include #include #include @@ -46,9 +47,9 @@ typedef struct spPointAttachment { spColor color; } spPointAttachment; -spPointAttachment* spPointAttachment_create (const char* name); -void spPointAttachment_computeWorldPosition (spPointAttachment* self, spBone* bone, float* x, float* y); -float spPointAttachment_computeWorldRotation (spPointAttachment* self, spBone* bone); +SP_API spPointAttachment* spPointAttachment_create (const char* name); +SP_API void spPointAttachment_computeWorldPosition (spPointAttachment* self, spBone* bone, float* x, float* y); +SP_API float spPointAttachment_computeWorldRotation (spPointAttachment* self, spBone* bone); #ifdef SPINE_SHORT_NAMES typedef spPointAttachment PointAttachment; diff --git a/spine-c/spine-c/include/spine/RegionAttachment.h b/spine-c/spine-c/include/spine/RegionAttachment.h index a77f7321c..9e23d5bdf 100644 --- a/spine-c/spine-c/include/spine/RegionAttachment.h +++ b/spine-c/spine-c/include/spine/RegionAttachment.h @@ -31,6 +31,7 @@ #ifndef SPINE_REGIONATTACHMENT_H_ #define SPINE_REGIONATTACHMENT_H_ +#include #include #include #include @@ -54,10 +55,10 @@ typedef struct spRegionAttachment { float uvs[8]; } spRegionAttachment; -spRegionAttachment* spRegionAttachment_create (const char* name); -void spRegionAttachment_setUVs (spRegionAttachment* self, float u, float v, float u2, float v2, int/*bool*/rotate); -void spRegionAttachment_updateOffset (spRegionAttachment* self); -void spRegionAttachment_computeWorldVertices (spRegionAttachment* self, spBone* bone, float* vertices, int offset, int stride); +SP_API spRegionAttachment* spRegionAttachment_create (const char* name); +SP_API void spRegionAttachment_setUVs (spRegionAttachment* self, float u, float v, float u2, float v2, int/*bool*/rotate); +SP_API void spRegionAttachment_updateOffset (spRegionAttachment* self); +SP_API void spRegionAttachment_computeWorldVertices (spRegionAttachment* self, spBone* bone, float* vertices, int offset, int stride); #ifdef SPINE_SHORT_NAMES typedef spRegionAttachment RegionAttachment; diff --git a/spine-c/spine-c/include/spine/Skeleton.h b/spine-c/spine-c/include/spine/Skeleton.h index 3d8973f20..0df9fe076 100644 --- a/spine-c/spine-c/include/spine/Skeleton.h +++ b/spine-c/spine-c/include/spine/Skeleton.h @@ -31,6 +31,7 @@ #ifndef SPINE_SKELETON_H_ #define SPINE_SKELETON_H_ +#include #include #include #include @@ -94,57 +95,57 @@ typedef struct spSkeleton { #endif } spSkeleton; -spSkeleton* spSkeleton_create (spSkeletonData* data); -void spSkeleton_dispose (spSkeleton* self); +SP_API spSkeleton* spSkeleton_create (spSkeletonData* data); +SP_API void spSkeleton_dispose (spSkeleton* self); /* Caches information about bones and constraints. Must be called if bones or constraints, or weighted path attachments * are added or removed. */ -void spSkeleton_updateCache (spSkeleton* self); -void spSkeleton_updateWorldTransform (const spSkeleton* self); +SP_API void spSkeleton_updateCache (spSkeleton* self); +SP_API void spSkeleton_updateWorldTransform (const spSkeleton* self); /* Sets the bones, constraints, and slots to their setup pose values. */ -void spSkeleton_setToSetupPose (const spSkeleton* self); +SP_API void spSkeleton_setToSetupPose (const spSkeleton* self); /* Sets the bones and constraints to their setup pose values. */ -void spSkeleton_setBonesToSetupPose (const spSkeleton* self); -void spSkeleton_setSlotsToSetupPose (const spSkeleton* self); +SP_API void spSkeleton_setBonesToSetupPose (const spSkeleton* self); +SP_API void spSkeleton_setSlotsToSetupPose (const spSkeleton* self); /* Returns 0 if the bone was not found. */ -spBone* spSkeleton_findBone (const spSkeleton* self, const char* boneName); +SP_API spBone* spSkeleton_findBone (const spSkeleton* self, const char* boneName); /* Returns -1 if the bone was not found. */ -int spSkeleton_findBoneIndex (const spSkeleton* self, const char* boneName); +SP_API int spSkeleton_findBoneIndex (const spSkeleton* self, const char* boneName); /* Returns 0 if the slot was not found. */ -spSlot* spSkeleton_findSlot (const spSkeleton* self, const char* slotName); +SP_API spSlot* spSkeleton_findSlot (const spSkeleton* self, const char* slotName); /* Returns -1 if the slot was not found. */ -int spSkeleton_findSlotIndex (const spSkeleton* self, const char* slotName); +SP_API int spSkeleton_findSlotIndex (const spSkeleton* self, const char* slotName); /* Sets the skin used to look up attachments before looking in the SkeletonData defaultSkin. Attachments from the new skin are * attached if the corresponding attachment from the old skin was attached. If there was no old skin, each slot's setup mode * attachment is attached from the new skin. * @param skin May be 0.*/ -void spSkeleton_setSkin (spSkeleton* self, spSkin* skin); +SP_API void spSkeleton_setSkin (spSkeleton* self, spSkin* skin); /* Returns 0 if the skin was not found. See spSkeleton_setSkin. * @param skinName May be 0. */ -int spSkeleton_setSkinByName (spSkeleton* self, const char* skinName); +SP_API int spSkeleton_setSkinByName (spSkeleton* self, const char* skinName); /* Returns 0 if the slot or attachment was not found. */ -spAttachment* spSkeleton_getAttachmentForSlotName (const spSkeleton* self, const char* slotName, const char* attachmentName); +SP_API spAttachment* spSkeleton_getAttachmentForSlotName (const spSkeleton* self, const char* slotName, const char* attachmentName); /* Returns 0 if the slot or attachment was not found. */ -spAttachment* spSkeleton_getAttachmentForSlotIndex (const spSkeleton* self, int slotIndex, const char* attachmentName); +SP_API spAttachment* spSkeleton_getAttachmentForSlotIndex (const spSkeleton* self, int slotIndex, const char* attachmentName); /* Returns 0 if the slot or attachment was not found. * @param attachmentName May be 0. */ -int spSkeleton_setAttachment (spSkeleton* self, const char* slotName, const char* attachmentName); +SP_API int spSkeleton_setAttachment (spSkeleton* self, const char* slotName, const char* attachmentName); /* Returns 0 if the IK constraint was not found. */ -spIkConstraint* spSkeleton_findIkConstraint (const spSkeleton* self, const char* constraintName); +SP_API spIkConstraint* spSkeleton_findIkConstraint (const spSkeleton* self, const char* constraintName); /* Returns 0 if the transform constraint was not found. */ -spTransformConstraint* spSkeleton_findTransformConstraint (const spSkeleton* self, const char* constraintName); +SP_API spTransformConstraint* spSkeleton_findTransformConstraint (const spSkeleton* self, const char* constraintName); /* Returns 0 if the path constraint was not found. */ -spPathConstraint* spSkeleton_findPathConstraint (const spSkeleton* self, const char* constraintName); +SP_API spPathConstraint* spSkeleton_findPathConstraint (const spSkeleton* self, const char* constraintName); -void spSkeleton_update (spSkeleton* self, float deltaTime); +SP_API void spSkeleton_update (spSkeleton* self, float deltaTime); #ifdef SPINE_SHORT_NAMES typedef spSkeleton Skeleton; diff --git a/spine-c/spine-c/include/spine/SkeletonBinary.h b/spine-c/spine-c/include/spine/SkeletonBinary.h index 7a84382e1..3d96a1da9 100644 --- a/spine-c/spine-c/include/spine/SkeletonBinary.h +++ b/spine-c/spine-c/include/spine/SkeletonBinary.h @@ -31,6 +31,7 @@ #ifndef SPINE_SKELETONBINARY_H_ #define SPINE_SKELETONBINARY_H_ +#include #include #include #include @@ -48,12 +49,12 @@ typedef struct spSkeletonBinary { const char* const error; } spSkeletonBinary; -spSkeletonBinary* spSkeletonBinary_createWithLoader (spAttachmentLoader* attachmentLoader); -spSkeletonBinary* spSkeletonBinary_create (spAtlas* atlas); -void spSkeletonBinary_dispose (spSkeletonBinary* self); +SP_API spSkeletonBinary* spSkeletonBinary_createWithLoader (spAttachmentLoader* attachmentLoader); +SP_API spSkeletonBinary* spSkeletonBinary_create (spAtlas* atlas); +SP_API void spSkeletonBinary_dispose (spSkeletonBinary* self); -spSkeletonData* spSkeletonBinary_readSkeletonData (spSkeletonBinary* self, const unsigned char* binary, const int length); -spSkeletonData* spSkeletonBinary_readSkeletonDataFile (spSkeletonBinary* self, const char* path); +SP_API spSkeletonData* spSkeletonBinary_readSkeletonData (spSkeletonBinary* self, const unsigned char* binary, const int length); +SP_API spSkeletonData* spSkeletonBinary_readSkeletonDataFile (spSkeletonBinary* self, const char* path); #ifdef SPINE_SHORT_NAMES typedef spSkeletonBinary SkeletonBinary; diff --git a/spine-c/spine-c/include/spine/SkeletonBounds.h b/spine-c/spine-c/include/spine/SkeletonBounds.h index 83add8fcc..da435c0a7 100644 --- a/spine-c/spine-c/include/spine/SkeletonBounds.h +++ b/spine-c/spine-c/include/spine/SkeletonBounds.h @@ -31,6 +31,7 @@ #ifndef SPINE_SKELETONBOUNDS_H_ #define SPINE_SKELETONBOUNDS_H_ +#include #include #include @@ -44,11 +45,11 @@ typedef struct spPolygon { int capacity; } spPolygon; -spPolygon* spPolygon_create (int capacity); -void spPolygon_dispose (spPolygon* self); +SP_API spPolygon* spPolygon_create (int capacity); +SP_API void spPolygon_dispose (spPolygon* self); -int/*bool*/spPolygon_containsPoint (spPolygon* polygon, float x, float y); -int/*bool*/spPolygon_intersectsSegment (spPolygon* polygon, float x1, float y1, float x2, float y2); +SP_API int/*bool*/spPolygon_containsPoint (spPolygon* polygon, float x, float y); +SP_API int/*bool*/spPolygon_intersectsSegment (spPolygon* polygon, float x1, float y1, float x2, float y2); #ifdef SPINE_SHORT_NAMES typedef spPolygon Polygon; @@ -68,29 +69,29 @@ typedef struct spSkeletonBounds { float minX, minY, maxX, maxY; } spSkeletonBounds; -spSkeletonBounds* spSkeletonBounds_create (); -void spSkeletonBounds_dispose (spSkeletonBounds* self); -void spSkeletonBounds_update (spSkeletonBounds* self, spSkeleton* skeleton, int/*bool*/updateAabb); +SP_API spSkeletonBounds* spSkeletonBounds_create (); +SP_API void spSkeletonBounds_dispose (spSkeletonBounds* self); +SP_API void spSkeletonBounds_update (spSkeletonBounds* self, spSkeleton* skeleton, int/*bool*/updateAabb); /** Returns true if the axis aligned bounding box contains the point. */ -int/*bool*/spSkeletonBounds_aabbContainsPoint (spSkeletonBounds* self, float x, float y); +SP_API int/*bool*/spSkeletonBounds_aabbContainsPoint (spSkeletonBounds* self, float x, float y); /** Returns true if the axis aligned bounding box intersects the line segment. */ -int/*bool*/spSkeletonBounds_aabbIntersectsSegment (spSkeletonBounds* self, float x1, float y1, float x2, float y2); +SP_API int/*bool*/spSkeletonBounds_aabbIntersectsSegment (spSkeletonBounds* self, float x1, float y1, float x2, float y2); /** Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds. */ -int/*bool*/spSkeletonBounds_aabbIntersectsSkeleton (spSkeletonBounds* self, spSkeletonBounds* bounds); +SP_API int/*bool*/spSkeletonBounds_aabbIntersectsSkeleton (spSkeletonBounds* self, spSkeletonBounds* bounds); /** Returns the first bounding box attachment that contains the point, or null. When doing many checks, it is usually more * efficient to only call this method if spSkeletonBounds_aabbContainsPoint returns true. */ -spBoundingBoxAttachment* spSkeletonBounds_containsPoint (spSkeletonBounds* self, float x, float y); +SP_API spBoundingBoxAttachment* spSkeletonBounds_containsPoint (spSkeletonBounds* self, float x, float y); /** Returns the first bounding box attachment that contains the line segment, or null. When doing many checks, it is usually * more efficient to only call this method if spSkeletonBounds_aabbIntersectsSegment returns true. */ -spBoundingBoxAttachment* spSkeletonBounds_intersectsSegment (spSkeletonBounds* self, float x1, float y1, float x2, float y2); +SP_API spBoundingBoxAttachment* spSkeletonBounds_intersectsSegment (spSkeletonBounds* self, float x1, float y1, float x2, float y2); /** Returns the polygon for the specified bounding box, or null. */ -spPolygon* spSkeletonBounds_getPolygon (spSkeletonBounds* self, spBoundingBoxAttachment* boundingBox); +SP_API spPolygon* spSkeletonBounds_getPolygon (spSkeletonBounds* self, spBoundingBoxAttachment* boundingBox); #ifdef SPINE_SHORT_NAMES typedef spSkeletonBounds SkeletonBounds; diff --git a/spine-c/spine-c/include/spine/SkeletonClipping.h b/spine-c/spine-c/include/spine/SkeletonClipping.h index fe9a95308..74f21fccb 100644 --- a/spine-c/spine-c/include/spine/SkeletonClipping.h +++ b/spine-c/spine-c/include/spine/SkeletonClipping.h @@ -31,6 +31,7 @@ #ifndef SPINE_SKELETONCLIPPING_H #define SPINE_SKELETONCLIPPING_H +#include #include #include #include @@ -52,13 +53,13 @@ typedef struct spSkeletonClipping { spArrayFloatArray* clippingPolygons; } spSkeletonClipping; -spSkeletonClipping* spSkeletonClipping_create(); -int spSkeletonClipping_clipStart(spSkeletonClipping* self, spSlot* slot, spClippingAttachment* clip); -void spSkeletonClipping_clipEnd(spSkeletonClipping* self, spSlot* slot); -void spSkeletonClipping_clipEnd2(spSkeletonClipping* self); -int /*boolean*/ spSkeletonClipping_isClipping(spSkeletonClipping* self); -void spSkeletonClipping_clipTriangles(spSkeletonClipping* self, float* vertices, int verticesLength, unsigned short* triangles, int trianglesLength, float* uvs, int stride); -void spSkeletonClipping_dispose(spSkeletonClipping* self); +SP_API spSkeletonClipping* spSkeletonClipping_create(); +SP_API int spSkeletonClipping_clipStart(spSkeletonClipping* self, spSlot* slot, spClippingAttachment* clip); +SP_API void spSkeletonClipping_clipEnd(spSkeletonClipping* self, spSlot* slot); +SP_API void spSkeletonClipping_clipEnd2(spSkeletonClipping* self); +SP_API int /*boolean*/ spSkeletonClipping_isClipping(spSkeletonClipping* self); +SP_API void spSkeletonClipping_clipTriangles(spSkeletonClipping* self, float* vertices, int verticesLength, unsigned short* triangles, int trianglesLength, float* uvs, int stride); +SP_API void spSkeletonClipping_dispose(spSkeletonClipping* self); #ifdef __cplusplus } diff --git a/spine-c/spine-c/include/spine/SkeletonData.h b/spine-c/spine-c/include/spine/SkeletonData.h index 4245100ca..5cbf3e1d4 100644 --- a/spine-c/spine-c/include/spine/SkeletonData.h +++ b/spine-c/spine-c/include/spine/SkeletonData.h @@ -31,6 +31,7 @@ #ifndef SPINE_SKELETONDATA_H_ #define SPINE_SKELETONDATA_H_ +#include #include #include #include @@ -75,26 +76,26 @@ typedef struct spSkeletonData { spPathConstraintData** pathConstraints; } spSkeletonData; -spSkeletonData* spSkeletonData_create (); -void spSkeletonData_dispose (spSkeletonData* self); +SP_API spSkeletonData* spSkeletonData_create (); +SP_API void spSkeletonData_dispose (spSkeletonData* self); -spBoneData* spSkeletonData_findBone (const spSkeletonData* self, const char* boneName); -int spSkeletonData_findBoneIndex (const spSkeletonData* self, const char* boneName); +SP_API spBoneData* spSkeletonData_findBone (const spSkeletonData* self, const char* boneName); +SP_API int spSkeletonData_findBoneIndex (const spSkeletonData* self, const char* boneName); -spSlotData* spSkeletonData_findSlot (const spSkeletonData* self, const char* slotName); -int spSkeletonData_findSlotIndex (const spSkeletonData* self, const char* slotName); +SP_API spSlotData* spSkeletonData_findSlot (const spSkeletonData* self, const char* slotName); +SP_API int spSkeletonData_findSlotIndex (const spSkeletonData* self, const char* slotName); -spSkin* spSkeletonData_findSkin (const spSkeletonData* self, const char* skinName); +SP_API spSkin* spSkeletonData_findSkin (const spSkeletonData* self, const char* skinName); -spEventData* spSkeletonData_findEvent (const spSkeletonData* self, const char* eventName); +SP_API spEventData* spSkeletonData_findEvent (const spSkeletonData* self, const char* eventName); -spAnimation* spSkeletonData_findAnimation (const spSkeletonData* self, const char* animationName); +SP_API spAnimation* spSkeletonData_findAnimation (const spSkeletonData* self, const char* animationName); -spIkConstraintData* spSkeletonData_findIkConstraint (const spSkeletonData* self, const char* constraintName); +SP_API spIkConstraintData* spSkeletonData_findIkConstraint (const spSkeletonData* self, const char* constraintName); -spTransformConstraintData* spSkeletonData_findTransformConstraint (const spSkeletonData* self, const char* constraintName); +SP_API spTransformConstraintData* spSkeletonData_findTransformConstraint (const spSkeletonData* self, const char* constraintName); -spPathConstraintData* spSkeletonData_findPathConstraint (const spSkeletonData* self, const char* constraintName); +SP_API spPathConstraintData* spSkeletonData_findPathConstraint (const spSkeletonData* self, const char* constraintName); #ifdef SPINE_SHORT_NAMES typedef spSkeletonData SkeletonData; diff --git a/spine-c/spine-c/include/spine/SkeletonJson.h b/spine-c/spine-c/include/spine/SkeletonJson.h index b7159fdd6..96f1b86ec 100644 --- a/spine-c/spine-c/include/spine/SkeletonJson.h +++ b/spine-c/spine-c/include/spine/SkeletonJson.h @@ -31,6 +31,7 @@ #ifndef SPINE_SKELETONJSON_H_ #define SPINE_SKELETONJSON_H_ +#include #include #include #include @@ -49,12 +50,12 @@ typedef struct spSkeletonJson { const char* const error; } spSkeletonJson; -spSkeletonJson* spSkeletonJson_createWithLoader (spAttachmentLoader* attachmentLoader); -spSkeletonJson* spSkeletonJson_create (spAtlas* atlas); -void spSkeletonJson_dispose (spSkeletonJson* self); +SP_API spSkeletonJson* spSkeletonJson_createWithLoader (spAttachmentLoader* attachmentLoader); +SP_API spSkeletonJson* spSkeletonJson_create (spAtlas* atlas); +SP_API void spSkeletonJson_dispose (spSkeletonJson* self); -spSkeletonData* spSkeletonJson_readSkeletonData (spSkeletonJson* self, const char* json); -spSkeletonData* spSkeletonJson_readSkeletonDataFile (spSkeletonJson* self, const char* path); +SP_API spSkeletonData* spSkeletonJson_readSkeletonData (spSkeletonJson* self, const char* json); +SP_API spSkeletonData* spSkeletonJson_readSkeletonDataFile (spSkeletonJson* self, const char* path); #ifdef SPINE_SHORT_NAMES typedef spSkeletonJson SkeletonJson; diff --git a/spine-c/spine-c/include/spine/Skin.h b/spine-c/spine-c/include/spine/Skin.h index 90ec026fa..806cde877 100644 --- a/spine-c/spine-c/include/spine/Skin.h +++ b/spine-c/spine-c/include/spine/Skin.h @@ -31,6 +31,7 @@ #ifndef SPINE_SKIN_H_ #define SPINE_SKIN_H_ +#include #include #ifdef __cplusplus @@ -63,19 +64,19 @@ typedef struct { _Entry* entries; } _spSkin; -spSkin* spSkin_create (const char* name); -void spSkin_dispose (spSkin* self); +SP_API spSkin* spSkin_create (const char* name); +SP_API void spSkin_dispose (spSkin* self); /* The Skin owns the attachment. */ -void spSkin_addAttachment (spSkin* self, int slotIndex, const char* name, spAttachment* attachment); +SP_API void spSkin_addAttachment (spSkin* self, int slotIndex, const char* name, spAttachment* attachment); /* Returns 0 if the attachment was not found. */ -spAttachment* spSkin_getAttachment (const spSkin* self, int slotIndex, const char* name); +SP_API spAttachment* spSkin_getAttachment (const spSkin* self, int slotIndex, const char* name); /* Returns 0 if the slot or attachment was not found. */ -const char* spSkin_getAttachmentName (const spSkin* self, int slotIndex, int attachmentIndex); +SP_API const char* spSkin_getAttachmentName (const spSkin* self, int slotIndex, int attachmentIndex); /** Attach each attachment in this skin if the corresponding attachment in oldSkin is currently attached. */ -void spSkin_attachAll (const spSkin* self, struct spSkeleton* skeleton, const spSkin* oldspSkin); +SP_API void spSkin_attachAll (const spSkin* self, struct spSkeleton* skeleton, const spSkin* oldspSkin); #ifdef SPINE_SHORT_NAMES typedef spSkin Skin; diff --git a/spine-c/spine-c/include/spine/Slot.h b/spine-c/spine-c/include/spine/Slot.h index 54a9d6b53..04647689a 100644 --- a/spine-c/spine-c/include/spine/Slot.h +++ b/spine-c/spine-c/include/spine/Slot.h @@ -31,6 +31,7 @@ #ifndef SPINE_SLOT_H_ #define SPINE_SLOT_H_ +#include #include #include #include @@ -64,16 +65,16 @@ typedef struct spSlot { #endif } spSlot; -spSlot* spSlot_create (spSlotData* data, spBone* bone); -void spSlot_dispose (spSlot* self); +SP_API spSlot* spSlot_create (spSlotData* data, spBone* bone); +SP_API void spSlot_dispose (spSlot* self); /* @param attachment May be 0 to clear the attachment for the slot. */ -void spSlot_setAttachment (spSlot* self, spAttachment* attachment); +SP_API void spSlot_setAttachment (spSlot* self, spAttachment* attachment); -void spSlot_setAttachmentTime (spSlot* self, float time); -float spSlot_getAttachmentTime (const spSlot* self); +SP_API void spSlot_setAttachmentTime (spSlot* self, float time); +SP_API float spSlot_getAttachmentTime (const spSlot* self); -void spSlot_setToSetupPose (spSlot* self); +SP_API void spSlot_setToSetupPose (spSlot* self); #ifdef SPINE_SHORT_NAMES typedef spSlot Slot; diff --git a/spine-c/spine-c/include/spine/SlotData.h b/spine-c/spine-c/include/spine/SlotData.h index 2978b29f2..1e12da61a 100644 --- a/spine-c/spine-c/include/spine/SlotData.h +++ b/spine-c/spine-c/include/spine/SlotData.h @@ -31,6 +31,7 @@ #ifndef SPINE_SLOTDATA_H_ #define SPINE_SLOTDATA_H_ +#include #include #include @@ -64,11 +65,11 @@ typedef struct spSlotData { #endif } spSlotData; -spSlotData* spSlotData_create (const int index, const char* name, spBoneData* boneData); -void spSlotData_dispose (spSlotData* self); +SP_API spSlotData* spSlotData_create (const int index, const char* name, spBoneData* boneData); +SP_API void spSlotData_dispose (spSlotData* self); /* @param attachmentName May be 0 for no setup pose attachment. */ -void spSlotData_setAttachmentName (spSlotData* self, const char* attachmentName); +SP_API void spSlotData_setAttachmentName (spSlotData* self, const char* attachmentName); #ifdef SPINE_SHORT_NAMES typedef spBlendMode BlendMode; diff --git a/spine-c/spine-c/include/spine/TransformConstraint.h b/spine-c/spine-c/include/spine/TransformConstraint.h index 254297834..07721cf14 100644 --- a/spine-c/spine-c/include/spine/TransformConstraint.h +++ b/spine-c/spine-c/include/spine/TransformConstraint.h @@ -31,6 +31,7 @@ #ifndef SPINE_TRANSFORMCONSTRAINT_H_ #define SPINE_TRANSFORMCONSTRAINT_H_ +#include #include #include @@ -61,10 +62,10 @@ typedef struct spTransformConstraint { #endif } spTransformConstraint; -spTransformConstraint* spTransformConstraint_create (spTransformConstraintData* data, const struct spSkeleton* skeleton); -void spTransformConstraint_dispose (spTransformConstraint* self); +SP_API spTransformConstraint* spTransformConstraint_create (spTransformConstraintData* data, const struct spSkeleton* skeleton); +SP_API void spTransformConstraint_dispose (spTransformConstraint* self); -void spTransformConstraint_apply (spTransformConstraint* self); +SP_API void spTransformConstraint_apply (spTransformConstraint* self); #ifdef SPINE_SHORT_NAMES typedef spTransformConstraint TransformConstraint; diff --git a/spine-c/spine-c/include/spine/TransformConstraintData.h b/spine-c/spine-c/include/spine/TransformConstraintData.h index 66526fdb8..8e6c33ff7 100644 --- a/spine-c/spine-c/include/spine/TransformConstraintData.h +++ b/spine-c/spine-c/include/spine/TransformConstraintData.h @@ -31,6 +31,7 @@ #ifndef SPINE_TRANSFORMCONSTRAINTDATA_H_ #define SPINE_TRANSFORMCONSTRAINTDATA_H_ +#include #include #ifdef __cplusplus @@ -70,8 +71,8 @@ typedef struct spTransformConstraintData { #endif } spTransformConstraintData; -spTransformConstraintData* spTransformConstraintData_create (const char* name); -void spTransformConstraintData_dispose (spTransformConstraintData* self); +SP_API spTransformConstraintData* spTransformConstraintData_create (const char* name); +SP_API void spTransformConstraintData_dispose (spTransformConstraintData* self); #ifdef SPINE_SHORT_NAMES typedef spTransformConstraintData TransformConstraintData; diff --git a/spine-c/spine-c/include/spine/Triangulator.h b/spine-c/spine-c/include/spine/Triangulator.h index 14fa25fd1..69863b2f7 100644 --- a/spine-c/spine-c/include/spine/Triangulator.h +++ b/spine-c/spine-c/include/spine/Triangulator.h @@ -31,6 +31,7 @@ #ifndef SPINE_TRIANGULATOR_H #define SPINE_TRIANGULATOR_H +#include #include #ifdef __cplusplus @@ -49,10 +50,10 @@ typedef struct spTriangulator { spArrayShortArray* polygonIndicesPool; } spTriangulator; -spTriangulator* spTriangulator_create(); -spShortArray* spTriangulator_triangulate(spTriangulator* self, spFloatArray* verticesArray); -spArrayFloatArray* spTriangulator_decompose(spTriangulator* self, spFloatArray* verticesArray, spShortArray* triangles); -void spTriangulator_dispose(spTriangulator* self); +SP_API spTriangulator* spTriangulator_create(); +SP_API spShortArray* spTriangulator_triangulate(spTriangulator* self, spFloatArray* verticesArray); +SP_API spArrayFloatArray* spTriangulator_decompose(spTriangulator* self, spFloatArray* verticesArray, spShortArray* triangles); +SP_API void spTriangulator_dispose(spTriangulator* self); #ifdef __cplusplus diff --git a/spine-c/spine-c/include/spine/VertexAttachment.h b/spine-c/spine-c/include/spine/VertexAttachment.h index 759921a39..7d232cc6e 100644 --- a/spine-c/spine-c/include/spine/VertexAttachment.h +++ b/spine-c/spine-c/include/spine/VertexAttachment.h @@ -31,6 +31,7 @@ #ifndef SPINE_VERTEXATTACHMENT_H_ #define SPINE_VERTEXATTACHMENT_H_ +#include #include #include @@ -53,7 +54,7 @@ struct spVertexAttachment { int id; }; -void spVertexAttachment_computeWorldVertices (spVertexAttachment* self, spSlot* slot, int start, int count, float* worldVertices, int offset, int stride); +SP_API void spVertexAttachment_computeWorldVertices (spVertexAttachment* self, spSlot* slot, int start, int count, float* worldVertices, int offset, int stride); #ifdef SPINE_SHORT_NAMES typedef spVertexAttachment VertexAttachment; diff --git a/spine-c/spine-c/include/spine/VertexEffect.h b/spine-c/spine-c/include/spine/VertexEffect.h index ae738ccd1..4f670119b 100644 --- a/spine-c/spine-c/include/spine/VertexEffect.h +++ b/spine-c/spine-c/include/spine/VertexEffect.h @@ -31,6 +31,7 @@ #ifndef SPINE_VERTEXEFFECT_H_ #define SPINE_VERTEXEFFECT_H_ +#include #include #include @@ -69,13 +70,13 @@ typedef struct spSwirlVertexEffect { float worldY; } spSwirlVertexEffect; -spJitterVertexEffect *spJitterVertexEffect_create(float jitterX, float jitterY); +SP_API spJitterVertexEffect *spJitterVertexEffect_create(float jitterX, float jitterY); -void spJitterVertexEffect_dispose(spJitterVertexEffect *effect); +SP_API void spJitterVertexEffect_dispose(spJitterVertexEffect *effect); -spSwirlVertexEffect *spSwirlVertexEffect_create(float radius); +SP_API spSwirlVertexEffect *spSwirlVertexEffect_create(float radius); -void spSwirlVertexEffect_dispose(spSwirlVertexEffect *effect); +SP_API void spSwirlVertexEffect_dispose(spSwirlVertexEffect *effect); #ifdef __cplusplus } diff --git a/spine-c/spine-c/include/spine/dll.h b/spine-c/spine-c/include/spine/dll.h new file mode 100644 index 000000000..ed9c328b5 --- /dev/null +++ b/spine-c/spine-c/include/spine/dll.h @@ -0,0 +1,48 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef SPINE_SHAREDLIB_H +#define SPINE_SHAREDLIB_H + +#define SP_API + +#ifdef _WIN32 + #define DLLIMPORT __declspec(dllimport) + #define DLLEXPORT __declspec(dllexport) +#else + #define DLLIMPORT + #define DLLEXPORT +#endif + +#ifdef SPINEPLUGIN_API + #define SP_API SPINEPLUGIN_API +#endif + +#endif /* SPINE_SHAREDLIB_H */ diff --git a/spine-c/spine-c/include/spine/spine.h b/spine-c/spine-c/include/spine/spine.h index 56f4b3cde..5085ed8e3 100644 --- a/spine-c/spine-c/include/spine/spine.h +++ b/spine-c/spine-c/include/spine/spine.h @@ -31,6 +31,7 @@ #ifndef SPINE_SPINE_H_ #define SPINE_SPINE_H_ +#include #include #include #include diff --git a/spine-c/spine-c/src/spine/AnimationState.c b/spine-c/spine-c/src/spine/AnimationState.c index 33d3abba6..31d60ad4d 100644 --- a/spine-c/spine-c/src/spine/AnimationState.c +++ b/spine-c/spine-c/src/spine/AnimationState.c @@ -193,9 +193,13 @@ void _spAnimationState_disposeTrackEntries (spAnimationState* state, spTrackEntr spTrackEntry* from = entry->mixingFrom; while (from) { spTrackEntry* nextFrom = from->mixingFrom; + if (entry->listener) entry->listener(state, SP_ANIMATION_DISPOSE, from, 0); + if (state->listener) state->listener(state, SP_ANIMATION_DISPOSE, from, 0); _spAnimationState_disposeTrackEntry(from); from = nextFrom; } + if (entry->listener) entry->listener(state, SP_ANIMATION_DISPOSE, entry, 0); + if (state->listener) state->listener(state, SP_ANIMATION_DISPOSE, entry, 0); _spAnimationState_disposeTrackEntry(entry); entry = next; } diff --git a/spine-csharp/src/Animation.cs b/spine-csharp/src/Animation.cs index e344f7319..2c8228949 100644 --- a/spine-csharp/src/Animation.cs +++ b/spine-csharp/src/Animation.cs @@ -436,11 +436,11 @@ namespace Spine { } // Mixing out uses sign of setup or current pose, else use sign of key. if (direction == MixDirection.Out) { - x = Math.Abs(x) * Math.Sign(bx); - y = Math.Abs(y) * Math.Sign(by); + x = (x >= 0 ? x : -x) * (bx >= 0 ? 1 : -1); + y = (y >= 0 ? y : -y) * (by >= 0 ? 1 : -1); } else { - bx = Math.Abs(bx) * Math.Sign(x); - by = Math.Abs(by) * Math.Sign(y); + bx = (bx >= 0 ? bx : -bx) * (x >= 0 ? 1 : -1); + by = (by >= 0 ? by : -by) * (y >= 0 ? 1 : -1); } bone.scaleX = bx + (x - bx) * alpha; bone.scaleY = by + (y - by) * alpha; diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonRenderer.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonRenderer.java index 4240e80ba..32e033b1a 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonRenderer.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonRenderer.java @@ -100,7 +100,9 @@ public class SkeletonRenderer { continue; } else if (attachment instanceof MeshAttachment) { - throw new RuntimeException("SkeletonMeshRenderer is required to render meshes."); + throw new RuntimeException( + "SkeletonRenderer#draw(PolygonSpriteBatch, Skeleton) or #draw(TwoColorPolygonBatch, Skeleton) must be used to " + + "render meshes."); } else if (attachment instanceof SkeletonAttachment) { Skeleton attachmentSkeleton = ((SkeletonAttachment)attachment).getSkeleton(); @@ -242,7 +244,7 @@ public class SkeletonRenderer { tempLight.set(temp5); tempDark.set(temp6); tempUv.x = uvs[u]; - tempUv.y = uvs[u + 1]; + tempUv.y = uvs[u + 1]; vertexEffect.transform(tempPos, tempUv, tempLight, tempDark); vertices[v] = tempPos.x; vertices[v + 1] = tempPos.y; @@ -378,7 +380,7 @@ public class SkeletonRenderer { tempLight.set(temp5); tempDark.set(temp6); tempUv.x = uvs[u]; - tempUv.y = uvs[u + 1]; + tempUv.y = uvs[u + 1]; vertexEffect.transform(tempPos, tempUv, tempLight, tempDark); vertices[v] = tempPos.x; vertices[v + 1] = tempPos.y; diff --git a/spine-ue4/Content/GettingStarted/06-cpp.umap b/spine-ue4/Content/GettingStarted/06-cpp.umap index fddce8eb5..ae79698fb 100644 Binary files a/spine-ue4/Content/GettingStarted/06-cpp.umap and b/spine-ue4/Content/GettingStarted/06-cpp.umap differ diff --git a/spine-ue4/Content/Test/Test.umap b/spine-ue4/Content/Test/Test.umap index 80d633a1e..f5fc98e8c 100644 Binary files a/spine-ue4/Content/Test/Test.umap and b/spine-ue4/Content/Test/Test.umap differ diff --git a/spine-ue4/Plugins/RuntimeMeshComponentPlugin/Source/RuntimeMeshComponent/Public/RuntimeMeshCore.h b/spine-ue4/Plugins/RuntimeMeshComponentPlugin/Source/RuntimeMeshComponent/Public/RuntimeMeshCore.h index 76c126c35..a6c7160cb 100644 --- a/spine-ue4/Plugins/RuntimeMeshComponentPlugin/Source/RuntimeMeshComponent/Public/RuntimeMeshCore.h +++ b/spine-ue4/Plugins/RuntimeMeshComponentPlugin/Source/RuntimeMeshComponent/Public/RuntimeMeshCore.h @@ -11,6 +11,7 @@ class FRuntimeMeshVertexFactory; +#pragma warning( disable : 4265 ) template struct FRuntimeMeshVertexTraits diff --git a/spine-ue4/Plugins/RuntimeMeshComponentPlugin/Source/RuntimeMeshComponent/RuntimeMeshComponent.Build.cs b/spine-ue4/Plugins/RuntimeMeshComponentPlugin/Source/RuntimeMeshComponent/RuntimeMeshComponent.Build.cs index 53cc6d659..7ce164d5a 100644 --- a/spine-ue4/Plugins/RuntimeMeshComponentPlugin/Source/RuntimeMeshComponent/RuntimeMeshComponent.Build.cs +++ b/spine-ue4/Plugins/RuntimeMeshComponentPlugin/Source/RuntimeMeshComponent/RuntimeMeshComponent.Build.cs @@ -4,7 +4,7 @@ using UnrealBuildTool; public class RuntimeMeshComponent : ModuleRules { - public RuntimeMeshComponent(TargetInfo Target) + public RuntimeMeshComponent(ReadOnlyTargetRules Target) : base(Target) { PrivateIncludePaths.Add("RuntimeMeshComponent/Private"); PublicIncludePaths.Add("RuntimeMeshComponent/Public"); diff --git a/spine-ue4/Plugins/RuntimeMeshComponentPlugin/Source/RuntimeMeshComponentEditor/RuntimeMeshComponentEditor.Build.cs b/spine-ue4/Plugins/RuntimeMeshComponentPlugin/Source/RuntimeMeshComponentEditor/RuntimeMeshComponentEditor.Build.cs index 3d774a8d1..3c838a3b4 100644 --- a/spine-ue4/Plugins/RuntimeMeshComponentPlugin/Source/RuntimeMeshComponentEditor/RuntimeMeshComponentEditor.Build.cs +++ b/spine-ue4/Plugins/RuntimeMeshComponentPlugin/Source/RuntimeMeshComponentEditor/RuntimeMeshComponentEditor.Build.cs @@ -4,7 +4,7 @@ namespace UnrealBuildTool.Rules { public class RuntimeMeshComponentEditor : ModuleRules { - public RuntimeMeshComponentEditor(TargetInfo Target) + public RuntimeMeshComponentEditor(ReadOnlyTargetRules Target) : base(Target) { PrivateIncludePaths.Add("RuntimeMeshComponentEditor/Private"); PublicIncludePaths.Add("RuntimeMeshComponentEditor/Public"); diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineBoneDriverComponent.cpp b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineBoneDriverComponent.cpp index 8a99bc6cb..b2143b83b 100644 --- a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineBoneDriverComponent.cpp +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineBoneDriverComponent.cpp @@ -31,7 +31,6 @@ #include "SpinePluginPrivatePCH.h" USpineBoneDriverComponent::USpineBoneDriverComponent () { - bWantsBeginPlay = true; PrimaryComponentTick.bCanEverTick = true; bTickInEditor = true; bAutoActivate = true; diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineBoneFollowerComponent.cpp b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineBoneFollowerComponent.cpp index 95f391aba..3795b4850 100644 --- a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineBoneFollowerComponent.cpp +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineBoneFollowerComponent.cpp @@ -31,7 +31,6 @@ #include "SpinePluginPrivatePCH.h" USpineBoneFollowerComponent::USpineBoneFollowerComponent () { - bWantsBeginPlay = true; PrimaryComponentTick.bCanEverTick = true; bTickInEditor = true; bAutoActivate = true; diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonAnimationComponent.cpp b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonAnimationComponent.cpp index 0f7b26be6..927920bcb 100644 --- a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonAnimationComponent.cpp +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonAnimationComponent.cpp @@ -73,7 +73,6 @@ void callback(spAnimationState* state, spEventType type, spTrackEntry* entry, sp } USpineSkeletonAnimationComponent::USpineSkeletonAnimationComponent () { - bWantsBeginPlay = true; PrimaryComponentTick.bCanEverTick = true; bTickInEditor = true; bAutoActivate = true; diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonComponent.cpp b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonComponent.cpp index 050265f87..3ba93e3fc 100644 --- a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonComponent.cpp +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonComponent.cpp @@ -33,7 +33,6 @@ #define LOCTEXT_NAMESPACE "Spine" USpineSkeletonComponent::USpineSkeletonComponent () { - bWantsBeginPlay = true; PrimaryComponentTick.bCanEverTick = true; bTickInEditor = true; bAutoActivate = true; diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonRendererComponent.cpp b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonRendererComponent.cpp index b82029b8e..8a7f1d2ee 100644 --- a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonRendererComponent.cpp +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonRendererComponent.cpp @@ -37,7 +37,6 @@ USpineSkeletonRendererComponent::USpineSkeletonRendererComponent (const FObjectInitializer& ObjectInitializer) : URuntimeMeshComponent(ObjectInitializer) { - bWantsBeginPlay = true; PrimaryComponentTick.bCanEverTick = true; bTickInEditor = true; bAutoActivate = true; diff --git a/spine-ue4/Plugins/SpinePlugin/SpinePlugin.uplugin b/spine-ue4/Plugins/SpinePlugin/SpinePlugin.uplugin index 144586253..26522d915 100644 --- a/spine-ue4/Plugins/SpinePlugin/SpinePlugin.uplugin +++ b/spine-ue4/Plugins/SpinePlugin/SpinePlugin.uplugin @@ -14,16 +14,25 @@ "CanContainContent" : true, "IsBetaVersion" : false, "Installed" : false, - "Modules" : - [ - { - "Name" : "SpinePlugin", - "Type" : "Runtime", - "LoadingPhase" : "PreDefault" - }, - { - "Name" : "SpineEditorPlugin", - "Type" : "Editor" - } - ] + "Modules": [ + { + "Name": "SpinePlugin", + "Type": "Runtime", + "LoadingPhase": "PreDefault" + }, + { + "Name": "SpineEditorPlugin", + "Type": "Editor" + } + ], + "Plugins": [ + { + "Name": "ProceduralMeshComponent", + "Enabled": true + }, + { + "Name": "RuntimeMeshComponent", + "Enabled": true + } + ] } diff --git a/spine-ue4/Source/SpineUE4.Target.cs b/spine-ue4/Source/SpineUE4.Target.cs index c5288c9b5..93a71b98a 100644 --- a/spine-ue4/Source/SpineUE4.Target.cs +++ b/spine-ue4/Source/SpineUE4.Target.cs @@ -5,21 +5,9 @@ using System.Collections.Generic; public class SpineUE4Target : TargetRules { - public SpineUE4Target(TargetInfo Target) + public SpineUE4Target(TargetInfo Target) : base(Target) { - Type = TargetType.Game; - } - - // - // TargetRules interface. - // - - public override void SetupBinaries( - TargetInfo Target, - ref List OutBuildBinaryConfigurations, - ref List OutExtraModuleNames - ) - { - OutExtraModuleNames.AddRange( new string[] { "SpineUE4" } ); + Type = TargetType.Game; + ExtraModuleNames.AddRange(new string[] { "SpineUE4" }); } } diff --git a/spine-ue4/Source/SpineUE4/MySceneComponent.cpp b/spine-ue4/Source/SpineUE4/MySceneComponent.cpp new file mode 100644 index 000000000..21cbfceb6 --- /dev/null +++ b/spine-ue4/Source/SpineUE4/MySceneComponent.cpp @@ -0,0 +1,34 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#include "SpineUE4.h" +#include "MySceneComponent.h" +#include "spine/spine.h" + + +// Sets default values for this component's properties +UMySceneComponent::UMySceneComponent(const FObjectInitializer& ObjectInitializer) : USpineSkeletonRendererComponent(ObjectInitializer) +{ + // Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features + // off to improve performance if you don't need them. + PrimaryComponentTick.bCanEverTick = true; +} + + +// Called when the game starts +void UMySceneComponent::BeginPlay() +{ + Super::BeginPlay(); + + // ... + +} + + +// Called every frame +void UMySceneComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) +{ + Super::TickComponent(DeltaTime, TickType, ThisTickFunction); + + // ... +} + diff --git a/spine-ue4/Source/SpineUE4/MySceneComponent.h b/spine-ue4/Source/SpineUE4/MySceneComponent.h new file mode 100644 index 000000000..92f20d67e --- /dev/null +++ b/spine-ue4/Source/SpineUE4/MySceneComponent.h @@ -0,0 +1,30 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "Components/SceneComponent.h" +#include "SpineSkeletonRendererComponent.h" +#include "MySceneComponent.generated.h" + + +UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) ) +class SPINEUE4_API UMySceneComponent : public USpineSkeletonRendererComponent +{ + GENERATED_BODY() + +public: + // Sets default values for this component's properties + UMySceneComponent(const FObjectInitializer& ObjectInitializer); + +protected: + // Called when the game starts + virtual void BeginPlay() override; + +public: + // Called every frame + virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override; + + + +}; diff --git a/spine-ue4/Source/SpineUE4/SpineUE4.Build.cs b/spine-ue4/Source/SpineUE4/SpineUE4.Build.cs index 63503caff..28e049ca4 100644 --- a/spine-ue4/Source/SpineUE4/SpineUE4.Build.cs +++ b/spine-ue4/Source/SpineUE4/SpineUE4.Build.cs @@ -6,7 +6,7 @@ public class SpineUE4 : ModuleRules { public SpineUE4(ReadOnlyTargetRules Target) : base(Target) { - PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "SpinePlugin" }); + PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "SpinePlugin", "RuntimeMeshComponent" }); PublicIncludePaths.AddRange(new string[] { "SpinePlugin/Public", "SpinePlugin/Classes" }); PrivateDependencyModuleNames.AddRange(new string[] { }); diff --git a/spine-ue4/Source/SpineUE4Editor.Target.cs b/spine-ue4/Source/SpineUE4Editor.Target.cs index 3b5458abe..247aedbe5 100644 --- a/spine-ue4/Source/SpineUE4Editor.Target.cs +++ b/spine-ue4/Source/SpineUE4Editor.Target.cs @@ -5,21 +5,9 @@ using System.Collections.Generic; public class SpineUE4EditorTarget : TargetRules { - public SpineUE4EditorTarget(TargetInfo Target) + public SpineUE4EditorTarget(TargetInfo Target) : base(Target) { Type = TargetType.Editor; - } - - // - // TargetRules interface. - // - - public override void SetupBinaries( - TargetInfo Target, - ref List OutBuildBinaryConfigurations, - ref List OutExtraModuleNames - ) - { - OutExtraModuleNames.AddRange( new string[] { "SpineUE4" } ); + ExtraModuleNames.AddRange(new string[] { "SpineUE4" }); } } diff --git a/spine-ue4/SpineUE4.uproject b/spine-ue4/SpineUE4.uproject index 8800d1490..dbd7825f0 100644 --- a/spine-ue4/SpineUE4.uproject +++ b/spine-ue4/SpineUE4.uproject @@ -1,6 +1,6 @@ { "FileVersion": 3, - "EngineAssociation": "4.16", + "EngineAssociation": "4.17", "Category": "", "Description": "", "Modules": [ diff --git a/spine-unity/Assets/spine-unity/Mesh Generation/SpineMesh.cs b/spine-unity/Assets/spine-unity/Mesh Generation/SpineMesh.cs index 16060da32..960abc265 100644 --- a/spine-unity/Assets/spine-unity/Mesh Generation/SpineMesh.cs +++ b/spine-unity/Assets/spine-unity/Mesh Generation/SpineMesh.cs @@ -265,7 +265,7 @@ namespace Spine.Unity { bool hasSeparators = separatorCount > 0; int clippingAttachmentSource = -1; - int lastPreActiveClipping = -1; + int lastPreActiveClipping = -1; // The index of the last slot that had an active ClippingAttachment. SlotData clippingEndSlot = null; int submeshIndex = 0; var drawOrderItems = drawOrder.Items; @@ -327,7 +327,7 @@ namespace Spine.Unity { } if (noRender) { - if (current.forceSeparate && generateMeshOverride && current.rawVertexCount > 0) { + if (current.forceSeparate && generateMeshOverride) { // && current.rawVertexCount > 0) { { // Add current.endSlot = i; current.preActiveClippingSlotSource = lastPreActiveClipping; diff --git a/spine-unity/Assets/spine-unity/Modules/Ghost/SkeletonGhost.cs b/spine-unity/Assets/spine-unity/Modules/Ghost/SkeletonGhost.cs index 5dea4e182..365d1272c 100644 --- a/spine-unity/Assets/spine-unity/Modules/Ghost/SkeletonGhost.cs +++ b/spine-unity/Assets/spine-unity/Modules/Ghost/SkeletonGhost.cs @@ -155,8 +155,10 @@ namespace Spine.Unity.Modules { } void OnDestroy () { - for (int i = 0; i < maximumGhosts; i++) - if (pool[i] != null) pool[i].Cleanup(); + if (pool != null) { + for (int i = 0; i < maximumGhosts; i++) + if (pool[i] != null) pool[i].Cleanup(); + } foreach (var mat in materialTable.Values) Destroy(mat); diff --git a/spine-unity/Assets/spine-unity/SkeletonAnimator.cs b/spine-unity/Assets/spine-unity/SkeletonAnimator.cs index 0337eedc4..558f2177e 100644 --- a/spine-unity/Assets/spine-unity/SkeletonAnimator.cs +++ b/spine-unity/Assets/spine-unity/SkeletonAnimator.cs @@ -36,7 +36,7 @@ using System.Collections.Generic; namespace Spine.Unity { [RequireComponent(typeof(Animator))] public class SkeletonAnimator : SkeletonRenderer, ISkeletonAnimation { - + [SerializeField] protected MecanimTranslator translator; public MecanimTranslator Translator { get { return translator; } } @@ -108,9 +108,13 @@ namespace Spine.Unity { public enum MixMode { AlwaysMix, MixNext, SpineStyle } - readonly Dictionary animationTable = new Dictionary(); - readonly Dictionary clipNameHashCodeTable = new Dictionary(); + readonly Dictionary animationTable = new Dictionary(IntEqualityComparer.Instance); + readonly Dictionary clipNameHashCodeTable = new Dictionary(AnimationClipEqualityComparer.Instance); readonly List previousAnimations = new List(); + #if UNITY_2017_1_OR_NEWER + readonly List clipInfoCache = new List(); + readonly List nextClipInfoCache = new List(); + #endif Animator animator; public Animator Animator { get { return this.animator; } } @@ -144,16 +148,19 @@ namespace Spine.Unity { AnimatorStateInfo nextStateInfo = animator.GetNextAnimatorStateInfo(layer); bool hasNext = nextStateInfo.fullPathHash != 0; - AnimatorClipInfo[] clipInfo = animator.GetCurrentAnimatorClipInfo(layer); - AnimatorClipInfo[] nextClipInfo = animator.GetNextAnimatorClipInfo(layer); - for (int c = 0; c < clipInfo.Length; c++) { + int clipInfoCount, nextClipInfoCount; + IList clipInfo, nextClipInfo; + GetAnimatorClipInfos(layer, out clipInfoCount, out nextClipInfoCount, out clipInfo, out nextClipInfo); + + for (int c = 0; c < clipInfoCount; c++) { var info = clipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue; previousAnimations.Add(animationTable[NameHashCode(info.clip)]); } + if (hasNext) { - for (int c = 0; c < nextClipInfo.Length; c++) { + for (int c = 0; c < nextClipInfoCount; c++) { var info = nextClipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue; previousAnimations.Add(animationTable[NameHashCode(info.clip)]); @@ -169,22 +176,20 @@ namespace Spine.Unity { AnimatorStateInfo nextStateInfo = animator.GetNextAnimatorStateInfo(layer); bool hasNext = nextStateInfo.fullPathHash != 0; - AnimatorClipInfo[] clipInfo = animator.GetCurrentAnimatorClipInfo(layer); - AnimatorClipInfo[] nextClipInfo = animator.GetNextAnimatorClipInfo(layer); - //UNITY 4 - //bool hasNext = nextStateInfo.nameHash != 0; - //var clipInfo = animator.GetCurrentAnimationClipState(i); - //var nextClipInfo = animator.GetNextAnimationClipState(i); + + int clipInfoCount, nextClipInfoCount; + IList clipInfo, nextClipInfo; + GetAnimatorClipInfos(layer, out clipInfoCount, out nextClipInfoCount, out clipInfo, out nextClipInfo); MixMode mode = layerMixModes[layer]; if (mode == MixMode.AlwaysMix) { // Always use Mix instead of Applying the first non-zero weighted clip. - for (int c = 0; c < clipInfo.Length; c++) { + for (int c = 0; c < clipInfoCount; c++) { var info = clipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue; animationTable[NameHashCode(info.clip)].Apply(skeleton, 0, AnimationTime(stateInfo.normalizedTime, info.clip.length, stateInfo.loop, stateInfo.speed < 0), stateInfo.loop, null, weight, MixPose.Current, MixDirection.In); } if (hasNext) { - for (int c = 0; c < nextClipInfo.Length; c++) { + for (int c = 0; c < nextClipInfoCount; c++) { var info = nextClipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue; animationTable[NameHashCode(info.clip)].Apply(skeleton, 0, AnimationTime(nextStateInfo.normalizedTime , info.clip.length,nextStateInfo.speed < 0), nextStateInfo.loop, null, weight, MixPose.Current, MixDirection.In); } @@ -192,13 +197,13 @@ namespace Spine.Unity { } else { // case MixNext || SpineStyle // Apply first non-zero weighted clip int c = 0; - for (; c < clipInfo.Length; c++) { + for (; c < clipInfoCount; c++) { var info = clipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue; animationTable[NameHashCode(info.clip)].Apply(skeleton, 0, AnimationTime(stateInfo.normalizedTime, info.clip.length, stateInfo.loop, stateInfo.speed < 0), stateInfo.loop, null, 1f, MixPose.Current, MixDirection.In); break; } // Mix the rest - for (; c < clipInfo.Length; c++) { + for (; c < clipInfoCount; c++) { var info = clipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue; animationTable[NameHashCode(info.clip)].Apply(skeleton, 0, AnimationTime(stateInfo.normalizedTime, info.clip.length, stateInfo.loop, stateInfo.speed < 0), stateInfo.loop, null, weight, MixPose.Current, MixDirection.In); } @@ -207,14 +212,14 @@ namespace Spine.Unity { if (hasNext) { // Apply next clip directly instead of mixing (ie: no crossfade, ignores mecanim transition weights) if (mode == MixMode.SpineStyle) { - for (; c < nextClipInfo.Length; c++) { + for (; c < nextClipInfoCount; c++) { var info = nextClipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue; animationTable[NameHashCode(info.clip)].Apply(skeleton, 0, AnimationTime(nextStateInfo.normalizedTime , info.clip.length,nextStateInfo.speed < 0), nextStateInfo.loop, null, 1f, MixPose.Current, MixDirection.In); break; } } // Mix the rest - for (; c < nextClipInfo.Length; c++) { + for (; c < nextClipInfoCount; c++) { var info = nextClipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue; animationTable[NameHashCode(info.clip)].Apply(skeleton, 0, AnimationTime(nextStateInfo.normalizedTime , info.clip.length,nextStateInfo.speed < 0), nextStateInfo.loop, null, weight, MixPose.Current, MixDirection.In); } @@ -239,6 +244,31 @@ namespace Spine.Unity { return normalizedTime * clipLength; } + void GetAnimatorClipInfos ( + int layer, + out int clipInfoCount, + out int nextClipInfoCount, + out IList clipInfo, + out IList nextClipInfo) { + #if UNITY_2017_1_OR_NEWER + clipInfoCount = animator.GetCurrentAnimatorClipInfoCount(layer); + nextClipInfoCount = animator.GetNextAnimatorClipInfoCount(layer); + if (clipInfoCache.Capacity < clipInfoCount) clipInfoCache.Capacity = clipInfoCount; + if (nextClipInfoCache.Capacity < nextClipInfoCount) nextClipInfoCache.Capacity = nextClipInfoCount; + animator.GetCurrentAnimatorClipInfo(layer, clipInfoCache); + animator.GetNextAnimatorClipInfo(layer, nextClipInfoCache); + + clipInfo = clipInfoCache; + nextClipInfo = nextClipInfoCache; + #else + clipInfo = animator.GetCurrentAnimatorClipInfo(layer); + nextClipInfo = animator.GetNextAnimatorClipInfo(layer); + + clipInfoCount = clipInfo.Count; + nextClipInfoCount = nextClipInfo.Count; + #endif + } + int NameHashCode (AnimationClip clip) { int clipNameHashCode; if (!clipNameHashCodeTable.TryGetValue(clip, out clipNameHashCode)) { @@ -247,6 +277,24 @@ namespace Spine.Unity { } return clipNameHashCode; } + + class AnimationClipEqualityComparer : IEqualityComparer { + internal static readonly IEqualityComparer Instance = new AnimationClipEqualityComparer(); + + public bool Equals (AnimationClip x, AnimationClip y) { + return x.GetInstanceID() == y.GetInstanceID(); + } + + public int GetHashCode (AnimationClip o) { + return o.GetInstanceID(); + } + } + + class IntEqualityComparer : IEqualityComparer { + internal static readonly IEqualityComparer Instance = new IntEqualityComparer(); + public bool Equals (int x, int y) { return x == y; } + public int GetHashCode(int o) { return o; } + } } }