-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix spine::Animation & spine::Timeline can not release normally #17653
base: v3.8.5
Are you sure you want to change the base?
Conversation
Interface Check Report! WARNING this pull request has changed these public interfaces:
@@ -51436,9 +51436,10 @@
frames: ArrayLike<number>;
frameVertices: Array<ArrayLike<number>>;
constructor(frameCount: number);
getPropertyId(): number;
- setFrame(frameIndex: number, time: number, vertices: ArrayLike<number>): void;
+ setFrame(frameIndex: number, time: number, vertices: [
+ ]): void;
apply(skeleton: Skeleton, lastTime: number, time: number, firedEvents: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
}
export class EventTimeline implements Timeline {
frames: ArrayLike<number>;
|
|
||
private: | ||
std::vector<std::shared_ptr<Timeline>> _vecTimelines; | ||
spine::Vector<Timeline*> _spineVecTimelines; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why need to use two different containers at the same time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spine::Animation's constructor requires spine::Vector<Timeline*>, we need to change from std::vector to spine::Vector
* Spine Runtimes License Agreement | ||
* Last updated January 1, 2020. Replaces all prior versions. | ||
* | ||
* Copyright (c) 2013-2020, Esoteric Software LLC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a new file we created, it's not a file in spine runtime , so I think we need to use our license.
@@ -0,0 +1,18 @@ | |||
|
|||
#include "SpineAnimationState.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing licenese.
@@ -0,0 +1,21 @@ | |||
#pragma once |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing licenese.
@@ -5,6 +5,7 @@ | |||
#include "spine-mesh-data.h" | |||
#include "spine-wasm.h" | |||
#include "util-function.h" | |||
#include "../spine-creator-support/SpineAnimationState.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use '../' for include path is not a good way.
@@ -47,6 +47,8 @@ SkeletonCache *SkeletonCacheMgr::buildSkeletonCache(const std::string &uuid) { | |||
void SkeletonCacheMgr::removeSkeletonCache(const std::string &uuid) { | |||
auto it = _caches.find(uuid); | |||
if (it != _caches.end()) { | |||
auto *item = it->second; | |||
delete item; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
item->release();
} | ||
|
||
TrackEntry* SpineAnimationState::addAnimation(size_t trackIndex, std::shared_ptr<Animation> animation, bool loop, float delay) { | ||
_vecAnimations.push_back(animation); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use emplace_back
instead.
@@ -449,7 +450,6 @@ class SkeletonCache { | |||
animationCache = new AnimationCache(spData); | |||
animationCache._privateMode = this._privateMode; | |||
} | |||
animationCache.init(skeletonInfo, animationName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why doesn't need to call init method now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be called outer this block
#include <spine/AnimationState.h> | ||
#include "spine/Animation.h" | ||
#include<vector> | ||
#include<memory> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a space before <
@@ -53,6 +53,7 @@ class SP_API TranslateTimeline : public CurveTimeline { | |||
virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>* pEvents, float alpha, MixBlend blend, MixDirection direction); | |||
|
|||
virtual int getPropertyId(); | |||
inline void setBoneIndex(int inValue) {_boneIndex = inValue;} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't modify source code in spine-runtime.
Re: #
cocos/cocos-test-projects#887
Changelog
Continuous Integration
This pull request:
Compatibility Check
This pull request: