diff --git a/Assets/UniGLTF/Editor/UniGLTF/ExportDialog/MaterialValidator.cs b/Assets/UniGLTF/Editor/UniGLTF/ExportDialog/MaterialValidator.cs
index bf6d15af4..b1c9f32a5 100644
--- a/Assets/UniGLTF/Editor/UniGLTF/ExportDialog/MaterialValidator.cs
+++ b/Assets/UniGLTF/Editor/UniGLTF/ExportDialog/MaterialValidator.cs
@@ -3,6 +3,9 @@ using UnityEngine;
namespace UniGLTF
{
+ ///
+ /// MeshExportValidator から使われる
+ ///
public interface IMaterialValidator
{
///
diff --git a/Assets/UniGLTF/Editor/UniGLTF/ExportDialog/MeshExportValidator.cs b/Assets/UniGLTF/Editor/UniGLTF/ExportDialog/MeshExportValidator.cs
index 976a39ff4..5ab9e55a8 100644
--- a/Assets/UniGLTF/Editor/UniGLTF/ExportDialog/MeshExportValidator.cs
+++ b/Assets/UniGLTF/Editor/UniGLTF/ExportDialog/MeshExportValidator.cs
@@ -85,7 +85,7 @@ namespace UniGLTF
var gltfMaterial = MaterialValidator.GetGltfMaterialTypeFromUnityShaderName(m.shader.name);
if (string.IsNullOrEmpty(gltfMaterial))
{
- yield return Validation.Warning($"{m}: unknown shader: {m.shader.name} => export as gltf default");
+ yield return Validation.Warning($"{m}: unknown shader: {m.shader.name} => export as gltf default", ValidationContext.Create(m));
}
var used = new HashSet();
diff --git a/Assets/VRM/Editor/Format/VRMExporterWizard.cs b/Assets/VRM/Editor/Format/VRMExporterWizard.cs
index 171533f06..be621b52f 100644
--- a/Assets/VRM/Editor/Format/VRMExporterWizard.cs
+++ b/Assets/VRM/Editor/Format/VRMExporterWizard.cs
@@ -121,42 +121,6 @@ namespace VRM
m_meshes = null;
}
- ///
- /// VRM0
- ///
- class VRMMaterialValidator : DefaultMaterialValidator
- {
- public override string GetGltfMaterialTypeFromUnityShaderName(string shaderName)
- {
- var name = VRMMaterialExporter.VrmMaterialName(shaderName);
- if (!string.IsNullOrEmpty(name))
- {
- return name;
- }
- return base.GetGltfMaterialTypeFromUnityShaderName(shaderName);
- }
-
- public override IEnumerable<(string propertyName, Texture texture)> EnumerateTextureProperties(Material m)
- {
- if (m.shader.name != "VRM/MToon")
- {
- foreach (var x in base.EnumerateTextureProperties(m))
- {
- yield return x;
- }
- }
-
- var prop = UniGLTF.ShaderPropExporter.PreShaderPropExporter.GetPropsForSupportedShader(m.shader.name);
- foreach (var kv in prop.Properties)
- {
- if (kv.ShaderPropertyType == UniGLTF.ShaderPropExporter.ShaderPropertyType.TexEnv)
- {
- yield return (kv.Key, m.GetTexture(kv.Key));
- }
- }
- }
- }
-
protected override IEnumerable ValidatorFactory()
{
// ヒエラルキー のチェック
diff --git a/Assets/VRM/Editor/Format/VRMMaterialValidator.cs b/Assets/VRM/Editor/Format/VRMMaterialValidator.cs
new file mode 100644
index 000000000..7ff0b6656
--- /dev/null
+++ b/Assets/VRM/Editor/Format/VRMMaterialValidator.cs
@@ -0,0 +1,43 @@
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace VRM
+{
+ ///
+ /// VRM0
+ ///
+ class VRMMaterialValidator : UniGLTF.DefaultMaterialValidator
+ {
+ public override string GetGltfMaterialTypeFromUnityShaderName(string shaderName)
+ {
+ var name = VRMMaterialExporter.VrmMaterialName(shaderName);
+ if (!string.IsNullOrEmpty(name))
+ {
+ return name;
+ }
+ return base.GetGltfMaterialTypeFromUnityShaderName(shaderName);
+ }
+
+ public override IEnumerable<(string propertyName, Texture texture)> EnumerateTextureProperties(Material m)
+ {
+ if (m.shader.name != "VRM/MToon")
+ {
+ // PBR, Unlit
+ foreach (var x in base.EnumerateTextureProperties(m))
+ {
+ yield return x;
+ }
+ }
+
+ // all
+ var prop = UniGLTF.ShaderPropExporter.PreShaderPropExporter.GetPropsForSupportedShader(m.shader.name);
+ foreach (var kv in prop.Properties)
+ {
+ if (kv.ShaderPropertyType == UniGLTF.ShaderPropExporter.ShaderPropertyType.TexEnv)
+ {
+ yield return (kv.Key, m.GetTexture(kv.Key));
+ }
+ }
+ }
+ }
+}
diff --git a/Assets/VRM/Editor/Format/VRMMaterialValidator.cs.meta b/Assets/VRM/Editor/Format/VRMMaterialValidator.cs.meta
new file mode 100644
index 000000000..375a03af3
--- /dev/null
+++ b/Assets/VRM/Editor/Format/VRMMaterialValidator.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 43a9939275e36534797e9be6fb83c71e
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/VRM10/Editor/VRM10MaterialValidator.cs b/Assets/VRM10/Editor/VRM10MaterialValidator.cs
new file mode 100644
index 000000000..083557e46
--- /dev/null
+++ b/Assets/VRM10/Editor/VRM10MaterialValidator.cs
@@ -0,0 +1,41 @@
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace UniVRM10
+{
+ ///
+ /// VRM0
+ ///
+ class VRM10MaterialValidator : UniGLTF.DefaultMaterialValidator
+ {
+ const string MTOON_SHADER_NAME = "VRM10/MToon10";
+
+ public override string GetGltfMaterialTypeFromUnityShaderName(string shaderName)
+ {
+ switch (shaderName)
+ {
+ case MTOON_SHADER_NAME:
+ return "VRMC_materials_mtoon";
+ }
+
+ // TODO: VRM-0.X
+
+ return base.GetGltfMaterialTypeFromUnityShaderName(shaderName);
+ }
+
+ public override IEnumerable<(string propertyName, Texture texture)> EnumerateTextureProperties(Material m)
+ {
+ if (m.shader.name == MTOON_SHADER_NAME)
+ {
+ // TODO
+ }
+ else
+ {
+ foreach (var x in base.EnumerateTextureProperties(m))
+ {
+ yield return x;
+ }
+ }
+ }
+ }
+}
diff --git a/Assets/VRM10/Editor/VRM10MaterialValidator.cs.meta b/Assets/VRM10/Editor/VRM10MaterialValidator.cs.meta
new file mode 100644
index 000000000..8d92b1cf7
--- /dev/null
+++ b/Assets/VRM10/Editor/VRM10MaterialValidator.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 77bcf6c00ae8990488aaea60f0ec9173
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/VRM10/Editor/Vrm10ExportDialog.cs b/Assets/VRM10/Editor/Vrm10ExportDialog.cs
index b2518cd9c..b49e234fd 100644
--- a/Assets/VRM10/Editor/Vrm10ExportDialog.cs
+++ b/Assets/VRM10/Editor/Vrm10ExportDialog.cs
@@ -136,6 +136,10 @@ namespace UniVRM10
yield break;
}
+ // Mesh/Renderer のチェック
+ m_meshes.MaterialValidator = new VRM10MaterialValidator();
+ yield return m_meshes.Validate;
+
yield return HumanoidValidator.Validate_TPose;
// MeshUtility.Validators.HumanoidValidator.EnableFreeze = false;