-
Notifications
You must be signed in to change notification settings - Fork 2k
统一spine中 setAnimation 和 addAnimation 方法的结构. #18549
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
Conversation
非缓存模式下 , setAnimation 和 addAnimation 方法 除了 最终调用的 spine底层方法不一样之外, 其他的逻辑 应该完全一致. 这个 commit 的目的就是 统一两者的结构 : - 两者应该用同样的方式来判断 animation是否存在 并且给与同样的提示 - 因为在判断 animation 是否存在时, 也判断了 this._skeleton 的有效性, 所以后面不用再做相关判断. - 经过测试, setAnimation 和 addAnimation 统一使用 this.state 下的相关方法是更好的选择. - setAnimation() 中的 `this._markForUpdateRenderData()` 是多余的, 因为spine在update 时, 会调用这个方法.
Code Size Check Report
Interface Check ReportThis pull request does not change any public interfaces ! |
经过测试 this._instance!.setAnimation() 和 this._state?.setAnimationWith() 并不等价. 前者比后者多了一个 updateWorldTransform() .
this._markForUpdateRenderData(); | ||
|
||
this._animationName = name; | ||
const trackEntry = this._instance!.setAnimation(trackIndex, name, loop); |
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._instance is not working at cache mode.
This issue is scheduled to be resolved in an upcoming major version refactoring.
} | ||
return null; | ||
|
||
return this._state?.addAnimationWith(trackIndex, animation, loop, delay); |
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.
cache-mode will cache animtion frame, so it can not be called immediately.
此 PR 作废. |
非缓存模式下 , setAnimation 和 addAnimation 方法
除了 最终调用的 spine底层方法不一样之外, 其他的逻辑 应该完全一致.
这个 commit 的目的就是 统一两者的结构 :
两者应该用同样的方式来判断 animation是否存在 并且给与同样的提示
因为在判断 animation 是否存在时, 也判断了 this._skeleton 的有效性, 所以后面不用再做相关判断.
经过测试, setAnimation 和 addAnimation 统一使用 this.state 下的相关方法是更好的选择.更新: 因为需要
_animState->apply(*_skeleton)
, 所以暂时不能用 state.setAnimationWith()setAnimation() 中的
this._markForUpdateRenderData()
是多余的, 因为spine在update 时, 会调用这个方法.Re: #
Changelog
Continuous Integration
This pull request:
Compatibility Check
This pull request: