// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.EdenAutoMorpher
using System.Collections;
using System.Collections.Generic;
using System.Text;
using UnityEngine;

public class EdenAutoMorpher : MonoBehaviour
{
    [SerializeField]
    public GameObject sourceAvatarObject;

    [SerializeField]
    public GameObject sourceClothesObject;

    [SerializeField]
    private List<SkinnedMeshRenderer> sourceBodyMeshes = new List<SkinnedMeshRenderer>();

    [SerializeField]
    private IReadOnlyList<SkinnedMeshRenderer> sourceBodyMeshesReadOnly = new List<SkinnedMeshRenderer>();

    [SerializeField]
    public string profileName;

    [SerializeField]
    public GameObject targetAvatarObject;

    [SerializeField]
    private GameObject targetClothesObject;

    [SerializeField]
    private GameObject targetClothesObjectOriginal;

    [SerializeField]
    private List<SkinnedMeshRenderer> targetBodyMeshes = new List<SkinnedMeshRenderer>();

    [SerializeField]
    private IReadOnlyList<SkinnedMeshRenderer> targetBodyMeshesReadOnly = new List<SkinnedMeshRenderer>();

    [SerializeField]
    private float minMargin = 0.003f;

    [SerializeField]
    private float worldRadius = 0.1f;

    [SerializeField]
    private float sigma = 0.85f;

    [SerializeField]
    private int smoothingIteration = 1;

    [SerializeField]
    private int fittingExpandIteration = 10;

    [SerializeField]
    private int fittingShrinkIteration = 12;

    [SerializeField]
    public bool isBodyAutoSetup = true;

    [SerializeField]
    public bool isReparentAccessoryBonesToTargetAvatar = true;

    [SerializeField]
    public bool skipFootFitting;

    [SerializeField]
    public bool transferWeightToAvatar;

    [SerializeField]
    public bool addAnchorBone = true;

    [SerializeField]
    public bool armatureBoneScaleCopy;

    [SerializeField]
    public bool isRemoveAutoMorphedClothes = true;

    private Dictionary<HumanBodyBones, HashSet<Transform>> clothesHumanoidMatchedBones;

    private Dictionary<Transform, ClothBoneType> clothBoneTypeMap;

    private GameObject fittedTargetAvatar;

    private GameObject fittedTargetClothes;

    private const string EditedMeshRootFolder = "Assets/@Eden_Mesh";

    private string tagEdenMorpehrCloth = "EDENAutoMorpher_EditedCloth";

    private bool doProcess;

    private MorpherMode morpherMode;

    private MorpherState morpherState;

    private ProcessInfo processInfo;

    public ProcessInfo GetProcessInfo()
    {
        return this.processInfo;
    }

    public void ChangeMode(MorpherMode newMode)
    {
        this.morpherMode = newMode;
        this.morpherState = MorpherState.Idle;
    }

    public void StopProcess()
    {
        this.doProcess = false;
        switch (this.morpherState)
        {
            case MorpherState.Fitting_Doing:
                this.morpherState = MorpherState.Idle;
                break;
            case MorpherState.Weighting_Doing:
                this.morpherState = MorpherState.Fitting_End;
                break;
            default:
                this.morpherState = MorpherState.Idle;
                break;
        }
    }

    private EdenAutoMorpherConfig SetupConfigData(MorpherMode morpherMode)
    {
        EdenAutoMorpherConfig result = default(EdenAutoMorpherConfig);
        switch (morpherMode)
        {
            case MorpherMode.AutoMorpher:
            case MorpherMode.ManualMorpher:
                result.sourceAvatarObject = this.sourceAvatarObject;
                result.sourceClothesObject = this.sourceClothesObject;
                result.sourceBodyMeshes = this.sourceBodyMeshesReadOnly;
                result.profileName = string.Empty;
                break;
            case MorpherMode.ProfileMorpher:
                result.sourceAvatarObject = null;
                result.sourceClothesObject = this.sourceClothesObject;
                result.sourceBodyMeshes = null;
                result.profileName = this.profileName;
                break;
            default:
                result.sourceAvatarObject = null;
                result.sourceClothesObject = null;
                result.sourceBodyMeshes = null;
                result.profileName = string.Empty;
                break;
        }
        result.targetAvatarObject = this.targetAvatarObject;
        result.targetClothesObject = this.targetClothesObject;
        result.targetBodyMeshes = this.targetBodyMeshesReadOnly;
        result.minMargin = this.minMargin;
        result.worldRadius = this.worldRadius;
        result.sigma = this.sigma;
        result.smoothingIteration = this.smoothingIteration;
        result.fittingExpandIteration = this.fittingExpandIteration;
        result.fittingShrinkIteration = this.fittingShrinkIteration;
        result.isBodyAutoSetup = this.isBodyAutoSetup;
        result.isReparentAccessoryBonesToTargetAvatar = this.isReparentAccessoryBonesToTargetAvatar;
        result.skipFootFitting = this.skipFootFitting;
        result.clothesHumanoidMatchedBones = this.clothesHumanoidMatchedBones;
        result.clothBoneTypeMap = this.clothBoneTypeMap;
        result.tagEdenMorpehrCloth = this.tagEdenMorpehrCloth;
        result.transferWeightToAvatar = this.transferWeightToAvatar;
        result.addAnchorBone = this.addAnchorBone;
        result.armatureBoneScaleCopy = this.armatureBoneScaleCopy;
        result.isRemoveAutoMorphedClothes = this.isRemoveAutoMorphedClothes;
        return result;
    }

    public void AutoPoseSetup(MorpherMode morpherMode)
    {
        TransformInfo transformInfo = new TransformInfo(this.sourceAvatarObject.transform);
        TransformInfo transformInfo2 = new TransformInfo(this.targetAvatarObject.transform);
        try
        {
            EdenAutoMorpher_SetUpUtil edenAutoMorpher_SetUpUtil = new EdenAutoMorpher_SetUpUtil();
            this.sourceBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(this.sourceAvatarObject, this.isBodyAutoSetup, this.sourceBodyMeshes, "Source ").AsReadOnly();
            this.targetBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(this.targetAvatarObject, this.isBodyAutoSetup, this.targetBodyMeshes, "Target ").AsReadOnly();
            this.targetAvatarObject.transform.SetParent(null, worldPositionStays: true);
            this.targetAvatarObject.transform.localRotation = Quaternion.identity;
            this.sourceAvatarObject.transform.SetParent(null, worldPositionStays: true);
            this.sourceAvatarObject.transform.localRotation = Quaternion.identity;
            EdenAutoMorpherConfig config = this.SetupConfigData(morpherMode);
            new EdenAutoMorpher_SetUpUtil().AutoSetup(ref config, out this.clothesHumanoidMatchedBones, out this.clothBoneTypeMap);
            this.targetClothesObject = config.targetClothesObject;
            this.targetClothesObjectOriginal = this.targetClothesObject;
        }
        finally
        {
            transformInfo.ApplyToTransform(this.sourceAvatarObject.transform, applyParent: true, applyPosition: false, applyRotation: true, applyScale: true);
            transformInfo2.ApplyToTransform(this.targetAvatarObject.transform, applyParent: true, applyPosition: false, applyRotation: true, applyScale: true);
        }
    }

    public void ProfileSetup(MorpherMode morpherMode)
    {
        TransformInfo transformInfo = new TransformInfo(this.sourceClothesObject.transform);
        TransformInfo transformInfo2 = new TransformInfo(this.targetAvatarObject.transform);
        try
        {
            EdenAutoMorpher_SetUpUtil edenAutoMorpher_SetUpUtil = new EdenAutoMorpher_SetUpUtil();
            this.targetBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(this.targetAvatarObject, this.isBodyAutoSetup, this.targetBodyMeshes, "Target ").AsReadOnly();
            this.targetAvatarObject.transform.SetParent(null, worldPositionStays: true);
            this.targetAvatarObject.transform.localRotation = Quaternion.identity;
            this.sourceClothesObject.transform.SetParent(null, worldPositionStays: true);
            this.sourceClothesObject.transform.localScale = Vector3.one;
            this.sourceClothesObject.transform.localRotation = Quaternion.identity;
            EdenAutoMorpherConfig config = this.SetupConfigData(morpherMode);
            new EdenAutoMorpher_SetUpUtil().ProfileAutoSetup(ref config, out this.clothesHumanoidMatchedBones, out this.clothBoneTypeMap);
            this.targetClothesObject = config.targetClothesObject;
            this.targetClothesObjectOriginal = this.targetClothesObject;
        }
        finally
        {
            transformInfo.ApplyToTransform(this.sourceClothesObject.transform, applyParent: true, applyPosition: false, applyRotation: true, applyScale: true);
            transformInfo2.ApplyToTransform(this.targetAvatarObject.transform, applyParent: true, applyPosition: false, applyRotation: true, applyScale: true);
        }
    }

    public IEnumerator AutoMorphingEnumerator(MorpherMode morpherMode)
    {
        this.doProcess = true;
        yield return null;
        this.ProcessInfoDebug(morpherMode, "Run ALL");
        this.morpherState = MorpherState.Fitting_Doing;
        IEnumerator fitEnum = null;
        this.morpherMode = morpherMode;
        yield return null;
        Debug.Log("[Eden Auto Morpher] Run ALL - Start Fitting");
        switch (morpherMode)
        {
            case MorpherMode.AutoMorpher:
                fitEnum = this.AutoFitting(morpherMode);
                break;
            case MorpherMode.ManualMorpher:
                fitEnum = this.ManualFitting(morpherMode);
                break;
            case MorpherMode.ProfileMorpher:
                fitEnum = this.ProfileFitting(morpherMode);
                break;
            default:
                Debug.LogError("Unknown Mode Index");
                break;
        }
        while (fitEnum != null && fitEnum.MoveNext() && this.doProcess)
        {
            yield return fitEnum.Current;
        }
        this.morpherState = MorpherState.Fitting_End;
        yield return null;
        this.morpherState = MorpherState.Weighting_Doing;
        yield return null;
        Debug.Log("[Eden Auto Morpher] Run ALL - Start Weighting");
        using (EdenAutoMorpherManager eamManager = new EdenAutoMorpherManager())
        {
            EdenAutoMorpherConfig config = this.SetupConfigData(morpherMode);
            IEnumerator eamFitting = eamManager.WeightingEnumerator(config);
            while (eamFitting.MoveNext() && this.doProcess)
            {
                var (title, text, progress) = eamManager.GetProgressInfo();
                this.processInfo.title = title;
                this.processInfo.text = text;
                this.processInfo.progress = progress;
                yield return eamFitting.Current;
            }
        }
        yield return null;
        this.doProcess = false;
        this.morpherState = MorpherState.Idle;
        Debug.Log("[Eden Auto Morpher] Ended Run ALL");
        yield return null;
    }

    public IEnumerator FittingEnumerator(MorpherMode morpherMode)
    {
        this.doProcess = true;
        this.processInfo.title = "Setup Avatar Pose";
        this.processInfo.text = "Calculating avatar shape and skeletal data.";
        this.processInfo.progress = 0f;

        yield return null;
        this.ProcessInfoDebug(morpherMode, "Fitting");
        yield return null;
        this.morpherState = MorpherState.Fitting_Doing;
        IEnumerator fitEnum = null;
        this.morpherMode = morpherMode;
        yield return null;
        switch (morpherMode)
        {
            case MorpherMode.AutoMorpher:
                fitEnum = this.AutoFitting(morpherMode);
                break;
            case MorpherMode.ManualMorpher:
                fitEnum = this.ManualFitting(morpherMode);
                break;
            case MorpherMode.ProfileMorpher:
                fitEnum = this.ProfileFitting(morpherMode);
                break;
            default:
                Debug.LogError("Unknown Mode Index");
                break;
        }
        while (fitEnum != null && fitEnum.MoveNext() && this.doProcess)
        {
            yield return null;
        }
        this.morpherState = MorpherState.Fitting_End;
        yield return null;
        this.doProcess = false;
        Debug.Log("[Eden Auto Morpher] Ended Fitting");
        yield return null;
    }

    public IEnumerator WeightingEnumerator()
    {
        this.morpherState = MorpherState.Weighting_Doing;
        this.doProcess = true;
        yield return null;
        this.ProcessInfoDebug(this.morpherMode, "Weighting");
        using (EdenAutoMorpherManager eamManager = new EdenAutoMorpherManager())
        {
            EdenAutoMorpherConfig config = this.SetupConfigData(MorpherMode.ETC);
            IEnumerator eamFitting = eamManager.WeightingEnumerator(config);
            while (eamFitting.MoveNext() && this.doProcess)
            {
                var (title, text, progress) = eamManager.GetProgressInfo();
                this.processInfo.title = title;
                this.processInfo.text = text;
                this.processInfo.progress = progress;
                yield return eamFitting.Current;
            }
        }
        yield return null;
        this.doProcess = false;
        this.morpherState = MorpherState.Idle;
        Debug.Log("[Eden Auto Morpher] Ended Weighting");
        yield return null;
    }

    public IEnumerator AutoFitting(MorpherMode morpherMode)
    {
        TransformInfo sourceAvatarInfo = new TransformInfo(this.sourceAvatarObject.transform);
        TransformInfo targetAvatarInfo = new TransformInfo(this.targetAvatarObject.transform);
        try
        {
            EdenAutoMorpher_SetUpUtil edenAutoMorpher_SetUpUtil = new EdenAutoMorpher_SetUpUtil();
            this.sourceBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(this.sourceAvatarObject, this.isBodyAutoSetup, this.sourceBodyMeshes, "Source ").AsReadOnly();
            this.targetBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(this.targetAvatarObject, this.isBodyAutoSetup, this.targetBodyMeshes, "Target ").AsReadOnly();
            this.targetAvatarObject.transform.SetParent(null, worldPositionStays: true);
            this.targetAvatarObject.transform.localRotation = Quaternion.identity;
            this.sourceAvatarObject.transform.SetParent(null, worldPositionStays: true);
            this.sourceAvatarObject.transform.localRotation = Quaternion.identity;
            EdenAutoMorpherConfig configData = this.SetupConfigData(morpherMode);
            new EdenAutoMorpher_SetUpUtil().AutoSetup(ref configData, out this.clothesHumanoidMatchedBones, out this.clothBoneTypeMap);
            this.targetClothesObject = configData.targetClothesObject;
            this.targetClothesObjectOriginal = this.targetClothesObject;
            yield return null;
            this.fittedTargetAvatar = null;
            this.fittedTargetClothes = null;
            yield return null;
            configData = this.SetupConfigData(morpherMode);
            using (EdenAutoMorpherManager eamManager = new EdenAutoMorpherManager())
            {
                IEnumerator eamFitting = eamManager.FittingIteration(configData, morpherMode);
                while (eamFitting.MoveNext() && this.doProcess)
                {
                    var (title, text, progress) = eamManager.GetProgressInfo();
                    this.processInfo.title = title;
                    this.processInfo.text = text;
                    this.processInfo.progress = progress;
                    yield return eamFitting.Current;
                }
            }
            this.fittedTargetAvatar = configData.targetAvatarObject;
            this.fittedTargetClothes = configData.targetClothesObject;
        }
        finally
        {
            EdenAutoMorpher edenAutoMorpher = this;
            sourceAvatarInfo.ApplyToTransform(edenAutoMorpher.sourceAvatarObject.transform, applyParent: true, applyPosition: false, applyRotation: true, applyScale: true);
            targetAvatarInfo.ApplyToTransform(edenAutoMorpher.targetAvatarObject.transform, applyParent: true, applyPosition: false, applyRotation: true, applyScale: true);
        }
        yield return null;
    }

    public IEnumerator ManualFitting(MorpherMode morpherMode)
    {
        TransformInfo sourceAvatarInfo = new TransformInfo(this.sourceAvatarObject.transform);
        TransformInfo targetAvatarInfo = new TransformInfo(this.targetAvatarObject.transform);
        try
        {
            EdenAutoMorpher_SetUpUtil edenAutoMorpher_SetUpUtil = new EdenAutoMorpher_SetUpUtil();
            this.sourceBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(this.sourceAvatarObject, this.isBodyAutoSetup, this.sourceBodyMeshes, "Source ").AsReadOnly();
            this.targetBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(this.targetAvatarObject, this.isBodyAutoSetup, this.targetBodyMeshes, "Target ").AsReadOnly();
            this.targetClothesObject = this.targetClothesObjectOriginal;
            EdenAutoMorpherConfig configData = this.SetupConfigData(morpherMode);
            new EdenAutoMorpher_SetUpUtil().ManulSetup(ref configData, out this.clothesHumanoidMatchedBones, out this.clothBoneTypeMap);
            yield return null;
            this.fittedTargetAvatar = null;
            this.fittedTargetClothes = null;
            configData = this.SetupConfigData(morpherMode);
            using (EdenAutoMorpherManager eamManager = new EdenAutoMorpherManager())
            {
                IEnumerator eamFitting = eamManager.FittingIteration(configData, morpherMode);
                while (eamFitting.MoveNext() && this.doProcess)
                {
                    var (title, text, progress) = eamManager.GetProgressInfo();
                    this.processInfo.title = title;
                    this.processInfo.text = text;
                    this.processInfo.progress = progress;
                    yield return eamFitting.Current;
                }
            }
            this.fittedTargetAvatar = configData.targetAvatarObject;
            this.fittedTargetClothes = configData.targetClothesObject;
        }
        finally
        {
            EdenAutoMorpher edenAutoMorpher = this;
            sourceAvatarInfo.ApplyToTransform(edenAutoMorpher.sourceAvatarObject.transform, applyParent: true, applyPosition: false, applyRotation: true, applyScale: true);
            targetAvatarInfo.ApplyToTransform(edenAutoMorpher.targetAvatarObject.transform, applyParent: true, applyPosition: false, applyRotation: true, applyScale: true);
        }
        yield return null;
    }

    public IEnumerator ProfileFitting(MorpherMode morpherMode)
    {
        TransformInfo sourceClothesInfo = new TransformInfo(this.sourceClothesObject.transform);
        TransformInfo targetAvatarInfo = new TransformInfo(this.targetAvatarObject.transform);
        try
        {
            EdenAutoMorpher_SetUpUtil edenAutoMorpher_SetUpUtil = new EdenAutoMorpher_SetUpUtil();
            this.targetBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(this.targetAvatarObject, this.isBodyAutoSetup, this.targetBodyMeshes, "Target ").AsReadOnly();
            this.targetAvatarObject.transform.SetParent(null, worldPositionStays: true);
            this.targetAvatarObject.transform.localRotation = Quaternion.identity;
            this.sourceClothesObject.transform.SetParent(null, worldPositionStays: true);
            this.sourceClothesObject.transform.localScale = Vector3.one;
            this.sourceClothesObject.transform.localRotation = Quaternion.identity;
            EdenAutoMorpherConfig configData = this.SetupConfigData(morpherMode);
            new EdenAutoMorpher_SetUpUtil().ProfileAutoSetup(ref configData, out this.clothesHumanoidMatchedBones, out this.clothBoneTypeMap);
            this.targetClothesObject = configData.targetClothesObject;
            this.targetClothesObjectOriginal = this.targetClothesObject;
            yield return null;
            this.fittedTargetAvatar = null;
            this.fittedTargetClothes = null;
            yield return null;
            configData = this.SetupConfigData(morpherMode);
            using (EdenAutoMorpherManager eamManager = new EdenAutoMorpherManager())
            {
                IEnumerator eamFitting = eamManager.FittingIteration(configData, morpherMode);
                while (eamFitting.MoveNext() && this.doProcess)
                {
                    var (title, text, progress) = eamManager.GetProgressInfo();
                    this.processInfo.title = title;
                    this.processInfo.text = text;
                    this.processInfo.progress = progress;
                    yield return eamFitting.Current;
                }
            }
            this.fittedTargetAvatar = configData.targetAvatarObject;
            this.fittedTargetClothes = configData.targetClothesObject;
            yield return null;
        }
        finally
        {
            EdenAutoMorpher edenAutoMorpher = this;
            sourceClothesInfo.ApplyToTransform(edenAutoMorpher.sourceClothesObject.transform, applyParent: true, applyPosition: false, applyRotation: true, applyScale: true);
            targetAvatarInfo.ApplyToTransform(edenAutoMorpher.targetAvatarObject.transform, applyParent: true, applyPosition: false, applyRotation: true, applyScale: true);
        }
    }

    public bool IsWeightingReady(bool isAutoMode)
    {
        bool flag = this.morpherState == MorpherState.Fitting_End && this.fittedTargetAvatar != null && this.fittedTargetAvatar == this.targetAvatarObject;
        if (!isAutoMode)
        {
            flag = flag && this.fittedTargetClothes == this.targetClothesObjectOriginal;
        }
        return flag;
    }

    private void ProcessInfoDebug(MorpherMode morpherMode, string processType)
    {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.AppendLine($"Start Process [{processType} / {morpherMode}]");
        EdenAutoMorpherConfig edenAutoMorpherConfig = this.SetupConfigData(morpherMode);
        string text = ((edenAutoMorpherConfig.sourceAvatarObject != null) ? edenAutoMorpherConfig.sourceAvatarObject.name : "null");
        string text2 = ((edenAutoMorpherConfig.sourceClothesObject != null) ? edenAutoMorpherConfig.sourceClothesObject.name : "null");
        string text3 = ((edenAutoMorpherConfig.targetAvatarObject != null) ? edenAutoMorpherConfig.targetAvatarObject.name : "null");
        string text4 = ((edenAutoMorpherConfig.targetClothesObject != null) ? edenAutoMorpherConfig.targetClothesObject.name : "null");
        stringBuilder.AppendLine("[Objects]");
        if (morpherMode == MorpherMode.ProfileMorpher)
        {
            stringBuilder.AppendLine("- profileName: " + (string.IsNullOrEmpty(edenAutoMorpherConfig.profileName) ? "null/empty" : edenAutoMorpherConfig.profileName));
        }
        stringBuilder.AppendLine("- sourceAvatarObject: " + text);
        stringBuilder.AppendLine("- sourceClothesObject: " + text2);
        if (edenAutoMorpherConfig.sourceClothesObject != null)
        {
            SkinnedMeshRenderer[] componentsInChildren = edenAutoMorpherConfig.sourceClothesObject.GetComponentsInChildren<SkinnedMeshRenderer>(includeInactive: true);
            stringBuilder.AppendLine($"  - sourceClothes SkinnedMeshRenderers Count: {componentsInChildren.Length}");
            int num = Mathf.Min(componentsInChildren.Length, 10);
            for (int i = 0; i < num; i++)
            {
                SkinnedMeshRenderer skinnedMeshRenderer = componentsInChildren[i];
                string text5 = ((skinnedMeshRenderer != null) ? skinnedMeshRenderer.name : "null");
                string text6 = ((skinnedMeshRenderer != null && skinnedMeshRenderer.rootBone != null) ? skinnedMeshRenderer.rootBone.name : "null");
                string text7 = ((skinnedMeshRenderer != null && skinnedMeshRenderer.sharedMesh != null) ? skinnedMeshRenderer.sharedMesh.name : "null");
                stringBuilder.AppendLine($"    - [{i}] SMR: {text5} / rootBone: {text6} / mesh: {text7}");
            }
            if (componentsInChildren.Length > num)
            {
                stringBuilder.AppendLine($"    - ... ({componentsInChildren.Length - num} more)");
            }
        }
        stringBuilder.AppendLine("- targetAvatarObject: " + text3);
        stringBuilder.AppendLine("- targetClothesObject: " + text4);
        if (edenAutoMorpherConfig.targetClothesObject != null)
        {
            SkinnedMeshRenderer[] componentsInChildren2 = edenAutoMorpherConfig.targetClothesObject.GetComponentsInChildren<SkinnedMeshRenderer>(includeInactive: true);
            stringBuilder.AppendLine($"  - targetClothes SkinnedMeshRenderers Count: {componentsInChildren2.Length}");
            int num2 = Mathf.Min(componentsInChildren2.Length, 10);
            for (int j = 0; j < num2; j++)
            {
                SkinnedMeshRenderer skinnedMeshRenderer2 = componentsInChildren2[j];
                string text8 = ((skinnedMeshRenderer2 != null) ? skinnedMeshRenderer2.name : "null");
                string text9 = ((skinnedMeshRenderer2 != null && skinnedMeshRenderer2.rootBone != null) ? skinnedMeshRenderer2.rootBone.name : "null");
                string text10 = ((skinnedMeshRenderer2 != null && skinnedMeshRenderer2.sharedMesh != null) ? skinnedMeshRenderer2.sharedMesh.name : "null");
                stringBuilder.AppendLine($"    - [{j}] SMR: {text8} / rootBone: {text9} / mesh: {text10}");
            }
            if (componentsInChildren2.Length > num2)
            {
                stringBuilder.AppendLine($"    - ... ({componentsInChildren2.Length - num2} more)");
            }
        }
        stringBuilder.AppendLine();
        stringBuilder.AppendLine("[Body Meshes]");
        stringBuilder.AppendLine($"- isBodyAutoSetup: {edenAutoMorpherConfig.isBodyAutoSetup}");
        if (!edenAutoMorpherConfig.isBodyAutoSetup)
        {
            if (edenAutoMorpherConfig.sourceBodyMeshes == null)
            {
                stringBuilder.AppendLine("- sourceBodyMeshes: null");
            }
            else
            {
                stringBuilder.AppendLine($"- sourceBodyMeshes Count: {this.sourceBodyMeshes.Count}");
                for (int k = 0; k < this.sourceBodyMeshes.Count; k++)
                {
                    SkinnedMeshRenderer skinnedMeshRenderer3 = this.sourceBodyMeshes[k];
                    string text11 = ((skinnedMeshRenderer3 != null) ? skinnedMeshRenderer3.name : "null");
                    string text12 = ((skinnedMeshRenderer3 != null && skinnedMeshRenderer3.rootBone != null) ? skinnedMeshRenderer3.rootBone.name : "null");
                    string text13 = ((skinnedMeshRenderer3 != null && skinnedMeshRenderer3.sharedMesh != null) ? skinnedMeshRenderer3.sharedMesh.name : "null");
                    stringBuilder.AppendLine($"  - [{k}] SMR: {text11} / rootBone: {text12} / mesh: {text13}");
                }
            }
            if (this.targetBodyMeshes == null)
            {
                stringBuilder.AppendLine("- targetBodyMeshes: null");
            }
            else
            {
                stringBuilder.AppendLine($"- targetBodyMeshes Count: {this.targetBodyMeshes.Count}");
                for (int l = 0; l < this.targetBodyMeshes.Count; l++)
                {
                    SkinnedMeshRenderer skinnedMeshRenderer4 = this.targetBodyMeshes[l];
                    string text14 = ((skinnedMeshRenderer4 != null) ? skinnedMeshRenderer4.name : "null");
                    string text15 = ((skinnedMeshRenderer4 != null && skinnedMeshRenderer4.rootBone != null) ? skinnedMeshRenderer4.rootBone.name : "null");
                    string text16 = ((skinnedMeshRenderer4 != null && skinnedMeshRenderer4.sharedMesh != null) ? skinnedMeshRenderer4.sharedMesh.name : "null");
                    stringBuilder.AppendLine($"  - [{l}] SMR: {text14} / rootBone: {text15} / mesh: {text16}");
                }
            }
        }
        stringBuilder.AppendLine();
        stringBuilder.AppendLine("[Parameters]");
        stringBuilder.AppendLine($"- minMargin: {edenAutoMorpherConfig.minMargin}");
        stringBuilder.AppendLine($"- worldRadius: {edenAutoMorpherConfig.worldRadius}");
        stringBuilder.AppendLine($"- sigma: {edenAutoMorpherConfig.sigma}");
        stringBuilder.AppendLine($"- smoothingIteration: {edenAutoMorpherConfig.smoothingIteration}");
        stringBuilder.AppendLine($"- fittingExpandIteration: {edenAutoMorpherConfig.fittingExpandIteration}");
        stringBuilder.AppendLine($"- fittingShrinkIteration: {edenAutoMorpherConfig.fittingShrinkIteration}");
        stringBuilder.AppendLine();
        stringBuilder.AppendLine("[Options]");
        stringBuilder.AppendLine($"- isReparentAccessoryBonesToTargetAvatar: {edenAutoMorpherConfig.isReparentAccessoryBonesToTargetAvatar}");
        stringBuilder.AppendLine($"- skipFootFitting: {edenAutoMorpherConfig.skipFootFitting}");
        Debug.Log(stringBuilder.ToString());
    }
}
