GLTFExport has stopped exporting metadata - probably a regression

I know the issue - Add meshes metadata on export as GLB · Issue #6473 · BabylonJS/Babylon.js · GitHub
I also know the discussion - Add metadata on GLB export

But I have taken the same example and I am downloading as GLTF. But in the resulting GLTF there is no metadata. There is no “something” : “more”

https://playground.babylonjs.com/#6I8V36#2

Here is also the original playground - https://playground.babylonjs.com/#6I8V36#1

The something more is printed only once and not a second time. So it is not in the read metadata.

Why is the metadata not available in the resulting Gltf.

Update1:

I think the metadata should be set as

box.metadata = {"gltf":{"extras": {"something": "special"}}};

for the metadata to be available in the final gltf. If it is just

box.metadata = {"something": "special"}};

it will not be available.

Further looking at it with our examples.

pinging @Drigax as this is high priority if this is a regression

I think I got it working for my case.

There is now a new issue and I am not sure if it is a bug.

I have a gltf that when imported produces the following structure in the inspector

Screenshot from 2020-01-28 20-33-04

Without modification the same gltf is exported as glb and imported again using SceneLoader.Load.

The inspector than shows one more root element

Screenshot from 2020-01-28 20-33-13

Why is this happening

Here is the export code

      BABYLON.GLTF2Export.GLBAsync(this._babylonScene, "scene.glb").then((response) => {
        response.downloadFiles();
      });

Here is the import

      let loader = BABYLON.SceneLoader;
      loader.ShowLoadingScreen = false;

      loader.Load(baseUrl, file, engine, (scene) => {
          ...
      });

Yes. I have tried importing, exporting, than importing again, then exporting, then importing.

Each time a new root node is added

Screenshot from 2020-01-28 20-40-00

Probably this issue has something to do with it

It was first merged, then reverted?

The to extra lights might be coming from

    const light1 = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(1, 1, 0), this._scene);
    const light2 = new BABYLON.PointLight("light2", new BABYLON.Vector3(0, 1, -1), this._scene);

Where I add lights to the scene.

I should probably remove them since they were not in the document

Yes it was merged and reverted because the fix was not right

@drigax and @thomlucc can give you more details on when we expect it to be fixed

To find the rootNode, is there might be many “root” nodes one inside the other I am doing

const rootNodeFilter = (node)=> { return node.name== "__root__" }
    let rootNode = scene.rootNodes.filter(rootNodeFilter)[0]
    let newRoot;
    while(newRoot = rootNode.getChildren().filter(rootNodeFilter)[0]) {
      rootNode = newRoot;
    }

@Deltakosh

I have some native side work, and demo related work I wanted to get out this week, but I can focus on exporter fixes next week

1 Like

Thanks. Colleagues in the office reminded me to ask you “Please, don’t go to any conferences with this coronavirus. You are too important for us” :slight_smile:

4 Likes

Definitely my top post of the day :slight_smile:

@kmitov,

I’m seeing the same pattern here, only metadata structured as : {gltf: { extras: {<metadata>} } } gets exported in the resulting gltf.

@Deltakosh, @bghgary Is this wrong behavior? I assume we may want to instead serialize all metadata on a given node without requiring additional formatting?

Looks like this is the culprit, I’m not sure if this was intended or not… @bghgary, what do you suggest?

My opinion originally is that metadata shouldn’t be exported by default, but now that we are loading metadata by default, maybe we should change this behavior. I should probably also change the loader to not add the pointers metadata by default if we do this.

The metadataSelector option allows users to choose what they want to export. The original commit is here and a follow up commit here. I made a comment to @deltakosh when the first commit was made which then changed the behavior to the current code, but this is not a regression. These two commits were made right after each other.