Ejemplo n.º 1
0
public static void Serialize_Aim(JsonFormatter f, AimConstraint 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(!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.AimVector!=null&&value.AimVector.Count()>=3){
        f.Key("aimVector");                
        Serialize_AimVector(f, value.AimVector);
    }

    if(value.UpVector!=null&&value.UpVector.Count()>=3){
        f.Key("upVector");                
        Serialize_UpVector(f, value.UpVector);
    }

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

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

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

            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 == "aimAxis")
                {
                    value.AimAxis = (AimAxis)Enum.Parse(typeof(AimAxis), kv.Value.GetString(), true);
                    continue;
                }

                if (key == "weight")
                {
                    value.Weight = kv.Value.GetSingle();
                    continue;
                }
            }
            return(value);
        }
Ejemplo n.º 3
0
        public static void __constraint_Serialize_Aim(JsonFormatter f, AimConstraint 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("aimAxis");
                f.Value(value.AimAxis.ToString());
            }

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

            f.EndMap();
        }
Ejemplo n.º 4
0
        public static AimConstraint Deserialize_Aim(JsonNode parsed)
        {
            var value = new AimConstraint();

            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 == "aimVector")
                {
                    value.AimVector = Deserialize_AimVector(kv.Value);
                    continue;
                }

                if (key == "upVector")
                {
                    value.UpVector = Deserialize_UpVector(kv.Value);
                    continue;
                }

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

                if (key == "weight")
                {
                    value.Weight = kv.Value.GetSingle();
                    continue;
                }
            }
            return(value);
        }