Esempio n. 1
0
        public static VRMC_node_constraint Deserialize(JsonNode parsed)
        {
            var value = new VRMC_node_constraint();

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

                if (key == "extensions")
                {
                    value.Extensions = new glTFExtensionImport(kv.Value);
                    continue;
                }

                if (key == "extras")
                {
                    value.Extras = new glTFExtensionImport(kv.Value);
                    continue;
                }

                if (key == "constraint")
                {
                    value.Constraint = Deserialize_Constraint(kv.Value);
                    continue;
                }
            }
            return(value);
        }
Esempio n. 2
0
        public static void Serialize(JsonFormatter f, VRMC_node_constraint value)
        {
            f.BeginMap();


            if (value.Extensions != null)
            {
                f.Key("extensions");
                value.Extensions.Serialize(f);
            }

            if (value.Extras != null)
            {
                f.Key("extras");
                value.Extras.Serialize(f);
            }

            if (value.Constraint != null)
            {
                f.Key("constraint");
                Serialize_Constraint(f, value.Constraint);
            }

            f.EndMap();
        }
Esempio n. 3
0
        public static void Serialize(JsonFormatter f, VRMC_node_constraint value)
        {
            f.BeginMap();


            if (value.Extensions != null)
            {
                f.Key("extensions");
                (value.Extensions as glTFExtension).Serialize(f);
            }

            if (value.Extras != null)
            {
                f.Key("extras");
                (value.Extras as glTFExtension).Serialize(f);
            }

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

            if (value.Constraint != null)
            {
                f.Key("constraint");
                Serialize_Constraint(f, value.Constraint);
            }

            f.EndMap();
        }
Esempio n. 4
0
        public static bool TryGet(UniGLTF.glTFExtension src, out VRMC_node_constraint extension)
        {
            if (src is UniGLTF.glTFExtensionImport extensions)
            {
                foreach (var kv in extensions.ObjectItems())
                {
                    if (kv.Key.GetUtf8String() == VRMC_node_constraint.ExtensionNameUtf8)
                    {
                        extension = Deserialize(kv.Value);
                        return(true);
                    }
                }
            }

            extension = default;
            return(false);
        }
Esempio n. 5
0
        public static void SerializeTo(ref UniGLTF.glTFExtension dst, VRMC_node_constraint extension)
        {
            if (dst is glTFExtensionImport)
            {
                throw new NotImplementedException();
            }

            if (!(dst is glTFExtensionExport extensions))
            {
                extensions = new glTFExtensionExport();
                dst = extensions;
            }

            var f = new JsonFormatter();
            Serialize(f, extension);
            extensions.Add(VRMC_node_constraint.ExtensionName, f.GetStoreBytes());
        }