3DSMax export to glTF: object properties to extras

Hi all,

we want to set custom JSON attached to an object and get it in the “extras” property of a node or mesh in the exported glTF.

To do so, I tried to set custom extra information attached to object in 3DSMax in the (right click) “object properties” -> “user defined” UI. This feature allow to set free text, and there is already a line filled by babylonJS setting a guid.

I added the line following line:
“extras”: { “my_prop”:“the_value”, “another_prop”: true}
but it is not exported in glTF.

Is there a way to do this, or it may be a feature request?

Thanks in advance.

It is something that can be done with a PR if you are ok to try :slight_smile:

Thanks! :slight_smile:
I’m not an expert in git, but I managed to do something, with some duplicated code:

extras = { "my_prop":"the_value", "another_prop": true, "a_sub_object": {"an_int":14, "an_array":[12.8, {"obj_in_array": true}]}}

is exported as:

  "extras": {
    "my_prop": "the_value",
    "another_prop": true,
    "a_sub_object": {
      "an_int": 14,
      "an_array": [
          "obj_in_array": true

Can I send the modified BabylonExporter.Mesh.cs to someone or here to have a look?

well gihub PR will be the best as it will expose the diff

ok. I need to clean the code.

And I just realize that:

babylonInstanceMesh.metadata = ExportExtraAttributes(meshNode, babylonScene);

is supposed to setup extras, but it is called only on InstanceMesh, not on MasterMesh. I don’t understand how it works since it calls max scritps :confused:

My bad, ExportExtraAttributes is called on master and instance.

I can only test on 3DSMax 2018. Do I #ifdef my code for 2018 only?

nope, if it compiles it should be fine as we check against all sdk

ok, done.

I’m also interested to store data within “object properties” → “user defined” UI but it doesn’t seems it is working. Any idea?


cc @Guillaume_Pelletier

let me have a look.