public static string ToJson(this glTF_VRM_SecondaryAnimationCollider self)
        {
            var f = new JsonFormatter();

            VRMSerializer.Serialize_vrm_secondaryAnimation_colliderGroups__colliders_ITEM(f, self);
            return(f.ToString());
        }
        public void SecondaryAnimationColliderTest()
        {
            var model = new glTF_VRM_SecondaryAnimationCollider()
            {
                offset = new Vector3(1, 2, 3),
                radius = 42,
            };

            var json = model.ToJson();

            Assert.AreEqual(@"{""offset"":{""x"":1,""y"":2,""z"":3},""radius"":42}", json);
            Debug.Log(json);
        }
Пример #3
0
        public void SecondaryAnimationColliderTest()
        {
            var model = new glTF_VRM_SecondaryAnimationCollider()
            {
                offset = new Vector3(1, 2, 3),
                radius = 42,
            };

            var json = model.ToJson();

            Assert.AreEqual(@"{""offset"":{""x"":1,""y"":2,""z"":3},""radius"":42}", json);
            Debug.Log(json);

            var c = new JsonSchemaValidationContext("")
            {
                EnableDiagnosisForNotRequiredFields = true,
            };
            var json2 = JsonSchema.FromType <glTF_VRM_SecondaryAnimationCollider>().Serialize(model, c);

            // NOTE: New serializer outputs values which will not be used...
            Assert.AreEqual(json, json2);
        }
Пример #4
0
        public static glTF_VRM_SecondaryAnimationCollider Deserialize_vrm_secondaryAnimation_colliderGroups__colliders_LIST(ListTreeNode <JsonValue> parsed)
        {
            var value = new glTF_VRM_SecondaryAnimationCollider();

            foreach (var kv in parsed.ObjectItems())
            {
                var key = kv.Key.GetString();

                if (key == "offset")
                {
                    value.offset = Deserialize_vrm_secondaryAnimation_colliderGroups__colliders__offset(kv.Value);
                    continue;
                }

                if (key == "radius")
                {
                    value.radius = kv.Value.GetSingle();
                    continue;
                }
            }
            return(value);
        }
Пример #5
0
        public static void Serialize_vrm_secondaryAnimation_colliderGroups__colliders_ITEM(JsonFormatter f, glTF_VRM_SecondaryAnimationCollider value)
        {
            f.BeginMap();


            if (value.offset != null)
            {
                f.Key("offset");
                Serialize_vrm_secondaryAnimation_colliderGroups__colliders__offset(f, value.offset);
            }

            if (true)
            {
                f.Key("radius");
                f.Value(value.radius);
            }

            f.EndMap();
        }