mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-09 08:38:43 +08:00
Added AnimationState.
Fixed bug with keeping attachments visisble when setting new skin. Clean up. Always more clean up can be done, freaking C++...
This commit is contained in:
parent
b075838c9e
commit
6899b5249c
@ -37,6 +37,9 @@
|
||||
</option>
|
||||
<option id="gnu.cpp.compiler.option.warnings.allwarn.2053349441" name="All warnings (-Wall)" superClass="gnu.cpp.compiler.option.warnings.allwarn" value="true" valueType="boolean"/>
|
||||
<option id="gnu.cpp.compiler.option.preprocessor.def.1463772359" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def"/>
|
||||
<option id="gnu.cpp.compiler.option.warnings.pedantic.762186482" name="Pedantic (-pedantic)" superClass="gnu.cpp.compiler.option.warnings.pedantic" value="false" valueType="boolean"/>
|
||||
<option id="gnu.cpp.compiler.option.warnings.extrawarn.2104256953" name="Extra warnings (-Wextra)" superClass="gnu.cpp.compiler.option.warnings.extrawarn" value="false" valueType="boolean"/>
|
||||
<option id="gnu.cpp.compiler.option.warnings.wconversion.2109535628" name="Implicit conversion warnings (-Wconversion)" superClass="gnu.cpp.compiler.option.warnings.wconversion" value="false" valueType="boolean"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1445618618" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.344670633" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug">
|
||||
|
||||
@ -19,8 +19,8 @@ org.eclipse.cdt.codan.internal.checkers.CatchByReference=Warning
|
||||
org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},unknown\=>false,exceptions\=>()}
|
||||
org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization=-Warning
|
||||
org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},skip\=>true}
|
||||
org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization=Warning
|
||||
org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization.params={fileScope\=>inclusion\=>(),exclusion\=>("json/*"),launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},skip\=>true}
|
||||
org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem=Error
|
||||
|
||||
@ -42,7 +42,7 @@ public:
|
||||
Animation (const std::vector<Timeline*> &timelines, float duration);
|
||||
~Animation ();
|
||||
|
||||
void apply (BaseSkeleton *skeleton, float time, bool loop) const;
|
||||
void apply (BaseSkeleton *skeleton, float time, bool loop = false) const;
|
||||
void mix (BaseSkeleton *skeleton, float time, bool loop, float alpha) const;
|
||||
};
|
||||
|
||||
@ -57,7 +57,7 @@ public:
|
||||
|
||||
virtual int getKeyframeCount () const = 0;
|
||||
|
||||
virtual void apply (BaseSkeleton *skeleton, float time, float alpha) const = 0;
|
||||
virtual void apply (BaseSkeleton *skeleton, float time, float alpha = 1) const = 0;
|
||||
};
|
||||
|
||||
//
|
||||
@ -94,7 +94,7 @@ public:
|
||||
|
||||
virtual float getDuration () const;
|
||||
virtual int getKeyframeCount () const;
|
||||
virtual void apply (BaseSkeleton *skeleton, float time, float alpha) const;
|
||||
virtual void apply (BaseSkeleton *skeleton, float time, float alpha = 1) const;
|
||||
|
||||
void setKeyframe (int keyframeIndex, float time, float value);
|
||||
};
|
||||
@ -112,7 +112,7 @@ public:
|
||||
|
||||
virtual float getDuration () const;
|
||||
virtual int getKeyframeCount () const;
|
||||
virtual void apply (BaseSkeleton *skeleton, float time, float alpha) const;
|
||||
virtual void apply (BaseSkeleton *skeleton, float time, float alpha = 1) const;
|
||||
|
||||
void setKeyframe (int keyframeIndex, float time, float x, float y);
|
||||
};
|
||||
@ -123,7 +123,7 @@ class ScaleTimeline: public TranslateTimeline {
|
||||
public:
|
||||
ScaleTimeline (int keyframeCount);
|
||||
|
||||
virtual void apply (BaseSkeleton *skeleton, float time, float alpha) const;
|
||||
virtual void apply (BaseSkeleton *skeleton, float time, float alpha = 1) const;
|
||||
};
|
||||
|
||||
//
|
||||
@ -139,7 +139,7 @@ public:
|
||||
|
||||
virtual float getDuration () const;
|
||||
virtual int getKeyframeCount () const;
|
||||
virtual void apply (BaseSkeleton *skeleton, float time, float alpha) const;
|
||||
virtual void apply (BaseSkeleton *skeleton, float time, float alpha = 1) const;
|
||||
|
||||
void setKeyframe (int keyframeIndex, float time, float r, float g, float b, float a);
|
||||
};
|
||||
@ -158,7 +158,7 @@ public:
|
||||
|
||||
virtual float getDuration () const;
|
||||
virtual int getKeyframeCount () const;
|
||||
virtual void apply (BaseSkeleton *skeleton, float time, float alpha) const;
|
||||
virtual void apply (BaseSkeleton *skeleton, float time, float alpha = 1) const;
|
||||
|
||||
/** The AttachmentTimeline owns the attachmentName.
|
||||
* @param attachmentName May be null to clear the image for a slot. */
|
||||
|
||||
60
spine-cpp/include/spine/AnimationState.h
Normal file
60
spine-cpp/include/spine/AnimationState.h
Normal file
@ -0,0 +1,60 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013, Esoteric Software
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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_ANIMATIONSTATE_H_
|
||||
#define SPINE_ANIMATIONSTATE_H_
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace spine {
|
||||
|
||||
class Animation;
|
||||
class AnimationStateData;
|
||||
class BaseSkeleton;
|
||||
|
||||
class AnimationState {
|
||||
private:
|
||||
Animation *previous;
|
||||
float previousTime;
|
||||
bool previousLoop;
|
||||
float mixTime, mixDuration;
|
||||
|
||||
public:
|
||||
AnimationStateData *data;
|
||||
Animation *animation;
|
||||
float time;
|
||||
bool loop;
|
||||
|
||||
AnimationState (AnimationStateData *data = 0);
|
||||
|
||||
void update (float delta);
|
||||
void apply (BaseSkeleton *skeleton);
|
||||
|
||||
void setAnimation (Animation *newAnimation, bool loop, float time);
|
||||
void setAnimation (Animation *animation, bool loop);
|
||||
};
|
||||
|
||||
} /* namespace spine */
|
||||
#endif /* SPINE_ANIMATIONSTATE_H_ */
|
||||
46
spine-cpp/include/spine/AnimationStateData.h
Normal file
46
spine-cpp/include/spine/AnimationStateData.h
Normal file
@ -0,0 +1,46 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013, Esoteric Software
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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_ANIMATIONSTATEDATA_H_
|
||||
#define SPINE_ANIMATIONSTATEDATA_H_
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace spine {
|
||||
|
||||
class Animation;
|
||||
|
||||
class AnimationStateData {
|
||||
private:
|
||||
std::map<std::pair<Animation*, Animation*>, float> animationToMixTime;
|
||||
|
||||
public:
|
||||
/** Set the mixing duration between two animations. */
|
||||
void setMixing (Animation *from, Animation *to, float duration);
|
||||
float getMixing (Animation *from, Animation *to);
|
||||
};
|
||||
|
||||
} /* namespace spine */
|
||||
#endif /* SPINE_ANIMATIONSTATEDATA_H_ */
|
||||
@ -40,17 +40,7 @@ public:
|
||||
float scaleX, scaleY;
|
||||
float yDown;
|
||||
|
||||
BoneData (const std::string &name) :
|
||||
name(name),
|
||||
parent(0),
|
||||
length(0),
|
||||
x(0),
|
||||
y(0),
|
||||
rotation(0),
|
||||
scaleX(1),
|
||||
scaleY(1),
|
||||
yDown(false) {
|
||||
}
|
||||
BoneData (const std::string &name);
|
||||
};
|
||||
|
||||
} /* namespace spine */
|
||||
|
||||
@ -52,7 +52,7 @@ void Animation::apply (BaseSkeleton *skeleton, float time, bool loop) const {
|
||||
if (loop && duration) time = fmodf(time, duration);
|
||||
|
||||
for (int i = 0, n = timelines.size(); i < n; i++)
|
||||
timelines[i]->apply(skeleton, time, 1);
|
||||
timelines[i]->apply(skeleton, time);
|
||||
}
|
||||
|
||||
void Animation::mix (BaseSkeleton *skeleton, float time, bool loop, float alpha) const {
|
||||
|
||||
84
spine-cpp/src/spine/AnimationState.cpp
Normal file
84
spine-cpp/src/spine/AnimationState.cpp
Normal file
@ -0,0 +1,84 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013, Esoteric Software
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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.
|
||||
******************************************************************************/
|
||||
|
||||
#include <stdexcept>
|
||||
#include <spine/AnimationState.h>
|
||||
#include <spine/AnimationStateData.h>
|
||||
#include <spine/Animation.h>
|
||||
#include <spine/BaseSkeleton.h>
|
||||
|
||||
namespace spine {
|
||||
|
||||
AnimationState::AnimationState (AnimationStateData *data) :
|
||||
previous(0),
|
||||
previousTime(0),
|
||||
previousLoop(false),
|
||||
mixTime(0),
|
||||
mixDuration(0),
|
||||
data(data),
|
||||
animation(0),
|
||||
time(0),
|
||||
loop(0) {
|
||||
}
|
||||
|
||||
void AnimationState::update (float delta) {
|
||||
time += delta;
|
||||
previousTime += delta;
|
||||
mixTime += delta;
|
||||
}
|
||||
|
||||
void AnimationState::apply (BaseSkeleton *skeleton) {
|
||||
if (!animation) return;
|
||||
if (previous) {
|
||||
previous->apply(skeleton, previousTime, previousLoop);
|
||||
float alpha = mixTime / mixDuration;
|
||||
if (alpha >= 1) {
|
||||
alpha = 1;
|
||||
previous = 0;
|
||||
}
|
||||
animation->mix(skeleton, time, loop, alpha);
|
||||
} else
|
||||
animation->apply(skeleton, time, loop);
|
||||
}
|
||||
|
||||
void AnimationState::setAnimation (Animation *animation, bool loop) {
|
||||
setAnimation(animation, loop, 0);
|
||||
}
|
||||
|
||||
void AnimationState::setAnimation (Animation *newAnimation, bool loop, float time) {
|
||||
previous = 0;
|
||||
if (newAnimation && animation && data) {
|
||||
mixDuration = data->getMixing(animation, newAnimation);
|
||||
if (mixDuration > 0) {
|
||||
mixTime = 0;
|
||||
previous = animation;
|
||||
}
|
||||
}
|
||||
animation = newAnimation;
|
||||
this->loop = loop;
|
||||
this->time = time;
|
||||
}
|
||||
|
||||
} /* namespace spine */
|
||||
50
spine-cpp/src/spine/AnimationStateData.cpp
Normal file
50
spine-cpp/src/spine/AnimationStateData.cpp
Normal file
@ -0,0 +1,50 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013, Esoteric Software
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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.
|
||||
******************************************************************************/
|
||||
|
||||
#include <stdexcept>
|
||||
#include <spine/AnimationStateData.h>
|
||||
#include <spine/Animation.h>
|
||||
|
||||
using std::invalid_argument;
|
||||
using std::make_pair;
|
||||
using std::pair;
|
||||
|
||||
namespace spine {
|
||||
|
||||
void AnimationStateData::setMixing (Animation *from, Animation *to, float duration) {
|
||||
if (!from) throw invalid_argument("from cannot be null.");
|
||||
if (!to) throw invalid_argument("to cannot be null.");
|
||||
animationToMixTime[make_pair(from, to)] = duration;
|
||||
}
|
||||
|
||||
float AnimationStateData::getMixing (Animation *from, Animation *to) {
|
||||
if (!from) throw invalid_argument("from cannot be null.");
|
||||
if (!to) throw invalid_argument("to cannot be null.");
|
||||
pair<Animation*, Animation*> key = make_pair(from, to);
|
||||
if (animationToMixTime.find(key) != animationToMixTime.end()) return animationToMixTime[key];
|
||||
return 0;
|
||||
}
|
||||
|
||||
} /* namespace spine */
|
||||
@ -211,6 +211,17 @@ BaseAtlasRegion* BaseAtlas::findRegion (const std::string &name) {
|
||||
//
|
||||
|
||||
BaseAtlasRegion::BaseAtlasRegion () :
|
||||
x(0),
|
||||
y(0),
|
||||
width(0),
|
||||
height(0),
|
||||
offsetX(0),
|
||||
offsetY(0),
|
||||
originalWidth(0),
|
||||
originalHeight(0),
|
||||
index(0),
|
||||
rotate(false),
|
||||
flip(false),
|
||||
splits(0),
|
||||
pads(0) {
|
||||
}
|
||||
|
||||
@ -41,7 +41,16 @@ Bone::Bone (BoneData *data) :
|
||||
y(data->y),
|
||||
rotation(data->rotation),
|
||||
scaleX(data->scaleX),
|
||||
scaleY(data->scaleY) {
|
||||
scaleY(data->scaleY),
|
||||
m00(0),
|
||||
m01(0),
|
||||
worldX(0),
|
||||
m10(0),
|
||||
m11(0),
|
||||
worldY(0),
|
||||
worldRotation(0),
|
||||
worldScaleX(0),
|
||||
worldScaleY(0) {
|
||||
if (!data) throw std::invalid_argument("data cannot be null.");
|
||||
}
|
||||
|
||||
|
||||
42
spine-cpp/src/spine/BoneData.cpp
Normal file
42
spine-cpp/src/spine/BoneData.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013, Esoteric Software
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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.
|
||||
******************************************************************************/
|
||||
|
||||
#include <spine/BoneData.h>
|
||||
|
||||
namespace spine {
|
||||
|
||||
BoneData::BoneData (const std::string &name) :
|
||||
name(name),
|
||||
parent(0),
|
||||
length(0),
|
||||
x(0),
|
||||
y(0),
|
||||
rotation(0),
|
||||
scaleX(1),
|
||||
scaleY(1),
|
||||
yDown(false) {
|
||||
}
|
||||
|
||||
} /* namespace spine */
|
||||
@ -53,7 +53,7 @@ Attachment* Skin::getAttachment (int slotIndex, const std::string &name) {
|
||||
}
|
||||
|
||||
void Skin::attachAll (BaseSkeleton *skeleton, Skin *oldSkin) {
|
||||
for (std::map<Key, Attachment*>::iterator iter = attachments.begin(); iter != attachments.end(); iter++) {
|
||||
for (std::map<Key, Attachment*>::iterator iter = oldSkin->attachments.begin(); iter != oldSkin->attachments.end(); iter++) {
|
||||
const Key key = iter->first;
|
||||
Slot *slot = skeleton->slots[key.slotIndex];
|
||||
if (slot->attachment == iter->second) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user