Skip to content

Commit

Permalink
Some changes to motion list for l2d models
Browse files Browse the repository at this point in the history
- Motion list is now sorted
- Motions divided into groups (each motion is a separate group)
- Motion names are used as group names
  • Loading branch information
aelurum committed Aug 26, 2023
1 parent cf67815 commit c8a2183
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions AssetStudioUtility/CubismLive2DExtractor/Live2DExtractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public static void ExtractLive2D(IGrouping<string, AssetStudio.Object> assets, s
}

//motion
var motions = new JArray();
var motions = new SortedDictionary<string, JArray>();

if (gameObjects.Count > 0)
{
Expand Down Expand Up @@ -205,11 +205,8 @@ public static void ExtractLive2D(IGrouping<string, AssetStudio.Object> assets, s
}
json.Meta.TotalUserDataSize = totalUserDataSize;

motions.Add(new JObject
{
{ "Name", animation.Name },
{ "File", $"motions/{animation.Name}.motion3.json" }
});
var motionPath = new JObject(new JProperty("File", $"motions/{animation.Name}.motion3.json"));
motions.Add(animation.Name, new JArray(motionPath));
File.WriteAllText($"{destMotionPath}{animation.Name}.motion3.json", JsonConvert.SerializeObject(json, Formatting.Indented, new MyJsonConverter()));
}
}
Expand Down Expand Up @@ -307,7 +304,7 @@ public static void ExtractLive2D(IGrouping<string, AssetStudio.Object> assets, s
{
Moc = $"{modelName}.moc3",
Textures = textures.ToArray(),
Motions = new JObject { { "", motions } },
Motions = JObject.FromObject(motions),
Expressions = expressions,
},
Groups = groups.ToArray()
Expand Down

0 comments on commit c8a2183

Please sign in to comment.