EdenAutoMorpherEditor 디컴파일 소스 추가
This commit is contained in:
@@ -0,0 +1,140 @@
|
||||
// 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.
|
||||
// EdenAutoMorpherEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
// Eden.AutoMorpher.AutoMorpherLogCollector
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Eden.AutoMorpher;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
public class AutoMorpherLogCollector
|
||||
{
|
||||
private struct LogEntry
|
||||
{
|
||||
public DateTime utcTime;
|
||||
|
||||
public LogType type;
|
||||
|
||||
public string condition;
|
||||
|
||||
public string stackTrace;
|
||||
}
|
||||
|
||||
private bool _isCapturing;
|
||||
|
||||
private DateTime _captureStartUtc;
|
||||
|
||||
private readonly List<LogEntry> _entries = new List<LogEntry>(2048);
|
||||
|
||||
private int entriesCapacity = 5000;
|
||||
|
||||
private const string logSavePath = "Assets/@Eden_Tools/Eden_AutoMorpher/Logs";
|
||||
|
||||
public void BeginCapture()
|
||||
{
|
||||
if (!_isCapturing)
|
||||
{
|
||||
_isCapturing = true;
|
||||
_entries.Clear();
|
||||
_captureStartUtc = DateTime.UtcNow;
|
||||
Application.logMessageReceived += OnLogMessageReceived;
|
||||
}
|
||||
}
|
||||
|
||||
public void EndCapture()
|
||||
{
|
||||
if (_isCapturing)
|
||||
{
|
||||
_isCapturing = false;
|
||||
Application.logMessageReceived -= OnLogMessageReceived;
|
||||
}
|
||||
}
|
||||
|
||||
public string SaveToTextFile(string defaultFileName, bool includeWarningsAndInfo)
|
||||
{
|
||||
EnsureLogDirectoryExists();
|
||||
string text = defaultFileName;
|
||||
if (string.IsNullOrEmpty(text))
|
||||
{
|
||||
text = "EdenAutoMorpher_Report.txt";
|
||||
}
|
||||
if (!text.EndsWith(".txt", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
text += ".txt";
|
||||
}
|
||||
string text2 = Path.Combine("Assets/@Eden_Tools/Eden_AutoMorpher/Logs", text);
|
||||
string contents = BuildReportText(includeWarningsAndInfo);
|
||||
File.WriteAllText(text2, contents, Encoding.UTF8);
|
||||
AssetDatabase.Refresh();
|
||||
Debug.Log("[AutoMorpher] Log report saved: " + text2);
|
||||
return text2;
|
||||
}
|
||||
|
||||
private void EnsureLogDirectoryExists()
|
||||
{
|
||||
if (AssetDatabase.IsValidFolder("Assets/@Eden_Tools/Eden_AutoMorpher/Logs"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
string[] array = "Assets/@Eden_Tools/Eden_AutoMorpher/Logs".Split('/', StringSplitOptions.None);
|
||||
string text = array[0];
|
||||
for (int i = 1; i < array.Length; i++)
|
||||
{
|
||||
string text2 = text + "/" + array[i];
|
||||
if (!AssetDatabase.IsValidFolder(text2))
|
||||
{
|
||||
AssetDatabase.CreateFolder(text, array[i]);
|
||||
}
|
||||
text = text2;
|
||||
}
|
||||
}
|
||||
|
||||
public string BuildReportText(bool includeWarningsAndInfo)
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder(65536);
|
||||
stringBuilder.AppendLine("==== EDEN AUTO MORPHER LOG REPORT ====");
|
||||
stringBuilder.AppendLine($"Captured (UTC) : {_captureStartUtc:yyyy-MM-dd HH:mm:ss} ~ {DateTime.UtcNow:yyyy-MM-dd HH:mm:ss}");
|
||||
stringBuilder.AppendLine("Unity Version : " + Application.unityVersion);
|
||||
stringBuilder.AppendLine($"Platform : {Application.platform}");
|
||||
stringBuilder.AppendLine("Project : " + Application.productName);
|
||||
stringBuilder.AppendLine();
|
||||
stringBuilder.AppendLine("---- Logs ----");
|
||||
for (int i = 0; i < _entries.Count; i++)
|
||||
{
|
||||
LogEntry logEntry = _entries[i];
|
||||
if (includeWarningsAndInfo || logEntry.type == LogType.Error || logEntry.type == LogType.Assert || logEntry.type == LogType.Exception)
|
||||
{
|
||||
stringBuilder.AppendLine($"[{i:0000}] - [{logEntry.type}] | {logEntry.utcTime:HH:mm:ss.fff} UTC");
|
||||
stringBuilder.AppendLine(logEntry.condition ?? string.Empty);
|
||||
if (!string.IsNullOrEmpty(logEntry.stackTrace))
|
||||
{
|
||||
stringBuilder.AppendLine("Details:");
|
||||
stringBuilder.AppendLine(logEntry.stackTrace);
|
||||
}
|
||||
stringBuilder.AppendLine();
|
||||
}
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
private void OnLogMessageReceived(string condition, string stackTrace, LogType type)
|
||||
{
|
||||
if (_isCapturing)
|
||||
{
|
||||
_entries.Add(new LogEntry
|
||||
{
|
||||
utcTime = DateTime.UtcNow,
|
||||
type = type,
|
||||
condition = condition,
|
||||
stackTrace = stackTrace
|
||||
});
|
||||
if (_entries.Count > entriesCapacity)
|
||||
{
|
||||
_entries.RemoveRange(0, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 48dbd59641bef954eb938512667a41d1
|
||||
@@ -0,0 +1,304 @@
|
||||
// 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.
|
||||
// EdenAutoMorpherEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
// Eden.AutoMorpher.AutoMorpherValidator
|
||||
using System.Text;
|
||||
using Eden.AutoMorpher;
|
||||
using UnityEngine;
|
||||
|
||||
public class AutoMorpherValidator
|
||||
{
|
||||
public bool ValidateAutoModeObjects(GameObject sourceAvatar, GameObject sourceClothes, GameObject targetAvatar, out string errorMessage)
|
||||
{
|
||||
return ValidateAutoModeObjects_Internal(sourceAvatar, sourceClothes, targetAvatar, out errorMessage);
|
||||
}
|
||||
|
||||
public bool ValidateManualMode_AutoSetup_Objects(GameObject sourceAvatar, GameObject sourceClothes, GameObject targetAvatar, out string errorMessage)
|
||||
{
|
||||
return ValidateManualMode_AutoSetup_Objects_Internal(sourceAvatar, sourceClothes, targetAvatar, out errorMessage);
|
||||
}
|
||||
|
||||
public bool ValidateManualModeObjects(GameObject sourceAvatar, GameObject sourceClothes, GameObject targetAvatar, GameObject targetClothes, out string errorMessage)
|
||||
{
|
||||
return ValidateManualModeObjects_Internal(sourceAvatar, sourceClothes, targetAvatar, targetClothes, out errorMessage);
|
||||
}
|
||||
|
||||
public bool ValidateProfileModeObjects(GameObject sourceClothes, GameObject targetAvatar, out string errorMessage)
|
||||
{
|
||||
return ValidateProfileModeObjects_Internal(sourceClothes, targetAvatar, out errorMessage);
|
||||
}
|
||||
|
||||
public bool ValidateAutoModeObjects_Internal(GameObject sourceAvatar, GameObject sourceClothes, GameObject targetAvatar, out string errorMessage)
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
ObjectNullCheck(stringBuilder, (sourceAvatar, "- Source Avatar Object"), (sourceClothes, "- Source Clothes Object"), (targetAvatar, "- Target Avatar Object"));
|
||||
if (sourceClothes != null)
|
||||
{
|
||||
ClothesChildCheck(stringBuilder, sourceAvatar, sourceClothes, LanguageManager.Get("UI.Validator.SourceClothesChildCheck"));
|
||||
HasSMRInClothes(stringBuilder, sourceClothes, "ClothesObject - There is No SkinnedMeshRenderer");
|
||||
HasLocalArmature(stringBuilder, sourceClothes, "Source " + LanguageManager.Get("UI.Validator.ClothesArmatureCheck"));
|
||||
}
|
||||
if (sourceAvatar != null)
|
||||
{
|
||||
IsHumanoid(stringBuilder, sourceAvatar, LanguageManager.Get("UI.Validator.SourceAvatarAnimatorCheck"));
|
||||
}
|
||||
if (targetAvatar != null)
|
||||
{
|
||||
IsHumanoid(stringBuilder, targetAvatar, LanguageManager.Get("UI.Validator.TargetAvatarAnimatorCheck"));
|
||||
}
|
||||
if (stringBuilder.Length == 0)
|
||||
{
|
||||
errorMessage = null;
|
||||
return true;
|
||||
}
|
||||
errorMessage = "Auto Mode: " + LanguageManager.Get("UI.Validator.Can'tFitting") + stringBuilder.ToString();
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool ValidateProfileModeObjects_Internal(GameObject sourceClothes, GameObject targetAvatar, out string errorMessage)
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
ObjectNullCheck(stringBuilder, (sourceClothes, "- Source Clothes Object"), (targetAvatar, "- Target Avatar Object"));
|
||||
if (sourceClothes != null)
|
||||
{
|
||||
HasSMRInClothes(stringBuilder, sourceClothes, "ClothesObject - There is No SkinnedMeshRenderer");
|
||||
HasLocalArmature(stringBuilder, sourceClothes, "Source " + LanguageManager.Get("UI.Validator.ClothesArmatureCheck"));
|
||||
}
|
||||
if (targetAvatar != null)
|
||||
{
|
||||
IsHumanoid(stringBuilder, targetAvatar, LanguageManager.Get("UI.Validator.TargetAvatarAnimatorCheck"));
|
||||
}
|
||||
if (stringBuilder.Length == 0)
|
||||
{
|
||||
errorMessage = null;
|
||||
return true;
|
||||
}
|
||||
errorMessage = "Profile Mode: " + LanguageManager.Get("UI.Validator.Can'tFitting") + stringBuilder.ToString();
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool ValidateManualMode_AutoSetup_Objects_Internal(GameObject sourceAvatar, GameObject sourceClothes, GameObject targetAvatar, out string errorMessage)
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
ObjectNullCheck(stringBuilder, (sourceAvatar, "- Source Avatar Object"), (sourceClothes, "- Source Clothes Object"), (targetAvatar, "- Target Avatar Object"));
|
||||
if (sourceClothes != null)
|
||||
{
|
||||
ClothesChildCheck(stringBuilder, sourceAvatar, sourceClothes, LanguageManager.Get("UI.Validator.SourceClothesChildCheck"));
|
||||
HasSMRInClothes(stringBuilder, sourceClothes, "ClothesObject - There is No SkinnedMeshRenderer");
|
||||
HasLocalArmature(stringBuilder, sourceClothes, "Source " + LanguageManager.Get("UI.Validator.ClothesArmatureCheck"));
|
||||
}
|
||||
if (sourceAvatar != null)
|
||||
{
|
||||
IsHumanoid(stringBuilder, sourceAvatar, LanguageManager.Get("UI.Validator.SourceAvatarAnimatorCheck"));
|
||||
}
|
||||
if (targetAvatar != null)
|
||||
{
|
||||
IsHumanoid(stringBuilder, targetAvatar, LanguageManager.Get("UI.Validator.TargetAvatarAnimatorCheck"));
|
||||
}
|
||||
if (stringBuilder.Length == 0)
|
||||
{
|
||||
errorMessage = null;
|
||||
return true;
|
||||
}
|
||||
errorMessage = "Manual Mode - Auto Setup: " + LanguageManager.Get("UI.Validator.Can'tFitting") + stringBuilder.ToString();
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool ValidateManualModeObjects_Internal(GameObject sourceAvatar, GameObject sourceClothes, GameObject targetAvatar, GameObject targetClothes, out string errorMessage)
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
ObjectNullCheck(stringBuilder, (sourceAvatar, "- Source Avatar Object"), (sourceClothes, "- Source Clothes Object"), (targetAvatar, "- Target Avatar Object"), (targetClothes, "- Target Clothes Object"));
|
||||
if (sourceClothes != null)
|
||||
{
|
||||
ClothesChildCheck(stringBuilder, sourceAvatar, sourceClothes, LanguageManager.Get("UI.Validator.SourceClothesChildCheck"));
|
||||
HasSMRInClothes(stringBuilder, sourceClothes, "ClothesObject - There is No SkinnedMeshRenderer");
|
||||
HasLocalArmature(stringBuilder, sourceClothes, "Source " + LanguageManager.Get("UI.Validator.ClothesArmatureCheck"));
|
||||
}
|
||||
if (targetClothes != null)
|
||||
{
|
||||
ClothesChildCheck(stringBuilder, targetAvatar, targetClothes, LanguageManager.Get("UI.Validator.TargetClothesChildCheck"));
|
||||
HasSMRInClothes(stringBuilder, targetClothes, "ClothesObject - There is No SkinnedMeshRenderer");
|
||||
HasLocalArmature(stringBuilder, targetClothes, "Target " + LanguageManager.Get("UI.Validator.ClothesArmatureCheck"));
|
||||
}
|
||||
if (sourceAvatar != null)
|
||||
{
|
||||
IsHumanoid(stringBuilder, sourceAvatar, LanguageManager.Get("UI.Validator.SourceAvatarAnimatorCheck"));
|
||||
}
|
||||
if (targetAvatar != null)
|
||||
{
|
||||
IsHumanoid(stringBuilder, targetAvatar, LanguageManager.Get("UI.Validator.TargetAvatarAnimatorCheck"));
|
||||
}
|
||||
if (sourceClothes != null && targetClothes != null)
|
||||
{
|
||||
AppendSmrAndVertexCheck(stringBuilder, sourceClothes, targetClothes);
|
||||
}
|
||||
if (stringBuilder.Length == 0)
|
||||
{
|
||||
errorMessage = null;
|
||||
return true;
|
||||
}
|
||||
errorMessage = "Manual Mode: " + LanguageManager.Get("UI.Validator.Can'tFitting") + stringBuilder.ToString();
|
||||
return false;
|
||||
}
|
||||
|
||||
private void ObjectNullCheck(StringBuilder sb, params (GameObject obj, string label)[] refs)
|
||||
{
|
||||
bool flag = false;
|
||||
for (int i = 0; i < refs.Length; i++)
|
||||
{
|
||||
if (refs[i].obj == null)
|
||||
{
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!flag)
|
||||
{
|
||||
return;
|
||||
}
|
||||
sb.AppendLine(LanguageManager.Get("UI.Validator.ReferenceCheck"));
|
||||
for (int j = 0; j < refs.Length; j++)
|
||||
{
|
||||
if (refs[j].obj == null)
|
||||
{
|
||||
sb.AppendLine(refs[j].label);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ClothesChildCheck(StringBuilder sb, GameObject parentObject, GameObject childObject, string messageOnInvalid)
|
||||
{
|
||||
if (!(childObject == null) && (parentObject == null || !childObject.transform.IsChildOf(parentObject.transform)))
|
||||
{
|
||||
if (sb.Length > 0)
|
||||
{
|
||||
sb.AppendLine();
|
||||
}
|
||||
sb.AppendLine(messageOnInvalid);
|
||||
}
|
||||
}
|
||||
|
||||
private void HasSMRInClothes(StringBuilder sb, GameObject clothesRoot, string messageOnInvalid)
|
||||
{
|
||||
if (clothesRoot == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
SkinnedMeshRenderer[] componentsInChildren = clothesRoot.GetComponentsInChildren<SkinnedMeshRenderer>(includeInactive: true);
|
||||
if (componentsInChildren == null || componentsInChildren.Length == 0)
|
||||
{
|
||||
if (sb.Length > 0)
|
||||
{
|
||||
sb.AppendLine();
|
||||
}
|
||||
sb.AppendLine(messageOnInvalid);
|
||||
}
|
||||
}
|
||||
|
||||
private void HasLocalArmature(StringBuilder sb, GameObject clothesRoot, string messageOnInvalid)
|
||||
{
|
||||
if (clothesRoot == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
SkinnedMeshRenderer[] componentsInChildren = clothesRoot.GetComponentsInChildren<SkinnedMeshRenderer>(includeInactive: true);
|
||||
if (componentsInChildren == null || componentsInChildren.Length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Transform transform = clothesRoot.transform;
|
||||
bool flag = true;
|
||||
SkinnedMeshRenderer[] array = componentsInChildren;
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
Transform[] bones = array[i].bones;
|
||||
if (bones == null || bones.Length == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Transform[] array2 = bones;
|
||||
foreach (Transform transform2 in array2)
|
||||
{
|
||||
if (!(transform2 == null) && !transform2.transform.IsChildOf(transform))
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!flag)
|
||||
{
|
||||
if (sb.Length > 0)
|
||||
{
|
||||
sb.AppendLine();
|
||||
}
|
||||
sb.AppendLine(messageOnInvalid);
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsHumanoid(StringBuilder sb, GameObject avatarObject, string messageOnInvalid)
|
||||
{
|
||||
if (avatarObject == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Animator component = avatarObject.GetComponent<Animator>();
|
||||
if (component == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (component.avatar == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!component.avatar.isHuman)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void AppendSmrAndVertexCheck(StringBuilder sb, GameObject sourceClothes, GameObject targetClothes)
|
||||
{
|
||||
if (sourceClothes == null || targetClothes == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
SkinnedMeshRenderer[] componentsInChildren = sourceClothes.GetComponentsInChildren<SkinnedMeshRenderer>(includeInactive: true);
|
||||
SkinnedMeshRenderer[] componentsInChildren2 = targetClothes.GetComponentsInChildren<SkinnedMeshRenderer>(includeInactive: true);
|
||||
int num = ((componentsInChildren != null) ? componentsInChildren.Length : 0);
|
||||
int num2 = ((componentsInChildren2 != null) ? componentsInChildren2.Length : 0);
|
||||
if (num != num2)
|
||||
{
|
||||
if (sb.Length > 0)
|
||||
{
|
||||
sb.AppendLine();
|
||||
}
|
||||
sb.AppendLine(LanguageManager.Get("UI.Validator.CheckRendererCountCheck"));
|
||||
sb.AppendLine($"- Source Clothes SMR : {num}");
|
||||
sb.AppendLine($"- Target Clothes SMR : {num2}");
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
SkinnedMeshRenderer skinnedMeshRenderer = componentsInChildren[i];
|
||||
SkinnedMeshRenderer skinnedMeshRenderer2 = componentsInChildren2[i];
|
||||
if (skinnedMeshRenderer == null || skinnedMeshRenderer2 == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Mesh sharedMesh = skinnedMeshRenderer.sharedMesh;
|
||||
Mesh sharedMesh2 = skinnedMeshRenderer2.sharedMesh;
|
||||
if (!(sharedMesh == null) && !(sharedMesh2 == null) && sharedMesh.vertexCount != sharedMesh2.vertexCount)
|
||||
{
|
||||
if (sb.Length > 0)
|
||||
{
|
||||
sb.AppendLine();
|
||||
}
|
||||
sb.AppendLine(LanguageManager.Get("UI.Validator.VertexCountCheck"));
|
||||
sb.AppendLine($"- Source: {skinnedMeshRenderer.name} (vertices: {sharedMesh.vertexCount})");
|
||||
sb.AppendLine($"- Target: {skinnedMeshRenderer2.name} (vertices: {sharedMesh2.vertexCount})");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 367e223b416de1d4d92bdcaee21b1df7
|
||||
1008
Assets/@Eden_Tools/Eden_AutoMorpher/Editor/EdenAutoMorpherEditor.cs
Normal file
1008
Assets/@Eden_Tools/Eden_AutoMorpher/Editor/EdenAutoMorpherEditor.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a5cebf384008fb4fa1e1141a4845238
|
||||
16
Assets/@Eden_Tools/Eden_AutoMorpher/Editor/ResultInfo.cs
Normal file
16
Assets/@Eden_Tools/Eden_AutoMorpher/Editor/ResultInfo.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
// 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.
|
||||
// EdenAutoMorpherEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
// Eden.AutoMorpher.ResultInfo
|
||||
public class ResultInfo
|
||||
{
|
||||
public bool isComplicated;
|
||||
|
||||
public string processTyep = "";
|
||||
|
||||
public string processEndState = "";
|
||||
|
||||
public string processTime = "";
|
||||
|
||||
public string errorMessage = "";
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 45a0e5ffc6837dc48b871f340e85e7a4
|
||||
Reference in New Issue
Block a user