microsoft / glTF-SDK

glTF-SDK is a C++ Software Development Kit for glTF (GL Transmission Format -https://github.com/KhronosGroup/glTF).
MIT License
535 stars 99 forks source link

Deserialize raises GLTFException: Unknown Schema uri glTFProperty.schema.jso #72

Open SpaceIm opened 3 years ago

SpaceIm commented 3 years ago

I'm trying to package gltf-SDK 1.9.5.0 for conan (with minimal modifications like std::powf replaced by std::pow, unvendoring of rapidjson, fix of installation folders).

I've written a simple cpp file, based on the tests in SerializeTests.cpp to see that produced package makes sense:

#include <GLTFSDK/GLTF.h>
#include <GLTFSDK/Deserialize.h>
#include <GLTFSDK/Document.h>
#include <GLTFSDK/Math.h>
#include <GLTFSDK/Serialize.h>

#include <utility>

int main() {
  Microsoft::glTF::Document originalDoc;

  Microsoft::glTF::Scene sc;
  sc.id = "0";
  sc.nodes = { "0" };
  originalDoc.SetDefaultScene(std::move(sc));

  Microsoft::glTF::Node matrixNode;
  matrixNode.id = "0";
  matrixNode.name = "matrixNode";
  matrixNode.matrix = Microsoft::glTF::Matrix4::IDENTITY;
  originalDoc.nodes.Append(std::move(matrixNode));

  auto outputString = Microsoft::glTF::Serialize(originalDoc);
  auto twoPassDoc = Microsoft::glTF::Deserialize(outputString);
  return 0;
}

GLTFException: Unknown Schema uri glTFProperty.schema.jso (without the "n") is raided in Microsoft::glTF::Deserialize (tested on Windows with gcc 7 and 8, Visual Studio 2015/2017/2019, and on Macos with apple-clang 12).

bghgary commented 3 years ago

I'm not sure if there is a question here. Looks like there is an issue with the schema uri. Have you debugged the code?

orzel7 commented 2 years ago

I have the same issue while trying to run GLTFSDK.Samples/Deserialize example. gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)

orzel7 commented 2 years ago

I can run the example by disabling schema validation: Deserialize(manifest, DeserializeFlags::None, SchemaFlags::DisableSchemaRoot);