mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2024-12-29 18:55:06 +08:00
chore: show error if outfit PhysBones affect to humanoid bones
This commit is contained in:
parent
b0c339e9d0
commit
4f3761ebf2
@ -94,6 +94,7 @@
|
||||
"hint.bad_vrcsdk": "Incompatible version of VRCSDK detected.\n\nPlease try upgrading your VRCSDK; if this does not work, check for a newer version of Modular Avatar as well.",
|
||||
"error.stack_trace": "Stack trace (provide this when reporting bugs!)",
|
||||
"error.merge_armature.merge_into_self": "Your Merge Armature component is referencing itself, or a child of itself, as the merge target. You should reference the avatar's armature instead. Do not put Merge Armature on the avatar's main armature.",
|
||||
"error.merge_armature.physbone_on_humanoid_bone": "PhysBone is set on the humanoid bone in armature to merge. You should remove PhysBone on the humanoid bone in armature to merge.",
|
||||
"error.internal_error": "An internal error has occurred: {0}\nwhen processing:",
|
||||
"error.merge_animator.param_type_mismatch": "Parameter {0} has multiple types: {1} != {2}",
|
||||
"error.rename_params.too_many_synced_params": "Too many synced parameters: Cost {0} > {1}",
|
||||
|
@ -92,6 +92,7 @@
|
||||
"hint.bad_vrcsdk": "使用中のVRCSDKのバージョンとは互換性がありません。\n\nVRCSDKを更新してみてください。それでもだめでしたら、Modular Avatarにも最新版が出てないかチェックしてください。",
|
||||
"error.stack_trace": "スタックトレース(バグを報告する時は必ず添付してください!)",
|
||||
"error.merge_armature.merge_into_self": "Merge Armatureに自分自身のオブジェクト、もしくは自分の子をターゲットにしてしています。かわりにアバターのメインArmatureを指定してください。アバター自体のArmatureに追加しないでください。",
|
||||
"error.merge_armature.physbone_on_humanoid_bone": "統合するArmatureのHumanoidボーンにPhysBoneが設定されています。統合するArmatureのHumanoidボーンからPhysBoneを削除してください。",
|
||||
"error.internal_error": "内部エラーが発生しました:{0}\n以下のオブジェクトの処理中に発生しました:",
|
||||
"error.merge_animator.param_type_mismatch": "パラメーター {0} に複数の種別が設定されています: {1} != {2}",
|
||||
"error.rename_params.too_many_synced_params": "同期パラメーターが多すぎます。コスト{0}が制限値の{1}を超えています。",
|
||||
|
@ -325,10 +325,17 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
childName.Length - config.prefix.Length - config.suffix.Length);
|
||||
var targetObject = newParent.transform.Find(targetObjectName);
|
||||
// Zip merge bones if the names match and the outfit side is not affected by its own PhysBone.
|
||||
if (targetObject != null && !IsAffectedByPhysBone(child))
|
||||
if (targetObject != null)
|
||||
{
|
||||
childNewParent = targetObject.gameObject;
|
||||
shouldZip = true;
|
||||
if (!IsAffectedByPhysBone(child))
|
||||
{
|
||||
childNewParent = targetObject.gameObject;
|
||||
shouldZip = true;
|
||||
}
|
||||
else if (IsHumanoidBone(targetObject))
|
||||
{
|
||||
BuildReport.LogFatal("error.merge_armature.physbone_on_humanoid_bone", new string[0], config);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -341,5 +348,22 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
{
|
||||
return physBones.Any(x => target.IsChildOf(x.GetRootTransform()) && !x.ignoreTransforms.Any(target.IsChildOf));
|
||||
}
|
||||
|
||||
private bool IsHumanoidBone(Transform target)
|
||||
{
|
||||
var animator = target.GetComponentInParent<Animator>();
|
||||
if (animator != null)
|
||||
{
|
||||
foreach (HumanBodyBones bone in Enum.GetValues(typeof(HumanBodyBones)))
|
||||
{
|
||||
if (bone == HumanBodyBones.LastBone) continue;
|
||||
if (target == animator.GetBoneTransform(bone))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user