diff --git a/Assets/VRM/Editor/Format/VRMMaterialValidator.cs b/Assets/VRM/Editor/Format/VRMMaterialValidator.cs index 941e59038..d6c792e65 100644 --- a/Assets/VRM/Editor/Format/VRMMaterialValidator.cs +++ b/Assets/VRM/Editor/Format/VRMMaterialValidator.cs @@ -30,7 +30,7 @@ namespace VRM // // extensions.VRM.materialProperties に記録する // - var prop = UniGLTF.ShaderPropExporter.PreShaderPropExporter.GetPropsForSupportedShader(m.shader.name); + var prop = UniGLTF.ShaderPropExporter.PreShaderPropExporter.GetPropsForMToon(); foreach (var kv in prop.Properties) { if (kv.ShaderPropertyType == UniGLTF.ShaderPropExporter.ShaderPropertyType.TexEnv) diff --git a/Assets/VRM/Runtime/IO/VRMMaterialExporter.cs b/Assets/VRM/Runtime/IO/VRMMaterialExporter.cs index bf021f20b..5b7c9035b 100644 --- a/Assets/VRM/Runtime/IO/VRMMaterialExporter.cs +++ b/Assets/VRM/Runtime/IO/VRMMaterialExporter.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Linq; using UniGLTF; using UniGLTF.ShaderPropExporter; @@ -135,16 +134,16 @@ namespace VRM renderQueue = m.renderQueue, }; - if (!PreShaderPropExporter.VRMExtensionShaders.Contains(m.shader.name)) + if (m.shader.name != MToon.Utils.ShaderName) { material.shader = glTF_VRM_Material.VRM_USE_GLTFSHADER; return material; } - var prop = PreShaderPropExporter.GetPropsForSupportedShader(m.shader.name); + var prop = PreShaderPropExporter.GetPropsForMToon(); if (prop == null) { - Debug.LogWarningFormat("Fail to export shader: {0}", m.shader.name); + throw new Exception("arienai"); } else { diff --git a/Assets/VRMShaders/VRM/IO/Runtime/PreShaderPropExporter.cs b/Assets/VRMShaders/VRM/IO/Runtime/PreShaderPropExporter.cs index 8bc5988cb..9d6cd11ce 100644 --- a/Assets/VRMShaders/VRM/IO/Runtime/PreShaderPropExporter.cs +++ b/Assets/VRMShaders/VRM/IO/Runtime/PreShaderPropExporter.cs @@ -25,17 +25,16 @@ namespace UniGLTF.ShaderPropExporter } } + /// + /// 今はMToon専用 + /// public static partial class PreShaderPropExporter { - public static readonly string[] VRMExtensionShaders = new string[] - { - "VRM/UnlitTransparentZWrite", - "VRM/MToon" - }; - static Dictionary m_shaderPropMap; - public static ShaderProps GetPropsForSupportedShader(string shaderName) + const string ShaderName = "VRM/MToon"; + + public static ShaderProps GetPropsForMToon() { if (m_shaderPropMap == null) { @@ -51,19 +50,12 @@ namespace UniGLTF.ShaderPropExporter } ShaderProps props; - if (m_shaderPropMap.TryGetValue(shaderName, out props)) + if (m_shaderPropMap.TryGetValue(ShaderName, out props)) { return props; } -#if UNITY_EDITOR - // fallback - Debug.LogWarningFormat("{0} is not predefined shader. Use ShaderUtil", shaderName); - var shader = Shader.Find(shaderName); - return ShaderProps.FromShader(shader); -#else - return null; -#endif + throw new Exception("arienai"); } } }