mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
[cocos2dx] Closes #1216. Cocos2dx may draw a SkeletonAnimation node before its update method is called. The skeleton is thus rendered in the setup pose for the first frame.
This commit is contained in:
parent
fd26abdd88
commit
ef5f68d8fa
@ -116,6 +116,8 @@ void SkeletonAnimation::initialize () {
|
||||
_state->listener = animationCallback;
|
||||
|
||||
_spAnimationState* stateInternal = (_spAnimationState*)_state;
|
||||
|
||||
_firstDraw = true;
|
||||
}
|
||||
|
||||
SkeletonAnimation::SkeletonAnimation ()
|
||||
@ -136,6 +138,14 @@ void SkeletonAnimation::update (float deltaTime) {
|
||||
spSkeleton_updateWorldTransform(_skeleton);
|
||||
}
|
||||
|
||||
void SkeletonAnimation::draw(cocos2d::Renderer *renderer, const cocos2d::Mat4 &transform, uint32_t transformFlags) {
|
||||
if (_firstDraw) {
|
||||
_firstDraw = false;
|
||||
update(0);
|
||||
}
|
||||
super::draw(renderer, transform, transformFlags);
|
||||
}
|
||||
|
||||
void SkeletonAnimation::setAnimationStateData (spAnimationStateData* stateData) {
|
||||
CCASSERT(stateData, "stateData cannot be null.");
|
||||
|
||||
|
||||
@ -109,6 +109,7 @@ protected:
|
||||
spAnimationState* _state;
|
||||
|
||||
bool _ownsAnimationStateData;
|
||||
bool _firstDraw;
|
||||
|
||||
StartListener _startListener;
|
||||
InterruptListener _interruptListener;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user