mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-04-25 07:28:51 -05:00
Fix error of extracting
This commit is contained in:
parent
68c8fed9dd
commit
6e85b42d65
|
|
@ -56,13 +56,14 @@ namespace UniGLTF
|
|||
s_foldTextures = EditorGUILayout.Foldout(s_foldTextures, "Remapped Textures");
|
||||
if (s_foldTextures)
|
||||
{
|
||||
importer.DrawRemapGUI<UnityEngine.Texture2D>(enumTextures(parser).Select(x => x.Key));
|
||||
importer.DrawRemapGUI<UnityEngine.Texture>(enumTextures(parser).Select(x => x.Key));
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Clear"))
|
||||
{
|
||||
importer.ClearExternalObjects<UnityEngine.Material>();
|
||||
importer.ClearExternalObjects<UnityEngine.Texture2D>();
|
||||
importer.ClearExternalObjects(
|
||||
typeof(UnityEngine.Material),
|
||||
typeof(UnityEngine.Texture));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using VRMShaders;
|
||||
#if UNITY_2020_2_OR_NEWER
|
||||
using UnityEditor.AssetImporters;
|
||||
|
|
@ -13,11 +15,19 @@ namespace UniGLTF
|
|||
{
|
||||
public static class ScriptedImporterExtension
|
||||
{
|
||||
public static void ClearExternalObjects<T>(this ScriptedImporter importer) where T : UnityEngine.Object
|
||||
public static void ClearExternalObjects(this ScriptedImporter importer, params Type[] targetTypes)
|
||||
{
|
||||
foreach (var externalObject in importer.GetExternalObjectMap().Where(x => x.Key.type == typeof(T)))
|
||||
foreach (var targetType in targetTypes)
|
||||
{
|
||||
importer.RemoveRemap(externalObject.Key);
|
||||
if (!typeof(UnityEngine.Object).IsAssignableFrom(targetType)) continue;
|
||||
|
||||
foreach (var (key, obj) in importer.GetExternalObjectMap())
|
||||
{
|
||||
if (key.type.IsAssignableFrom(targetType))
|
||||
{
|
||||
importer.RemoveRemap(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AssetDatabase.WriteImportSettingsIfDirty(importer.assetPath);
|
||||
|
|
|
|||
|
|
@ -46,8 +46,9 @@ namespace UniVRM10
|
|||
|
||||
if (GUILayout.Button("Clear"))
|
||||
{
|
||||
importer.ClearExternalObjects<VRM10MetaObject>();
|
||||
importer.ClearExternalObjects<VRM10Expression>();
|
||||
importer.ClearExternalObjects(
|
||||
typeof(VRM10MetaObject),
|
||||
typeof(VRM10Expression));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user