예제 #1
0
        public static glTF_VRM_BlendShapeBind Deserialize_vrm_blendShapeMaster_blendShapeGroups__binds_LIST(ListTreeNode <JsonValue> parsed)
        {
            var value = new glTF_VRM_BlendShapeBind();

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

                if (key == "mesh")
                {
                    value.mesh = kv.Value.GetInt32();
                    continue;
                }

                if (key == "index")
                {
                    value.index = kv.Value.GetInt32();
                    continue;
                }

                if (key == "weight")
                {
                    value.weight = kv.Value.GetSingle();
                    continue;
                }
            }
            return(value);
        }
        public static string ToJson(this glTF_VRM_BlendShapeBind self)
        {
            var f = new JsonFormatter();

            VRMSerializer.Serialize_vrm_blendShapeMaster_blendShapeGroups__binds_ITEM(f, self);
            return(f.ToString());
        }
예제 #3
0
        public void BlendShapeBindTestError()
        {
            var model = new glTF_VRM_BlendShapeBind();

            var c = new JsonSchemaValidationContext("")
            {
                EnableDiagnosisForNotRequiredFields = true,
            };
            var ex = Assert.Throws <JsonSchemaValidationException>(
                () => JsonSchema.FromType <glTF_VRM_BlendShapeBind>().Serialize(model, c)
                );

            Assert.AreEqual("[mesh.String] minimum: ! -1>=0", ex.Message);
        }
        public void BlendShapeBindTest()
        {
            var model = new glTF_VRM_BlendShapeBind()
            {
                mesh   = 1,
                weight = 2,
                index  = 3,
            };

            var json = model.ToJson();

            Assert.AreEqual(@"{""mesh"":1,""index"":3,""weight"":2}", json);
            Debug.Log(json);
        }
예제 #5
0
        public void BlendShapeBindTest()
        {
            var model = new glTF_VRM_BlendShapeBind()
            {
                mesh   = 1,
                weight = 2,
                index  = 3,
            };

            var json = model.ToJson();

            Assert.AreEqual(@"{""mesh"":1,""index"":3,""weight"":2}", json);
            Debug.Log(json);

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

            Assert.AreEqual(json, json2);
        }
예제 #6
0
        public static void Serialize_vrm_blendShapeMaster_blendShapeGroups__binds_ITEM(JsonFormatter f, glTF_VRM_BlendShapeBind value)
        {
            f.BeginMap();


            if (value.mesh >= 0)
            {
                f.Key("mesh");
                f.Value(value.mesh);
            }

            if (value.index >= 0)
            {
                f.Key("index");
                f.Value(value.index);
            }

            if (value.weight >= 0)
            {
                f.Key("weight");
                f.Value(value.weight);
            }

            f.EndMap();
        }
 public void BlendShapeBindTestError()
 {
     var model = new glTF_VRM_BlendShapeBind();
 }