Prevent automapper throwing obscure error.

Add check to prevent the skeleton auto-mapper throwing a cryptic
error when neither a head or neck bone could initially be detected.
This commit is contained in:
Saracen 2024-08-26 23:45:03 +01:00
parent 28a72fa434
commit 3caba6e4fb
1 changed files with 5 additions and 3 deletions

View File

@ -1229,11 +1229,13 @@ void BoneMapper::auto_mapping_process(Ref<BoneMap> &p_bone_map) {
picklist.push_back("face");
int head = search_bone_by_name(skeleton, picklist, BONE_SEGREGATION_NONE, neck);
if (head == -1) {
if (neck != -1) {
search_path = skeleton->get_bone_children(neck);
if (search_path.size() == 1) {
head = search_path[0]; // Maybe only one child of the Neck is Head.
}
}
}
if (head == -1) {
if (neck != -1) {
head = neck; // The head animation should have more movement.