mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-26 14:00:17 +00:00
add some stats
This commit is contained in:
parent
8531e758e2
commit
b3fb1870d6
1 changed files with 18 additions and 2 deletions
|
@ -2,6 +2,7 @@
|
||||||
using SanAndreasUnity.Utilities;
|
using SanAndreasUnity.Utilities;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
|
@ -22,6 +23,9 @@ namespace SanAndreasUnity.Editor
|
||||||
|
|
||||||
private CoroutineInfo m_coroutineInfo;
|
private CoroutineInfo m_coroutineInfo;
|
||||||
|
|
||||||
|
private int m_numNewlyExportedAssets = 0;
|
||||||
|
private int m_numAlreadyExportedAssets = 0;
|
||||||
|
|
||||||
private bool m_exportFromSelection = false;
|
private bool m_exportFromSelection = false;
|
||||||
|
|
||||||
private bool m_exportCollisionMeshes = true;
|
private bool m_exportCollisionMeshes = true;
|
||||||
|
@ -106,6 +110,9 @@ namespace SanAndreasUnity.Editor
|
||||||
{
|
{
|
||||||
yield return null;
|
yield return null;
|
||||||
|
|
||||||
|
m_numNewlyExportedAssets = 0;
|
||||||
|
m_numAlreadyExportedAssets = 0;
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(m_selectedFolder))
|
if (string.IsNullOrWhiteSpace(m_selectedFolder))
|
||||||
{
|
{
|
||||||
EditorUtility.DisplayDialog("", "Select a folder first.", "Ok");
|
EditorUtility.DisplayDialog("", "Select a folder first.", "Ok");
|
||||||
|
@ -157,6 +164,8 @@ namespace SanAndreasUnity.Editor
|
||||||
if (EditorApplication.isPlaying)
|
if (EditorApplication.isPlaying)
|
||||||
EditorApplication.isPaused = true;
|
EditorApplication.isPaused = true;
|
||||||
|
|
||||||
|
var stopwatch = Stopwatch.StartNew();
|
||||||
|
|
||||||
EditorUtility.DisplayProgressBar("", "Creating folders...", 0f);
|
EditorUtility.DisplayProgressBar("", "Creating folders...", 0f);
|
||||||
|
|
||||||
this.CreateFolders();
|
this.CreateFolders();
|
||||||
|
@ -196,7 +205,9 @@ namespace SanAndreasUnity.Editor
|
||||||
AssetDatabase.Refresh();
|
AssetDatabase.Refresh();
|
||||||
|
|
||||||
EditorUtility.ClearProgressBar();
|
EditorUtility.ClearProgressBar();
|
||||||
EditorUtility.DisplayDialog("", "Finished !", "Ok");
|
string displayText = $"number of newly exported asssets {m_numNewlyExportedAssets}, number of already exported assets {m_numAlreadyExportedAssets}, time elapsed {stopwatch.Elapsed}";
|
||||||
|
UnityEngine.Debug.Log($"Exporting of assets finished, {displayText}");
|
||||||
|
EditorUtility.DisplayDialog("", $"Finished ! \r\n{displayText}", "Ok");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateFolders()
|
void CreateFolders()
|
||||||
|
@ -272,16 +283,21 @@ namespace SanAndreasUnity.Editor
|
||||||
meshRenderer.sharedMaterials = mats;
|
meshRenderer.sharedMaterials = mats;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Object CreateAssetIfNotExists(Object asset, string path)
|
private Object CreateAssetIfNotExists(Object asset, string path)
|
||||||
{
|
{
|
||||||
if (AssetDatabase.Contains(asset))
|
if (AssetDatabase.Contains(asset))
|
||||||
return asset;
|
return asset;
|
||||||
|
|
||||||
if (File.Exists(Path.Combine(Application.dataPath + "/../", path)))
|
if (File.Exists(Path.Combine(Application.dataPath + "/../", path)))
|
||||||
|
{
|
||||||
|
m_numAlreadyExportedAssets++;
|
||||||
return AssetDatabase.LoadMainAssetAtPath(path);
|
return AssetDatabase.LoadMainAssetAtPath(path);
|
||||||
|
}
|
||||||
|
|
||||||
AssetDatabase.CreateAsset(asset, path);
|
AssetDatabase.CreateAsset(asset, path);
|
||||||
|
|
||||||
|
m_numNewlyExportedAssets++;
|
||||||
|
|
||||||
return AssetDatabase.LoadMainAssetAtPath(path);
|
return AssetDatabase.LoadMainAssetAtPath(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue