Пример #1
0
        public static RotationConstraint Deserialize_Rotation(JsonNode parsed)
        {
            var value = new RotationConstraint();

            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 == "name")
                {
                    value.Name = kv.Value.GetString();
                    continue;
                }

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

                if (key == "sourceSpace")
                {
                    value.SourceSpace = (ObjectSpace)Enum.Parse(typeof(ObjectSpace), kv.Value.GetString(), true);
                    continue;
                }

                if (key == "destinationSpace")
                {
                    value.DestinationSpace = (ObjectSpace)Enum.Parse(typeof(ObjectSpace), kv.Value.GetString(), true);
                    continue;
                }

                if (key == "freezeAxes")
                {
                    value.FreezeAxes = Deserialize_FreezeAxes(kv.Value);
                    continue;
                }

                if (key == "weight")
                {
                    value.Weight = kv.Value.GetSingle();
                    continue;
                }
            }
            return(value);
        }
Пример #2
0
        public static void __constraint_Serialize_Rotation(JsonFormatter f, RotationConstraint 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.Name))
            {
                f.Key("name");
                f.Value(value.Name);
            }

            if (value.Source.HasValue)
            {
                f.Key("source");
                f.Value(value.Source.GetValueOrDefault());
            }

            if (true)
            {
                f.Key("sourceSpace");
                f.Value(value.SourceSpace.ToString());
            }

            if (true)
            {
                f.Key("destinationSpace");
                f.Value(value.DestinationSpace.ToString());
            }

            if (value.FreezeAxes != null && value.FreezeAxes.Count() >= 3)
            {
                f.Key("freezeAxes");
                __constraint__rotation_Serialize_FreezeAxes(f, value.FreezeAxes);
            }

            if (value.Weight.HasValue)
            {
                f.Key("weight");
                f.Value(value.Weight.GetValueOrDefault());
            }

            f.EndMap();
        }
Пример #3
0
        public static RotationConstraint __constraint_Deserialize_Rotation(JsonNode parsed)
        {
            var value = new RotationConstraint();

            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 == "name")
                {
                    value.Name = kv.Value.GetString();
                    continue;
                }

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

                if (key == "weight")
                {
                    value.Weight = kv.Value.GetSingle();
                    continue;
                }
            }
            return(value);
        }
Пример #4
0
        public static void __constraint_Serialize_Rotation(JsonFormatter f, RotationConstraint 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.Name))
            {
                f.Key("name");
                f.Value(value.Name);
            }

            if (value.Source.HasValue)
            {
                f.Key("source");
                f.Value(value.Source.GetValueOrDefault());
            }

            if (value.Weight.HasValue)
            {
                f.Key("weight");
                f.Value(value.Weight.GetValueOrDefault());
            }

            f.EndMap();
        }