public void SecondaryAnimationGroupTestErrorColliderGroups()
 {
     var model = new glTF_VRM_SecondaryAnimationGroup()
     {
         colliderGroups = new int[] { -1 }
     };
 }
 public void SecondaryAnimationGroupTestErrorBones()
 {
     var model = new glTF_VRM_SecondaryAnimationGroup()
     {
         bones = new int[] { -1 }
     };
 }
        public static string ToJson(this glTF_VRM_SecondaryAnimationGroup self)
        {
            var f = new JsonFormatter();

            VRMSerializer.Serialize_vrm_secondaryAnimation_boneGroups_ITEM(f, self);
            return(f.ToString());
        }
        public void SecondaryAnimationGroupTest()
        {
            var model = new glTF_VRM_SecondaryAnimationGroup();

            var json = model.ToJson();

            Assert.AreEqual(@"{""stiffiness"":0,""gravityPower"":0,""gravityDir"":{""x"":0,""y"":0,""z"":0},""dragForce"":0,""center"":0,""hitRadius"":0,""bones"":[],""colliderGroups"":[]}", json);
            Debug.Log(json);
        }
        public void SecondaryAnimationGroupTestErrorColliderGroups()
        {
            var model = new glTF_VRM_SecondaryAnimationGroup()
            {
                colliderGroups = new int[] { -1 }
            };

            var c = new JsonSchemaValidationContext("")
            {
                EnableDiagnosisForNotRequiredFields = true,
            };
            var ex = Assert.Throws <JsonSchemaValidationException>(
                () => JsonSchema.FromType <glTF_VRM_SecondaryAnimationGroup>().Serialize(model, c)
                );

            Assert.AreEqual("[colliderGroups.String] minimum: ! -1>=0", ex.Message);
        }
Exemple #6
0
        public void SecondaryAnimationGroupTest()
        {
            var model = new glTF_VRM_SecondaryAnimationGroup();

            var json = model.ToJson();

            Assert.AreEqual(@"{""stiffiness"":0,""gravityPower"":0,""gravityDir"":{""x"":0,""y"":0,""z"":0},""dragForce"":0,""center"":0,""hitRadius"":0,""bones"":[],""colliderGroups"":[]}", json);
            Debug.Log(json);

            var c = new JsonSchemaValidationContext("")
            {
                EnableDiagnosisForNotRequiredFields = true,
            };
            var json2 = JsonSchema.FromType <glTF_VRM_SecondaryAnimationGroup>().Serialize(model, c);

            // NOTE: New serializer outputs values which will not be used...
            Assert.AreEqual(json, json2);
        }
Exemple #7
0
        public static void Serialize_vrm_secondaryAnimation_boneGroups_ITEM(JsonFormatter f, glTF_VRM_SecondaryAnimationGroup value)
        {
            f.BeginMap();


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

            if (true)
            {
                f.Key("stiffiness");
                f.Value(value.stiffiness);
            }

            if (true)
            {
                f.Key("gravityPower");
                f.Value(value.gravityPower);
            }

            if (value.gravityDir != null)
            {
                f.Key("gravityDir");
                Serialize_vrm_secondaryAnimation_boneGroups__gravityDir(f, value.gravityDir);
            }

            if (true)
            {
                f.Key("dragForce");
                f.Value(value.dragForce);
            }

            if (true)
            {
                f.Key("center");
                f.Value(value.center);
            }

            if (true)
            {
                f.Key("hitRadius");
                f.Value(value.hitRadius);
            }

            if (value.bones != null && value.bones.Length >= 0)
            {
                f.Key("bones");
                Serialize_vrm_secondaryAnimation_boneGroups__bones(f, value.bones);
            }

            if (value.colliderGroups != null && value.colliderGroups.Length >= 0)
            {
                f.Key("colliderGroups");
                Serialize_vrm_secondaryAnimation_boneGroups__colliderGroups(f, value.colliderGroups);
            }

            f.EndMap();
        }
Exemple #8
0
        public static glTF_VRM_SecondaryAnimationGroup Deserialize_vrm_secondaryAnimation_boneGroups_LIST(ListTreeNode <JsonValue> parsed)
        {
            var value = new glTF_VRM_SecondaryAnimationGroup();

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

                if (key == "comment")
                {
                    value.comment = kv.Value.GetString();
                    continue;
                }

                if (key == "stiffiness")
                {
                    value.stiffiness = kv.Value.GetSingle();
                    continue;
                }

                if (key == "gravityPower")
                {
                    value.gravityPower = kv.Value.GetSingle();
                    continue;
                }

                if (key == "gravityDir")
                {
                    value.gravityDir = Deserialize_vrm_secondaryAnimation_boneGroups__gravityDir(kv.Value);
                    continue;
                }

                if (key == "dragForce")
                {
                    value.dragForce = kv.Value.GetSingle();
                    continue;
                }

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

                if (key == "hitRadius")
                {
                    value.hitRadius = kv.Value.GetSingle();
                    continue;
                }

                if (key == "bones")
                {
                    value.bones = Deserialize_vrm_secondaryAnimation_boneGroups__bones(kv.Value);
                    continue;
                }

                if (key == "colliderGroups")
                {
                    value.colliderGroups = Deserialize_vrm_secondaryAnimation_boneGroups__colliderGroups(kv.Value);
                    continue;
                }
            }
            return(value);
        }