EdenAutoMorpherScript dll을 디컴파일한 결과를 그대로 가져옴

This commit is contained in:
2026-02-01 14:57:52 +09:00
parent 8e1adbd907
commit f9c4088ef4
85 changed files with 10524 additions and 0 deletions

View File

@@ -0,0 +1,107 @@
// Decompiled with JetBrains decompiler
// Type: Eden.AutoMorpher.BodyPoseMatchUtil
// Assembly: EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: D39968B3-E151-4276-BDB4-E82752BBAFF0
// Assembly location: D:\dev\AutoMorpher\Assets\@Eden_Tools\Eden_AutoMorpher\Script\EdenAutoMorpherScript.dll
using System.Collections.Generic;
using UnityEngine;
namespace Eden.AutoMorpher
{
public class BodyPoseMatchUtil
{
private WorldVertexUtil _worldVertexUtil;
private MeshClassifier meshClassifier;
private BodyPoseMatch_CommonUtil poseMatchCommonUtil;
private bool doDebug;
public BodyPoseMatchUtil()
{
this._worldVertexUtil = new WorldVertexUtil();
this.meshClassifier = new MeshClassifier();
this.poseMatchCommonUtil = new BodyPoseMatch_CommonUtil();
}
public GameObject AutoAdjustBodyPose(
GameObject sourceAvatar,
IReadOnlyList<SkinnedMeshRenderer> sourceBodyMeshes,
GameObject targetAvatar,
IReadOnlyList<SkinnedMeshRenderer> targetBodyMeshes,
out Dictionary<Transform, Transform> sourceToProxy,
float neckTargetHeight = 1.5f,
bool onlyScaling = false)
{
Animator component1 = sourceAvatar.GetComponent<Animator>();
Animator component2 = targetAvatar.GetComponent<Animator>();
if (Object.op_Equality((Object)component1, (Object)null) || Object.op_Equality((Object)component2, (Object)null))
{
Debug.LogError((object)"[AvatarBodyMatchUtil] sourceAvatar 또는 targetAvatar가 null입니다.");
sourceToProxy = new Dictionary<Transform, Transform>();
return (GameObject)null;
}
Dictionary<HumanBodyBones, HashSet<Transform>> humanBoneMap = this.meshClassifier.MeshHumanoidBoneMatcher(component1, sourceBodyMeshes);
Dictionary<HumanBodyBones, HashSet<Transform>> dictionary1 = this.meshClassifier.MeshHumanoidBoneMatcher(component2, targetBodyMeshes);
BodyPoseMatchSetupUtil poseMatchSetupUtil = new BodyPoseMatchSetupUtil();
poseMatchSetupUtil.AdjustAvatarScaleByNeck(sourceAvatar.transform, humanBoneMap, neckTargetHeight);
poseMatchSetupUtil.AdjustAvatarScaleByNeck(targetAvatar.transform, dictionary1, neckTargetHeight);
List<SkinnedMeshRenderer> proxyBodyMeshes;
GameObject bodyProxy = poseMatchSetupUtil.CreateBodyProxy(component1, sourceBodyMeshes, out proxyBodyMeshes, out sourceToProxy);
Animator component3 = bodyProxy.GetComponent<Animator>();
if (onlyScaling)
{
bodyProxy.transform.SetParent(targetAvatar.transform);
bodyProxy.transform.localPosition = Vector3.zero;
return bodyProxy;
}
Dictionary<HumanBodyBones, HashSet<Transform>> dictionary2 = this.meshClassifier.MeshHumanoidBoneMatcher(component3, (IReadOnlyList<SkinnedMeshRenderer>)proxyBodyMeshes);
if (dictionary2 == null || dictionary2.Count == 0)
throw new AutoMorpherException("Proxy Bone Map is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters\n - proxyBoneMap is null");
bodyProxy.transform.SetParent(targetAvatar.transform);
bodyProxy.transform.localPosition = Vector3.zero;
List<BakedBodyMesh> bakedBodyMeshList1 = new List<BakedBodyMesh>();
foreach (SkinnedMeshRenderer _smr in proxyBodyMeshes)
bakedBodyMeshList1.Add(new BakedBodyMesh(_smr));
List<BakedBodyMesh> bakedBodyMeshList2 = new List<BakedBodyMesh>();
foreach (SkinnedMeshRenderer targetBodyMesh in (IEnumerable<SkinnedMeshRenderer>)targetBodyMeshes)
bakedBodyMeshList2.Add(new BakedBodyMesh(targetBodyMesh));
BodyPoseMatch_Torso bodyPoseMatchTorso = new BodyPoseMatch_Torso();
bodyPoseMatchTorso.AlignTorsoByNeck(bodyProxy, (IReadOnlyList<BakedBodyMesh>)bakedBodyMeshList1, dictionary2, targetAvatar, (IReadOnlyList<BakedBodyMesh>)bakedBodyMeshList2, dictionary1);
if (this.doDebug)
{
bodyPoseMatchTorso.DrawTorsoPcaDebug(bodyProxy, (IReadOnlyList<BakedBodyMesh>)bakedBodyMeshList1, dictionary2, Color.yellow, Color.cyan, duration: 20f);
bodyPoseMatchTorso.DrawTorsoPcaDebug(targetAvatar, (IReadOnlyList<BakedBodyMesh>)bakedBodyMeshList2, dictionary1, Color.red, Color.green, duration: 20f);
}
foreach (BakedBodyMesh bakedBodyMesh in bakedBodyMeshList1)
bakedBodyMesh.ReBakeMesh();
BodyPoseMatch_Arm bodyPoseMatchArm = new BodyPoseMatch_Arm();
bodyPoseMatchArm.AlignUpperArmByArmPcaCenters((IReadOnlyList<BakedBodyMesh>)bakedBodyMeshList1, dictionary2, (IReadOnlyList<BakedBodyMesh>)bakedBodyMeshList2, dictionary1);
if (this.doDebug)
{
bodyPoseMatchArm.DrawArmPcaDebug(bodyProxy, (IReadOnlyList<BakedBodyMesh>)bakedBodyMeshList1, dictionary2, true, Color.yellow, Color.cyan, duration: 20f);
bodyPoseMatchArm.DrawArmPcaDebug(targetAvatar, (IReadOnlyList<BakedBodyMesh>)bakedBodyMeshList2, dictionary1, true, Color.red, Color.green, duration: 20f);
}
foreach (BakedBodyMesh bakedBodyMesh in bakedBodyMeshList1)
bakedBodyMesh.ReBakeMesh();
bodyPoseMatchArm.ScalingBothArmsLength((IReadOnlyList<BakedBodyMesh>)bakedBodyMeshList1, dictionary2, (IReadOnlyList<BakedBodyMesh>)bakedBodyMeshList2, dictionary1);
foreach (BakedBodyMesh bakedBodyMesh in bakedBodyMeshList1)
bakedBodyMesh.ReBakeMesh();
BodyPoseMatch_Leg bodyPoseMatchLeg = new BodyPoseMatch_Leg();
bodyPoseMatchLeg.AlignBothUpperLegs(bodyProxy, (IReadOnlyList<BakedBodyMesh>)bakedBodyMeshList1, dictionary2, targetAvatar, (IReadOnlyList<BakedBodyMesh>)bakedBodyMeshList2, dictionary1);
foreach (BakedBodyMesh bakedBodyMesh in bakedBodyMeshList1)
bakedBodyMesh.ReBakeMesh();
bodyPoseMatchLeg.ScalingBothLegsAndFoots(bodyProxy, (IReadOnlyList<BakedBodyMesh>)bakedBodyMeshList1, dictionary2, targetAvatar, (IReadOnlyList<BakedBodyMesh>)bakedBodyMeshList2, dictionary1);
if (this.doDebug)
{
foreach (BakedBodyMesh bakedBodyMesh in bakedBodyMeshList1)
bakedBodyMesh.ReBakeMesh();
bodyPoseMatchLeg.DrawLegPcaDebug(bodyProxy, (IReadOnlyList<BakedBodyMesh>)bakedBodyMeshList1, dictionary2, true, Color.yellow, Color.cyan, duration: 5f);
bodyPoseMatchLeg.DrawLegPcaDebug(bodyProxy, (IReadOnlyList<BakedBodyMesh>)bakedBodyMeshList1, dictionary2, false, Color.yellow, Color.cyan, duration: 5f);
bodyPoseMatchLeg.DrawLegPcaDebug(targetAvatar, (IReadOnlyList<BakedBodyMesh>)bakedBodyMeshList2, dictionary1, true, Color.magenta, Color.green, duration: 5f);
bodyPoseMatchLeg.DrawLegPcaDebug(targetAvatar, (IReadOnlyList<BakedBodyMesh>)bakedBodyMeshList2, dictionary1, false, Color.magenta, Color.green, duration: 5f);
bodyPoseMatchArm.DrawForearmExtremeDebugPair(bodyProxy.gameObject, (IReadOnlyList<SkinnedMeshRenderer>)proxyBodyMeshes, targetAvatar, targetBodyMeshes, true, 1f, 5f);
}
return bodyProxy;
}
}
}