From a1ee61c54276fc00225b19327924de6195c1d694 Mon Sep 17 00:00:00 2001 From: VaDiM Date: Tue, 10 Jun 2025 01:43:30 +0300 Subject: [PATCH] Some minor fixes --- AssetStudioCLI/Exporter.cs | 9 +- AssetStudioCLI/Options/CLIOptions.cs | 73 +++++------ AssetStudioCLI/Program.cs | 2 +- AssetStudioCLI/Studio.cs | 2 +- AssetStudioGUI/Exporter.cs | 188 +++++++++++++-------------- AssetStudioUtility/ModelConverter.cs | 68 ++++------ 6 files changed, 165 insertions(+), 177 deletions(-) diff --git a/AssetStudioCLI/Exporter.cs b/AssetStudioCLI/Exporter.cs index 17d6b86..6b5c84c 100644 --- a/AssetStudioCLI/Exporter.cs +++ b/AssetStudioCLI/Exporter.cs @@ -372,8 +372,13 @@ namespace AssetStudioCLI var convert = animationList != null ? new ModelConverter(gameObject, CLIOptions.o_imageFormat.Value, animationList.Select(x => (AnimationClip)x.Asset).ToArray()) : new ModelConverter(gameObject, CLIOptions.o_imageFormat.Value); - exportPath = exportPath + FixFileName(gameObject.m_Name) + ".fbx"; - ExportFbx(convert, exportPath); + var modelName = FixFileName(gameObject.m_Name); + var exportFullPath = Path.Combine(exportPath, "FBX_GameObjects", modelName, modelName + ".fbx"); + if (File.Exists(exportFullPath)) + { + exportFullPath = Path.Combine(exportPath, $"{modelName}_{gameObject.GetHashCode():X}", modelName + ".fbx"); + } + ExportFbx(convert, exportFullPath); } public static string FixFileName(string str) diff --git a/AssetStudioCLI/Options/CLIOptions.cs b/AssetStudioCLI/Options/CLIOptions.cs index f6c1de2..d796848 100644 --- a/AssetStudioCLI/Options/CLIOptions.cs +++ b/AssetStudioCLI/Options/CLIOptions.cs @@ -79,7 +79,6 @@ namespace AssetStudioCLI.Options internal static class CLIOptions { public static bool isParsed; - public static bool showHelp; public static string[] cliArgs; public static List inputPathList; public static FilterBy filterBy; @@ -166,7 +165,6 @@ namespace AssetStudioCLI.Options private static void InitOptions() { isParsed = false; - showHelp = false; cliArgs = null; inputPathList = new List(); filterBy = FilterBy.None; @@ -214,7 +212,7 @@ namespace AssetStudioCLI.Options optionDescription: "Specify asset type(s) to export\n" + "\n" + - "All - export all asset types, which are listed in the values\n" + + "All - Export all asset types listed in the values\n" + "*To specify multiple asset types, write them separated by ',' or ';' without spaces\n", optionExample: "Examples: \"-t sprite\" or \"-t tex2d,sprite,audio\" or \"-t tex2d;sprite;font\"\n", optionHelpGroup: HelpGroups.General @@ -524,7 +522,7 @@ namespace AssetStudioCLI.Options ( optionDefaultValue: false, optionName: "--not-restore-extension", - optionDescription: "(Flag) If specified, AssetStudio will not try to use/restore original TextAsset\nextension name, and will just export all TextAssets with the \".txt\" extension\n", + optionDescription: "(Flag) If specified, Studio will not try to use/restore original TextAsset extension,\nand will just export all TextAssets with the \".txt\" extension\n", optionExample: "", optionHelpGroup: HelpGroups.Advanced, isFlag: true @@ -533,7 +531,7 @@ namespace AssetStudioCLI.Options ( optionDefaultValue: false, optionName: "--avoid-typetree-loading", - optionDescription: "(Flag) If specified, AssetStudio will not try to parse assets at load time\nusing their type tree\n", + optionDescription: "(Flag) If specified, Studio will not try to parse assets at load time\nusing their type tree\n", optionExample: "", optionHelpGroup: HelpGroups.Advanced, isFlag: true @@ -542,7 +540,7 @@ namespace AssetStudioCLI.Options ( optionDefaultValue: false, optionName: "--load-all", - optionDescription: "(Flag) If specified, AssetStudio will load assets of all types\n(Only for Dump, Info and ExportRaw modes)", + optionDescription: "(Flag) If specified, Studio will load assets of all types\n(Only for Dump, Info and ExportRaw modes)", optionExample: "", optionHelpGroup: HelpGroups.Advanced, isFlag: true @@ -559,7 +557,7 @@ namespace AssetStudioCLI.Options if (args.Length == 0 || args.Any(x => x.ToLower() == "-h" || x.ToLower() == "--help" || x.ToLower() == "-?")) { - showHelp = true; + o_displayHelp.Value = true; return; } @@ -583,35 +581,34 @@ namespace AssetStudioCLI.Options return; } - var resplittedArgs = new List(); - for (int i = 1; i < args.Length; i++) + var processedArgs = new List(); + for (var i = 1; i < args.Length; i++) { - string arg = args[i]; - + var arg = args[i]; if (arg.Contains('=')) { - var splittedArgs = arg.Split('='); - resplittedArgs.Add(splittedArgs[0]); - resplittedArgs.Add(splittedArgs[1]); + var splitArgs = arg.Split('='); + processedArgs.Add(splitArgs[0]); + processedArgs.Add(splitArgs[1]); } else { - resplittedArgs.Add(arg); - } - }; + processedArgs.Add(arg); + } + } #region Parse "Working Mode" Option - var workModeOptionIndex = resplittedArgs.FindIndex(x => x.ToLower() == "-m" || x.ToLower() == "--mode"); + var workModeOptionIndex = processedArgs.FindIndex(x => x.ToLower() == "-m" || x.ToLower() == "--mode"); if (workModeOptionIndex >= 0) { - var option = resplittedArgs[workModeOptionIndex]; - if (workModeOptionIndex + 1 >= resplittedArgs.Count) + var option = processedArgs[workModeOptionIndex]; + if (workModeOptionIndex + 1 >= processedArgs.Count) { Console.WriteLine($"{"Error during parsing options:".Color(brightRed)} Value for [{option.Color(brightYellow)}] option was not found.\n"); TryFindOptionDescription(option, optionsDict); return; } - var value = resplittedArgs[workModeOptionIndex + 1]; + var value = processedArgs[workModeOptionIndex + 1]; switch (value.ToLower()) { case "extract": @@ -659,14 +656,14 @@ namespace AssetStudioCLI.Options ShowOptionDescription(o_workMode); return; } - resplittedArgs.RemoveRange(workModeOptionIndex, 2); + processedArgs.RemoveRange(workModeOptionIndex, 2); } #endregion #region Parse Flags - for (var i = 0; i < resplittedArgs.Count; i++) + for (var i = 0; i < processedArgs.Count; i++) { - var flag = resplittedArgs[i].ToLower(); + var flag = processedArgs[i].ToLower(); switch(flag) { @@ -678,7 +675,7 @@ namespace AssetStudioCLI.Options return; } f_l2dAssetSearchByFilename.Value = true; - resplittedArgs.RemoveAt(i); + processedArgs.RemoveAt(i); break; case "--l2d-force-bezier": if (o_workMode.Value != WorkMode.Live2D) @@ -688,7 +685,7 @@ namespace AssetStudioCLI.Options return; } f_l2dForceBezier.Value = true; - resplittedArgs.RemoveAt(i); + processedArgs.RemoveAt(i); break; case "--fbx-uvs-as-diffuse": if (o_workMode.Value != WorkMode.SplitObjects) @@ -698,19 +695,19 @@ namespace AssetStudioCLI.Options return; } f_fbxUvsAsDiffuseMaps.Value = true; - resplittedArgs.RemoveAt(i); + processedArgs.RemoveAt(i); break; case "--filter-with-regex": f_filterWithRegex.Value = true; - resplittedArgs.RemoveAt(i); + processedArgs.RemoveAt(i); break; case "--not-restore-extension": f_notRestoreExtensionName.Value = true; - resplittedArgs.RemoveAt(i); + processedArgs.RemoveAt(i); break; case "--avoid-typetree-loading": f_avoidLoadingViaTypetree.Value = true; - resplittedArgs.RemoveAt(i); + processedArgs.RemoveAt(i); break; case "--load-all": switch (o_workMode.Value) @@ -719,7 +716,7 @@ namespace AssetStudioCLI.Options case WorkMode.Dump: case WorkMode.Info: f_loadAllAssets.Value = true; - resplittedArgs.RemoveAt(i); + processedArgs.RemoveAt(i); break; default: Console.WriteLine($"{"Error".Color(brightRed)} during parsing [{flag.Color(brightYellow)}] flag. This flag is not suitable for the current working mode [{o_workMode.Value}].\n"); @@ -732,12 +729,12 @@ namespace AssetStudioCLI.Options #endregion #region Parse Options - for (var i = 0; i < resplittedArgs.Count; i++) + for (var i = 0; i < processedArgs.Count; i++) { - var option = resplittedArgs[i].ToLower(); + var option = processedArgs[i].ToLower(); try { - var value = resplittedArgs[i + 1].Replace("\"", ""); + var value = processedArgs[i + 1].Replace("\"", ""); switch (option) { case "-t": @@ -1249,7 +1246,7 @@ namespace AssetStudioCLI.Options if (isRegex) return new[] {value}; - var separator = value.Contains(';') ? ';' : ','; + var separator = value.Contains(',') ? ',' : ';'; return value.Split(separator); } @@ -1282,7 +1279,7 @@ namespace AssetStudioCLI.Options var helpMessage = new StringBuilder(); var usage = new StringBuilder(); var appAssembly = typeof(Program).Assembly.GetName(); - usage.Append($"{"Usage:".Color(ColorConsole.BrightYellow)} {appAssembly.Name} "); + usage.Append($"{"Usage:".Color(ColorConsole.BrightYellow)} {appAssembly.Name} "); var i = 0; foreach (var optionsGroup in optionGroups.Keys) @@ -1366,8 +1363,8 @@ namespace AssetStudioCLI.Options { sb.AppendLine($"# Output Path: \"{o_outputFolder}\""); } - sb.AppendLine($"Bundle BlockInfo Compression Type: {o_bundleBlockInfoCompression}"); - sb.AppendLine($"Bundle Block Compression Type: {o_bundleBlockCompression}"); + sb.AppendLine($"# Bundle BlockInfo Compression Type: {o_bundleBlockInfoCompression}"); + sb.AppendLine($"# Bundle Block Compression Type: {o_bundleBlockCompression}"); switch (o_workMode.Value) { case WorkMode.Export: diff --git a/AssetStudioCLI/Program.cs b/AssetStudioCLI/Program.cs index d036299..3d51e03 100644 --- a/AssetStudioCLI/Program.cs +++ b/AssetStudioCLI/Program.cs @@ -13,7 +13,7 @@ namespace AssetStudioCLI { CLIRun(); } - else if (CLIOptions.showHelp) + else if (CLIOptions.o_displayHelp.Value) { CLIOptions.ShowHelp(); } diff --git a/AssetStudioCLI/Studio.cs b/AssetStudioCLI/Studio.cs index f99c5c3..d0a2742 100644 --- a/AssetStudioCLI/Studio.cs +++ b/AssetStudioCLI/Studio.cs @@ -861,7 +861,7 @@ namespace AssetStudioCLI var log = $"Found {exportableCount} exportable object(s) "; if (isFiltered) { - log += $"that contain {$"\"{string.Join("\", \"", CLIOptions.o_filterByName.Value)}\"".Color(Ansi.BrightYellow)} in their Names"; + log += $"that contain {$"\"{string.Join("\", \"", searchList)}\"".Color(Ansi.BrightYellow)} in their Names"; } Logger.Info(log); if (exportableCount > 0) diff --git a/AssetStudioGUI/Exporter.cs b/AssetStudioGUI/Exporter.cs index e908c77..2187929 100644 --- a/AssetStudioGUI/Exporter.cs +++ b/AssetStudioGUI/Exporter.cs @@ -9,7 +9,61 @@ namespace AssetStudioGUI { internal static class Exporter { - public static bool ExportShader(AssetItem item, string exportPath) + private static bool TryExportFile(string dir, AssetItem item, string extension, out string fullPath, string mode = "Export") + { + var fileName = FixFileName(item.Text); + var filenameFormatIndex = Properties.Settings.Default.filenameFormat; + switch (filenameFormatIndex) + { + case 1: //assetName@pathID + fileName = $"{fileName} @{item.m_PathID}"; + break; + case 2: //pathID + fileName = item.m_PathID.ToString(); + break; + } + fullPath = Path.Combine(dir, fileName + extension); + if (!File.Exists(fullPath)) + { + Directory.CreateDirectory(dir); + return true; + } + if (filenameFormatIndex == 0) //assetName + { + fullPath = Path.Combine(dir, fileName + item.UniqueID + extension); + if (!File.Exists(fullPath)) + { + Directory.CreateDirectory(dir); + return true; + } + } + Logger.Warning($"{mode} failed. File \"{fullPath.Color(ColorConsole.BrightYellow)}\" already exist"); + return false; + } + + private static bool ExportVideoClip(AssetItem item, string exportPath) + { + var m_VideoClip = (VideoClip)item.Asset; + if (m_VideoClip.m_ExternalResources.m_Size > 0) + { + if (!TryExportFile(exportPath, item, Path.GetExtension(m_VideoClip.m_OriginalPath), out var exportFullPath)) + return false; + m_VideoClip.m_VideoData.WriteData(exportFullPath); + return true; + } + return false; + } + + private static bool ExportMovieTexture(AssetItem item, string exportPath) + { + var m_MovieTexture = (MovieTexture)item.Asset; + if (!TryExportFile(exportPath, item, ".ogv", out var exportFullPath)) + return false; + File.WriteAllBytes(exportFullPath, m_MovieTexture.m_MovieData); + return true; + } + + private static bool ExportShader(AssetItem item, string exportPath) { if (!TryExportFile(exportPath, item, ".shader", out var exportFullPath)) return false; @@ -19,7 +73,7 @@ namespace AssetStudioGUI return true; } - public static bool ExportTextAsset(AssetItem item, string exportPath) + private static bool ExportTextAsset(AssetItem item, string exportPath) { var m_TextAsset = (TextAsset)item.Asset; var extension = ".txt"; @@ -45,7 +99,7 @@ namespace AssetStudioGUI return true; } - public static bool ExportMonoBehaviour(AssetItem item, string exportPath) + private static bool ExportMonoBehaviour(AssetItem item, string exportPath) { if (!TryExportFile(exportPath, item, ".json", out var exportFullPath)) return false; @@ -61,7 +115,7 @@ namespace AssetStudioGUI return true; } - public static bool ExportFont(AssetItem item, string exportPath) + private static bool ExportFont(AssetItem item, string exportPath) { var m_Font = (Font)item.Asset; if (m_Font.m_FontData != null) @@ -79,7 +133,7 @@ namespace AssetStudioGUI return false; } - public static bool ExportMesh(AssetItem item, string exportPath) + private static bool ExportMesh(AssetItem item, string exportPath) { var m_Mesh = (Mesh)item.Asset; if (m_Mesh.m_VertexCount <= 0) @@ -161,26 +215,25 @@ namespace AssetStudioGUI return true; } - public static bool ExportVideoClip(AssetItem item, string exportPath) + public static bool ExportAnimator(AssetItem item, string exportPath, List animationList = null) { - var m_VideoClip = (VideoClip)item.Asset; - if (m_VideoClip.m_ExternalResources.m_Size > 0) + var exportFullPath = Path.Combine(exportPath, item.Text, item.Text + ".fbx"); + if (File.Exists(exportFullPath)) { - if (!TryExportFile(exportPath, item, Path.GetExtension(m_VideoClip.m_OriginalPath), out var exportFullPath)) - return false; - m_VideoClip.m_VideoData.WriteData(exportFullPath); - return true; + exportFullPath = Path.Combine(exportPath, item.Text + item.UniqueID, item.Text + ".fbx"); } - return false; + var m_Animator = (Animator)item.Asset; + var convert = animationList != null + ? new ModelConverter(m_Animator, Properties.Settings.Default.convertType, animationList.Select(x => (AnimationClip)x.Asset).ToArray()) + : new ModelConverter(m_Animator, Properties.Settings.Default.convertType); + ExportFbx(convert, exportFullPath); + return true; } - public static bool ExportMovieTexture(AssetItem item, string exportPath) + private static void ExportFbx(IImported convert, string exportPath) { - var m_MovieTexture = (MovieTexture)item.Asset; - if (!TryExportFile(exportPath, item, ".ogv", out var exportFullPath)) - return false; - File.WriteAllBytes(exportFullPath, m_MovieTexture.m_MovieData); - return true; + var fbxSettings = Fbx.Settings.FromBase64(Properties.Settings.Default.fbxSettings); + ModelExporter.ExportFbx(exportPath, convert, fbxSettings); } public static bool ExportRawFile(AssetItem item, string exportPath) @@ -212,77 +265,6 @@ namespace AssetStudioGUI return true; } - private static bool TryExportFile(string dir, AssetItem item, string extension, out string fullPath, string mode = "Export") - { - var fileName = FixFileName(item.Text); - var filenameFormatIndex = Properties.Settings.Default.filenameFormat; - switch (filenameFormatIndex) - { - case 1: //assetName@pathID - fileName = $"{fileName} @{item.m_PathID}"; - break; - case 2: //pathID - fileName = item.m_PathID.ToString(); - break; - } - fullPath = Path.Combine(dir, fileName + extension); - if (!File.Exists(fullPath)) - { - Directory.CreateDirectory(dir); - return true; - } - if (filenameFormatIndex == 0) //assetName - { - fullPath = Path.Combine(dir, fileName + item.UniqueID + extension); - if (!File.Exists(fullPath)) - { - Directory.CreateDirectory(dir); - return true; - } - } - Logger.Warning($"{mode} failed. File \"{fullPath.Color(ColorConsole.BrightYellow)}\" already exist"); - return false; - } - - public static bool ExportAnimator(AssetItem item, string exportPath, List animationList = null) - { - var exportFullPath = Path.Combine(exportPath, item.Text, item.Text + ".fbx"); - if (File.Exists(exportFullPath)) - { - exportFullPath = Path.Combine(exportPath, item.Text + item.UniqueID, item.Text + ".fbx"); - } - var m_Animator = (Animator)item.Asset; - var convert = animationList != null - ? new ModelConverter(m_Animator, Properties.Settings.Default.convertType, animationList.Select(x => (AnimationClip)x.Asset).ToArray()) - : new ModelConverter(m_Animator, Properties.Settings.Default.convertType); - ExportFbx(convert, exportFullPath); - return true; - } - - public static void ExportGameObject(GameObject gameObject, string exportPath, List animationList = null) - { - var convert = animationList != null - ? new ModelConverter(gameObject, Properties.Settings.Default.convertType, animationList.Select(x => (AnimationClip)x.Asset).ToArray()) - : new ModelConverter(gameObject, Properties.Settings.Default.convertType); - exportPath = exportPath + FixFileName(gameObject.m_Name) + ".fbx"; - ExportFbx(convert, exportPath); - } - - public static void ExportGameObjectMerge(List gameObject, string exportPath, List animationList = null) - { - var rootName = Path.GetFileNameWithoutExtension(exportPath); - var convert = animationList != null - ? new ModelConverter(rootName, gameObject, Properties.Settings.Default.convertType, animationList.Select(x => (AnimationClip)x.Asset).ToArray()) - : new ModelConverter(rootName, gameObject, Properties.Settings.Default.convertType); - ExportFbx(convert, exportPath); - } - - private static void ExportFbx(IImported convert, string exportPath) - { - var fbxSettings = Fbx.Settings.FromBase64(Properties.Settings.Default.fbxSettings); - ModelExporter.ExportFbx(exportPath, convert, fbxSettings); - } - public static bool ExportDumpFile(AssetItem item, string exportPath) { if (!TryExportFile(exportPath, item, ".txt", out var exportFullPath, mode: "Dump")) @@ -315,6 +297,10 @@ namespace AssetStudioGUI case ClassIDType.AudioClip: case ClassIDType.Sprite: throw new System.NotImplementedException(); + case ClassIDType.VideoClip: + return ExportVideoClip(item, exportPath); + case ClassIDType.MovieTexture: + return ExportMovieTexture(item, exportPath); case ClassIDType.Shader: return ExportShader(item, exportPath); case ClassIDType.TextAsset: @@ -325,10 +311,6 @@ namespace AssetStudioGUI return ExportFont(item, exportPath); case ClassIDType.Mesh: return ExportMesh(item, exportPath); - case ClassIDType.VideoClip: - return ExportVideoClip(item, exportPath); - case ClassIDType.MovieTexture: - return ExportMovieTexture(item, exportPath); case ClassIDType.Animator: return ExportAnimator(item, exportPath); case ClassIDType.AnimationClip: @@ -338,6 +320,24 @@ namespace AssetStudioGUI } } + public static void ExportGameObject(GameObject gameObject, string exportPath, List animationList = null) + { + var convert = animationList != null + ? new ModelConverter(gameObject, Properties.Settings.Default.convertType, animationList.Select(x => (AnimationClip)x.Asset).ToArray()) + : new ModelConverter(gameObject, Properties.Settings.Default.convertType); + exportPath = exportPath + FixFileName(gameObject.m_Name) + ".fbx"; + ExportFbx(convert, exportPath); + } + + public static void ExportGameObjectMerge(List gameObject, string exportPath, List animationList = null) + { + var rootName = Path.GetFileNameWithoutExtension(exportPath); + var convert = animationList != null + ? new ModelConverter(rootName, gameObject, Properties.Settings.Default.convertType, animationList.Select(x => (AnimationClip)x.Asset).ToArray()) + : new ModelConverter(rootName, gameObject, Properties.Settings.Default.convertType); + ExportFbx(convert, exportPath); + } + public static string FixFileName(string str) { return str.Length >= 260 diff --git a/AssetStudioUtility/ModelConverter.cs b/AssetStudioUtility/ModelConverter.cs index 2897858..3f5847c 100644 --- a/AssetStudioUtility/ModelConverter.cs +++ b/AssetStudioUtility/ModelConverter.cs @@ -178,35 +178,24 @@ namespace AssetStudio { if (m_Animator.m_Controller.TryGet(out var m_Controller)) { + AnimatorController m_AnimatorController; var animationList = new List(); - switch (m_Controller) + if (m_Controller is AnimatorOverrideController overrideController) { - case AnimatorOverrideController m_AnimatorOverrideController: - { - if (m_AnimatorOverrideController.m_Controller.TryGet(out var m_AnimatorController)) - { - foreach (var pptr in m_AnimatorController.m_AnimationClips) - { - if (pptr.TryGet(out var m_AnimationClip)) - { - animationList.Add(m_AnimationClip); - } - } - } - break; - } + if (!overrideController.m_Controller.TryGet(out m_AnimatorController)) + return; + } + else + { + m_AnimatorController = (AnimatorController)m_Controller; + } - case AnimatorController m_AnimatorController: - { - foreach (var pptr in m_AnimatorController.m_AnimationClips) - { - if (pptr.TryGet(out var m_AnimationClip)) - { - animationList.Add(m_AnimationClip); - } - } - break; - } + foreach (var pptr in m_AnimatorController.m_AnimationClips) + { + if (pptr.TryGet(out var m_AnimationClip)) + { + animationList.Add(m_AnimationClip); + } } animationClipUniqArray = animationList.Distinct(animationClipEqComparer).ToArray(); } @@ -795,7 +784,7 @@ namespace AssetStudio var name = animationClip.m_Name; if (AnimationList.Exists(x => x.Name == name)) { - for (int i = 1; ; i++) + for (var i = 1; ; i++) { var fixName = name + $"_{i}"; if (!AnimationList.Exists(x => x.Name == fixName)) @@ -811,7 +800,7 @@ namespace AssetStudio AnimationList.Add(iAnim); if (animationClip.m_Legacy) { - foreach (var m_CompressedRotationCurve in animationClip.m_CompressedRotationCurves) + foreach (var m_CompressedRotationCurve in animationClip?.m_CompressedRotationCurves) { var track = iAnim.FindTrack(FixBonePath(animationClip, m_CompressedRotationCurve.m_Path)); @@ -858,15 +847,12 @@ namespace AssetStudio track.Scalings.Add(new ImportedKeyframe(m_Curve.time, new Vector3(m_Curve.value.X, m_Curve.value.Y, m_Curve.value.Z))); } } - if (animationClip.m_EulerCurves != null) + foreach (var m_EulerCurve in animationClip?.m_EulerCurves) { - foreach (var m_EulerCurve in animationClip.m_EulerCurves) + var track = iAnim.FindTrack(FixBonePath(animationClip, m_EulerCurve.path)); + foreach (var m_Curve in m_EulerCurve.curve.m_Curve) { - var track = iAnim.FindTrack(FixBonePath(animationClip, m_EulerCurve.path)); - foreach (var m_Curve in m_EulerCurve.curve.m_Curve) - { - track.Rotations.Add(new ImportedKeyframe(m_Curve.time, new Vector3(m_Curve.value.X, -m_Curve.value.Y, -m_Curve.value.Z))); - } + track.Rotations.Add(new ImportedKeyframe(m_Curve.time, new Vector3(m_Curve.value.X, -m_Curve.value.Y, -m_Curve.value.Z))); } } foreach (var m_FloatCurve in animationClip.m_FloatCurves) @@ -900,22 +886,22 @@ namespace AssetStudio var m_Clip = animationClip.m_MuscleClip.m_Clip.data; var streamedFrames = m_Clip.m_StreamedClip.ReadData(); var m_ClipBindingConstant = animationClip.m_ClipBindingConstant ?? m_Clip.ConvertValueArrayToGenericBinding(); - for (int frameIndex = 1; frameIndex < streamedFrames.Count - 1; frameIndex++) + for (var frameIndex = 1; frameIndex < streamedFrames.Count - 1; frameIndex++) { var frame = streamedFrames[frameIndex]; var streamedValues = frame.keyList.Select(x => x.value).ToArray(); - for (int curveIndex = 0; curveIndex < frame.keyList.Length;) + for (var curveIndex = 0; curveIndex < frame.keyList.Length;) { ReadCurveData(iAnim, m_ClipBindingConstant, frame.keyList[curveIndex].index, frame.time, streamedValues, 0, ref curveIndex); } } var m_DenseClip = m_Clip.m_DenseClip; var streamCount = m_Clip.m_StreamedClip.curveCount; - for (int frameIndex = 0; frameIndex < m_DenseClip.m_FrameCount; frameIndex++) + for (var frameIndex = 0; frameIndex < m_DenseClip.m_FrameCount; frameIndex++) { var time = m_DenseClip.m_BeginTime + frameIndex / m_DenseClip.m_SampleRate; var frameOffset = frameIndex * m_DenseClip.m_CurveCount; - for (int curveIndex = 0; curveIndex < m_DenseClip.m_CurveCount;) + for (var curveIndex = 0; curveIndex < m_DenseClip.m_CurveCount;) { var index = streamCount + curveIndex; ReadCurveData(iAnim, m_ClipBindingConstant, (int)index, time, m_DenseClip.m_SampleArray, (int)frameOffset, ref curveIndex); @@ -926,9 +912,9 @@ namespace AssetStudio var m_ConstantClip = m_Clip.m_ConstantClip; var denseCount = m_Clip.m_DenseClip.m_CurveCount; var time2 = 0.0f; - for (int i = 0; i < 2; i++) + for (var i = 0; i < 2; i++) { - for (int curveIndex = 0; curveIndex < m_ConstantClip.data.Length;) + for (var curveIndex = 0; curveIndex < m_ConstantClip.data.Length;) { var index = streamCount + denseCount + curveIndex; ReadCurveData(iAnim, m_ClipBindingConstant, (int)index, time2, m_ConstantClip.data, 0, ref curveIndex);