From 6cc687d1fd210a7c0722baa2458498e09c188585 Mon Sep 17 00:00:00 2001 From: bd_ Date: Wed, 6 Mar 2024 00:51:43 -0800 Subject: [PATCH] fix: broken humanoid rigs can break assumptions made in EasySetupOutfit (#737) Closes: #735 --- Editor/EasySetupOutfit.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Editor/EasySetupOutfit.cs b/Editor/EasySetupOutfit.cs index 28fbe56c..1afbbcc3 100644 --- a/Editor/EasySetupOutfit.cs +++ b/Editor/EasySetupOutfit.cs @@ -154,7 +154,7 @@ namespace nadena.dev.modular_avatar.core.editor var parentTransform = subConfig.transform.parent; var parentConfig = parentTransform.GetComponentInParent(); var parentMapping = parentConfig.MapBone(parentTransform); - + subConfig.mergeTarget = new AvatarObjectReference(); subConfig.mergeTarget.referencePath = RuntimeUtil.RelativePath(avatarRoot, parentMapping.gameObject); @@ -316,7 +316,7 @@ namespace nadena.dev.modular_avatar.core.editor }; return false; } - + if (nearestAvatarTransform == xform) { errorMessageGroups = new string[] @@ -386,6 +386,14 @@ namespace nadena.dev.modular_avatar.core.editor outfitHips = outfitAnimator.isHuman ? outfitAnimator.GetBoneTransform(HumanBodyBones.Hips)?.gameObject : null; + + if (outfitHips.transform.parent == outfitRoot.transform) + { + // Sometimes broken rigs can have the hips as a direct child of the root, instead of having + // an intermediate Armature object. We do not currently support this kind of rig, and so we'll + // assume the outfit's humanoid rig is broken and move on to heuristic matching. + outfitHips = null; + } } var hipsCandidates = new List();