how to obtain the object with the name described with "newmtl xxx" in mtl file?

Started by tomoroho, September 05, 2012, 05:56:43 AM

Previous topic - Next topic

tomoroho

with class Loader's loadOBJ method , i can get the obj array in the obj file.
how to obtain the object with the name described with "newmtl xxx" in mtl file?
the getName method in Object3D class provide the name in obj file
thx very much!

EgonOlsen

The name in the mtl-file is the name of the material that is referenced by the obj file. There can be multiple references from one obj to different materials, so there's no way to say that an obj is named after a material. What do you want that for?

tomoroho

Quote from: EgonOlsen on September 06, 2012, 09:56:33 AM
The name in the mtl-file is the name of the material that is referenced by the obj file. There can be multiple references from one obj to different materials, so there's no way to say that an obj is named after a material. What do you want that for?

thanks. Every object in my obj file references one material defined in mtl file with "usemtl xxx". And the name of the object(such as object1,object2,which is hard to recognize) is different from the one in mtl file(such as slide,which is easy to recognized).
I just wanted to obtain the object with the name of the material. Now i find it's stupid.   I change the name of object one by one manually ,keeping it the same as the one in mtl file.
And problem solved.
Thank you for your help.