Merge pull request #492 from danwillm/inverse-bind-matrix

Make inverseBindMatrices optional
diff --git a/tests/issue-492.glb b/tests/issue-492.glb
new file mode 100644
index 0000000..3a46d0c
--- /dev/null
+++ b/tests/issue-492.glb
Binary files differ
diff --git a/tests/tester.cc b/tests/tester.cc
index 807fb1c..6b10979 100644
--- a/tests/tester.cc
+++ b/tests/tester.cc
@@ -1182,3 +1182,21 @@
     }
   }
 }
+
+TEST_CASE("inverse-bind-matrices-optional", "[issue-492]") {
+  tinygltf::Model model;
+  tinygltf::TinyGLTF ctx;
+  std::string err;
+  std::string warn;
+
+  bool ret = ctx.LoadBinaryFromFile(&model, &err, &warn, "issue-492.glb");
+  if (!warn.empty()) {
+    std::cout << "WARN:" << warn << std::endl;
+  }
+  if (!err.empty()) {
+    std::cerr << "ERR:" << err << std::endl;
+  }
+
+  REQUIRE(true == ret);
+  REQUIRE(err.empty());
+}
\ No newline at end of file
diff --git a/tiny_gltf.h b/tiny_gltf.h
index 4a8d073..e0f99cc 100644
--- a/tiny_gltf.h
+++ b/tiny_gltf.h
@@ -5660,7 +5660,7 @@
   skin->skeleton = skeleton;
 
   int invBind = -1;
-  ParseIntegerProperty(&invBind, err, o, "inverseBindMatrices", true, "Skin");
+  ParseIntegerProperty(&invBind, err, o, "inverseBindMatrices", false, "Skin");
   skin->inverseBindMatrices = invBind;
 
   ParseExtrasAndExtensions(skin, err, o,