Author Topic: how to obtain the object with the name described with "newmtl xxx" in mtl file?  (Read 2409 times)

Offline tomoroho

  • byte
  • *
  • Posts: 16
    • View Profile
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!
« Last Edit: September 06, 2012, 07:41:04 am by tomoroho »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
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?

Offline tomoroho

  • byte
  • *
  • Posts: 16
    • View Profile
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.
« Last Edit: September 06, 2012, 02:05:37 pm by tomoroho »