Hi, I am trying to retain my object names from 3DS over to JME so I can more easily reference and manipulate parts of a mesh through code. However it seems the OBJ importer renames all the individual geometries as it comes across them, ref. this line from OBJLoader (line 395):
Geometry geom = new Geometry(objName + "-geom-" + (geomIndex++), mesh);
As a simple example, say I have a file named MyModel with two cylinders, Cylinder1 and Cylinder2. I want to write something like
Of course, with Cylinder1 and Cylinder2 having been renamed MyModel-geom-01 and MyModel-geom-02 respectively this does not work.
My model has well over 50 individual geometries and it’s not the only one. I don’t want to have to manually reference and manipulate MyModel-geom-01 through MyModel-geom-57 before I find the geometry I want to reference.
The .OBJ file itself retains object names by starting every new geometry with the line
g Cylinder1
It’s a bit weird that the filename is substituted for the objName instead of the actual object name - I’d think the “correct” result here would be to end up with Cylinder1-geom-01 and Cylinder2-geom-01 instead of MyModel-geom-01 and MyModel-geom-02?
Yes, it is known behaviour of ObjLoader. It renames the groups because it tries to merge everything sharing common material, regardless of how many separate object groups were in original obj file.
I had to modify it to play around with Sponza geometry. You can get fixed version of ObjLoader at
This is breaking change - certain object files are going to work a slower with it applied. It could be possibly introduced as an option, but I’m not sure how you can parametrize loaders, given how asset manager instantiates them.