From 6b7eb4b559fa495365f8b0a1c2904f8addb4d859 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Thu, 14 Sep 2023 16:41:47 +0900 Subject: [PATCH 1/8] feat: add option to avoid name conflict in MergeBone --- Editor/Processors/MergeBoneProcessor.cs | 21 +++++++++++++++++---- Localization/en.po | 6 ++++++ Localization/ja.po | 6 ++++++ Runtime/MergeBone.cs | 7 ++++++- 4 files changed, 35 insertions(+), 5 deletions(-) diff --git a/Editor/Processors/MergeBoneProcessor.cs b/Editor/Processors/MergeBoneProcessor.cs index 9099f71f5..fe6a12c44 100644 --- a/Editor/Processors/MergeBoneProcessor.cs +++ b/Editor/Processors/MergeBoneProcessor.cs @@ -70,19 +70,24 @@ public void Process(OptimizerSession session) DoBoneMap2(meshInfo2, mergeMapping); }); + var counter = 0; + foreach (var pair in mergeMapping) { var mapping = pair.Key; var mapped = pair.Value; + var avoidNameConflict = mapping.GetComponent().avoidNameConflict; // if intermediate objects are inactive, moved bone should be initially inactive // animations are not performed correctly but if bones activity is animated, automatic // merge bone doesn't merge such bone so ignore that for manual merge bone. - var activeSelf = ActiveSelfForNow(mapping, mapped); + var (activeSelf, namePrefix) = ActiveSelfAndNamePrefix(mapping, mapped); foreach (var child in mapping.DirectChildrenEnumerable().ToArray()) { if (mergeMapping.ContainsKey(child)) continue; child.parent = mapped; if (!activeSelf) child.gameObject.SetActive(false); + if (avoidNameConflict) + child.name = namePrefix + "$" + child.name + "$" + (counter++); } } @@ -90,11 +95,19 @@ public void Process(OptimizerSession session) if (pair) Object.DestroyImmediate(pair.gameObject); - bool ActiveSelfForNow(Transform transform, Transform parent) + (bool activeSelf, string namePrefix) ActiveSelfAndNamePrefix(Transform transform, Transform parent) { + var segments = new List(); + var activeSelf = true; for (; transform != parent; transform = transform.parent) - if (!transform.gameObject.activeSelf) return false; - return true; + { + segments.Add(transform.name); + activeSelf &= transform.gameObject.activeSelf; + } + + segments.Reverse(); + + return (activeSelf, string.Join("$", segments)); } } diff --git a/Localization/en.po b/Localization/en.po index 1d66050df..87d58fa17 100644 --- a/Localization/en.po +++ b/Localization/en.po @@ -88,6 +88,12 @@ msgstr "Execute Early doesn't support Animation Remapping. Make sure you made an msgid "MergeBone:description" msgstr "You will remove this GameObject and merge bone to parent" +msgid "MergeBone:prop:avoidNameConflict" +msgstr "Avoid Name Conflict" + +msgid "MergeBone:tooltip:avoidNameConflict" +msgstr "By changing names of children GameObjects, avoid GameObject name conflict" + msgid "MergeBone:validation:thereAreComponent" msgstr "There are some components other than Transform. This is not supported." diff --git a/Localization/ja.po b/Localization/ja.po index 9a7b26104..f4dcc7c78 100644 --- a/Localization/ja.po +++ b/Localization/ja.po @@ -91,6 +91,12 @@ msgstr "'早期に実行する'はアニメーションのパス修正が動き msgid "MergeBone:description" msgstr "このGameObjectを削除して親に統合する。" +msgid "MergeBone:prop:avoidNameConflict" +msgstr "名前の競合を避ける" + +msgid "MergeBone:tooltip:avoidNameConflict" +msgstr "子GameObjectの名前を少し変更することで、ゲームオブジェクト名の競合を回避します" + msgid "MergeBone:validation:thereAreComponent" msgstr "Transform以外のコンポーネントがあります。これはサポートされていません。" diff --git a/Runtime/MergeBone.cs b/Runtime/MergeBone.cs index d51725508..094faa088 100644 --- a/Runtime/MergeBone.cs +++ b/Runtime/MergeBone.cs @@ -1,4 +1,5 @@ using Anatawa12.AvatarOptimizer.ErrorReporting; +using CustomLocalization4EditorExtension; using UnityEngine; namespace Anatawa12.AvatarOptimizer @@ -7,5 +8,9 @@ namespace Anatawa12.AvatarOptimizer [DisallowMultipleComponent] [HelpURL("https://vpm.anatawa12.com/avatar-optimizer/ja/docs/reference/merge-bone/")] internal class MergeBone : AvatarTagComponent, IStaticValidated - { } + { + [CL4EELocalized("MergeBone:prop:avoidNameConflict", "MergeBone:tooltip:avoidNameConflict")] + [ToggleLeft] + public bool avoidNameConflict; + } } From 46eb676f3f39a6fc124c71cdf997a3d667a32d46 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Thu, 14 Sep 2023 16:44:31 +0900 Subject: [PATCH 2/8] chore: use avoidNameConflict in automatic merge bone --- .../Processors/TraceAndOptimize/FindUnusedObjectsProcessor.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Editor/Processors/TraceAndOptimize/FindUnusedObjectsProcessor.cs b/Editor/Processors/TraceAndOptimize/FindUnusedObjectsProcessor.cs index 7378d170d..fa3835d1a 100644 --- a/Editor/Processors/TraceAndOptimize/FindUnusedObjectsProcessor.cs +++ b/Editor/Processors/TraceAndOptimize/FindUnusedObjectsProcessor.cs @@ -336,7 +336,8 @@ bool ConfigureRecursive(Transform transform, ImmutableModificationsContainer mod } } - transform.gameObject.GetOrAddComponent(); + if (!transform.gameObject.GetComponent()) + transform.gameObject.AddComponent().avoidNameConflict = true; return true; } From 9c22f58a8a09b8fc22a0b7c0d393a58b215651ef Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Thu, 14 Sep 2023 17:01:11 +0900 Subject: [PATCH 3/8] docs(merge-bone): add about Avoid Name Conflict --- .../docs/reference/merge-bone/component.png | Bin 7797 -> 7873 bytes .../docs/reference/merge-bone/index.ja.md | 4 +++- .../docs/reference/merge-bone/index.md | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.docs/content/docs/reference/merge-bone/component.png b/.docs/content/docs/reference/merge-bone/component.png index 98f5a1471eda2a78f92423cab6d183242e3338e0..d2c7f5aea87acb0e40b4aeb925d640bd7fe1a015 100644 GIT binary patch literal 7873 zcmXY$bzIZm_s2J!I6@dLAsZqcQVv0Kbf-ut0un<;NC}c7N2gNKAxMX$bVv#U0@95N z=;#3he&h4~{jbBDz{0QNC5!AZ8cRzeE(fYDb=o}r$jIbHOh~bm&nKz3`$NvO92Zwtdj3r9 z0p#qTUIbgNQ$-ry$)i{M{ z|2}V;ZnsRQ`+RGf$|{{4;L83o%FRO*8F()~7@S;U@KKurZkAC7<|f<{4(9TBZ z^Ahm_+>QnuTIhgE9mxZ<#3u`HvLz0NM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o`J8*PGkYR=8f`b~xsv zWHl*8ze0uDqRgL&*3sG2xCws@?@ia?l1j5?f~;6W%V8mLv*yr$>+%Bn%WHYZrgEeB zkfw((E~`^hBED0{FsT!d0d}9dltjdeQzSGd>|Qb(hMg>qv@(%X1WU3I#v!RF8O!5_ zBE5joMe0&^KO0e4;xrq%TbX(_^rr$?u?yqim*+AB3Aw`Lg^`rjsTgib$3zlA=@P6Q z9sk8!l5qX=IB0L)EzC16QP9~oJNa2}kS^3*e>r`v#|HG)vZC*>w8YOyIvmLbe6HC7 z&8cnc#bnG1Mc`T2w>;Dr47$c0?A^sTpMwY)JLahtSgtWpHUB0xo@QV-!c)qNrpg<9 zXGXrMUnSbR-n5w z0MSw>AbK11La2w8 Date: Thu, 14 Sep 2023 17:01:57 +0900 Subject: [PATCH 4/8] chore(merge-bone): avoidNameConflict by default for newly created MergeBone --- Runtime/MergeBone.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Runtime/MergeBone.cs b/Runtime/MergeBone.cs index 094faa088..50ebbca12 100644 --- a/Runtime/MergeBone.cs +++ b/Runtime/MergeBone.cs @@ -12,5 +12,10 @@ internal class MergeBone : AvatarTagComponent, IStaticValidated [CL4EELocalized("MergeBone:prop:avoidNameConflict", "MergeBone:tooltip:avoidNameConflict")] [ToggleLeft] public bool avoidNameConflict; + + private void Reset() + { + avoidNameConflict = true; + } } } From 011026369658ef8b0dcdff58c962afa5d286d3e1 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Thu, 14 Sep 2023 17:06:55 +0900 Subject: [PATCH 5/8] docs(changelog): Avoid Name Conflict in MergeBone and use it in Automatic --- CHANGELOG-PRERELEASE.md | 2 ++ CHANGELOG.md | 1 + 2 files changed, 3 insertions(+) diff --git a/CHANGELOG-PRERELEASE.md b/CHANGELOG-PRERELEASE.md index ce5b3842b..adb2cf4e1 100644 --- a/CHANGELOG-PRERELEASE.md +++ b/CHANGELOG-PRERELEASE.md @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog]. ## [Unreleased] ### Added +- Avoid Name Conflict in MergeBone `#467` ### Changed @@ -17,6 +18,7 @@ The format is based on [Keep a Changelog]. ### Fixed - Light disappears `#466` +- Automatic MergeBone may break Animation by conflictng GameObject name `#467` ### Security diff --git a/CHANGELOG.md b/CHANGELOG.md index d5935c8e5..1b103c943 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ The format is based on [Keep a Changelog]. - Moved `Use Advanced Animator Parser` to there - Added `Exclusions` for exclude some GameObjects from optimization - In this section, there are for debugging GC Objects `#464` +- Avoid Name Conflict in MergeBone `#467` ### Changed - Improved 'Remove Unused Objects' `#401` From 0d119ddc4c6f91f41efd70f4b2985f3e456ff234 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Thu, 14 Sep 2023 23:35:13 +0900 Subject: [PATCH 6/8] chore(localization): Apply suggestions from code review Co-authored-by: Sayamame-beans <61457993+Sayamame-beans@users.noreply.github.com> --- Localization/en.po | 2 +- Localization/ja.po | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Localization/en.po b/Localization/en.po index 87d58fa17..f2bfaf1fc 100644 --- a/Localization/en.po +++ b/Localization/en.po @@ -92,7 +92,7 @@ msgid "MergeBone:prop:avoidNameConflict" msgstr "Avoid Name Conflict" msgid "MergeBone:tooltip:avoidNameConflict" -msgstr "By changing names of children GameObjects, avoid GameObject name conflict" +msgstr "Renaming children GameObjects to avoid name conflict" msgid "MergeBone:validation:thereAreComponent" msgstr "There are some components other than Transform. This is not supported." diff --git a/Localization/ja.po b/Localization/ja.po index f4dcc7c78..d3ef8a7a2 100644 --- a/Localization/ja.po +++ b/Localization/ja.po @@ -95,7 +95,7 @@ msgid "MergeBone:prop:avoidNameConflict" msgstr "名前の競合を避ける" msgid "MergeBone:tooltip:avoidNameConflict" -msgstr "子GameObjectの名前を少し変更することで、ゲームオブジェクト名の競合を回避します" +msgstr "統合時に子GameObjectの名前を変更し、名前の重複を回避します" msgid "MergeBone:validation:thereAreComponent" msgstr "Transform以外のコンポーネントがあります。これはサポートされていません。" From 350fdd01aa21449466ded5b7c6c7415036cdecf1 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Thu, 14 Sep 2023 23:35:52 +0900 Subject: [PATCH 7/8] docs: Apply suggestions from code review Co-authored-by: Sayamame-beans <61457993+Sayamame-beans@users.noreply.github.com> --- .docs/content/docs/reference/merge-bone/index.ja.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.docs/content/docs/reference/merge-bone/index.ja.md b/.docs/content/docs/reference/merge-bone/index.ja.md index 8890ebf6f..6468e44e2 100644 --- a/.docs/content/docs/reference/merge-bone/index.ja.md +++ b/.docs/content/docs/reference/merge-bone/index.ja.md @@ -15,4 +15,4 @@ weight: 100 ![component.png](component.png) -- `名前の競合を避ける` この設定をオンにするとマージされたあとに子ボーンの名前がかぶることによってアニメーションが正しく動かなくなる問題を回避します。 +- `名前の競合を避ける` 統合時に子GameObjectの名前を変更することで、名前の重複によってアニメーションが正しく動かなくなる問題を回避します。 From 0caa724be24cca0fc8b75040ecf590e890694e16 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Thu, 14 Sep 2023 23:37:53 +0900 Subject: [PATCH 8/8] chore(localization): Apply suggestions from code review --- Localization/en.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Localization/en.po b/Localization/en.po index f2bfaf1fc..d10940117 100644 --- a/Localization/en.po +++ b/Localization/en.po @@ -92,7 +92,7 @@ msgid "MergeBone:prop:avoidNameConflict" msgstr "Avoid Name Conflict" msgid "MergeBone:tooltip:avoidNameConflict" -msgstr "Renaming children GameObjects to avoid name conflict" +msgstr "Renames child GameObjects to avoid name conflict" msgid "MergeBone:validation:thereAreComponent" msgstr "There are some components other than Transform. This is not supported."