Ejemplo n.º 1
0
        public static void Serialize(JsonFormatter f, VRMC_springBone 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.Springs != null && value.Springs.Count() >= 0)
            {
                f.Key("springs");
                Serialize_Springs(f, value.Springs);
            }

            f.EndMap();
        }
Ejemplo n.º 2
0
        public static VRMC_springBone Deserialize(JsonNode parsed)
        {
            var value = new VRMC_springBone();

            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 == "colliderGroups")
                {
                    value.ColliderGroups = Deserialize_ColliderGroups(kv.Value);
                    continue;
                }

                if (key == "springs")
                {
                    value.Springs = Deserialize_Springs(kv.Value);
                    continue;
                }
            }
            return(value);
        }
Ejemplo n.º 3
0
        public static void Serialize(JsonFormatter f, VRMC_springBone 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 (value.ColliderGroups != null && value.ColliderGroups.Count() >= 0)
            {
                f.Key("colliderGroups");
                Serialize_ColliderGroups(f, value.ColliderGroups);
            }

            if (value.Springs != null && value.Springs.Count() >= 0)
            {
                f.Key("springs");
                Serialize_Springs(f, value.Springs);
            }

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

            extension = default;
            return(false);
        }
Ejemplo n.º 5
0
        public static void SerializeTo(ref UniGLTF.glTFExtension dst, VRMC_springBone 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_springBone.ExtensionName, f.GetStoreBytes());
        }
Ejemplo n.º 6
0
        public static void Serialize(JsonFormatter f, VRMC_springBone 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.Colliders != null && value.Colliders.Count() >= 1)
            {
                f.Key("colliders");
                Serialize_Colliders(f, value.Colliders);
            }

            if (value.ColliderGroups != null && value.ColliderGroups.Count() >= 1)
            {
                f.Key("colliderGroups");
                Serialize_ColliderGroups(f, value.ColliderGroups);
            }

            if (value.Springs != null && value.Springs.Count() >= 1)
            {
                f.Key("springs");
                Serialize_Springs(f, value.Springs);
            }

            f.EndMap();
        }
Ejemplo n.º 7
0
        public static void Serialize(JsonFormatter f, VRMC_springBone value)
        {
            f.BeginMap();


            if (value.Settings != null && value.Settings.Count() >= 0)
            {
                f.Key("settings");
                Serialize_Settings(f, value.Settings);
            }

            if (value.Springs != null && value.Springs.Count() >= 0)
            {
                f.Key("springs");
                Serialize_Springs(f, value.Springs);
            }

            f.EndMap();
        }
Ejemplo n.º 8
0
        public static VRMC_springBone Deserialize(ListTreeNode <JsonValue> parsed)
        {
            var value = new VRMC_springBone();

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

                if (key == "settings")
                {
                    value.Settings = Deserialize_Settings(kv.Value);
                    continue;
                }

                if (key == "springs")
                {
                    value.Springs = Deserialize_Springs(kv.Value);
                    continue;
                }
            }
            return(value);
        }