Problem on Exporting with some FormData

Hello Babylon.js community,

I’m working on a project that allows users to take measurements of 3D models within a scene (e.g., distances between faces). I’m seeking advice on the best approach to export and store this measurement data.

Currently, I’m storing the data in node metadata, which works, but I have some concerns:

  1. With multiple nodes representing different meshes, storing measurement data on specific nodes feels potentially confusing and disorganized.
  2. I’m wondering if there’s a more structured way to handle this data that would make it easier to manage and retrieve.

I’m considering creating a custom GLTF extension to store this measurement data. My questions are:

  1. Is creating a custom GLTF extension an appropriate solution for this use case?
  2. Are there any existing GLTF extensions that might serve this purpose?
  3. If creating a custom extension is the way to go, what would be the best practices for structuring and implementing it?
  4. Are there any potential pitfalls or considerations I should be aware of when creating and using a custom GLTF extension?

Any insights, suggestions, or best practices would be greatly appreciated. Thank you in advance for your help!

Hello and welcome :slight_smile:

I would “the perfect way to go” doesn’t exist, since it’s proper to any dev to choose the way he prefers to save data, could be a JSON file sent to server, some entries sent to a database, etc, etc…

If your goal is to export the whole scene as “1 file only” including geometry and data, then I would say saving a babylon file, with some metadata on some nodes is a good way.

Now, about not being confused, it depends on the hierarchical structure of your scene. For example, another way to go would be to create a “save” node (“one node to rule them all”) and save the full data of your scene in its metadata, as a unique JSON ? etc…

++
Tricotou

Thanks for the reply. By your answer, would I understand that as for Babylonjs, it only support to store the information in the metadata of the nodes? I have researched a lot about custom GLTF extension but few people mentioned about that approach.

I’ve never used but I think that GLTF export already supports metadata, in the “extras” field. (examples of posts here and here)

Sure! I have already tested and found the results all good. Thank you for your suggestions!