mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-22 02:06:03 +08:00
[c] Timeline type and debugging prints.
This commit is contained in:
parent
a71d73928d
commit
69f0873122
@ -78,6 +78,34 @@ SP_API int /*bool*/ spAnimation_hasTimeline(spAnimation* self, spPropertyId* ids
|
|||||||
SP_API 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, spMixBlend blend, spMixDirection direction);
|
spEvent** events, int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction);
|
||||||
|
|
||||||
|
/**/
|
||||||
|
typedef enum {
|
||||||
|
SP_TIMELINE_ATTACHMENT,
|
||||||
|
SP_TIMELINE_ALPHA,
|
||||||
|
SP_TIMELINE_PATHCONSTRAINTPOSITION,
|
||||||
|
SP_TIMELINE_PATHCONSTRAINTSPACING,
|
||||||
|
SP_TIMELINE_ROTATE,
|
||||||
|
SP_TIMELINE_SCALEX,
|
||||||
|
SP_TIMELINE_SCALEY,
|
||||||
|
SP_TIMELINE_SHEARX,
|
||||||
|
SP_TIMELINE_SHEARY,
|
||||||
|
SP_TIMELINE_TRANSLATEX,
|
||||||
|
SP_TIMELINE_TRANSLATEY,
|
||||||
|
SP_TIMELINE_SCALE,
|
||||||
|
SP_TIMELINE_SHEAR,
|
||||||
|
SP_TIMELINE_TRANSLATE,
|
||||||
|
SP_TIMELINE_DEFORM,
|
||||||
|
SP_TIMELINE_IKCONSTRAINT,
|
||||||
|
SP_TIMELINE_PATHCONSTRAINTMIX,
|
||||||
|
SP_TIMELINE_RGB2,
|
||||||
|
SP_TIMELINE_RGBA2,
|
||||||
|
SP_TIMELINE_RGBA,
|
||||||
|
SP_TIMELINE_RGB,
|
||||||
|
SP_TIMELINE_TRANSFORMCONSTRAINT,
|
||||||
|
SP_TIMELINE_DRAWORDER,
|
||||||
|
SP_TIMELINE_EVENT
|
||||||
|
} spTimelineType;
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -119,13 +147,13 @@ struct spTimeline {
|
|||||||
spFloatArray *frames;
|
spFloatArray *frames;
|
||||||
int frameCount;
|
int frameCount;
|
||||||
int frameEntries;
|
int frameEntries;
|
||||||
|
spTimelineType type;
|
||||||
};
|
};
|
||||||
|
|
||||||
SP_API void spTimeline_dispose (spTimeline* self);
|
SP_API void spTimeline_dispose (spTimeline* self);
|
||||||
SP_API void spTimeline_apply (spTimeline* self, struct spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents,
|
SP_API void spTimeline_apply (spTimeline* self, struct spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents,
|
||||||
int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction);
|
int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction);
|
||||||
SP_API void spTimeline_setBezier(spTimeline* self, int bezier, int frame, float value, float time1, float value1, float cx1, float cy1, float cx2, float cy2, float time2, float value2);
|
SP_API void spTimeline_setBezier(spTimeline* self, int bezier, int frame, float value, float time1, float value1, float cx1, float cy1, float cx2, float cy2, float time2, float value2);
|
||||||
SP_API int spTimeline_getFrameCount (const spTimeline* self);
|
|
||||||
SP_API float spTimeline_getDuration (const spTimeline* self);
|
SP_API float spTimeline_getDuration (const spTimeline* self);
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
54
spine-c/spine-c/include/spine/Debug.h
Normal file
54
spine-c/spine-c/include/spine/Debug.h
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Spine Runtimes License Agreement
|
||||||
|
* Last updated January 1, 2020. Replaces all prior versions.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||||
|
*
|
||||||
|
* Integration of the Spine Runtimes into software or otherwise creating
|
||||||
|
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||||
|
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||||
|
* http://esotericsoftware.com/spine-editor-license
|
||||||
|
*
|
||||||
|
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||||
|
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||||
|
* "Products"), provided that each user of the Products must obtain their own
|
||||||
|
* Spine Editor license and redistribution of the Products in any form must
|
||||||
|
* include this license and copyright notice.
|
||||||
|
*
|
||||||
|
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "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 LLC 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
|
||||||
|
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef SPINE_DEBUG_H_
|
||||||
|
#define SPINE_DEBUG_H_
|
||||||
|
|
||||||
|
#include <spine/spine.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void spDebug_printSkeletonData(spSkeletonData* skeletonData);
|
||||||
|
void spDebug_printAnimation(spAnimation* animation);
|
||||||
|
void spDebug_printTimeline(spTimeline* timeline);
|
||||||
|
void spDebug_printBoneDatas(spBoneData** boneDatas, int numBoneDatas);
|
||||||
|
void spDebug_printBoneData(spBoneData* boneData);
|
||||||
|
|
||||||
|
void spDebug_printSkeleton(spSkeleton* skeleton);
|
||||||
|
void spDebug_printBones(spBone** bones, int numBones);
|
||||||
|
void spDebug_printBone(spBone* bone);
|
||||||
|
void spDebug_printFloats(float *values, int numFloats);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -104,6 +104,7 @@ void _spTimeline_init (spTimeline* self,
|
|||||||
int frameEntries,
|
int frameEntries,
|
||||||
spPropertyId* propertyIds,
|
spPropertyId* propertyIds,
|
||||||
int propertyIdsCount,
|
int propertyIdsCount,
|
||||||
|
spTimelineType type,
|
||||||
void (*dispose) (spTimeline* self),
|
void (*dispose) (spTimeline* self),
|
||||||
void (*apply) (spTimeline* self, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents,
|
void (*apply) (spTimeline* self, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents,
|
||||||
int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction),
|
int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction),
|
||||||
@ -115,13 +116,16 @@ void _spTimeline_init (spTimeline* self,
|
|||||||
self->frames->size = frameCount * frameEntries;
|
self->frames->size = frameCount * frameEntries;
|
||||||
self->frameCount = frameCount;
|
self->frameCount = frameCount;
|
||||||
self->frameEntries = frameEntries;
|
self->frameEntries = frameEntries;
|
||||||
self->vtable.dispose = dispose;
|
|
||||||
self->vtable.apply = apply;
|
|
||||||
self->vtable.setBezier = setBezier;
|
|
||||||
|
|
||||||
for (i = 0, n = propertyIdsCount; i < n; i++)
|
for (i = 0, n = propertyIdsCount; i < n; i++)
|
||||||
self->propertyIds[i] = propertyIds[i];
|
self->propertyIds[i] = propertyIds[i];
|
||||||
self->propertyIdsCount = propertyIdsCount;
|
self->propertyIdsCount = propertyIdsCount;
|
||||||
|
|
||||||
|
self->type = type;
|
||||||
|
|
||||||
|
self->vtable.dispose = dispose;
|
||||||
|
self->vtable.apply = apply;
|
||||||
|
self->vtable.setBezier = setBezier;
|
||||||
}
|
}
|
||||||
|
|
||||||
void spTimeline_dispose (spTimeline* self) {
|
void spTimeline_dispose (spTimeline* self) {
|
||||||
@ -140,10 +144,6 @@ void spTimeline_setBezier(spTimeline* self, int bezier, int frame, float value,
|
|||||||
self->vtable.setBezier(self, bezier, frame, value, time1, value1, cx1, cy1, cx2, cy2, time2, value2);
|
self->vtable.setBezier(self, bezier, frame, value, time1, value1, cx1, cy1, cx2, cy2, time2, value2);
|
||||||
}
|
}
|
||||||
|
|
||||||
int spTimeline_getFrameCount (const spTimeline* self) {
|
|
||||||
return self->frameCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
float spTimeline_getDuration (const spTimeline* self) {
|
float spTimeline_getDuration (const spTimeline* self) {
|
||||||
return self->frames->items[self->frames->size - self->frameEntries];
|
return self->frames->items[self->frames->size - self->frameEntries];
|
||||||
}
|
}
|
||||||
@ -161,12 +161,13 @@ void _spCurveTimeline_init (spCurveTimeline* self,
|
|||||||
int bezierCount,
|
int bezierCount,
|
||||||
spPropertyId* propertyIds,
|
spPropertyId* propertyIds,
|
||||||
int propertyIdsCount,
|
int propertyIdsCount,
|
||||||
|
spTimelineType type,
|
||||||
void (*dispose) (spTimeline* self),
|
void (*dispose) (spTimeline* self),
|
||||||
void (*apply) (spTimeline* self, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents,
|
void (*apply) (spTimeline* self, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents,
|
||||||
int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction),
|
int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction),
|
||||||
void (*setBezier) (spTimeline* self, int bezier, int frame, float value, float time1, float value1, float cx1, float cy1,
|
void (*setBezier) (spTimeline* self, int bezier, int frame, float value, float time1, float value1, float cx1, float cy1,
|
||||||
float cx2, float cy2, float time2, float value2)) {
|
float cx2, float cy2, float time2, float value2)) {
|
||||||
_spTimeline_init(SUPER(self), frameCount, frameEntries, propertyIds, propertyIdsCount, dispose, apply, setBezier);
|
_spTimeline_init(SUPER(self), frameCount, frameEntries, propertyIds, propertyIdsCount, type, dispose, apply, setBezier);
|
||||||
self->curves = spFloatArray_create(frameCount + bezierCount * BEZIER_SIZE);
|
self->curves = spFloatArray_create(frameCount + bezierCount * BEZIER_SIZE);
|
||||||
self->curves->size = frameCount + bezierCount * BEZIER_SIZE;
|
self->curves->size = frameCount + bezierCount * BEZIER_SIZE;
|
||||||
}
|
}
|
||||||
@ -178,7 +179,7 @@ void _spCurveTimeline_dispose (spTimeline* self) {
|
|||||||
void _spCurveTimeline_setBezier (spTimeline* timeline, int bezier, int frame, float value, float time1, float value1, float cx1, float cy1, float cx2, float cy2, float time2, float value2) {
|
void _spCurveTimeline_setBezier (spTimeline* timeline, int bezier, int frame, float value, float time1, float value1, float cx1, float cy1, float cx2, float cy2, float time2, float value2) {
|
||||||
spCurveTimeline *self = SUB_CAST(spCurveTimeline, timeline);
|
spCurveTimeline *self = SUB_CAST(spCurveTimeline, timeline);
|
||||||
float tmpx, tmpy, dddx, dddy,ddx, ddy, dx, dy, x, y;
|
float tmpx, tmpy, dddx, dddy,ddx, ddy, dx, dy, x, y;
|
||||||
int i = spTimeline_getFrameCount(SUPER(self)) + bezier * BEZIER_SIZE, n;
|
int i = self->super.frameCount + bezier * BEZIER_SIZE, n;
|
||||||
float* curves = self->curves->items;
|
float* curves = self->curves->items;
|
||||||
if (value == 0) curves[frame] = CURVE_BEZIER + i;
|
if (value == 0) curves[frame] = CURVE_BEZIER + i;
|
||||||
tmpx = (time1 - cx1 * 2 + cx2) * 0.03; tmpy = (value1 - cy1 * 2 + cy2) * 0.03;
|
tmpx = (time1 - cx1 * 2 + cx2) * 0.03; tmpy = (value1 - cy1 * 2 + cy2) * 0.03;
|
||||||
@ -321,7 +322,7 @@ spRotateTimeline* spRotateTimeline_create (int frameCount, int bezierCount, int
|
|||||||
spRotateTimeline* timeline = NEW(spRotateTimeline);
|
spRotateTimeline* timeline = NEW(spRotateTimeline);
|
||||||
spPropertyId ids[1];
|
spPropertyId ids[1];
|
||||||
ids[0] = ((spPropertyId)SP_PROPERTY_ROTATE << 32) | boneIndex;
|
ids[0] = ((spPropertyId)SP_PROPERTY_ROTATE << 32) | boneIndex;
|
||||||
_spCurveTimeline_init(SUPER(timeline), frameCount, CURVE1_ENTRIES, bezierCount, ids, 1, _spCurveTimeline_dispose, _spRotateTimeline_apply, _spCurveTimeline_setBezier);
|
_spCurveTimeline_init(SUPER(timeline), frameCount, CURVE1_ENTRIES, bezierCount, ids, 1, SP_TIMELINE_ROTATE, _spCurveTimeline_dispose, _spRotateTimeline_apply, _spCurveTimeline_setBezier);
|
||||||
timeline->boneIndex = boneIndex;
|
timeline->boneIndex = boneIndex;
|
||||||
return timeline;
|
return timeline;
|
||||||
}
|
}
|
||||||
@ -409,7 +410,7 @@ spTranslateTimeline* spTranslateTimeline_create (int frameCount, int bezierCount
|
|||||||
spPropertyId ids[2];
|
spPropertyId ids[2];
|
||||||
ids[0] = ((spPropertyId)SP_PROPERTY_X << 32) | boneIndex;
|
ids[0] = ((spPropertyId)SP_PROPERTY_X << 32) | boneIndex;
|
||||||
ids[1] = ((spPropertyId)SP_PROPERTY_Y << 32) | boneIndex;
|
ids[1] = ((spPropertyId)SP_PROPERTY_Y << 32) | boneIndex;
|
||||||
_spCurveTimeline_init(SUPER(timeline), frameCount, CURVE2_ENTRIES, bezierCount, ids, 2, _spCurveTimeline_dispose, _spTranslateTimeline_apply, _spCurveTimeline_setBezier);
|
_spCurveTimeline_init(SUPER(timeline), frameCount, CURVE2_ENTRIES, bezierCount, ids, 2, SP_TIMELINE_TRANSLATE, _spCurveTimeline_dispose, _spTranslateTimeline_apply, _spCurveTimeline_setBezier);
|
||||||
timeline->boneIndex = boneIndex;
|
timeline->boneIndex = boneIndex;
|
||||||
return timeline;
|
return timeline;
|
||||||
}
|
}
|
||||||
@ -467,7 +468,7 @@ spTranslateXTimeline* spTranslateXTimeline_create (int frameCount, int bezierCou
|
|||||||
spTranslateXTimeline* timeline = NEW(spTranslateXTimeline);
|
spTranslateXTimeline* timeline = NEW(spTranslateXTimeline);
|
||||||
spPropertyId ids[1];
|
spPropertyId ids[1];
|
||||||
ids[0] = ((spPropertyId)SP_PROPERTY_X << 32) | boneIndex;
|
ids[0] = ((spPropertyId)SP_PROPERTY_X << 32) | boneIndex;
|
||||||
_spCurveTimeline_init(SUPER(timeline), frameCount, CURVE1_ENTRIES, bezierCount, ids, 1, _spCurveTimeline_dispose, _spTranslateXTimeline_apply, _spCurveTimeline_setBezier);
|
_spCurveTimeline_init(SUPER(timeline), frameCount, CURVE1_ENTRIES, bezierCount, ids, 1, SP_TIMELINE_TRANSLATEX, _spCurveTimeline_dispose, _spTranslateXTimeline_apply, _spCurveTimeline_setBezier);
|
||||||
timeline->boneIndex = boneIndex;
|
timeline->boneIndex = boneIndex;
|
||||||
return timeline;
|
return timeline;
|
||||||
}
|
}
|
||||||
@ -525,7 +526,7 @@ spTranslateYTimeline* spTranslateYTimeline_create (int frameCount, int bezierCou
|
|||||||
spTranslateYTimeline* timeline = NEW(spTranslateYTimeline);
|
spTranslateYTimeline* timeline = NEW(spTranslateYTimeline);
|
||||||
spPropertyId ids[1];
|
spPropertyId ids[1];
|
||||||
ids[0] = ((spPropertyId)SP_PROPERTY_Y << 32) | boneIndex;
|
ids[0] = ((spPropertyId)SP_PROPERTY_Y << 32) | boneIndex;
|
||||||
_spCurveTimeline_init(SUPER(timeline), frameCount, CURVE1_ENTRIES, bezierCount, ids, 1, _spCurveTimeline_dispose, _spTranslateYTimeline_apply, _spCurveTimeline_setBezier);
|
_spCurveTimeline_init(SUPER(timeline), frameCount, CURVE1_ENTRIES, bezierCount, ids, 1, SP_TIMELINE_TRANSLATEY, _spCurveTimeline_dispose, _spTranslateYTimeline_apply, _spCurveTimeline_setBezier);
|
||||||
timeline->boneIndex = boneIndex;
|
timeline->boneIndex = boneIndex;
|
||||||
return timeline;
|
return timeline;
|
||||||
}
|
}
|
||||||
@ -653,7 +654,7 @@ spScaleTimeline* spScaleTimeline_create (int frameCount, int bezierCount, int bo
|
|||||||
spPropertyId ids[2];
|
spPropertyId ids[2];
|
||||||
ids[0] = ((spPropertyId)SP_PROPERTY_SCALEX << 32) | boneIndex;
|
ids[0] = ((spPropertyId)SP_PROPERTY_SCALEX << 32) | boneIndex;
|
||||||
ids[1] = ((spPropertyId)SP_PROPERTY_SCALEY << 32) | boneIndex;
|
ids[1] = ((spPropertyId)SP_PROPERTY_SCALEY << 32) | boneIndex;
|
||||||
_spCurveTimeline_init(SUPER(timeline), frameCount, CURVE2_ENTRIES, bezierCount, ids, 2, _spCurveTimeline_dispose, _spScaleTimeline_apply, _spCurveTimeline_setBezier);
|
_spCurveTimeline_init(SUPER(timeline), frameCount, CURVE2_ENTRIES, bezierCount, ids, 2, SP_TIMELINE_SCALE, _spCurveTimeline_dispose, _spScaleTimeline_apply, _spCurveTimeline_setBezier);
|
||||||
timeline->boneIndex = boneIndex;
|
timeline->boneIndex = boneIndex;
|
||||||
return timeline;
|
return timeline;
|
||||||
}
|
}
|
||||||
@ -739,7 +740,7 @@ spScaleXTimeline* spScaleXTimeline_create (int frameCount, int bezierCount, int
|
|||||||
spScaleXTimeline* timeline = NEW(spScaleXTimeline);
|
spScaleXTimeline* timeline = NEW(spScaleXTimeline);
|
||||||
spPropertyId ids[1];
|
spPropertyId ids[1];
|
||||||
ids[0] = ((spPropertyId)SP_PROPERTY_SCALEX << 32) | boneIndex;
|
ids[0] = ((spPropertyId)SP_PROPERTY_SCALEX << 32) | boneIndex;
|
||||||
_spCurveTimeline_init(SUPER(timeline), frameCount, CURVE1_ENTRIES, bezierCount, ids, 1, _spCurveTimeline_dispose, _spScaleXTimeline_apply, _spCurveTimeline_setBezier);
|
_spCurveTimeline_init(SUPER(timeline), frameCount, CURVE1_ENTRIES, bezierCount, ids, 1, SP_TIMELINE_SCALEX, _spCurveTimeline_dispose, _spScaleXTimeline_apply, _spCurveTimeline_setBezier);
|
||||||
timeline->boneIndex = boneIndex;
|
timeline->boneIndex = boneIndex;
|
||||||
return timeline;
|
return timeline;
|
||||||
}
|
}
|
||||||
@ -825,7 +826,7 @@ spScaleYTimeline* spScaleYTimeline_create (int frameCount, int bezierCount, int
|
|||||||
spScaleYTimeline* timeline = NEW(spScaleYTimeline);
|
spScaleYTimeline* timeline = NEW(spScaleYTimeline);
|
||||||
spPropertyId ids[1];
|
spPropertyId ids[1];
|
||||||
ids[0] = ((spPropertyId)SP_PROPERTY_SCALEY << 32) | boneIndex;
|
ids[0] = ((spPropertyId)SP_PROPERTY_SCALEY << 32) | boneIndex;
|
||||||
_spCurveTimeline_init(SUPER(timeline), frameCount, CURVE1_ENTRIES, bezierCount, ids, 1, _spCurveTimeline_dispose, _spScaleYTimeline_apply, _spCurveTimeline_setBezier);
|
_spCurveTimeline_init(SUPER(timeline), frameCount, CURVE1_ENTRIES, bezierCount, ids, 1, SP_TIMELINE_SCALEY, _spCurveTimeline_dispose, _spScaleYTimeline_apply, _spCurveTimeline_setBezier);
|
||||||
timeline->boneIndex = boneIndex;
|
timeline->boneIndex = boneIndex;
|
||||||
return timeline;
|
return timeline;
|
||||||
}
|
}
|
||||||
@ -912,7 +913,7 @@ spShearTimeline* spShearTimeline_create (int frameCount, int bezierCount, int bo
|
|||||||
spPropertyId ids[2];
|
spPropertyId ids[2];
|
||||||
ids[0] = ((spPropertyId)SP_PROPERTY_SHEARX << 32) | boneIndex;
|
ids[0] = ((spPropertyId)SP_PROPERTY_SHEARX << 32) | boneIndex;
|
||||||
ids[1] = ((spPropertyId)SP_PROPERTY_SHEARY << 32) | boneIndex;
|
ids[1] = ((spPropertyId)SP_PROPERTY_SHEARY << 32) | boneIndex;
|
||||||
_spCurveTimeline_init(SUPER(timeline), frameCount, CURVE2_ENTRIES, bezierCount, ids, 2, _spCurveTimeline_dispose, _spShearTimeline_apply, _spCurveTimeline_setBezier);
|
_spCurveTimeline_init(SUPER(timeline), frameCount, CURVE2_ENTRIES, bezierCount, ids, 2, SP_TIMELINE_SHEAR, _spCurveTimeline_dispose, _spShearTimeline_apply, _spCurveTimeline_setBezier);
|
||||||
timeline->boneIndex = boneIndex;
|
timeline->boneIndex = boneIndex;
|
||||||
return timeline;
|
return timeline;
|
||||||
}
|
}
|
||||||
@ -969,7 +970,7 @@ spShearXTimeline* spShearXTimeline_create (int frameCount, int bezierCount, int
|
|||||||
spShearXTimeline* timeline = NEW(spShearXTimeline);
|
spShearXTimeline* timeline = NEW(spShearXTimeline);
|
||||||
spPropertyId ids[1];
|
spPropertyId ids[1];
|
||||||
ids[0] = ((spPropertyId)SP_PROPERTY_SHEARX << 32) | boneIndex;
|
ids[0] = ((spPropertyId)SP_PROPERTY_SHEARX << 32) | boneIndex;
|
||||||
_spCurveTimeline_init(SUPER(timeline), frameCount, CURVE1_ENTRIES, bezierCount, ids, 1, _spCurveTimeline_dispose, _spShearXTimeline_apply, _spCurveTimeline_setBezier);
|
_spCurveTimeline_init(SUPER(timeline), frameCount, CURVE1_ENTRIES, bezierCount, ids, 1, SP_TIMELINE_SHEARX, _spCurveTimeline_dispose, _spShearXTimeline_apply, _spCurveTimeline_setBezier);
|
||||||
timeline->boneIndex = boneIndex;
|
timeline->boneIndex = boneIndex;
|
||||||
return timeline;
|
return timeline;
|
||||||
}
|
}
|
||||||
@ -1027,7 +1028,7 @@ spShearYTimeline* spShearYTimeline_create (int frameCount, int bezierCount, int
|
|||||||
spShearYTimeline* timeline = NEW(spShearYTimeline);
|
spShearYTimeline* timeline = NEW(spShearYTimeline);
|
||||||
spPropertyId ids[1];
|
spPropertyId ids[1];
|
||||||
ids[0] = ((spPropertyId)SP_PROPERTY_SHEARY << 32) | boneIndex;
|
ids[0] = ((spPropertyId)SP_PROPERTY_SHEARY << 32) | boneIndex;
|
||||||
_spCurveTimeline_init(SUPER(timeline), frameCount, CURVE1_ENTRIES, bezierCount, ids, 1, _spCurveTimeline_dispose, _spShearYTimeline_apply, _spCurveTimeline_setBezier);
|
_spCurveTimeline_init(SUPER(timeline), frameCount, CURVE1_ENTRIES, bezierCount, ids, 1, SP_TIMELINE_SHEARY, _spCurveTimeline_dispose, _spShearYTimeline_apply, _spCurveTimeline_setBezier);
|
||||||
timeline->boneIndex = boneIndex;
|
timeline->boneIndex = boneIndex;
|
||||||
return timeline;
|
return timeline;
|
||||||
}
|
}
|
||||||
@ -1123,7 +1124,7 @@ spRGBATimeline* spRGBATimeline_create (int framesCount, int bezierCount, int slo
|
|||||||
spPropertyId ids[2];
|
spPropertyId ids[2];
|
||||||
ids[0] = ((spPropertyId)SP_PROPERTY_RGB << 32) | slotIndex;
|
ids[0] = ((spPropertyId)SP_PROPERTY_RGB << 32) | slotIndex;
|
||||||
ids[1] = ((spPropertyId)SP_PROPERTY_ALPHA << 32) | slotIndex;
|
ids[1] = ((spPropertyId)SP_PROPERTY_ALPHA << 32) | slotIndex;
|
||||||
_spCurveTimeline_init(SUPER(timeline), framesCount, RGBA_ENTRIES, bezierCount, ids, 2, _spCurveTimeline_dispose, _spRGBATimeline_apply, _spCurveTimeline_setBezier);
|
_spCurveTimeline_init(SUPER(timeline), framesCount, RGBA_ENTRIES, bezierCount, ids, 2, SP_TIMELINE_RGBA, _spCurveTimeline_dispose, _spRGBATimeline_apply, _spCurveTimeline_setBezier);
|
||||||
timeline->slotIndex = slotIndex;
|
timeline->slotIndex = slotIndex;
|
||||||
return timeline;
|
return timeline;
|
||||||
}
|
}
|
||||||
@ -1225,7 +1226,7 @@ spRGBTimeline* spRGBTimeline_create (int framesCount, int bezierCount, int slotI
|
|||||||
spRGBTimeline* timeline = NEW(spRGBTimeline);
|
spRGBTimeline* timeline = NEW(spRGBTimeline);
|
||||||
spPropertyId ids[1];
|
spPropertyId ids[1];
|
||||||
ids[0] = ((spPropertyId)SP_PROPERTY_RGB << 32) | slotIndex;
|
ids[0] = ((spPropertyId)SP_PROPERTY_RGB << 32) | slotIndex;
|
||||||
_spCurveTimeline_init(SUPER(timeline), framesCount, RGB_ENTRIES, bezierCount, ids, 1, _spCurveTimeline_dispose, _spRGBTimeline_apply, _spCurveTimeline_setBezier);
|
_spCurveTimeline_init(SUPER(timeline), framesCount, RGB_ENTRIES, bezierCount, ids, 1, SP_TIMELINE_RGB, _spCurveTimeline_dispose, _spRGBTimeline_apply, _spCurveTimeline_setBezier);
|
||||||
timeline->slotIndex = slotIndex;
|
timeline->slotIndex = slotIndex;
|
||||||
return timeline;
|
return timeline;
|
||||||
}
|
}
|
||||||
@ -1286,7 +1287,7 @@ spAlphaTimeline* spAlphaTimeline_create (int frameCount, int bezierCount, int sl
|
|||||||
spAlphaTimeline* timeline = NEW(spAlphaTimeline);
|
spAlphaTimeline* timeline = NEW(spAlphaTimeline);
|
||||||
spPropertyId ids[1];
|
spPropertyId ids[1];
|
||||||
ids[0] = ((spPropertyId)SP_PROPERTY_ALPHA << 32) | slotIndex;
|
ids[0] = ((spPropertyId)SP_PROPERTY_ALPHA << 32) | slotIndex;
|
||||||
_spCurveTimeline_init(SUPER(timeline), frameCount, CURVE1_ENTRIES, bezierCount, ids, 1, _spCurveTimeline_dispose, _spAlphaTimeline_apply, _spCurveTimeline_setBezier);
|
_spCurveTimeline_init(SUPER(timeline), frameCount, CURVE1_ENTRIES, bezierCount, ids, 1, SP_TIMELINE_ALPHA, _spCurveTimeline_dispose, _spAlphaTimeline_apply, _spCurveTimeline_setBezier);
|
||||||
timeline->slotIndex = slotIndex;
|
timeline->slotIndex = slotIndex;
|
||||||
return timeline;
|
return timeline;
|
||||||
}
|
}
|
||||||
@ -1411,7 +1412,7 @@ spRGBA2Timeline* spRGBA2Timeline_create (int framesCount, int bezierCount, int s
|
|||||||
ids[0] = ((spPropertyId)SP_PROPERTY_RGB << 32) | slotIndex;
|
ids[0] = ((spPropertyId)SP_PROPERTY_RGB << 32) | slotIndex;
|
||||||
ids[1] = ((spPropertyId)SP_PROPERTY_ALPHA << 32) | slotIndex;
|
ids[1] = ((spPropertyId)SP_PROPERTY_ALPHA << 32) | slotIndex;
|
||||||
ids[2] = ((spPropertyId)SP_PROPERTY_RGB2 << 32) | slotIndex;
|
ids[2] = ((spPropertyId)SP_PROPERTY_RGB2 << 32) | slotIndex;
|
||||||
_spCurveTimeline_init(SUPER(timeline), framesCount, RGBA2_ENTRIES, bezierCount, ids, 3, _spCurveTimeline_dispose, _spRGBA2Timeline_apply, _spCurveTimeline_setBezier);
|
_spCurveTimeline_init(SUPER(timeline), framesCount, RGBA2_ENTRIES, bezierCount, ids, 3, SP_TIMELINE_RGBA2, _spCurveTimeline_dispose, _spRGBA2Timeline_apply, _spCurveTimeline_setBezier);
|
||||||
timeline->slotIndex = slotIndex;
|
timeline->slotIndex = slotIndex;
|
||||||
return timeline;
|
return timeline;
|
||||||
}
|
}
|
||||||
@ -1539,7 +1540,7 @@ spRGB2Timeline* spRGB2Timeline_create (int framesCount, int bezierCount, int slo
|
|||||||
spPropertyId ids[2];
|
spPropertyId ids[2];
|
||||||
ids[0] = ((spPropertyId)SP_PROPERTY_RGB << 32) | slotIndex;
|
ids[0] = ((spPropertyId)SP_PROPERTY_RGB << 32) | slotIndex;
|
||||||
ids[1] = ((spPropertyId)SP_PROPERTY_RGB2 << 32) | slotIndex;
|
ids[1] = ((spPropertyId)SP_PROPERTY_RGB2 << 32) | slotIndex;
|
||||||
_spCurveTimeline_init(SUPER(timeline), framesCount, RGB2_ENTRIES, bezierCount, ids, 2, _spCurveTimeline_dispose, _spRGB2Timeline_apply, _spCurveTimeline_setBezier);
|
_spCurveTimeline_init(SUPER(timeline), framesCount, RGB2_ENTRIES, bezierCount, ids, 2, SP_TIMELINE_RGB2, _spCurveTimeline_dispose, _spRGB2Timeline_apply, _spCurveTimeline_setBezier);
|
||||||
timeline->slotIndex = slotIndex;
|
timeline->slotIndex = slotIndex;
|
||||||
return timeline;
|
return timeline;
|
||||||
}
|
}
|
||||||
@ -1610,7 +1611,7 @@ spAttachmentTimeline* spAttachmentTimeline_create (int framesCount, int slotInde
|
|||||||
spAttachmentTimeline* self = NEW(spAttachmentTimeline);
|
spAttachmentTimeline* self = NEW(spAttachmentTimeline);
|
||||||
spPropertyId ids[1];
|
spPropertyId ids[1];
|
||||||
ids[0] = ((spPropertyId)SP_PROPERTY_ATTACHMENT << 32) | slotIndex;
|
ids[0] = ((spPropertyId)SP_PROPERTY_ATTACHMENT << 32) | slotIndex;
|
||||||
_spTimeline_init(SUPER(self), framesCount, 1, ids, 1, _spAttachmentTimeline_dispose, _spAttachmentTimeline_apply, 0);
|
_spTimeline_init(SUPER(self), framesCount, 1, ids, 1, SP_TIMELINE_ATTACHMENT, _spAttachmentTimeline_dispose, _spAttachmentTimeline_apply, 0);
|
||||||
CONST_CAST(char**, self->attachmentNames) = CALLOC(char*, framesCount);
|
CONST_CAST(char**, self->attachmentNames) = CALLOC(char*, framesCount);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@ -1630,7 +1631,7 @@ void spAttachmentTimeline_setFrame (spAttachmentTimeline* self, int frameIndex,
|
|||||||
void _spDeformTimeline_setBezier(spTimeline *timeline, int bezier, int frame, float value, float time1, float value1, float cx1, float cy1,
|
void _spDeformTimeline_setBezier(spTimeline *timeline, int bezier, int frame, float value, float time1, float value1, float cx1, float cy1,
|
||||||
float cx2, float cy2, float time2, float value2) {
|
float cx2, float cy2, float time2, float value2) {
|
||||||
spDeformTimeline *self = SUB_CAST(spDeformTimeline, timeline);
|
spDeformTimeline *self = SUB_CAST(spDeformTimeline, timeline);
|
||||||
int n, i = spTimeline_getFrameCount(SUPER(SUPER(self)))+ bezier * BEZIER_SIZE;
|
int n, i = self->super.super.frameCount + bezier * BEZIER_SIZE;
|
||||||
float *curves = self->super.curves->items;
|
float *curves = self->super.curves->items;
|
||||||
float tmpx = (time1 - cx1 * 2 + cx2) * 0.03, tmpy = cy2 * 0.03 - cy1 * 0.06;
|
float tmpx = (time1 - cx1 * 2 + cx2) * 0.03, tmpy = cy2 * 0.03 - cy1 * 0.06;
|
||||||
float dddx = ((cx1 - cx2) * 3 - time1 + time2) * 0.006, dddy = (cy1 - cy2 + 0.33333333) * 0.018;
|
float dddx = ((cx1 - cx2) * 3 - time1 + time2) * 0.006, dddy = (cy1 - cy2 + 0.33333333) * 0.018;
|
||||||
@ -1911,7 +1912,7 @@ spDeformTimeline* spDeformTimeline_create (int framesCount, int frameVerticesCou
|
|||||||
spDeformTimeline* self = NEW(spDeformTimeline);
|
spDeformTimeline* self = NEW(spDeformTimeline);
|
||||||
spPropertyId ids[1];
|
spPropertyId ids[1];
|
||||||
ids[0] = ((spPropertyId) SP_PROPERTY_DEFORM << 32) | ((slotIndex << 16 | attachment->id) & 0xffffffff);
|
ids[0] = ((spPropertyId) SP_PROPERTY_DEFORM << 32) | ((slotIndex << 16 | attachment->id) & 0xffffffff);
|
||||||
_spCurveTimeline_init(SUPER(self), framesCount, 1, bezierCount, ids, 1, _spDeformTimeline_dispose, _spDeformTimeline_apply, _spDeformTimeline_setBezier);
|
_spCurveTimeline_init(SUPER(self), framesCount, 1, bezierCount, ids, 1, SP_TIMELINE_DEFORM, _spDeformTimeline_dispose, _spDeformTimeline_apply, _spDeformTimeline_setBezier);
|
||||||
CONST_CAST(float**, self->frameVertices) = CALLOC(float*, framesCount);
|
CONST_CAST(float**, self->frameVertices) = CALLOC(float*, framesCount);
|
||||||
CONST_CAST(int, self->frameVerticesCount) = frameVerticesCount;
|
CONST_CAST(int, self->frameVerticesCount) = frameVerticesCount;
|
||||||
return self;
|
return self;
|
||||||
@ -1983,7 +1984,7 @@ spEventTimeline* spEventTimeline_create (int framesCount) {
|
|||||||
spEventTimeline* self = NEW(spEventTimeline);
|
spEventTimeline* self = NEW(spEventTimeline);
|
||||||
spPropertyId ids[1];
|
spPropertyId ids[1];
|
||||||
ids[0] = (spPropertyId)SP_PROPERTY_EVENT << 32;
|
ids[0] = (spPropertyId)SP_PROPERTY_EVENT << 32;
|
||||||
_spTimeline_init(SUPER(self), framesCount, 1, ids, 1, _spEventTimeline_dispose, _spEventTimeline_apply, 0);
|
_spTimeline_init(SUPER(self), framesCount, 1, ids, 1, SP_TIMELINE_EVENT, _spEventTimeline_dispose, _spEventTimeline_apply, 0);
|
||||||
CONST_CAST(spEvent**, self->events) = CALLOC(spEvent*, framesCount);
|
CONST_CAST(spEvent**, self->events) = CALLOC(spEvent*, framesCount);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@ -2043,7 +2044,7 @@ spDrawOrderTimeline* spDrawOrderTimeline_create (int framesCount, int slotsCount
|
|||||||
spDrawOrderTimeline* self = NEW(spDrawOrderTimeline);
|
spDrawOrderTimeline* self = NEW(spDrawOrderTimeline);
|
||||||
spPropertyId ids[1];
|
spPropertyId ids[1];
|
||||||
ids[0] = (spPropertyId)SP_PROPERTY_DRAWORDER << 32;
|
ids[0] = (spPropertyId)SP_PROPERTY_DRAWORDER << 32;
|
||||||
_spTimeline_init(SUPER(self), framesCount, 1, ids, 1, _spDrawOrderTimeline_dispose, _spDrawOrderTimeline_apply, 0);
|
_spTimeline_init(SUPER(self), framesCount, 1, ids, 1, SP_TIMELINE_DRAWORDER, _spDrawOrderTimeline_dispose, _spDrawOrderTimeline_apply, 0);
|
||||||
|
|
||||||
CONST_CAST(int**, self->drawOrders) = CALLOC(int*, framesCount);
|
CONST_CAST(int**, self->drawOrders) = CALLOC(int*, framesCount);
|
||||||
CONST_CAST(int, self->slotsCount) = slotsCount;
|
CONST_CAST(int, self->slotsCount) = slotsCount;
|
||||||
@ -2158,7 +2159,7 @@ spIkConstraintTimeline* spIkConstraintTimeline_create (int framesCount, int bezi
|
|||||||
spIkConstraintTimeline* timeline = NEW(spIkConstraintTimeline);
|
spIkConstraintTimeline* timeline = NEW(spIkConstraintTimeline);
|
||||||
spPropertyId ids[1];
|
spPropertyId ids[1];
|
||||||
ids[0] = ((spPropertyId)SP_PROPERTY_IKCONSTRAINT << 32) | ikConstraintIndex;
|
ids[0] = ((spPropertyId)SP_PROPERTY_IKCONSTRAINT << 32) | ikConstraintIndex;
|
||||||
_spCurveTimeline_init(SUPER(timeline), framesCount, IKCONSTRAINT_ENTRIES, bezierCount, ids, 1, _spCurveTimeline_dispose, _spIkConstraintTimeline_apply, _spCurveTimeline_setBezier);
|
_spCurveTimeline_init(SUPER(timeline), framesCount, IKCONSTRAINT_ENTRIES, bezierCount, ids, 1, SP_TIMELINE_IKCONSTRAINT, _spCurveTimeline_dispose, _spIkConstraintTimeline_apply, _spCurveTimeline_setBezier);
|
||||||
timeline->ikConstraintIndex = ikConstraintIndex;
|
timeline->ikConstraintIndex = ikConstraintIndex;
|
||||||
return timeline;
|
return timeline;
|
||||||
}
|
}
|
||||||
@ -2291,7 +2292,7 @@ spTransformConstraintTimeline* spTransformConstraintTimeline_create (int framesC
|
|||||||
spTransformConstraintTimeline* timeline = NEW(spTransformConstraintTimeline);
|
spTransformConstraintTimeline* timeline = NEW(spTransformConstraintTimeline);
|
||||||
spPropertyId ids[1];
|
spPropertyId ids[1];
|
||||||
ids[0] = ((spPropertyId)SP_PROPERTY_TRANSFORMCONSTRAINT << 32) | transformConstraintIndex;
|
ids[0] = ((spPropertyId)SP_PROPERTY_TRANSFORMCONSTRAINT << 32) | transformConstraintIndex;
|
||||||
_spCurveTimeline_init(SUPER(timeline), framesCount, IKCONSTRAINT_ENTRIES, bezierCount, ids, 1, _spCurveTimeline_dispose, _spTransformConstraintTimeline_apply, _spCurveTimeline_setBezier);
|
_spCurveTimeline_init(SUPER(timeline), framesCount, IKCONSTRAINT_ENTRIES, bezierCount, ids, 1, SP_TIMELINE_TRANSFORMCONSTRAINT, _spCurveTimeline_dispose, _spTransformConstraintTimeline_apply, _spCurveTimeline_setBezier);
|
||||||
timeline->transformConstraintIndex = transformConstraintIndex;
|
timeline->transformConstraintIndex = transformConstraintIndex;
|
||||||
return timeline;
|
return timeline;
|
||||||
}
|
}
|
||||||
@ -2355,7 +2356,7 @@ spPathConstraintPositionTimeline* spPathConstraintPositionTimeline_create (int f
|
|||||||
spPathConstraintPositionTimeline* timeline = NEW(spPathConstraintPositionTimeline);
|
spPathConstraintPositionTimeline* timeline = NEW(spPathConstraintPositionTimeline);
|
||||||
spPropertyId ids[1];
|
spPropertyId ids[1];
|
||||||
ids[0] = ((spPropertyId)SP_PROPERTY_PATHCONSTRAINT_POSITION << 32) | pathConstraintIndex;
|
ids[0] = ((spPropertyId)SP_PROPERTY_PATHCONSTRAINT_POSITION << 32) | pathConstraintIndex;
|
||||||
_spCurveTimeline_init(SUPER(timeline), framesCount, PATHCONSTRAINTPOSITION_ENTRIES, bezierCount, ids, 1, _spCurveTimeline_dispose, _spPathConstraintPositionTimeline_apply, _spCurveTimeline_setBezier);
|
_spCurveTimeline_init(SUPER(timeline), framesCount, PATHCONSTRAINTPOSITION_ENTRIES, bezierCount, ids, 1, SP_TIMELINE_PATHCONSTRAINTPOSITION, _spCurveTimeline_dispose, _spPathConstraintPositionTimeline_apply, _spCurveTimeline_setBezier);
|
||||||
timeline->pathConstraintIndex = pathConstraintIndex;
|
timeline->pathConstraintIndex = pathConstraintIndex;
|
||||||
return timeline;
|
return timeline;
|
||||||
}
|
}
|
||||||
@ -2414,7 +2415,7 @@ spPathConstraintSpacingTimeline* spPathConstraintSpacingTimeline_create (int fra
|
|||||||
spPathConstraintSpacingTimeline* timeline = NEW(spPathConstraintSpacingTimeline);
|
spPathConstraintSpacingTimeline* timeline = NEW(spPathConstraintSpacingTimeline);
|
||||||
spPropertyId ids[1];
|
spPropertyId ids[1];
|
||||||
ids[0] = ((spPropertyId)SP_PROPERTY_PATHCONSTRAINT_SPACING << 32) | pathConstraintIndex;
|
ids[0] = ((spPropertyId)SP_PROPERTY_PATHCONSTRAINT_SPACING << 32) | pathConstraintIndex;
|
||||||
_spCurveTimeline_init(SUPER(timeline), framesCount, PATHCONSTRAINTSPACING_ENTRIES, bezierCount, ids, 1, _spCurveTimeline_dispose, _spPathConstraintSpacingTimeline_apply, _spCurveTimeline_setBezier);
|
_spCurveTimeline_init(SUPER(timeline), framesCount, PATHCONSTRAINTSPACING_ENTRIES, bezierCount, ids, 1, SP_TIMELINE_PATHCONSTRAINTSPACING, _spCurveTimeline_dispose, _spPathConstraintSpacingTimeline_apply, _spCurveTimeline_setBezier);
|
||||||
timeline->pathConstraintIndex = pathConstraintIndex;
|
timeline->pathConstraintIndex = pathConstraintIndex;
|
||||||
return timeline;
|
return timeline;
|
||||||
}
|
}
|
||||||
@ -2513,7 +2514,7 @@ spPathConstraintMixTimeline* spPathConstraintMixTimeline_create (int framesCount
|
|||||||
spPathConstraintMixTimeline* timeline = NEW(spPathConstraintMixTimeline);
|
spPathConstraintMixTimeline* timeline = NEW(spPathConstraintMixTimeline);
|
||||||
spPropertyId ids[1];
|
spPropertyId ids[1];
|
||||||
ids[0] = ((spPropertyId)SP_PROPERTY_PATHCONSTRAINT_MIX << 32) | pathConstraintIndex;
|
ids[0] = ((spPropertyId)SP_PROPERTY_PATHCONSTRAINT_MIX << 32) | pathConstraintIndex;
|
||||||
_spCurveTimeline_init(SUPER(timeline), framesCount, PATHCONSTRAINTMIX_ENTRIES, bezierCount, ids, 1, _spCurveTimeline_dispose, _spPathConstraintMixTimeline_apply, _spCurveTimeline_setBezier);
|
_spCurveTimeline_init(SUPER(timeline), framesCount, PATHCONSTRAINTMIX_ENTRIES, bezierCount, ids, 1, SP_TIMELINE_PATHCONSTRAINTMIX, _spCurveTimeline_dispose, _spPathConstraintMixTimeline_apply, _spCurveTimeline_setBezier);
|
||||||
timeline->pathConstraintIndex = pathConstraintIndex;
|
timeline->pathConstraintIndex = pathConstraintIndex;
|
||||||
return timeline;
|
return timeline;
|
||||||
}
|
}
|
||||||
|
|||||||
254
spine-c/spine-c/src/spine/Debug.c
Normal file
254
spine-c/spine-c/src/spine/Debug.c
Normal file
@ -0,0 +1,254 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Spine Runtimes License Agreement
|
||||||
|
* Last updated January 1, 2020. Replaces all prior versions.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||||
|
*
|
||||||
|
* Integration of the Spine Runtimes into software or otherwise creating
|
||||||
|
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||||
|
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||||
|
* http://esotericsoftware.com/spine-editor-license
|
||||||
|
*
|
||||||
|
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||||
|
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||||
|
* "Products"), provided that each user of the Products must obtain their own
|
||||||
|
* Spine Editor license and redistribution of the Products in any form must
|
||||||
|
* include this license and copyright notice.
|
||||||
|
*
|
||||||
|
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "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 LLC 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
|
||||||
|
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include <spine/Debug.h>
|
||||||
|
#include <spine/Animation.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
static const char* _spTimelineTypeNames[] = {
|
||||||
|
"Attachment",
|
||||||
|
"Alpha",
|
||||||
|
"PathConstraintPosition",
|
||||||
|
"PathConstraintSpace",
|
||||||
|
"Rotate",
|
||||||
|
"ScaleX",
|
||||||
|
"ScaleY",
|
||||||
|
"ShearX",
|
||||||
|
"ShearY",
|
||||||
|
"TranslateX",
|
||||||
|
"TranslateY",
|
||||||
|
"Scale",
|
||||||
|
"Shear",
|
||||||
|
"Translate",
|
||||||
|
"Deform",
|
||||||
|
"IkConstraint",
|
||||||
|
"PathConstraintMix",
|
||||||
|
"Rgb2",
|
||||||
|
"Rgba2",
|
||||||
|
"Rgba",
|
||||||
|
"Rgb",
|
||||||
|
"TransformConstraint",
|
||||||
|
"DrawOrder",
|
||||||
|
"Event"
|
||||||
|
};
|
||||||
|
|
||||||
|
void spDebug_printSkeletonData(spSkeletonData* skeletonData) {
|
||||||
|
int i, n;
|
||||||
|
spDebug_printBoneDatas(skeletonData->bones, skeletonData->bonesCount);
|
||||||
|
|
||||||
|
for (i = 0, n = skeletonData->animationsCount; i < n; i++) {
|
||||||
|
spDebug_printAnimation(skeletonData->animations[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _spDebug_printTimelineBase(spTimeline* timeline) {
|
||||||
|
printf(" Timeline %s:\n", _spTimelineTypeNames[timeline->type]);
|
||||||
|
printf(" frame count: %i\n", timeline->frameCount);
|
||||||
|
printf(" frame entries: %i\n", timeline->frameEntries);
|
||||||
|
printf(" frames: ");
|
||||||
|
spDebug_printFloats(timeline->frames->items, timeline->frames->size);
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void _spDebug_printCurveTimeline(spCurveTimeline* timeline) {
|
||||||
|
_spDebug_printTimelineBase(&timeline->super);
|
||||||
|
printf(" curves: ");
|
||||||
|
spDebug_printFloats(timeline->curves->items, timeline->curves->size);
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void spDebug_printTimeline(spTimeline* timeline) {
|
||||||
|
switch(timeline->type) {
|
||||||
|
case SP_TIMELINE_ATTACHMENT: {
|
||||||
|
spAttachmentTimeline *t = (spAttachmentTimeline*)timeline;
|
||||||
|
_spDebug_printTimelineBase(&t->super);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SP_TIMELINE_ALPHA: {
|
||||||
|
spAlphaTimeline *t = (spAlphaTimeline*)timeline;
|
||||||
|
_spDebug_printCurveTimeline(&t->super);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SP_TIMELINE_PATHCONSTRAINTPOSITION: {
|
||||||
|
spPathConstraintPositionTimeline *t = (spPathConstraintPositionTimeline*)timeline;
|
||||||
|
_spDebug_printCurveTimeline(&t->super);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SP_TIMELINE_PATHCONSTRAINTSPACING: {
|
||||||
|
spPathConstraintMixTimeline *t = (spPathConstraintMixTimeline*)timeline;
|
||||||
|
_spDebug_printCurveTimeline(&t->super);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SP_TIMELINE_ROTATE: {
|
||||||
|
spRotateTimeline *t = (spRotateTimeline*)timeline;
|
||||||
|
_spDebug_printCurveTimeline(&t->super);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SP_TIMELINE_SCALEX: {
|
||||||
|
spScaleXTimeline *t = (spScaleXTimeline*)timeline;
|
||||||
|
_spDebug_printCurveTimeline(&t->super);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SP_TIMELINE_SCALEY: {
|
||||||
|
spScaleYTimeline *t = (spScaleYTimeline*)timeline;
|
||||||
|
_spDebug_printCurveTimeline(&t->super);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SP_TIMELINE_SHEARX: {
|
||||||
|
spShearXTimeline *t = (spShearXTimeline *)timeline;
|
||||||
|
_spDebug_printCurveTimeline(&t->super);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SP_TIMELINE_SHEARY: {
|
||||||
|
spShearYTimeline *t = (spShearYTimeline*)timeline;
|
||||||
|
_spDebug_printCurveTimeline(&t->super);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SP_TIMELINE_TRANSLATEX: {
|
||||||
|
spTranslateXTimeline *t = (spTranslateXTimeline*)timeline;
|
||||||
|
_spDebug_printCurveTimeline(&t->super);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SP_TIMELINE_TRANSLATEY: {
|
||||||
|
spTranslateYTimeline *t = (spTranslateYTimeline*)timeline;
|
||||||
|
_spDebug_printCurveTimeline(&t->super);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SP_TIMELINE_SCALE: {
|
||||||
|
spScaleTimeline *t = (spScaleTimeline*)timeline;
|
||||||
|
_spDebug_printCurveTimeline(&t->super);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SP_TIMELINE_SHEAR: {
|
||||||
|
spShearTimeline *t = (spShearTimeline*)timeline;
|
||||||
|
_spDebug_printCurveTimeline(&t->super);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SP_TIMELINE_TRANSLATE: {
|
||||||
|
spTranslateTimeline *t = (spTranslateTimeline*)timeline;
|
||||||
|
_spDebug_printCurveTimeline(&t->super);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SP_TIMELINE_DEFORM: {
|
||||||
|
spDeformTimeline *t = (spDeformTimeline*)timeline;
|
||||||
|
_spDebug_printCurveTimeline(&t->super);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SP_TIMELINE_IKCONSTRAINT: {
|
||||||
|
spIkConstraintTimeline *t = (spIkConstraintTimeline*)timeline;
|
||||||
|
_spDebug_printCurveTimeline(&t->super);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SP_TIMELINE_PATHCONSTRAINTMIX: {
|
||||||
|
spPathConstraintMixTimeline *t = (spPathConstraintMixTimeline*)timeline;
|
||||||
|
_spDebug_printCurveTimeline(&t->super);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SP_TIMELINE_RGB2: {
|
||||||
|
spRGB2Timeline *t = (spRGB2Timeline*)timeline;
|
||||||
|
_spDebug_printCurveTimeline(&t->super);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SP_TIMELINE_RGBA2: {
|
||||||
|
spRGBA2Timeline *t = (spRGBA2Timeline*)timeline;
|
||||||
|
_spDebug_printCurveTimeline(&t->super);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SP_TIMELINE_RGBA: {
|
||||||
|
spRGBATimeline *t = (spRGBATimeline*)timeline;
|
||||||
|
_spDebug_printCurveTimeline(&t->super);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SP_TIMELINE_RGB: {
|
||||||
|
spRGBTimeline *t = (spRGBTimeline*)timeline;
|
||||||
|
_spDebug_printCurveTimeline(&t->super);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SP_TIMELINE_TRANSFORMCONSTRAINT: {
|
||||||
|
spTransformConstraintTimeline *t = (spTransformConstraintTimeline*)timeline;
|
||||||
|
_spDebug_printCurveTimeline(&t->super);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SP_TIMELINE_DRAWORDER: {
|
||||||
|
spDrawOrderTimeline *t = (spDrawOrderTimeline*)timeline;
|
||||||
|
_spDebug_printTimelineBase(&t->super);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SP_TIMELINE_EVENT: {
|
||||||
|
spEventTimeline *t = (spEventTimeline*)timeline;
|
||||||
|
_spDebug_printTimelineBase(&t->super);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void spDebug_printAnimation(spAnimation* animation) {
|
||||||
|
int i, n;
|
||||||
|
printf("Animation %s: %i timelines\n", animation->name, animation->timelines->size);
|
||||||
|
|
||||||
|
for (i = 0, n = animation->timelines->size; i < n; i++) {
|
||||||
|
spDebug_printTimeline(animation->timelines->items[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void spDebug_printBoneDatas(spBoneData** boneDatas, int numBoneDatas) {
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < numBoneDatas; i++) {
|
||||||
|
spDebug_printBoneData(boneDatas[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void spDebug_printBoneData(spBoneData* boneData) {
|
||||||
|
printf("Bone data %s: %f, %f, %f, %f, %f, %f %f\n", boneData->name, boneData->rotation, boneData->scaleX, boneData->scaleY, boneData->x, boneData->y, boneData->shearX, boneData->shearY);
|
||||||
|
}
|
||||||
|
|
||||||
|
void spDebug_printSkeleton(spSkeleton* skeleton) {
|
||||||
|
spDebug_printBones(skeleton->bones, skeleton->bonesCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
void spDebug_printBones(spBone** bones, int numBones) {
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < numBones; i++) {
|
||||||
|
spDebug_printBone(bones[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void spDebug_printBone(spBone* bone) {
|
||||||
|
printf("Bone %s: %f, %f, %f, %f, %f, %f\n", bone->data->name, bone->a, bone->b, bone->c, bone->d, bone->worldX, bone->worldY);
|
||||||
|
}
|
||||||
|
|
||||||
|
void spDebug_printFloats(float *values, int numFloats) {
|
||||||
|
int i;
|
||||||
|
printf("[");
|
||||||
|
for (i = 0; i < numFloats; i++) {
|
||||||
|
printf("%f, ", values[i]);
|
||||||
|
}
|
||||||
|
printf("]");
|
||||||
|
}
|
||||||
@ -227,7 +227,7 @@ static spTimeline* readTimeline (_dataInput *input, spCurveTimeline1 *timeline,
|
|||||||
float time2, value2;
|
float time2, value2;
|
||||||
float time = readFloat(input);
|
float time = readFloat(input);
|
||||||
float value = readFloat(input) * scale;
|
float value = readFloat(input) * scale;
|
||||||
for (frame = 0, bezier = 0, frameLast = spTimeline_getFrameCount(SUPER(timeline)) - 1;; frame++) {
|
for (frame = 0, bezier = 0, frameLast = timeline->super.frameCount - 1;; frame++) {
|
||||||
spCurveTimeline1_setFrame(timeline, frame, time, value);
|
spCurveTimeline1_setFrame(timeline, frame, time, value);
|
||||||
if (frame == frameLast) break;
|
if (frame == frameLast) break;
|
||||||
time2 = readFloat(input);
|
time2 = readFloat(input);
|
||||||
@ -251,7 +251,7 @@ static spTimeline* readTimeline2 (_dataInput *input, spCurveTimeline2 *timeline,
|
|||||||
float time = readFloat(input);
|
float time = readFloat(input);
|
||||||
float value1 = readFloat(input) * scale;
|
float value1 = readFloat(input) * scale;
|
||||||
float value2 = readFloat(input) * scale;
|
float value2 = readFloat(input) * scale;
|
||||||
for (frame = 0, bezier = 0, frameLast = spTimeline_getFrameCount(SUPER(timeline)) - 1;; frame++) {
|
for (frame = 0, bezier = 0, frameLast = timeline->super.frameCount - 1;; frame++) {
|
||||||
spCurveTimeline2_setFrame(timeline, frame, time, value1, value2);
|
spCurveTimeline2_setFrame(timeline, frame, time, value1, value2);
|
||||||
if (frame == frameLast) break;
|
if (frame == frameLast) break;
|
||||||
time2 = readFloat(input);
|
time2 = readFloat(input);
|
||||||
@ -697,7 +697,7 @@ static spAnimation* _spSkeletonBinary_readAnimation (spSkeletonBinary* self, con
|
|||||||
mixRotate = readFloat(input);
|
mixRotate = readFloat(input);
|
||||||
mixX = readFloat(input);
|
mixX = readFloat(input);
|
||||||
mixY = readFloat(input);
|
mixY = readFloat(input);
|
||||||
for (frame = 0, bezier = 0, frameLast = spTimeline_getFrameCount(SUPER(SUPER(timeline))) - 1;; frame++) {
|
for (frame = 0, bezier = 0, frameLast = timeline->super.super.frameCount - 1;; frame++) {
|
||||||
float time2, mixRotate2, mixX2, mixY2;
|
float time2, mixRotate2, mixX2, mixY2;
|
||||||
spPathConstraintMixTimeline_setFrame(timeline, frame, time, mixRotate, mixX, mixY);
|
spPathConstraintMixTimeline_setFrame(timeline, frame, time, mixRotate, mixX, mixY);
|
||||||
if (frame == frameLast) break;
|
if (frame == frameLast) break;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user