Skip to content

[Spine] **供官方参考** 修复迄今为止我反馈的所有spine的 bug. #18638

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

Open
wants to merge 19 commits into
base: v3.8.7
Choose a base branch
from

Conversation

finscn
Copy link
Contributor

@finscn finscn commented Apr 18, 2025

Re: #

此 PR 并不奢望官方合并 , 只是提供参考.
从我开始用 cocos 3.x , 迄今为止, 反馈了大概 十几个 spine 的bug (有些 bug 的诱因可能是同样的).

经过最近一段时间通宵达旦的研究和学习, 我在自己的自定义引擎里, 尝试解决了目前我自己遇到的所有问题.
期间也合并了官方 一些关于的 spine PR (截止到 上周的 #18581)

最终整理出了这个 PR, 希望能帮助官方解决更多的 spine 的bug.

我的这些方案可能治标不治本 或者 会引出新的 bug.不敢保证百分百正确.
但是至少目前我们的项目运行还 ok .

注意 我们使用的是3.8, 4.2下没有测试, 而且没有使用 缓存模式.
所以 Cache相关的代码都没有改动过.所以我的这个 PR 可能在 4.2 或者 cache模式下有bug.


补充说明:

我们的项目是一个移植项目, 把一个原版用 c++自研引擎的游戏 用cocos 重写.
该项目重度依赖spine 3.8 , spine 动画数量700多个, 而且用法比较复杂, 各种融合、动态换肤、多track 同时播放、自定义播放顺序,自定义播放区间, 倒放, 变速播放 等等。
所以 我可能确实会遇到一些别人不太会遇到的 bug.
处于保密协议等原因, 有些 bug 我也很难提供重现 demo.

Changelog


Continuous Integration

This pull request:

  • needs automatic test cases check.

    Manual trigger with @cocos-robot run test cases afterward.

  • does not change any runtime related code or build configuration

    If any reviewer thinks the CI checks are needed, please uncheck this option, then close and reopen the issue.


Compatibility Check

This pull request:

  • changes public API, and have ensured backward compatibility with deprecated features.
  • affects platform compatibility, e.g. system version, browser version, platform sdk version, platform toolchain, language version, hardware compatibility etc.
  • affects file structure of the build package or build configuration which requires user project upgrade.
  • introduces breaking changes, please list all changes, affected features and the scope of violation.

finscn added 10 commits April 18, 2025 16:20
导出 addAnimation 方法
- 添加 addAnimation() 方法;
- 删除多余的  _animState->clearTracks();
- 删除多余的  _skeleton->setToSetupPose();
- 删除多余的 _skeleton->updateWorldTransform()
在头文件中添加 addAnimation() 方法的声明
- 统一 setAnimation() 和 addAnimation() 中 判断 animation 是否存在的 逻辑
- 通过新增的 this._instance!.addAnimation() 方法来调用原生的相关逻辑.
- 为 addAnimation() 方法添加 _state->apply(*_skeleton);
- 删除 多余的(错误的) setToSetupPose() 调用
删除多余的(错误的) setSlotsToSetupPose() 调用
导出 addAnimation() 方法
确保构建时, 可以通过命令行的 -D 进行传参.
不添加 `CACHE STRING` , 无论-D 后面怎么写, 构建时还是以 文件里写的为准.很不方便.
必须使用
```
emcmake cmake .. -G "Ninja"
```

你们官方本机不需要加 -G "Ninja" , 可能是因为你们的机器里之前执行过  `emcmake cmake .. -G "Ninja"`
- 修改 调用update(0) 的逻辑, 通过标志位来延迟调用.
- 修正 计算 loopCount 时的 bug.
- 在 updateAnimation() 中添加 markForUpdateRenderData() 
- 添加 /* global globalThis */ 注释, 避免开发工具中报错
@finscn
Copy link
Contributor Author

finscn commented Apr 18, 2025

@bofeng-song @dumganhar 请参考

finscn added 3 commits April 18, 2025 17:19
同步 upstream .
添加 addAnimation() 方法的声明
添加
```
// eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
```
解决 枚举对象 TextureFilter 中有重复值的问题.

这里的重复值 是否可以去掉 ?   @bofeng-song @dumganhar
event 不存在时, 不执行 emitListener() 和  emitTrackEntryListener() 中的逻辑.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant