Fixing more issues with constraint merging

This commit is contained in:
bd_ 2022-10-02 20:20:29 -07:00
parent 594971b8e2
commit 5f4f26f106

View File

@ -61,7 +61,7 @@ namespace net.fushizen.modular_avatar.core.editor
var bones = renderer.bones; var bones = renderer.bones;
for (int i = 0; i < bones.Length; i++) bones[i] = MapBoneReference(bones[i], Retargetable.Ignore); for (int i = 0; i < bones.Length; i++) bones[i] = MapBoneReference(bones[i], Retargetable.Ignore);
renderer.bones = bones; renderer.bones = bones;
renderer.rootBone = MapBoneReference(renderer.rootBone); renderer.rootBone = MapBoneReference(renderer.rootBone, Retargetable.Ignore);
renderer.probeAnchor = MapBoneReference(renderer.probeAnchor); 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.translationOffsets = new Vector3[] {targetToSrc.MultiplyPoint(Vector3.zero)};
pc.rotationOffsets = new Vector3[] {targetToSrc.rotation.eulerAngles}; 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.locked = true;
constraint.constraintActive = true; constraint.constraintActive = true;
@ -333,7 +325,10 @@ namespace net.fushizen.modular_avatar.core.editor
if ((constraintType != null && constraintType != typeof(ParentConstraint)) if ((constraintType != null && constraintType != typeof(ParentConstraint))
|| (constraintType == null && src.GetComponent<IConstraint>() != null)) || (constraintType == null && src.GetComponent<IConstraint>() != null))
{ {
zipMerge = false; Debug.LogWarning(
$"Retaining: {RuntimeUtil.RelativePath(RuntimeUtil.FindAvatarInParents(src.transform).gameObject, src.gameObject)}" +
$"with constraintType {constraintType} and constraint {src.GetComponent<IConstraint>()}");
return true;
} }
List<Transform> children = new List<Transform>(); List<Transform> children = new List<Transform>();