Skip to content

Commit

Permalink
+ ExportMusumeAssets
Browse files Browse the repository at this point in the history
  • Loading branch information
vinjn committed Jun 23, 2021
1 parent be8493e commit 6aa7b2f
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 10 deletions.
24 changes: 17 additions & 7 deletions AssetStudio/AssetStudioGUI/AssetStudioGUIForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions AssetStudio/AssetStudioGUI/AssetStudioGUIForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2097,6 +2097,17 @@ private void generateVizToolStripMenuItem_Click(object sender, EventArgs e)
}
}

private void museToolStripMenuItem_Click(object sender, EventArgs e)
{
var saveFolderDialog = new OpenFolderDialog();
if (saveFolderDialog.ShowDialog(this) == DialogResult.OK)
{
timer.Stop();

Studio.ExportMusumeAssets(saveFolderDialog.Folder, exportableAssets);
}
}

private void glControl1_MouseWheel(object sender, MouseEventArgs e)
{
if (glControl1.Visible)
Expand Down
6 changes: 3 additions & 3 deletions AssetStudio/AssetStudioGUI/AssetStudioGUIForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>312, 17</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>432, 17</value>
</metadata>
<data name="fontPreviewBox.Text" xml:space="preserve">
<value>abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWYZ
1234567890.:,;'\"(!?)+-*/=
Expand All @@ -138,9 +141,6 @@ The quick brown fox jumps over the lazy dog. 1234567890

The quick brown fox jumps over the lazy dog. 1234567890</value>
</data>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>432, 17</value>
</metadata>
<metadata name="timer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>553, 17</value>
</metadata>
Expand Down
49 changes: 49 additions & 0 deletions AssetStudio/AssetStudioGUI/Studio.cs
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,55 @@ public static void ExportAssets2(string savePath, List<AssetItem> toExportAssets
}
}

public static void ExportMusumeAssets(string savePath, List<AssetItem> toExportAssets)
{
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
int exportedCount = 0;

var animators = new List<AssetItem>();
var clips = new List<AssetItem>();

// pass#1: collect animators and clips
foreach (var asset in toExportAssets)
{
if (asset.Type == ClassIDType.Animator && asset.Container.StartsWith("assets/_gallopresources/bundle/resources/3d/chara/body"))
{
//if (asset.Container == "assets/_gallopresources/bundle/resources/3d/chara/body/bdy1060_90/pfb_bdy1060_90.prefab")
{
animators.Add(asset);
}
}
else if (asset.Type == ClassIDType.AnimationClip && asset.Container.StartsWith("assets/_gallopresources/bundle/resources/3d/motion/event/body/type00/anm_eve_type00_"))
{
clips.Add(asset);
}
}

// pass#2: export one animator with all clips
var animator = animators[0];
foreach (var clip in clips)
{
try
{
var clipName = clip.Text.Replace("anm_eve_type00_", "");
Exporter.ExportAnimator(animator, Path.Combine(savePath, clipName), new List<AssetItem> { clip });
exportedCount++;
}
catch (Exception ex)
{
MessageBox.Show($"Export {clip.Type}:{clip.Text} error\r\n{ex.Message}\r\n{ex.StackTrace}");
}
}

var statusText = exportedCount == 0 ? "Nothing exported." : $"Finished exporting {exportedCount} assets.";
StatusStripUpdate(statusText);

if (Properties.Settings.Default.openAfterExport && exportedCount > 0)
{
Process.Start(savePath);
}
}

public static void ExportSplitObjects(string savePath, TreeNodeCollection nodes)
{
ThreadPool.QueueUserWorkItem(state =>
Expand Down

0 comments on commit 6aa7b2f

Please sign in to comment.