SkeletonData.cpp
6.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated May 1, 2019. Replaces all prior versions.
*
* Copyright (c) 2013-2019, 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.
*
* THIS SOFTWARE IS 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 THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#ifdef SPINE_UE4
#include "SpinePluginPrivatePCH.h"
#endif
#include <spine/SkeletonData.h>
#include <spine/BoneData.h>
#include <spine/SlotData.h>
#include <spine/Skin.h>
#include <spine/EventData.h>
#include <spine/Animation.h>
#include <spine/IkConstraintData.h>
#include <spine/TransformConstraintData.h>
#include <spine/PathConstraintData.h>
#include <spine/ContainerUtil.h>
using namespace spine;
SkeletonData::SkeletonData() :
_name(),
_defaultSkin(NULL),
_x(0),
_y(0),
_width(0),
_height(0),
_version(),
_hash(),
_fps(0),
_imagesPath() {
}
SkeletonData::~SkeletonData() {
ContainerUtil::cleanUpVectorOfPointers(_bones);
ContainerUtil::cleanUpVectorOfPointers(_slots);
ContainerUtil::cleanUpVectorOfPointers(_skins);
_defaultSkin = NULL;
ContainerUtil::cleanUpVectorOfPointers(_events);
ContainerUtil::cleanUpVectorOfPointers(_animations);
ContainerUtil::cleanUpVectorOfPointers(_ikConstraints);
ContainerUtil::cleanUpVectorOfPointers(_transformConstraints);
ContainerUtil::cleanUpVectorOfPointers(_pathConstraints);
for (size_t i = 0; i < _strings.size(); i++) {
SpineExtension::free(_strings[i], __FILE__, __LINE__);
}
}
BoneData *SkeletonData::findBone(const String &boneName) {
return ContainerUtil::findWithName(_bones, boneName);
}
int SkeletonData::findBoneIndex(const String &boneName) {
return ContainerUtil::findIndexWithName(_bones, boneName);
}
SlotData *SkeletonData::findSlot(const String &slotName) {
return ContainerUtil::findWithName(_slots, slotName);
}
int SkeletonData::findSlotIndex(const String &slotName) {
return ContainerUtil::findIndexWithName(_slots, slotName);
}
Skin *SkeletonData::findSkin(const String &skinName) {
return ContainerUtil::findWithName(_skins, skinName);
}
spine::EventData *SkeletonData::findEvent(const String &eventDataName) {
return ContainerUtil::findWithName(_events, eventDataName);
}
Animation *SkeletonData::findAnimation(const String &animationName) {
return ContainerUtil::findWithName(_animations, animationName);
}
IkConstraintData *SkeletonData::findIkConstraint(const String &constraintName) {
return ContainerUtil::findWithName(_ikConstraints, constraintName);
}
TransformConstraintData *SkeletonData::findTransformConstraint(const String &constraintName) {
return ContainerUtil::findWithName(_transformConstraints, constraintName);
}
PathConstraintData *SkeletonData::findPathConstraint(const String &constraintName) {
return ContainerUtil::findWithName(_pathConstraints, constraintName);
}
int SkeletonData::findPathConstraintIndex(const String &pathConstraintName) {
return ContainerUtil::findIndexWithName(_pathConstraints, pathConstraintName);
}
const String &SkeletonData::getName() {
return _name;
}
void SkeletonData::setName(const String &inValue) {
_name = inValue;
}
Vector<BoneData *> &SkeletonData::getBones() {
return _bones;
}
Vector<SlotData *> &SkeletonData::getSlots() {
return _slots;
}
Vector<Skin *> &SkeletonData::getSkins() {
return _skins;
}
Skin *SkeletonData::getDefaultSkin() {
return _defaultSkin;
}
void SkeletonData::setDefaultSkin(Skin *inValue) {
_defaultSkin = inValue;
}
Vector<spine::EventData *> &SkeletonData::getEvents() {
return _events;
}
Vector<Animation *> &SkeletonData::getAnimations() {
return _animations;
}
Vector<IkConstraintData *> &SkeletonData::getIkConstraints() {
return _ikConstraints;
}
Vector<TransformConstraintData *> &SkeletonData::getTransformConstraints() {
return _transformConstraints;
}
Vector<PathConstraintData *> &SkeletonData::getPathConstraints() {
return _pathConstraints;
}
float SkeletonData::getX() {
return _x;
}
void SkeletonData::setX(float inValue) {
_x = inValue;
}
float SkeletonData::getY() {
return _y;
}
void SkeletonData::setY(float inValue) {
_y = inValue;
}
float SkeletonData::getWidth() {
return _width;
}
void SkeletonData::setWidth(float inValue) {
_width = inValue;
}
float SkeletonData::getHeight() {
return _height;
}
void SkeletonData::setHeight(float inValue) {
_height = inValue;
}
const String &SkeletonData::getVersion() {
return _version;
}
void SkeletonData::setVersion(const String &inValue) {
_version = inValue;
}
const String &SkeletonData::getHash() {
return _hash;
}
void SkeletonData::setHash(const String &inValue) {
_hash = inValue;
}
const String &SkeletonData::getImagesPath() {
return _imagesPath;
}
void SkeletonData::setImagesPath(const String &inValue) {
_imagesPath = inValue;
}
const String &SkeletonData::getAudioPath() {
return _audioPath;
}
void SkeletonData::setAudioPath(const String &inValue) {
_audioPath = inValue;
}
float SkeletonData::getFps() {
return _fps;
}
void SkeletonData::setFps(float inValue) {
_fps = inValue;
}