Hi Nate.
I've updated my runtime in the hope to use events in my code (I'm using cocos2d-x).
I was previously on CommitID 7d7158894d61c3b37495008ea1f12838d2bebc22 and I'm now on 93c60a0bdf12c05a4de410a2893c19c915ef08ab.
I'm a bit lost with the new code and I'm having multiple issues due to the changes in AnimationState:
1/ My skeleton uses multiple animations.
My old code
Load and init:
#define MAIN_ANIM 0
#define BLINK_ANIM 1
#define EAT_ANIM 2
CCSkeletonAnimation* skeleton = CCSkeletonAnimation::createWithFile("skel.json","skel.atlas");
skeleton->addAnimationState(); // For BLINK_ANIM
skeleton->addAnimationState(); // For EAT_ANIM
// Start animations
skeleton->setAnimation("walk",true,MAIN_ANIM);
skeleton->setAnimation("blink",true",BLINK_ANIM);
Now when some event occurs in my game, I change my main animation, and I want to clear the blink one, I used to do that:
skeleton->setAnimation("run",true,MAIN_ANIM);
skeleton->clearAnimation(BLINK_ANIM); // Stop blinking animation when running
From time to time, I start another animation (not using the same bones than the main one) like this:
skeleton->setAnimation("eat",false,EAT_ANIM);
Now that I've updated the runtime, those functions don't compile, I have to change the code.
Firstly, I removed the 2 addAnimation calls during init.
I've moved the 3rd parameter for all the setAnimation calls, to the 1st one.
Now when the clearAnimation(BLINK_ANIM) is called, I've got an access violation in _TrackEntry_dispose, called from AnimationState_clearTrack, because current->previous is 0xfeeefeee (memory already freed).
I've tried this instead of the clearAnimation call: setAnimation(BLINK_ANIM,NULL,false) but in that case I've got a segfault in _AttachementTimeline_apply, called from CCScheduler::update because self is 0xcccccccc.
Am I doing something wrong? Have I missed the new concept of "tracks" that replaced the animation index?
2/ I'm using a different timeScale for each of my animation tracks
Like we discussed in this thread viewtopic.php?f=7&t=993
I've subclassed the CCSkeletonAnimation class and added a new method:
setStateTimeScale(float scale,int stateIndex) which allowed me to use a different timeScale in the CCSkeletonAnimation::update method.
With the new AnimationState code, how can I achieve what I did before?
I need the MAIN_ANIM to run at a different timeScale than the BLINK_ANIM for example.
Thanks for your time, keep up the good work, you're awesome!