mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-10 14:44:17 +00:00
measure ETA
This commit is contained in:
parent
d21ec31eff
commit
f2e1d920bd
1 changed files with 15 additions and 3 deletions
|
@ -268,6 +268,8 @@ namespace SanAndreasUnity.Editor
|
|||
|
||||
int nextIndexToTriggerLoad = 0;
|
||||
var isCanceledRef = new Ref<bool>();
|
||||
var etaStopwatch = Stopwatch.StartNew();
|
||||
string etaTime = "0";
|
||||
|
||||
for (int i = 0; i < objectsToExport.Length; i++)
|
||||
{
|
||||
|
@ -283,7 +285,7 @@ namespace SanAndreasUnity.Editor
|
|||
{
|
||||
Transform triggerLoadObject = objectsToExport[triggerLoadIndex];
|
||||
|
||||
if (DisplayPausableProgressBar("", $"Triggering async load ({triggerLoadIndex + 1}/{objectsToExport.Length})... {triggerLoadObject.name}", i / (float)objectsToExport.Length))
|
||||
if (DisplayPausableProgressBar("", $"Triggering async load ({triggerLoadIndex + 1}/{objectsToExport.Length}), ETA {etaTime} ... {triggerLoadObject.name}", i / (float)objectsToExport.Length))
|
||||
yield break;
|
||||
|
||||
triggerLoadObject.GetComponentOrThrow<MapObject>().Show(1f);
|
||||
|
@ -294,7 +296,7 @@ namespace SanAndreasUnity.Editor
|
|||
// wait for completion of jobs
|
||||
|
||||
foreach (var item in WaitForCompletionOfLoadingJobs(
|
||||
$"\r\nobjects processed {i}/{objectsToExport.Length}",
|
||||
$"\r\nETA {etaTime}, objects processed {i}/{objectsToExport.Length}",
|
||||
i / (float)objectsToExport.Length,
|
||||
nextNextIndex / (float)objectsToExport.Length,
|
||||
4,
|
||||
|
@ -306,7 +308,7 @@ namespace SanAndreasUnity.Editor
|
|||
|
||||
}
|
||||
|
||||
if (DisplayPausableProgressBar("", $"Creating assets ({i + 1}/{objectsToExport.Length})... {currentObject.name}", i / (float)objectsToExport.Length))
|
||||
if (DisplayPausableProgressBar("", $"Creating assets ({i + 1}/{objectsToExport.Length}), ETA {etaTime} ... {currentObject.name}", i / (float)objectsToExport.Length))
|
||||
yield break;
|
||||
|
||||
AssetDatabase.StartAssetEditing();
|
||||
|
@ -318,6 +320,16 @@ namespace SanAndreasUnity.Editor
|
|||
{
|
||||
AssetDatabase.StopAssetEditing();
|
||||
}
|
||||
|
||||
if (i % 20 == 0)
|
||||
{
|
||||
// update ETA
|
||||
double numPerSecond = 20 / etaStopwatch.Elapsed.TotalSeconds;
|
||||
etaStopwatch.Restart();
|
||||
int numLeft = objectsToExport.Length - i;
|
||||
double secondsLeft = numLeft / numPerSecond;
|
||||
etaTime = F.FormatElapsedTime((float) secondsLeft);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_exportPrefabs)
|
||||
|
|
Loading…
Reference in a new issue