4 # Called when the node enters the scene tree for the first time.
9 # TODO: this doesn't work well because animation pose positions are offset!
10 # The actual solution is to make blender spit out a proper skeleton hierarchy
11 func _reparent_rigify_floating_bones() -> void:
12 var head_bone_idx: int = find_bone("DEF-spine.006")
13 var head_bone_rest: Transform3D = get_bone_global_rest(head_bone_idx)
15 var to_head_arr := ["ORG-face", "DEF-hair-root", "DEF-hair-root.001",
16 "DEF-hair-root.002", "DEF-hair-root.003", "DEF-hair-root.004",
20 # parent the face, hair, and horns to the head bone
22 var idx: int = find_bone(n)
23 var rest: Transform3D = get_bone_global_rest(idx)
25 # set bone position relative to its new parent
26 set_bone_rest(idx, rest * head_bone_rest)
27 #set_bone_pose_position(idx, head_bone_rest.basis.x - rest.basis.x)
28 set_bone_parent(idx, head_bone_idx)