From 5f4f26f1065dbcb2e49de698685af7d9e3d4e944 Mon Sep 17 00:00:00 2001 From: bd_ Date: Sun, 2 Oct 2022 20:20:29 -0700 Subject: [PATCH] Fixing more issues with constraint merging --- .../Editor/MergeArmatureHook.cs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/Packages/net.fushizen.modular-avatar/Editor/MergeArmatureHook.cs b/Packages/net.fushizen.modular-avatar/Editor/MergeArmatureHook.cs index 2723b4dd..286d48ef 100644 --- a/Packages/net.fushizen.modular-avatar/Editor/MergeArmatureHook.cs +++ b/Packages/net.fushizen.modular-avatar/Editor/MergeArmatureHook.cs @@ -61,7 +61,7 @@ namespace net.fushizen.modular_avatar.core.editor var bones = renderer.bones; for (int i = 0; i < bones.Length; i++) bones[i] = MapBoneReference(bones[i], Retargetable.Ignore); renderer.bones = bones; - renderer.rootBone = MapBoneReference(renderer.rootBone); + renderer.rootBone = MapBoneReference(renderer.rootBone, Retargetable.Ignore); renderer.probeAnchor = MapBoneReference(renderer.probeAnchor); } @@ -317,14 +317,6 @@ namespace net.fushizen.modular_avatar.core.editor pc.translationOffsets = new Vector3[] {targetToSrc.MultiplyPoint(Vector3.zero)}; pc.rotationOffsets = new Vector3[] {targetToSrc.rotation.eulerAngles}; } - else if (constraint is PositionConstraint pos) - { - pos.translationOffset = targetToSrc.MultiplyPoint(Vector3.zero); - } - else if (constraint is RotationConstraint rot) - { - rot.rotationOffset = targetToSrc.rotation.eulerAngles; - } constraint.locked = true; constraint.constraintActive = true; @@ -333,7 +325,10 @@ namespace net.fushizen.modular_avatar.core.editor if ((constraintType != null && constraintType != typeof(ParentConstraint)) || (constraintType == null && src.GetComponent() != null)) { - zipMerge = false; + Debug.LogWarning( + $"Retaining: {RuntimeUtil.RelativePath(RuntimeUtil.FindAvatarInParents(src.transform).gameObject, src.gameObject)}" + + $"with constraintType {constraintType} and constraint {src.GetComponent()}"); + return true; } List children = new List();