Exemplo n.º 1
0
        static void SaveSpringBoneToJSON()
        {
            var path = EditorUtility.SaveFilePanel(
                "Save spring to json",
                null,
                "VRMSpring.json",
                "json");

            if (string.IsNullOrEmpty(path))
            {
                return;
            }

            var go     = Selection.activeObject as GameObject;
            var root   = go.transform;
            var nodes  = root.Traverse().Skip(1).ToList();
            var spring = new glTF_VRM_SecondaryAnimation();

            ExportSecondary(root, nodes,
                            spring.colliderGroups.Add,
                            spring.boneGroups.Add
                            );

            File.WriteAllText(path, spring.ToJson());
        }
        public void SecondaryAnimationTest()
        {
            var model = new glTF_VRM_SecondaryAnimation();

            var json = model.ToJson();

            Assert.AreEqual(@"{""boneGroups"":[],""colliderGroups"":[]}", json);
            Debug.Log(json);
        }
Exemplo n.º 3
0
        public void SecondaryAnimationTest()
        {
            var model = new glTF_VRM_SecondaryAnimation();

            var json = model.ToJson();

            Assert.AreEqual(@"{""boneGroups"":[],""colliderGroups"":[]}", json);
            Debug.Log(json);

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

            // NOTE: New serializer outputs values which will not be used...
            Assert.AreEqual(json, json2);
        }