TmpGuiEnable to EditorGUI.DisabledScope

This commit is contained in:
ousttrue
2021-06-01 18:45:26 +09:00
parent 909ee484ea
commit 4c130f1e27
2 changed files with 2 additions and 16 deletions

View File

@@ -14,20 +14,6 @@ using UnityEditor.Experimental.AssetImporters;
namespace UniGLTF
{
public class TmpGuiEnable : IDisposable
{
bool m_backup;
public TmpGuiEnable(bool enable)
{
m_backup = GUI.enabled;
GUI.enabled = enable;
}
public void Dispose()
{
GUI.enabled = m_backup;
}
}
public static class EditorMaterial
{
static bool s_foldMaterials = true;
@@ -36,7 +22,7 @@ namespace UniGLTF
public static void OnGUI(ScriptedImporter importer, GltfParser parser, ITextureDescriptorGenerator textureDescriptorGenerator, Func<string, string> textureDir, Func<string, string> materialDir)
{
var hasExternal = importer.GetExternalObjectMap().Any(x => x.Value is Material || x.Value is Texture2D);
using (new TmpGuiEnable(!hasExternal))
using (new EditorGUI.DisabledGroupScope(!hasExternal))
{
if (GUILayout.Button("Extract Materials And Textures ..."))
{

View File

@@ -30,7 +30,7 @@ namespace UniVRM10
public static void OnGUI(ScriptedImporter importer, GltfParser parser, UniGLTF.Extensions.VRMC_vrm.VRMC_vrm vrm)
{
var hasExternal = importer.GetExternalObjectMap().Any(x => x.Value is VRM10MetaObject || x.Value is VRM10ExpressionAvatar || x.Value is VRM10Expression);
using (new TmpGuiEnable(!hasExternal))
using (new EditorGUI.DisabledScope(!hasExternal))
{
if (GUILayout.Button("Extract Meta And Expressions ..."))
{