From eb3173f6ac02b50f0958d8911d42a681550d554f Mon Sep 17 00:00:00 2001 From: CroakFang <1605296300@qq.com> Date: Sun, 30 Jul 2023 14:54:00 +0800 Subject: [PATCH] add morph convert config --- Assets/Scripts/Config.cs | 77 ++++++++++++++++++- .../VMDRecorder/UnityHumanoidVMDRecorder.cs | 67 ++++------------ Assets/Scripts/UmaViewerAudio.cs | 1 - .../Scripts/umamusume/Gallop/Live/Director.cs | 2 +- 4 files changed, 92 insertions(+), 55 deletions(-) diff --git a/Assets/Scripts/Config.cs b/Assets/Scripts/Config.cs index e469d57..bf27eec 100644 --- a/Assets/Scripts/Config.cs +++ b/Assets/Scripts/Config.cs @@ -1,4 +1,5 @@ -using System; +using System; +using System.Collections.Generic; using System.IO; using UnityEngine; @@ -17,6 +18,67 @@ public class Config public string WorkModeTip = "Affects how application work, options: 0 - work with game client, 1 - work without game client(slow), Database needs to be updated manually"; public WorkMode WorkMode = WorkMode.Default; + public List MorphConvertSetting = new List + { + new MorphConvertConfig("にこり右", new string[] { "EyeBrow_1_R" }), + new MorphConvertConfig("にこり左", new string[] { "EyeBrow_1_L" }), + new MorphConvertConfig("真面目右", new string[] { "EyeBrow_17_R" }), + new MorphConvertConfig("真面目左", new string[] { "EyeBrow_17_L" }), + new MorphConvertConfig("困る右", new string[] { "EyeBrow_6_R", "EyeBrow_12_R" }), + new MorphConvertConfig("困る左", new string[] { "EyeBrow_6_L" }), + new MorphConvertConfig("困る2", new string[] { "EyeBrow_13_L", "EyeBrow_20_L", "EyeBrow_10_L" }), + new MorphConvertConfig("怒り右", new string[] { "EyeBrow_5_R", "EyeBrow_15_R", "EyeBrow_16_R", "EyeBrow_19_R", "EyeBrow_7_R" }), + new MorphConvertConfig("怒り左", new string[] { "EyeBrow_5_L", "EyeBrow_15_L", "EyeBrow_16_L", "EyeBrow_19_L", "EyeBrow_7_L" }), + new MorphConvertConfig("怒り2", new string[] { "EyeBrow_18_L" }), + new MorphConvertConfig("下右", new string[] { "EyeBrow_14_R", "EyeBrow_22_R", "EyeBrow_11_R" }), + new MorphConvertConfig("下左", new string[] { "EyeBrow_14_L", "EyeBrow_22_L", "EyeBrow_11_L" }), + new MorphConvertConfig("上右", new string[] { "EyeBrow_21_R" }), + new MorphConvertConfig("上左", new string[] { "EyeBrow_21_L" }), + new MorphConvertConfig("眉左", new string[] { "EyeBrow_23_L", "EyeBrow_23_R" }), + new MorphConvertConfig("眉右", new string[] { "EyeBrow_24_L", "EyeBrow_24_R" }), + new MorphConvertConfig("ウィンク2右", new string[] { "Eye_2_R" }), + new MorphConvertConfig("ウィンク2", new string[] { "Eye_2_L" }), + new MorphConvertConfig("ウィンク右", new string[] { "Eye_5_R", "Eye_8_R" }), + new MorphConvertConfig("ウィンク", new string[] { "Eye_5_L", "Eye_8_L" }), + new MorphConvertConfig("キリッ", new string[] { "Eye_9_L", "Eye_10_L", "Eye_11_L", "Eye_18_L" }), + new MorphConvertConfig("なごみ", new string[] { "Eye_16_L" }), + new MorphConvertConfig("びっくり", new string[] { "Eye_12_L" }), + new MorphConvertConfig("じと目", new string[] { "Eye_15_L" }), + new MorphConvertConfig("瞳小", new string[] { "Eye_14_L" }), + new MorphConvertConfig("笑い目", new string[] { "Eye_19_L" }), + new MorphConvertConfig("笑い目2", new string[] { "Eye_23_L" }), + new MorphConvertConfig("ぷく~_左", new string[] { "Mouth_2_0" }), + new MorphConvertConfig("ぷく~_右", new string[] { "Mouth_3_0" }), + new MorphConvertConfig("ん", new string[] { "Mouth_9_0" }), + new MorphConvertConfig("~~", new string[] { "Mouth_44_0", "Mouth_11_0" }), + new MorphConvertConfig("にっこり", new string[] { "Mouth_12_0" }), + new MorphConvertConfig("口角上げ", new string[] { "Mouth_13_0" }), + new MorphConvertConfig("□", new string[] { "Mouth_15_0" }), + new MorphConvertConfig("▲", new string[] { "Mouth_16_0" }), + new MorphConvertConfig("ω□", new string[] { "Mouth_17_0" }), + new MorphConvertConfig("にやり2", new string[] { "Mouth_18_0" }), + new MorphConvertConfig("にやり3", new string[] { "Mouth_19_0" }), + new MorphConvertConfig("にやり", new string[] { "Mouth_1_0", "Mouth_4_0", "Mouth_22_0" }), + new MorphConvertConfig("にぃー", new string[] { "Mouth_26_0" }), + new MorphConvertConfig("あ", new string[] { "Mouth_5_0", "Mouth_6_0", "Mouth_7_0", "Mouth_23_0" }), + new MorphConvertConfig("い", new string[] { "Mouth_25_0", "Mouth_35_0", "Mouth_36_0", "Mouth_8_0" }), + new MorphConvertConfig("う", new string[] { "Mouth_28_0", "Mouth_27_0" }), + new MorphConvertConfig("お", new string[] { "Mouth_31_0", "Mouth_10_0", "Mouth_14_0" }), + new MorphConvertConfig("え", new string[] { "Mouth_29_0", "Mouth_30_0", "Mouth_37_0", "Mouth_33_0" }), + new MorphConvertConfig("口角下げ", new string[] { "Mouth_41_0" }), + new MorphConvertConfig("ぺろっ", new string[] { "Mouth_45_0" }), + new MorphConvertConfig("てへぺろ", new string[] { "Mouth_46_0" }), + new MorphConvertConfig("ぺろっ2", new string[] { "Mouth_47_0" }), + new MorphConvertConfig("てへぺろ2", new string[] { "Mouth_48_0" }), + new MorphConvertConfig("ぺろっ3", new string[] { "Mouth_49_0" }), + new MorphConvertConfig("口上", new string[] { "Mouth_50_0" }), + new MorphConvertConfig("口下", new string[] { "Mouth_51_0" }), + new MorphConvertConfig("口左", new string[] { "Mouth_52_0" }), + new MorphConvertConfig("口右", new string[] { "Mouth_53_0" }), + new MorphConvertConfig("口横広げ", new string[] { "Mouth_54_0" }), + new MorphConvertConfig("口横狭い", new string[] { "Mouth_55_0" }) + }; + public Config() { @@ -61,4 +123,17 @@ public enum WorkMode { Default, Standalone +} + +[Serializable] +public class MorphConvertConfig +{ + public string MMDMorph; + public List UMAMorph; + + public MorphConvertConfig(string mmdMorph, string[] umaMorphs) + { + UMAMorph = new List(umaMorphs); + MMDMorph = mmdMorph; + } } \ No newline at end of file diff --git a/Assets/Scripts/Exporters/VMDRecorder/UnityHumanoidVMDRecorder.cs b/Assets/Scripts/Exporters/VMDRecorder/UnityHumanoidVMDRecorder.cs index a519fa8..8dc8d63 100644 --- a/Assets/Scripts/Exporters/VMDRecorder/UnityHumanoidVMDRecorder.cs +++ b/Assets/Scripts/Exporters/VMDRecorder/UnityHumanoidVMDRecorder.cs @@ -417,10 +417,9 @@ public class UnityHumanoidVMDRecorder : MonoBehaviour { for (int i = 0; i < frameNumberSaved; i++) { - if ((i % KeyReductionLevel) != 0) { continue; } - foreach (BoneNames boneName in Enum.GetValues(typeof(BoneNames))) { + if ((i % KeyReductionLevel) != 0 && boneName != BoneNames.全ての親) { continue; } if (!BoneDictionary.Keys.Contains(boneName)) { continue; } if (BoneDictionary[boneName] == null) { continue; } if (!UseParentOfAll && boneName == BoneNames.全ての親) { continue; } @@ -817,60 +816,24 @@ public class UnityHumanoidVMDRecorder : MonoBehaviour } } + public string ConvertMorphName(string name) { - switch (name) + if (Config.Instance.MorphConvertSetting.Count > 0) { - case "EyeBrow_1_R": return "にこり右"; - case "EyeBrow_1_L": return "にこり左"; - case "EyeBrow_5_R": return "真面目右"; - case "EyeBrow_5_L": return "真面目左"; - case "EyeBrow_6_R": return "困る右"; - case "EyeBrow_6_L": return "困る左"; - case "EyeBrow_7_R": return "怒り右"; - case "EyeBrow_7_L": return "怒り左"; - case "EyeBrow_11_R": return "下右"; - case "EyeBrow_11_L": return "下左"; - case "EyeBrow_21_R": return "上右"; - case "EyeBrow_21_L": return "上左"; - - case "Eye_2_R": return "ウィンク2右"; - case "Eye_2_L": return "ウィンク2"; - case "Eye_5_R": return "ウィンク右"; - case "Eye_5_L": return "ウィンク"; - case "Eye_8_R": return "ウィンク右"; - case "Eye_8_L": return "ウィンク"; - case "Eye_9_L": - case "Eye_10_L": - case "Eye_11_L": - case "Eye_18_L": return "キリッ"; - case "Eye_16_L": return "なごみ"; - case "Eye_12_L": return "びっくり"; - case "Eye_15_L": return "じと目"; - case "Eye_14_L": return "瞳小"; - - case "Mouth_9_0": return "ん"; - case "Mouth_12_0": return "にっこり"; - case "Mouth_13_0": return "口角上げ"; - case "Mouth_22_0": return "にやり"; - case "Mouth_5_0": - case "Mouth_6_0": - case "Mouth_7_0": - case "Mouth_23_0": return "あ"; - case "Mouth_25_0": - case "Mouth_8_0": return "い"; - case "Mouth_28_0": - case "Mouth_16_0": return "う"; - case "Mouth_31_0": - case "Mouth_10_0": - case "Mouth_14_0": return "お"; - case "Mouth_33_0": return "え"; - case "Mouth_41_0": return "口角下げ"; - case "Mouth_45_0": return "ぺろっ"; - case "Mouth_54_0": return "口横広げ"; - case "Mouth_55_0": return "口横狭い"; - default: return name; + var setting = Config.Instance.MorphConvertSetting; + foreach (var val in setting) + { + foreach (var v in val.UMAMorph) + { + if(v.Equals(name)) + { + return val.MMDMorph; + } + } + } } + return name; } public void RecrodAllMorph() diff --git a/Assets/Scripts/UmaViewerAudio.cs b/Assets/Scripts/UmaViewerAudio.cs index c44f73c..a4f0bc8 100644 --- a/Assets/Scripts/UmaViewerAudio.cs +++ b/Assets/Scripts/UmaViewerAudio.cs @@ -22,7 +22,6 @@ public class UmaViewerAudio static public UmaSoundInfo getSoundPath(string name) { - //Debug.Log(name); UmaSoundInfo info; info.awb = Main.AbSounds.FirstOrDefault(a => a.Name.Contains(name) && a.Name.EndsWith("awb")); return info; diff --git a/Assets/Scripts/umamusume/Gallop/Live/Director.cs b/Assets/Scripts/umamusume/Gallop/Live/Director.cs index b9596ec..8e03feb 100644 --- a/Assets/Scripts/umamusume/Gallop/Live/Director.cs +++ b/Assets/Scripts/umamusume/Gallop/Live/Director.cs @@ -729,7 +729,7 @@ namespace Gallop.Live if (recorder.IsRecording) { recorder.StopRecording(); - recorder.SaveLiveVMD($"Live{live.MusicId}_Pos{CharaContainerScript.IndexOf(container)}", 1); + recorder.SaveLiveVMD($"Live{live.MusicId}_Pos{CharaContainerScript.IndexOf(container)}"); } } }