From da4eff13189dc878e4f535e063f74a3b9c9c8a6e Mon Sep 17 00:00:00 2001 From: ousttrue Date: Fri, 16 Jul 2021 15:49:09 +0900 Subject: [PATCH] =?UTF-8?q?=E9=9D=9E=E5=AF=BE=E5=BF=9C=E3=81=AE=E3=83=86?= =?UTF-8?q?=E3=82=AF=E3=82=B9=E3=83=81=E3=83=A3=E3=82=BF=E3=82=A4=E3=83=97?= =?UTF-8?q?=E3=82=92=E3=82=A8=E3=83=A9=E3=83=BC=E3=81=AB=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ExportDialog/MeshExportValidator.cs | 38 ++++++++++++++++++- .../Runtime/UniGLTF/Validation/Validation.cs | 4 +- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/Assets/UniGLTF/Editor/UniGLTF/ExportDialog/MeshExportValidator.cs b/Assets/UniGLTF/Editor/UniGLTF/ExportDialog/MeshExportValidator.cs index 7ad8ac66d..e83a249e9 100644 --- a/Assets/UniGLTF/Editor/UniGLTF/ExportDialog/MeshExportValidator.cs +++ b/Assets/UniGLTF/Editor/UniGLTF/ExportDialog/MeshExportValidator.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Linq; using UniGLTF.M17N; +using UnityEditor; using UnityEngine; namespace UniGLTF @@ -118,9 +119,42 @@ namespace UniGLTF { yield return Validation.Warning($"{m}: unknown shader: {m.shader.name} => export as gltf default"); } - } - yield break; + var count = ShaderUtil.GetPropertyCount(m.shader); + for (int i = 0; i < count; ++i) + { + var propType = ShaderUtil.GetPropertyType(m.shader, i); + if (propType == ShaderUtil.ShaderPropertyType.TexEnv) + { + var propName = ShaderUtil.GetPropertyName(m.shader, i); + var tex = m.GetTexture(propName); + if (tex != null) + { + var assetPath = AssetDatabase.GetAssetPath(tex); + if (!string.IsNullOrEmpty(assetPath)) + { + if (AssetImporter.GetAtPath(assetPath) is TextureImporter textureImporter) + { + switch (textureImporter.textureType) + { + case TextureImporterType.Default: + case TextureImporterType.NormalMap: + break; + + default: + // EditorTextureSerializer throw Exception + // エクスポート未実装 + yield return Validation.Error($"{tex}: unknown texture type: {textureImporter.textureType}", ValidationContext.Create(tex)); + break; + } + } + } + } + } + } + + yield break; + } } } } diff --git a/Assets/UniGLTF/Runtime/UniGLTF/Validation/Validation.cs b/Assets/UniGLTF/Runtime/UniGLTF/Validation/Validation.cs index b6fa5ad92..be438bf3a 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/Validation/Validation.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/Validation/Validation.cs @@ -32,14 +32,14 @@ namespace UniGLTF /// Messageの発生個所にジャンプするための情報 /// public Type Type; - public UnityEngine.Component Context; + public UnityEngine.Object Context; /// /// DrawGUIから呼び出す。追加のGUIボタンなどを実装する /// public Action Extended; - public static ValidationContext Create(T c) where T : UnityEngine.Component + public static ValidationContext Create(T c) where T : UnityEngine.Object { return new ValidationContext {