fix ApiSampleTests.cs

This commit is contained in:
ousttrue
2021-01-27 16:27:24 +09:00
parent f470f817d8
commit f6babc46e0
6 changed files with 19 additions and 15 deletions

View File

@@ -59,7 +59,7 @@ namespace UniGLTF
public glTFExtensionExport Add(string key, ArraySegment<byte> raw)
{
m_serialized.Add(key, raw);
m_serialized[key] = raw;
return this;
}

View File

@@ -728,7 +728,7 @@ namespace UniVRM10
joint.GravityDir = gltfJoint.GravityDir.ToVector3();
joint.GravityPower = gltfJoint.GravityPower.Value;
joint.Stiffness = gltfJoint.Stiffness.Value;
joint.Exclude = gltfJoint.Exclude.Value;
joint.Exclude = gltfJoint.Exclude.GetValueOrDefault();
springBone.Joints.Add(joint);
}

View File

@@ -18,7 +18,10 @@ namespace UniVRM10
return null;
}
var springBone = new VRMC_springBone();
var springBone = new VRMC_springBone
{
Springs = new List<Spring>(),
};
//
// VRMC_node_collider
@@ -26,7 +29,10 @@ namespace UniVRM10
foreach (var nodeCollider in self.Springs.SelectMany(x => x.Colliders))
{
var index = nodes.IndexOfThrow(nodeCollider.Node);
var gltfCollider = new VRMC_node_collider();
var gltfCollider = new VRMC_node_collider
{
Shapes = new List<ColliderShape>(),
};
foreach (var y in nodeCollider.Colliders)
{
switch (y.ColliderType)
@@ -80,6 +86,7 @@ namespace UniVRM10
{
Name = x.Comment,
Colliders = x.Colliders.Select(y => nodes.IndexOfThrow(y.Node)).ToArray(),
Joints = new List<SpringBoneJoint>(),
};
foreach (var y in x.Joints)

View File

@@ -11,10 +11,8 @@
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": true,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": false,
"defineConstraints": [
"UNITY_INCLUDE_TESTS"
]
"defineConstraints": []
}

View File

@@ -1,5 +1,6 @@
using System;
using System.IO;
using NUnit.Framework;
using UnityEngine;
using UnityEngine.TestTools;
@@ -9,7 +10,7 @@ namespace UniVRM10.Test
{
VrmLib.Model ReadModel(string path)
{
var bytes = File.ReadAllBytes(path);
var bytes = Migration.Migrate(File.ReadAllBytes(path));
if (!UniGLTF.Glb.TryParse(bytes, out UniGLTF.Glb glb, out Exception ex))
{
@@ -17,7 +18,7 @@ namespace UniVRM10.Test
return null;
}
var model = UniVRM10.VrmLoader.CreateVrmModel(path);
var model = UniVRM10.VrmLoader.CreateVrmModel(bytes, new FileInfo(path));
return model;
}
@@ -43,10 +44,10 @@ namespace UniVRM10.Test
return bytes;
}
[UnityTest]
public bool Sample()
[Test]
public void Sample()
{
var path = "Tests/Models/Alicia_vrm-1.00/AliciaSolid_vrm-1.00.vrm";
var path = "Tests/Models/Alicia_vrm-0.51/AliciaSolid_vrm-0.51.vrm";
Debug.Log($"load: {path}");
// import
@@ -74,8 +75,6 @@ namespace UniVRM10.Test
var vrmBytes = ToVrm10(dstModel);
Debug.Log($"export {vrmBytes.Length} bytes");
return true;
}
}
}