public static void Serialize(JsonFormatter f, VRMC_node_collider 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.Shapes != null && value.Shapes.Count() >= 0)
            {
                f.Key("shapes");
                Serialize_Shapes(f, value.Shapes);
            }

            f.EndMap();
        }
Beispiel #2
0
        public static VRMC_node_collider Deserialize(JsonNode parsed)
        {
            var value = new VRMC_node_collider();

            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 == "shapes")
                {
                    value.Shapes = Deserialize_Shapes(kv.Value);
                    continue;
                }
            }
            return(value);
        }
Beispiel #3
0
        public static VRMC_node_collider Deserialize(ListTreeNode <JsonValue> parsed)
        {
            var value = new VRMC_node_collider();

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

                if (key == "shapes")
                {
                    value.Shapes = Deserialize_Shapes(kv.Value);
                    continue;
                }
            }
            return(value);
        }
Beispiel #4
0
        public static bool TryGet(UniGLTF.glTFExtension src, out VRMC_node_collider extension)
        {
            if (src is UniGLTF.glTFExtensionImport extensions)
            {
                foreach (var kv in extensions.ObjectItems())
                {
                    if (kv.Key.GetUtf8String() == VRMC_node_collider.ExtensionNameUtf8)
                    {
                        extension = Deserialize(kv.Value);
                        return(true);
                    }
                }
            }

            extension = default;
            return(false);
        }
Beispiel #5
0
        public static void SerializeTo(ref UniGLTF.glTFExtension dst, VRMC_node_collider 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_collider.ExtensionName, f.GetStoreBytes());
        }