Some changes to motion list for l2d models

- Motion list is now sorted
- Motions divided into groups (each motion is a separate group)
- Motion names are used as group names
This commit is contained in:
VaDiM 2023-08-27 01:33:34 +03:00
parent cf67815d53
commit c8a21838c9

View File

@ -99,7 +99,7 @@ namespace CubismLive2DExtractor
} }
//motion //motion
var motions = new JArray(); var motions = new SortedDictionary<string, JArray>();
if (gameObjects.Count > 0) if (gameObjects.Count > 0)
{ {
@ -205,11 +205,8 @@ namespace CubismLive2DExtractor
} }
json.Meta.TotalUserDataSize = totalUserDataSize; json.Meta.TotalUserDataSize = totalUserDataSize;
motions.Add(new JObject var motionPath = new JObject(new JProperty("File", $"motions/{animation.Name}.motion3.json"));
{ motions.Add(animation.Name, new JArray(motionPath));
{ "Name", animation.Name },
{ "File", $"motions/{animation.Name}.motion3.json" }
});
File.WriteAllText($"{destMotionPath}{animation.Name}.motion3.json", JsonConvert.SerializeObject(json, Formatting.Indented, new MyJsonConverter())); File.WriteAllText($"{destMotionPath}{animation.Name}.motion3.json", JsonConvert.SerializeObject(json, Formatting.Indented, new MyJsonConverter()));
} }
} }
@ -307,7 +304,7 @@ namespace CubismLive2DExtractor
{ {
Moc = $"{modelName}.moc3", Moc = $"{modelName}.moc3",
Textures = textures.ToArray(), Textures = textures.ToArray(),
Motions = new JObject { { "", motions } }, Motions = JObject.FromObject(motions),
Expressions = expressions, Expressions = expressions,
}, },
Groups = groups.ToArray() Groups = groups.ToArray()