mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-03-10 15:54:56 +08:00
Refactor: Delete unused code for MAAssetBundle generation (#515)
* refactor: delete unused code for MAAssetBundle generation * fix unit tests
This commit is contained in:
parent
0174b71bcc
commit
5f3e1dcf86
@ -25,7 +25,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using JetBrains.Annotations;
|
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEditor.Animations;
|
using UnityEditor.Animations;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -34,24 +33,9 @@ using Object = UnityEngine.Object;
|
|||||||
|
|
||||||
namespace nadena.dev.modular_avatar.core.editor
|
namespace nadena.dev.modular_avatar.core.editor
|
||||||
{
|
{
|
||||||
internal class CleanupTempAssets : IVRCSDKPostprocessAvatarCallback
|
|
||||||
{
|
|
||||||
public int callbackOrder => 99999;
|
|
||||||
|
|
||||||
public void OnPostprocessAvatar()
|
|
||||||
{
|
|
||||||
Util.DeleteTemporaryAssets();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[InitializeOnLoad]
|
[InitializeOnLoad]
|
||||||
internal static class Util
|
internal static class Util
|
||||||
{
|
{
|
||||||
private const string generatedAssetsSubdirectory = "999_Modular_Avatar_Generated";
|
|
||||||
private const string generatedAssetsPath = "Assets/" + generatedAssetsSubdirectory;
|
|
||||||
|
|
||||||
[CanBeNull] public static string OverridePath;
|
|
||||||
|
|
||||||
static Util()
|
static Util()
|
||||||
{
|
{
|
||||||
RuntimeUtil.delayCall = (cb) => EditorApplication.delayCall += cb.Invoke;
|
RuntimeUtil.delayCall = (cb) => EditorApplication.delayCall += cb.Invoke;
|
||||||
@ -153,42 +137,6 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
return component;
|
return component;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GenerateAssetPath()
|
|
||||||
{
|
|
||||||
return GetGeneratedAssetsFolder() + "/" + GUID.Generate() + ".asset";
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string GetGeneratedAssetsFolder()
|
|
||||||
{
|
|
||||||
var path = OverridePath ?? generatedAssetsPath;
|
|
||||||
|
|
||||||
var pathParts = path.Split('/');
|
|
||||||
|
|
||||||
for (int i = 1; i < pathParts.Length; i++)
|
|
||||||
{
|
|
||||||
var subPath = string.Join("/", pathParts, 0, i + 1);
|
|
||||||
if (!AssetDatabase.IsValidFolder(subPath))
|
|
||||||
{
|
|
||||||
AssetDatabase.CreateFolder(string.Join("/", pathParts, 0, i), pathParts[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static void DeleteTemporaryAssets()
|
|
||||||
{
|
|
||||||
EditorApplication.delayCall += () =>
|
|
||||||
{
|
|
||||||
AssetDatabase.SaveAssets();
|
|
||||||
|
|
||||||
var subdir = generatedAssetsPath;
|
|
||||||
|
|
||||||
AssetDatabase.DeleteAsset(subdir);
|
|
||||||
FileUtil.DeleteFileOrDirectory(subdir);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Type FindType(string typeName)
|
public static Type FindType(string typeName)
|
||||||
{
|
{
|
||||||
Type avatarValidation = null;
|
Type avatarValidation = null;
|
||||||
|
@ -48,7 +48,8 @@ namespace modular_avatar_tests
|
|||||||
Object.DestroyImmediate(obj);
|
Object.DestroyImmediate(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
Util.DeleteTemporaryAssets();
|
AssetDatabase.DeleteAsset(TEMP_ASSET_PATH);
|
||||||
|
FileUtil.DeleteFileOrDirectory(TEMP_ASSET_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected nadena.dev.ndmf.BuildContext CreateContext(GameObject root)
|
protected nadena.dev.ndmf.BuildContext CreateContext(GameObject root)
|
||||||
|
Loading…
Reference in New Issue
Block a user