コード例 #1
0
        public static string ToJson(this glTF_VRM_MeshAnnotation self)
        {
            var f = new JsonFormatter();

            VRMSerializer.Serialize_vrm_firstPerson_meshAnnotations_ITEM(f, self);
            return(f.ToString());
        }
コード例 #2
0
        public void MeshAnnotationTest()
        {
            var model = new glTF_VRM_MeshAnnotation();

            var json = model.ToJson();

            Assert.AreEqual(@"{""mesh"":0}", json);
            Debug.Log(json);
        }
コード例 #3
0
        public void MeshAnnotationTest()
        {
            var model = new glTF_VRM_MeshAnnotation();

            var json = model.ToJson();

            Assert.AreEqual(@"{""mesh"":0}", json);
            Debug.Log(json);

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

            Assert.AreEqual(json, json2);
        }
コード例 #4
0
        public static glTF_VRM_MeshAnnotation Deserialize_vrm_firstPerson_meshAnnotations_LIST(ListTreeNode <JsonValue> parsed)
        {
            var value = new glTF_VRM_MeshAnnotation();

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

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

                if (key == "firstPersonFlag")
                {
                    value.firstPersonFlag = kv.Value.GetString();
                    continue;
                }
            }
            return(value);
        }
コード例 #5
0
        public static void Serialize_vrm_firstPerson_meshAnnotations_ITEM(JsonFormatter f, glTF_VRM_MeshAnnotation value)
        {
            f.BeginMap();


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

            if (!string.IsNullOrEmpty(value.firstPersonFlag))
            {
                f.Key("firstPersonFlag");
                f.Value(value.firstPersonFlag);
            }

            f.EndMap();
        }