mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-07-08 13:14:30 -05:00
Merge pull request #874 from ousttrue/fix/VRMMaterialImporter_if
if文の間違いを修正
This commit is contained in:
commit
ea4e842e72
|
|
@ -97,7 +97,7 @@ namespace VRM
|
|||
public IEnumerable<(SubAssetKey, TextureImportParam)> EnumerateTexturesForMaterial(GltfParser parser, int i)
|
||||
{
|
||||
// mtoon
|
||||
if (TryCreateParam(parser, i, out MaterialImportParam param))
|
||||
if (!TryCreateParam(parser, i, out MaterialImportParam param))
|
||||
{
|
||||
// unlit
|
||||
if (!GltfUnlitMaterial.TryCreateParam(parser, i, out param))
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
"references": [
|
||||
"VRM",
|
||||
"UniGLTF",
|
||||
"UniGLTF.Editor",
|
||||
"MeshUtility",
|
||||
"MeshUtility.Editor",
|
||||
"VRMShaders.GLTF.IO.Runtime",
|
||||
|
|
|
|||
30
Assets/VRM/Tests/VRMTestAssets.cs
Normal file
30
Assets/VRM/Tests/VRMTestAssets.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/VRM/Tests/VRMTestAssets.cs.meta
Normal file
11
Assets/VRM/Tests/VRMTestAssets.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 983946c4f70cc494e87c8c8cf47d2589
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Reference in New Issue
Block a user