MToonMaterialParamTest を追加。

This commit is contained in:
ousttrue
2021-04-15 14:16:15 +09:00
parent 00460ea051
commit 91c44254fb
4 changed files with 62 additions and 1 deletions

View File

@@ -16,7 +16,7 @@ namespace VRM
filterMode = FilterMode.Bilinear,
};
var textureManager = new TextureExporter(AssetTextureUtil.IsTextureEditorAsset );
var textureManager = new TextureExporter(AssetTextureUtil.IsTextureEditorAsset);
var srcMaterial = new Material(Shader.Find("VRM/MToon"));
var offset = new Vector2(0.3f, 0.2f);
@@ -35,5 +35,24 @@ namespace VRM
materialProperties = new System.Collections.Generic.List<glTF_VRM_Material> { vrmMaterial }
});
}
[Test]
public void MToonMaterialParamTest()
{
if (!VRMTestAssets.TryGetPath("Models/VRoid/VictoriaRubin/VictoriaRubin.vrm", out string path))
{
return;
}
var parser = new GltfParser();
parser.ParsePath(path);
var importer = new VRMImporterContext(parser, null);
var materialImporter = new VRMMtoonMaterialImporter(importer.VRM);
Assert.AreEqual(73, parser.GLTF.materials.Count);
Assert.True(materialImporter.TryCreateParam(parser, 0, out MaterialImportParam param));
}
}
}

View File

@@ -3,6 +3,7 @@
"references": [
"VRM",
"UniGLTF",
"UniGLTF.Editor",
"MeshUtility",
"MeshUtility.Editor",
"VRMShaders.GLTF.IO.Runtime",

View File

@@ -0,0 +1,30 @@
using System.IO;
namespace VRM
{
public static class VRMTestAssets
{
public static bool TryGetPath(string relative, out string path)
{
var env = System.Environment.GetEnvironmentVariable("VRM_TEST_MODELS");
if (string.IsNullOrEmpty(env))
{
path = default;
return false;
}
var root = new DirectoryInfo(env);
if (!root.Exists)
{
path = default;
return false;
}
path = Path.Combine(root.FullName, relative);
if (!File.Exists(path))
{
return false;
}
return true;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 983946c4f70cc494e87c8c8cf47d2589
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: