feat(model): humanoid 骨名映射对齐 MMD/中文(契约 skeleton-topology 0.2.0)
- CANDIDATES 由服务端表生成写入(与 model-inspector.ts 逐字一致,parity 测试断言) - normalize() 保留 CJK/假名并把全角 ASCII 折半角,修复 MMD 骨名归一化成空串导致 humanoid 覆盖率恒为 0/22 的问题 - contracts/ 同步至 0.5.0 / 0.2.0
This commit is contained in:
+30
-22
@@ -60,8 +60,16 @@ static func normalize(node_name: String) -> String:
|
||||
var out := ""
|
||||
for i in lower.length():
|
||||
var c := lower[i]
|
||||
var code := c.unicode_at(0)
|
||||
if (c >= "a" and c <= "z") or (c >= "0" and c <= "9"):
|
||||
out += c
|
||||
elif code >= 0xff01 and code <= 0xff5e:
|
||||
# 全角 ASCII 折成半角:MMD 常写「足IK」「つま先IK」
|
||||
out += String.chr(code - 0xfee0)
|
||||
elif (code >= 0x3040 and code <= 0x30ff) or (code >= 0x4e00 and code <= 0x9fff) or code == 0x3005:
|
||||
# 中文 / 日文必须保留:MMD 骨名(上半身 / 左ひじ / 首 / 下半身)全是这些字符;
|
||||
# v0.3.0 之前只保留 a-z0-9,MMD 骨名会归一化成空串、humanoid 覆盖率恒为 0/22。
|
||||
out += c
|
||||
return out
|
||||
|
||||
|
||||
@@ -100,28 +108,28 @@ static func variants(node_name: String) -> PackedStringArray:
|
||||
|
||||
## 每个 canonical 骨骼的候选名(全部为归一化后的形态,含 compact 与 expanded 写法)
|
||||
const CANDIDATES := {
|
||||
"hips": ["chips", "hips", "hip", "pelvis", "root"],
|
||||
"spine": ["cspine", "spine", "spine1", "spinemid"],
|
||||
"chest": ["cchest", "chest", "spine2", "spineupper"],
|
||||
"upperChest": ["cupperchest", "upperchest", "chest2", "spine3"],
|
||||
"neck": ["cneck", "neck", "neck1"],
|
||||
"head": ["chead", "head"],
|
||||
"leftShoulder": ["lshoulder", "leftshoulder", "shoulderl", "shoulderleft", "claviclel", "lclavicle"],
|
||||
"leftUpperArm": ["lupperarm", "leftupperarm", "larm", "leftarm", "luparm"],
|
||||
"leftLowerArm": ["llowerarm", "leftlowerarm", "lforearm", "leftforearm", "lelbow"],
|
||||
"leftHand": ["lhand", "lefthand", "lwrist", "leftwrist"],
|
||||
"rightShoulder": ["rshoulder", "rightshoulder", "shoulderr", "shoulderright", "clavicler", "rclavicle"],
|
||||
"rightUpperArm": ["rupperarm", "rightupperarm", "rarm", "rightarm", "ruparm"],
|
||||
"rightLowerArm": ["rlowerarm", "rightlowerarm", "rforearm", "rightforearm", "relbow"],
|
||||
"rightHand": ["rhand", "righthand", "rwrist", "rightwrist"],
|
||||
"leftUpperLeg": ["lupperleg", "leftupperleg", "lthigh", "leftthigh", "lupleg", "lhip", "lefthip"],
|
||||
"leftLowerLeg": ["llowerleg", "leftlowerleg", "lleg", "leftleg", "lshin", "leftshin", "lknee", "leftknee"],
|
||||
"leftFoot": ["lfoot", "leftfoot", "lankle", "leftankle"],
|
||||
"leftToes": ["ltoes", "lefttoes", "ltoe", "lefttoe", "ltoebase", "lefttoebase"],
|
||||
"rightUpperLeg": ["rupperleg", "rightupperleg", "rthigh", "rightthigh", "rupleg", "rhip", "righthip"],
|
||||
"rightLowerLeg": ["rlowerleg", "rightlowerleg", "rleg", "rightleg", "rshin", "rightshin", "rknee", "rightknee"],
|
||||
"rightFoot": ["rfoot", "rightfoot", "rankle", "rightankle"],
|
||||
"rightToes": ["rtoes", "righttoes", "rtoe", "righttoe", "rtoebase", "righttoebase"],
|
||||
"hips": ["chips", "hips", "hip", "pelvis", "root", "下半身", "腰", "センター", "center", "臀部", "髋", "骨盆"],
|
||||
"spine": ["cspine", "spine", "spine1", "spinemid", "上半身", "脊椎", "脊柱"],
|
||||
"chest": ["cchest", "chest", "spine2", "spineupper", "上半身2", "胸部", "胸"],
|
||||
"upperChest": ["cupperchest", "upperchest", "chest2", "spine3", "上半身3"],
|
||||
"neck": ["cneck", "neck", "neck1", "首", "颈", "脖子"],
|
||||
"head": ["chead", "head", "頭", "头", "头部"],
|
||||
"leftShoulder": ["lshoulder", "leftshoulder", "shoulderl", "shoulderleft", "claviclel", "lclavicle", "左肩", "左锁骨"],
|
||||
"leftUpperArm": ["lupperarm", "leftupperarm", "larm", "leftarm", "luparm", "左腕", "左大臂", "左上臂", "左臂"],
|
||||
"leftLowerArm": ["llowerarm", "leftlowerarm", "lforearm", "leftforearm", "lelbow", "左ひじ", "左肘", "左小臂", "左前臂"],
|
||||
"leftHand": ["lhand", "lefthand", "lwrist", "leftwrist", "左手首", "左手", "左手腕"],
|
||||
"rightShoulder": ["rshoulder", "rightshoulder", "shoulderr", "shoulderright", "clavicler", "rclavicle", "右肩", "右锁骨"],
|
||||
"rightUpperArm": ["rupperarm", "rightupperarm", "rarm", "rightarm", "ruparm", "右腕", "右大臂", "右上臂", "右臂"],
|
||||
"rightLowerArm": ["rlowerarm", "rightlowerarm", "rforearm", "rightforearm", "relbow", "右ひじ", "右肘", "右小臂", "右前臂"],
|
||||
"rightHand": ["rhand", "righthand", "rwrist", "rightwrist", "右手首", "右手", "右手腕"],
|
||||
"leftUpperLeg": ["lupperleg", "leftupperleg", "lthigh", "leftthigh", "lupleg", "lhip", "lefthip", "左足", "左大腿"],
|
||||
"leftLowerLeg": ["llowerleg", "leftlowerleg", "lleg", "leftleg", "lshin", "leftshin", "lknee", "leftknee", "左ひざ", "左膝", "左小腿", "左膝盖"],
|
||||
"leftFoot": ["lfoot", "leftfoot", "lankle", "leftankle", "左足首", "左脚", "左脚踝"],
|
||||
"leftToes": ["ltoes", "lefttoes", "ltoe", "lefttoe", "ltoebase", "lefttoebase", "左つま先", "左脚趾"],
|
||||
"rightUpperLeg": ["rupperleg", "rightupperleg", "rthigh", "rightthigh", "rupleg", "rhip", "righthip", "右足", "右大腿"],
|
||||
"rightLowerLeg": ["rlowerleg", "rightlowerleg", "rleg", "rightleg", "rshin", "rightshin", "rknee", "rightknee", "右ひざ", "右膝", "右小腿", "右膝盖"],
|
||||
"rightFoot": ["rfoot", "rightfoot", "rankle", "rightankle", "右足首", "右脚", "右脚踝"],
|
||||
"rightToes": ["rtoes", "righttoes", "rtoe", "righttoe", "rtoebase", "righttoebase", "右つま先", "右脚趾"],
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user