How do you recover an object by name from a 3D model

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
gabba
Posts: 8
Joined: Wed Jan 21, 2009 7:56 am

How do you recover an object by name from a 3D model

Post by gabba »

In all modelling programs (I'm currently using 3dsMAX), you can give names to the objects you are creating. My question is, is there a way to recover the name and position (and mesh data, and ...) of those objects once they have been exported to some 3D format (such as .b3d or .X or .3ds) and loaded into Irrlicht?

Irrlicht seems to represent each sub-object of a Mesh with a separate MeshBuffer. I've looked through the API, and apparently meshbuffers don't have names, or at least there is no way to search or recover those names. Am I mistaken?

If not at the meshbuffer level, maybe there's a way to look at the data as it is loaded from the 3D file, and associate a name with each meshbuffer at that moment. Does anyone have insight into the .b3d (or maybe the .X) mesh loader? If there are some callback functions that can be used to get at the data I'm seeking, or if you could show me the right direction for adding one, I'd be very grateful. :)

I realize I'm assuming that 3D models keep the names from 3dsMAX, that may not even be the case for all of them. Do we know which of the Irrlicht-supported formats do remember the object names?

I need this object detection for several things, but especially for adding tiny markers in 3dsMAX that indicate where some dynamically created objects should appear, and stuff like that. I guess I could use some kind of level editor for that, but markers have served me well in the past, and I'd like to reuse the technique with Irrlicht, instead of introducing yet another tool (and its bugs) into my workflow.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Nope... I think some of the model loaders in Irrlicht do preserve the groupings by putting them into seperate mesh buffers but they're not named so you won't know which is which...

In general a mesh buffer is just a collection of arbitrary vertices which share the same material... That's pretty much all you can rely on I think, so not much use for what you're trying to do.
Image Image Image
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

but it wont ever work, because when you export for example to b3d, all of the meshbuffers will be called as "ROOT"
in .x it changes names too i think.. (it sure changes material names, but dunno the meshbuffers)
Image
Image
gabba
Posts: 8
Joined: Wed Jan 21, 2009 7:56 am

Post by gabba »

I see. I guess I was spoiled with a 3dsMAX exporter that kept all object names - unfortunately that format was more educational than anything and was both slow-loading and had few other features.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

the scene loaders do support this. Each node has a name, you can recover nodes by name, and you can also edit the scene more easily this way. Try .irr or Collada.
gabba
Posts: 8
Joined: Wed Jan 21, 2009 7:56 am

Post by gabba »

hybrid wrote:the scene loaders do support this. Each node has a name, you can recover nodes by name, and you can also edit the scene more easily this way. Try .irr or Collada.
Thanks Hybrid. I'll probable use irrEdit to assemble the scene after making the individual models in 3dsMAX.

However I must point out that in a past project recovering object names from the MAX scene was very handy: to avoid having to do convex decomposition with complex 3d models, I placed simple collision objects (cylinders, planes, spheres) to form a shell around the object. It's easier to do with MAX's precise controls and clone options than with more basic editors... Then when loading the mesh, I used the collision objects (their name started with "collision") only as physics data, while I displayed the rest in the 3D engine.

I'm surprised that it's actually impossible to do with popular 3D formats: I thought it was a pretty clever idea, that worked well and was flexible.
Post Reply