mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-05-25 05:40:21 -04:00
fixed export "Selected assets" problem
This commit is contained in:
parent
63bc2ca970
commit
03b2ab97d6
@ -2968,13 +2968,23 @@ namespace Unity_Studio
|
|||||||
if (exportableAssets.Count > 0 && saveFolderDialog1.ShowDialog() == DialogResult.OK)
|
if (exportableAssets.Count > 0 && saveFolderDialog1.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
timer.Stop();
|
timer.Stop();
|
||||||
int[] SelectedIndices = new int[assetListView.SelectedIndices.Count];
|
List<AssetPreloadData> toExportAssets = null;
|
||||||
assetListView.SelectedIndices.CopyTo(SelectedIndices, 0);
|
if (((ToolStripItem)sender).Name == "exportAllAssetsMenuItem")
|
||||||
|
{
|
||||||
bool exportAll = ((ToolStripItem)sender).Name == "exportAllAssetsMenuItem";
|
toExportAssets = exportableAssets;
|
||||||
bool exportFiltered = ((ToolStripItem)sender).Name == "exportFilteredAssetsMenuItem";
|
}
|
||||||
bool exportSelected = ((ToolStripItem)sender).Name == "exportSelectedAssetsMenuItem";
|
else if (((ToolStripItem)sender).Name == "exportFilteredAssetsMenuItem")
|
||||||
|
{
|
||||||
|
toExportAssets = visibleAssets;
|
||||||
|
}
|
||||||
|
else if (((ToolStripItem)sender).Name == "exportSelectedAssetsMenuItem")
|
||||||
|
{
|
||||||
|
toExportAssets = new List<AssetPreloadData>(assetListView.SelectedIndices.Count);
|
||||||
|
foreach (var i in assetListView.SelectedIndices.OfType<int>())
|
||||||
|
{
|
||||||
|
toExportAssets.Add((AssetPreloadData)assetListView.Items[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
int assetGroupSelectedIndex = assetGroupOptions.SelectedIndex;
|
int assetGroupSelectedIndex = assetGroupOptions.SelectedIndex;
|
||||||
|
|
||||||
ThreadPool.QueueUserWorkItem(delegate
|
ThreadPool.QueueUserWorkItem(delegate
|
||||||
@ -2983,26 +2993,18 @@ namespace Unity_Studio
|
|||||||
if (Path.GetFileName(savePath) == "Select folder or write folder name to create")
|
if (Path.GetFileName(savePath) == "Select folder or write folder name to create")
|
||||||
{ savePath = Path.GetDirectoryName(saveFolderDialog1.FileName); }
|
{ savePath = Path.GetDirectoryName(saveFolderDialog1.FileName); }
|
||||||
|
|
||||||
int toExport = 0;
|
int toExport = toExportAssets.Count;
|
||||||
int exportedCount = 0;
|
int exportedCount = 0;
|
||||||
|
|
||||||
SetProgressBarValue(0);
|
SetProgressBarValue(0);
|
||||||
SetProgressBarMaximum(assetsfileList.Count);
|
SetProgressBarMaximum(toExport);
|
||||||
//looping assetsFiles will optimize HDD access
|
//looping assetsFiles will optimize HDD access
|
||||||
//but will also have a small performance impact when exporting only a couple of selected assets
|
//but will also have a small performance impact when exporting only a couple of selected assets
|
||||||
foreach (var assetsFile in assetsfileList)
|
foreach (var asset in toExportAssets)
|
||||||
{
|
{
|
||||||
string exportpath = savePath + "\\";
|
string exportpath = savePath + "\\";
|
||||||
if (assetGroupSelectedIndex == 1) { exportpath += Path.GetFileNameWithoutExtension(assetsFile.filePath) + "_export\\"; }
|
if (assetGroupSelectedIndex == 1) { exportpath += Path.GetFileNameWithoutExtension(asset.sourceFile.filePath) + "_export\\"; }
|
||||||
|
else if (assetGroupSelectedIndex == 0) { exportpath = savePath + "\\" + asset.TypeString + "\\"; }
|
||||||
foreach (var asset in assetsFile.exportableAssets)
|
|
||||||
{
|
|
||||||
if (exportAll ||
|
|
||||||
visibleAssets.Exists(x => x.uniqueID == asset.uniqueID) &&
|
|
||||||
(exportFiltered || exportSelected && asset.Index >= 0 && SelectedIndices.Contains(asset.Index)))
|
|
||||||
{
|
|
||||||
toExport++;
|
|
||||||
if (assetGroupSelectedIndex == 0) { exportpath = savePath + "\\" + asset.TypeString + "\\"; }
|
|
||||||
|
|
||||||
//AudioClip and Texture2D extensions are set when the list is built
|
//AudioClip and Texture2D extensions are set when the list is built
|
||||||
//so their overwrite tests can be done without loading them again
|
//so their overwrite tests can be done without loading them again
|
||||||
@ -3044,20 +3046,14 @@ namespace Unity_Studio
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
ProgressBarPerformStep();
|
ProgressBarPerformStep();
|
||||||
}
|
}
|
||||||
|
|
||||||
string statusText = "";
|
string statusText = "";
|
||||||
switch (exportedCount)
|
switch (exportedCount)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
statusText = "Nothing exported.";
|
statusText = "Nothing exported.";
|
||||||
break;
|
break;
|
||||||
/*case 1:
|
|
||||||
statusText = toolStripStatusLabel1.Text + " finished.";
|
|
||||||
break;*/
|
|
||||||
default:
|
default:
|
||||||
statusText = "Finished exporting " + exportedCount.ToString() + " assets.";
|
statusText = "Finished exporting " + exportedCount.ToString() + " assets.";
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user