Question about assimp and mesh names

Hi guys… In a project we are developing, we need to load a OBJ file that has multiple meshes, and we need to apply different processing based on mesh names.

When we load the file trough ofxAssimpLoader everything works great, except that the meshes names are reported as an empty string, so I am unable to identify the different meshes on load.

I also tried ofxObjLoader, that reports the mesh names properly, but I can’t figure out how to load textures and materials, seems to return only the meshes. My objects can have different textures, so is not an option to load them separately.

Any suggestions of how to approach to this problem?

ciao drakko
obj only exports geometry datas (vertices, normals, texture co-ords, and optionally material data in an second file)
I think that for your porpouse collada is a better format

@nkint

Weird, in the OBJviewer that I use or even in cinema 4d, I got back the meshes with name. Also, using ofxObjLoader, I can get the name of the mesh while loading, that addon creates a response in the format

std::map<string meshName, ofMesh mesh>

But well, if its no possible with assimp I will try a different approach; it may be a non standard wa to write an obj file.

mhmm
try eventually to open the obj file, it is a plain text format really easy to read/parse
in any case collada has much more information (if I remember well it can exports also camera parameters and lights)…
let me know what is the best way in the end!

Reading the obj file, this is one simple object definition:

#
# object LIGHT093
#

v  2608.1807 0.1002 -29.9860
v  2608.1807 0.1002 -9.9949
v  2714.1328 0.1002 -9.9950
v  2714.1318 0.1002 -29.9860
# 4 vertices

vn -0.0000 1.0000 -0.0000
# 1 vertex normals

g LIGHT093
usemtl wire_028089177
s 8
f 365//116 366//116 367//116 
f 367//116 368//116 365//116 
# 2 faces

So I will have to figure out how to get the group name back :wink: