mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-25 20:32:32 -05:00
非対応のテクスチャタイプをエラーにする
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,14 +32,14 @@ namespace UniGLTF
|
||||
/// Messageの発生個所にジャンプするための情報
|
||||
/// </summary>
|
||||
public Type Type;
|
||||
public UnityEngine.Component Context;
|
||||
public UnityEngine.Object Context;
|
||||
|
||||
/// <summary>
|
||||
/// DrawGUIから呼び出す。追加のGUIボタンなどを実装する
|
||||
/// </summary>
|
||||
public Action Extended;
|
||||
|
||||
public static ValidationContext Create<T>(T c) where T : UnityEngine.Component
|
||||
public static ValidationContext Create<T>(T c) where T : UnityEngine.Object
|
||||
{
|
||||
return new ValidationContext
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user