Skip to content

Commit

Permalink
refine
Browse files Browse the repository at this point in the history
  • Loading branch information
bofeng-song committed Sep 20, 2024
1 parent 7a051b8 commit 8c532a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,21 @@

using namespace spine;

spine::Vector<Timeline*> convertAndUseVector(const std::vector<std::shared_ptr<Timeline>>& stdVec) {
spine::Vector<Timeline*> spineVec;

spine::Vector<Timeline*>& convertAndUseVector(const std::vector<std::shared_ptr<Timeline>>& stdVec, spine::Vector<Timeline*>& _spineVecTimelines) {
for (const auto& element : stdVec) {
spineVec.add(element.get());
_spineVecTimelines.add(element.get());
}

return spineVec;
return _spineVecTimelines;
}

SpineAnimation::SpineAnimation(const String& name, std::vector<std::shared_ptr<Timeline>> timelines, float duration) : Animation(name, std::move(convertAndUseVector(timelines)), duration) {
SpineAnimation::SpineAnimation(const String& name, std::vector<std::shared_ptr<Timeline>> timelines, float duration) : Animation(name, convertAndUseVector(timelines, _spineVecTimelines), duration) {
_vecTimelines = timelines;
}

SpineAnimation::~SpineAnimation() {
_vecTimelines.clear();
_spineVecTimelines.clear();
auto& timelines = getTimelines();
timelines.clear();
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class SpineAnimation : public Animation {

private:
std::vector<std::shared_ptr<Timeline>> _vecTimelines;
spine::Vector<Timeline*> _spineVecTimelines;
};

} // namespace spine

0 comments on commit 8c532a4

Please sign in to comment.