ani
This commit is contained in:
+14
-1
@@ -27,6 +27,19 @@ const CANONICAL := [
|
||||
]
|
||||
|
||||
|
||||
## Godot sanitises ':' to '_' while turning glTF nodes into scene names. The
|
||||
## sidecar intentionally keeps the source bone spelling so Blender can verify
|
||||
## it against the exported GLB, therefore every runtime consumer must resolve
|
||||
## through this bridge instead of assuming those two representations match.
|
||||
static func find_imported_bone(skel: Skeleton3D, authored_name: String) -> int:
|
||||
if authored_name == "":
|
||||
return -1
|
||||
var bone := skel.find_bone(authored_name)
|
||||
if bone < 0 and authored_name.contains(":"):
|
||||
bone = skel.find_bone(authored_name.replace(":", "_"))
|
||||
return bone
|
||||
|
||||
|
||||
## Resolve `names` against a skeleton, given the sidecar's role table.
|
||||
##
|
||||
## The spine needs its own handling because a rig that kept its own skeleton
|
||||
@@ -52,7 +65,7 @@ static func resolve(skel: Skeleton3D, roles: Dictionary,
|
||||
# Canonical names are the role keys with the DEF- prefix, so the limbs,
|
||||
# hips, neck and head all map straight through.
|
||||
var actual: String = alias.get(n, roles.get(String(n).trim_prefix("DEF-"), n))
|
||||
var b := skel.find_bone(actual)
|
||||
var b := find_imported_bone(skel, actual)
|
||||
if b < 0:
|
||||
b = skel.find_bone(String(n))
|
||||
idx[n] = b
|
||||
|
||||
Reference in New Issue
Block a user