diff --git a/spine-cpp/spine-cpp/include/spine/Animation.h b/spine-cpp/spine-cpp/include/spine/Animation.h index 38e8c2565..c30997f38 100644 --- a/spine-cpp/spine-cpp/include/spine/Animation.h +++ b/spine-cpp/spine-cpp/include/spine/Animation.h @@ -145,6 +145,9 @@ namespace spine { /// The animation's name, which is unique across all animations in the skeleton. const String &getName(); + /// The bone indices affected by this animation. + const Vector &getBones(); + /// @param target After the first and before the last entry. static int search(Vector &values, float target); diff --git a/spine-cpp/spine-cpp/include/spine/InheritTimeline.h b/spine-cpp/spine-cpp/include/spine/InheritTimeline.h index 6c79eedc6..78319533a 100644 --- a/spine-cpp/spine-cpp/include/spine/InheritTimeline.h +++ b/spine-cpp/spine-cpp/include/spine/InheritTimeline.h @@ -54,7 +54,7 @@ namespace spine { virtual void apply(Skeleton &skeleton, float lastTime, float time, Vector *pEvents, float alpha, MixBlend blend, - MixDirection direction); + MixDirection direction, bool appliedPose); int getBoneIndex() { return _boneIndex; } diff --git a/spine-cpp/spine-cpp/src/spine/Animation.cpp b/spine-cpp/spine-cpp/src/spine/Animation.cpp index f1e2f85ea..df24c6009 100644 --- a/spine-cpp/spine-cpp/src/spine/Animation.cpp +++ b/spine-cpp/spine-cpp/src/spine/Animation.cpp @@ -32,6 +32,8 @@ #include #include #include +#include +#include #include @@ -76,6 +78,10 @@ const String &Animation::getName() { return _name; } +const Vector &Animation::getBones() { + return _bones; +} + Vector &Animation::getTimelines() { return _timelines; } @@ -113,18 +119,21 @@ void Animation::setTimelines(Vector &timelines) { HashMap boneSet; for (size_t i = 0; i < n; i++) { Timeline *timeline = timelines[i]; - Vector propertyIds = timeline->getPropertyIds(); + Vector &propertyIds = timeline->getPropertyIds(); for (size_t ii = 0; ii < propertyIds.size(); ii++) { _timelineIds.put(propertyIds[ii], true); } - BoneTimeline *boneTimeline = timeline->getRTTI().instanceOf(BoneTimeline1::rtti) ? static_cast(timeline) : NULL; - if (boneTimeline) { - int boneIndex = boneTimeline->getBoneIndex(); - if (!boneSet.containsKey(boneIndex)) { - boneSet.put(boneIndex, true); - _bones.add(boneIndex); - } + int boneIndex = -1; + if (timeline->getRTTI().instanceOf(BoneTimeline1::rtti)) { + boneIndex = static_cast(timeline)->getBoneIndex(); + } else if (timeline->getRTTI().instanceOf(BoneTimeline2::rtti)) { + boneIndex = static_cast(timeline)->getBoneIndex(); + } + + if (boneIndex >= 0 && !boneSet.containsKey(boneIndex)) { + boneSet.put(boneIndex, true); + _bones.add(boneIndex); } } } diff --git a/spine-cpp/spine-cpp/src/spine/InheritTimeline.cpp b/spine-cpp/spine-cpp/src/spine/InheritTimeline.cpp index d8da9e827..b1d069cdb 100644 --- a/spine-cpp/spine-cpp/src/spine/InheritTimeline.cpp +++ b/spine-cpp/spine-cpp/src/spine/InheritTimeline.cpp @@ -58,17 +58,18 @@ void InheritTimeline::setFrame(int frame, float time, Inherit inherit) { void InheritTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector *pEvents, float alpha, - MixBlend blend, MixDirection direction) { + MixBlend blend, MixDirection direction, bool appliedPose) { SP_UNUSED(lastTime); SP_UNUSED(pEvents); SP_UNUSED(direction); SP_UNUSED(alpha); + SP_UNUSED(appliedPose); Bone *bone = skeleton.getBones()[_boneIndex]; if (!bone->isActive()) return; if (direction == MixDirection_Out) { - if (blend == MixBlend_Setup) bone->setInherit(bone->_data.getInherit()); + if (blend == MixBlend_Setup) bone->_inherit = bone->_data.getInherit(); return; }