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.