diff --git a/CHANGELOG-PRERELEASE.md b/CHANGELOG-PRERELEASE.md index f344edb4..aae4cc7a 100644 --- a/CHANGELOG-PRERELEASE.md +++ b/CHANGELOG-PRERELEASE.md @@ -10,6 +10,9 @@ The format is based on [Keep a Changelog]. ### Added ### Changed +- Make error for MergeBone with MergePB rotation mode fix `#1345` + - This was not working as expected in previous version so I made this error. + - We may add support or change behavior in the future release ### Deprecated diff --git a/CHANGELOG.md b/CHANGELOG.md index 58438b8b..7ca6bd53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,7 +55,7 @@ The format is based on [Keep a Changelog]. - AAO 1.8.0 introduced BlendShape support for Merge Skinned Mesh, but new default mode "Rename to avoid conflicts" would increase number of BlendShape. - This feature is added to relax this problem by automatically merging multiple BlendShapes of one Mesh. - With this feature, you can use rename mode without performance loss. -- Fix mode for PhysBone Limits in Merge PhysBone `#665` `#1336` +- Fix mode for PhysBone Limits in Merge PhysBone `#665` `#1336` `#1345` - In addition to existing `Copy` and `Override`, we added `Fix` mode. - This mode will try to correct roll axis by rotating bone. - This feature allows you to configure the mode for PhysBone Limits in Merge PhysBone. diff --git a/Editor/Processors/MergePhysBoneProcessor.cs b/Editor/Processors/MergePhysBoneProcessor.cs index 3dac5e45..f039c2fd 100644 --- a/Editor/Processors/MergePhysBoneProcessor.cs +++ b/Editor/Processors/MergePhysBoneProcessor.cs @@ -149,13 +149,18 @@ internal static void DoMerge(MergePhysBone merge, BuildContext? context) } } - var newIgnores = new List(); + var originalBones = new List(); // fix rotations foreach (var physBone in sourceComponents) - FixYawPitch(physBone, root, context, newIgnores); + FixYawPitch(physBone, root, context, originalBones); + + if (originalBones.Any(x => x.GetComponent())) + { + BuildLog.LogError("MergePhysBone:error:limit-rotation-fix-merge-bone"); + } // fix configurations - merged.ignoreTransforms = merged.ignoreTransforms.Concat(newIgnores).ToList(); + merged.ignoreTransforms = merged.ignoreTransforms.Concat(originalBones).ToList(); var sourceComponent = sourceComponents[0]; var chainLength = sourceComponent.BoneChainLength(); @@ -236,7 +241,7 @@ public static void FixYawPitch( VRCPhysBoneBase physBone, Transform root, BuildContext? context, - List newIgnores) + List originalBones) { // Already fixed; nothing to do! if (physBone.limitRotation.Equals(Vector3.zero)) return; @@ -246,7 +251,7 @@ public static void FixYawPitch( var ignoreTransforms = new HashSet(physBone.ignoreTransforms); - RotateRecursive(physBone, physBone.GetTarget(), root, maxChainLength, 0, ignoreTransforms, newIgnores); + RotateRecursive(physBone, physBone.GetTarget(), root, maxChainLength, 0, ignoreTransforms, originalBones); } /* @@ -293,7 +298,7 @@ private static void RotateRecursive(VRCPhysBoneBase physBone, int totalDepth, int depth, HashSet ignoreTransforms, - List newIgnores) + List originalBones) { Vector3 targetLocation; @@ -365,7 +370,7 @@ private static void RotateRecursive(VRCPhysBoneBase physBone, // move old bone to child of newBone transform.SetParent(newBone.transform, true); - newIgnores.Add(transform); + originalBones.Add(transform); //var rotationQuaternion = Quaternion.Euler(0, -thisRotation, 0); @@ -375,7 +380,7 @@ private static void RotateRecursive(VRCPhysBoneBase physBone, //child.localRotation = rotationQuaternion * child.localRotation; if (ignoreTransforms.Contains(child)) continue; - RotateRecursive(physBone, child, newBone.transform, totalDepth, depth + 1, ignoreTransforms, newIgnores); + RotateRecursive(physBone, child, newBone.transform, totalDepth, depth + 1, ignoreTransforms, originalBones); } } diff --git a/Localization/en-us.po b/Localization/en-us.po index a8ac3669..a2aa9b11 100644 --- a/Localization/en-us.po +++ b/Localization/en-us.po @@ -278,6 +278,9 @@ msgstr "Components" msgid "MergePhysBone:warning:limit-rotation-fix-animation" msgstr "Limit Rotation mode is Fix but physBone affected transforms are animated." +msgid "MergePhysBone:warning:limit-rotation-fix-animation" +msgstr "Merge Bone on PhysBone for Merge PhysBone with Limit Rotation mode Fix does not work and completely unsupported." + msgid "MergePhysBone:warning:limit-rotation-fix-animation:description" msgstr "This is not supported with Limit Rotation mode Fix for now."