mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
102.58k stars 35.36k forks source link

GLTF DRACO loader - extras not added to userData #23961

Closed PlopTheReal closed 2 years ago

PlopTheReal commented 2 years ago

When loading a DRACO compressed GLTF it seems the extras field doesn't populates the userData. I've tried without DRACO compression and it works ok. For a given mesh within the GLTF (DRACO compressed):

...
{
    "mesh": 8,
    "translation": [..],
    "name": "Objet057",
    "extras": {
      "material": {
        "type": "Frêne",
        "density": 0.68
      },
      "date": 1963
    },
    "rotation": [...],
    "scale": [..]
},
...

Resulting userData after loading the GLTF :

userData: {
     name: "Objet057"
}

GLTF made with babylon.js glTF exporter for 3dsmax 2022 v20220210.4

Platform:

EDIT: added two GLTF with extras Cube_no_draco.zip Cube_draco.zip

Mugen87 commented 2 years ago

I can't reproduce the issue. I've drag'n'dropped the asset into the three.js editor and the 'extras' data are applied to userData. E.g. the values from the node Cube01 in the glTF are:

"extras": {
    "material": {
        "type": "Wood",
        "density": 0.6
    },
    "date": 2022
},

And later in Object3D.userData it looks like so:

{
  "name": "Cube01",
  "material": {
    "type": "Wood",
    "density": 0.6
  },
  "date": 2022
}
PlopTheReal commented 2 years ago

Thanks for the quick reply. Also I didn't knew about that editor, pretty cool for testing thanks! Yes I can see it also there. I'll continue investigating what could be wrong on my end.

PlopTheReal commented 2 years ago

Ok I can see them now... forgive me I've certainly messed up in some ways with the models... At least I've heard about this player, thanks!