skip T if [0, 0, 0]

This commit is contained in:
ousttrue
2021-06-22 14:06:41 +09:00
parent c6cb7e9df3
commit 20d068e16f
3 changed files with 5 additions and 3 deletions

View File

@@ -16,6 +16,7 @@ namespace UniGLTF
const string Begin = @"using System;
using System.Collections.Generic;
using UniJSON;
using System.Linq;
namespace UniGLTF {
@@ -34,7 +35,7 @@ namespace UniGLTF {
get
{
return Path.Combine(UnityEngine.Application.dataPath,
"UniGLTF/UniGLTF/Scripts/IO/GltfSerializer.g.cs");
"UniGLTF/Runtime/UniGLTF/Format/GltfSerializer.g.cs");
}
}

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using UniJSON;
using System.Linq;
namespace UniGLTF {
@@ -1121,7 +1122,7 @@ public static void Serialize_gltf_nodes_ITEM(JsonFormatter f, glTFNode value)
Serialize_gltf_nodes__matrix(f, value.matrix);
}
if(value.translation!=null&&value.translation.Length>=3){
if(value.translation!=null&&value.translation.Length>=3&&!value.translation.SequenceEqual(new float[]{0, 0, 0})){
f.Key("translation");
Serialize_gltf_nodes__translation(f, value.translation);
}

View File

@@ -17,7 +17,7 @@ namespace UniGLTF
[JsonSchema(MinItems = 16, MaxItems = 16)]
public float[] matrix;
[JsonSchema(MinItems = 3, MaxItems = 3)]
[JsonSchema(MinItems = 3, MaxItems = 3, SerializationConditions = new string[] { "!value.translation.SequenceEqual(new float[]{0, 0, 0})" })]
public float[] translation;
[JsonSchema(MinItems = 4, MaxItems = 4)]