feat: 将Atlas的scale参数处理移动至skel中,实现无损4→3降级#29
Draft
Agent-0808 wants to merge 7 commits into
Draft
Conversation
此前处理加权网格时错误地缩放了 vertices 中的所有元素,导致 vector 越界。 修复:只缩放 x, y 坐标,跳过 boneCount、bone index 和 weight。
调整 applyAtlasScale 函数,区分加权和非加权网格的缩放逻辑,对非加权网格直接缩放全部顶点坐标
Agent-0808
marked this pull request as draft
June 24, 2026 06:33
Contributor
Author
|
发现还是有不对的地方 |
yCENzh
added a commit
to yCENzh/SpineSkeletonDataConverter
that referenced
this pull request
Jul 14, 2026
- curve: 增加 epsilon 阈值保护贝塞尔曲线归一化除零 (PR #33) - curve: 4.x→3.x 转换时截断多分量曲线残留数据 (PR #33) - writer(42): 加权网格判断 `>` 改为 `!=` 更精确 (PR #31) - cmake: 输出目录改为 bin/ (exe) 和 lib/ (静态库) (PR #26) - common: 添加 <sstream> 头文件包含 (PR #26) - gitignore: 忽略更多构建产物 (PR #26) - converter: SpineConverter.py 跨平台搜索可执行文件 (PR #26) - atlas: SpineAtlasDowngrade.py 新增 --ignore-scale 无损模式 (PR #29) Refs: wang606/SpineSkeletonDataConverter#33 wang606/SpineSkeletonDataConverter#31 wang606/SpineSkeletonDataConverter#29 wang606/SpineSkeletonDataConverter#26
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.
功能:--atlas-scale 参数实现
相关issue: #20 #28
声明:代码是我vibe出来的,我确实不太懂spine内部格式,但是我用手头的素材测试了一下可以正常使用。
至于有没有更好的实现方法我就不清楚了233
保留了原方案为默认方案,新实现的无损转换功能通过
--atlas-scale参数开启。下方的报告也是AI代写
背景
Spine 4.x Atlas 支持 scale 参数(如 scale: 0.6 或 1.27),Spine 3.x 不支持。
传统降级方案通过缩放 PNG 图像处理,导致像素精度损失。
方案
将 Atlas scale 操作转移到 Skel 文件的浮点数据转换中,实现无损转换。
实现细节
applyAtlasScale(SkeletonData& data, double scale)函数处理以下数据:bone.x,bone.y,bone.length× scaleroot.scaleX,root.scaleY× (1/scale),恢复设计尺寸x,y,width,height× scalewidth,height× scalevertices处理:[boneCount, boneIdx, weight, x, y, ...]循环格式,只缩放 x, y 坐标[x, y, x, y, ...]直接缩放所有坐标width,height× (1/scale)使用方式
方式一:Python 脚本
方式二:手动调用
文件更新
src/main.cpp:添加applyAtlasScale()函数和--atlas-scale参数tools/Spine4xTo38Converter.py:添加--lossless模式,集成 atlas scale 处理逻辑tools/SpineAtlasDowngrade.py:添加--ignore-scale参数