[SOLVED] Getting the names of objects (not meshes) into jME

I’m using Blender to make my game world and then use gltf to export my world for usage inside jME. In Blender all my objects have names but it seems that I can’t find a way to actually get those names in jME. The mesh names are fine. Those are properly loaded but not the object names.

For now the only solution I found is to manually use custom data in Blender and then use an ExtrasLoader implementation to fetch those and assign them to my game objects. But that requires me to set custom data in Blender which is annoying. It would be much easier if I could use the blender object name automatically.

Is there a way to make this easier? Thanks

2 Likes

Hi,

Afaik mesh has no name in JME, so the plugin assign mesh names to Geometry. Object in blender has no equivalent in JME/Gltf (?) so it ignores the object name.

Edit:
By the way, this is a restriction on the Blender Gltf plugin so we probably can not do much about it in JME.

1 Like

Actually the object names ARE in the gltf. Here is an example:

    {
        "extras" : {
            "logic" : "doorInside"
        },
        "mesh" : 18,
        "name" : "D10_sto",
        "rotation" : [
            0,
            0.7071067094802856,
            0,
            -0.7071068286895752
        ],
        "translation" : [
            -18.39000129699707,
            0,
            38.20000076293945
        ]
    },

The D10_sto is the name I’d like to get in jME. It’s really unfortunate that jME doesn’t allow objects to have names because that’s something that’s so useful for game objects. But anyway, since the data is in the gltf it should be able to get it out but I haven’t been able to figure out how

1 Like

Oh actually. I found the name. In the ExtrasLoader I can go to the parent (which is a node) and in that parent the desired object name can be found. It’s just not used by the loader but I can extract it from there and store it in my own datastructure. So problem solved

3 Likes

Glad you solved it. :slightly_smiling_face:

Marked the thread as solved.

2 Likes