fix(Skel38BinWriter): 修复动画时间线计数错误,排除SLOT_ALPHA类型#25
Open
Agent-0808 wants to merge 1 commit intowang606:mainfrom
Open
fix(Skel38BinWriter): 修复动画时间线计数错误,排除SLOT_ALPHA类型#25Agent-0808 wants to merge 1 commit intowang606:mainfrom
Agent-0808 wants to merge 1 commit intowang606:mainfrom
Conversation
修改动画二进制写入逻辑,正确计算非SLOT_ALPHA类型的时间线数量。 原实现错误地包含了所有时间线,现通过遍历检查类型来准确计数。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修复 Slot 时间线数量计算问题(4.2 转 3.8)
注:本提交由 LLM 分析定位问题并修复,经我人工测试验证通过。我不熟悉 Spine 内部格式细节。
问题描述
发现一个特定 Spine 4.2 版本的骨骼数据转换为 3.8 版本时,转换后的文件无法在 Spine 中打开的问题。
错误信息:
修复说明
问题原因
Spine 4.2 引入了
SLOT_ALPHA时间线类型,但 3.8 版本不支持此类型。原代码在写入时间线数量时,写入了包含
SLOT_ALPHA的总数,但在实际写入数据时跳过了SLOT_ALPHA时间线。这导致 Spine 3.8 读取时期待的时间线数量与实际写入的数量不匹配,引发数组越界错误。修复方案
在写入时间线数量前,先计算实际会写入的时间线数量(排除
SLOT_ALPHA)。文件:
src/SkeletonData38BinaryWriter.cpp修改位置:
writeAnimation()函数中 Slot 时间线序列化部分(约第 244 行)修改前:
修改后:
测试验证
测试文件
ch0309_home.zip
CH0309_home.skel(Spine 4.2 版本,包含 Alpha 时间线).skel格式测试结果
IndexOutOfBoundsException影响范围
检查清单