2

I'm developing a program that outputs object files that can be imported into Blender. The output consists of a WaveFront object file (.obj) with a Material Library File (.mtl) that go side-by-side.

The importing works fine and the textures all show up correctly mapped, however I would like to apply a transformation to the textures so that the scale values don't need to be manually tweaked inside Blender after the import.

Following the specifications for the MTL format (http://paulbourke.net/dataformats/mtl/) the scaling would be transformed by using the -s argument, like below.

newmtl AM_BBAY_WINDOWS_PIRATE
illum 2
Kd 1.000000 1.000000 1.000000
Ka 0.250000 0.250000 0.250000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ns 0.000000
map_Kd -s 1.0 -1.0 1.0 AM_BBAY_WINDOWS_PIRATE.png

Expected behavior: Blender should use AM_BBAY_WINDOWS_PIRATE.png as the texture file and set the material size to 1.0, -1.0, 1.0.

Actual behavior: The size is kept as default and the file is set to -s 1.0 -1.0 1.0 AM_BBAY_WINDOWS_PIRATE.png which obviously is invalid and therefore does not work.

Why is Blender completely ignoring the arguments for texture maps in material libraries for imported objects? Is there another method/syntax for Blender that I've missed?

Kruithne
  • 21
  • 1
  • The .obj importer is written Python, you could have a look at ../scripts/addons/io_scene_obj/import_obj.py. If it's part of the spec, and your file is valid, perhaps a bug report is appropriate. – zeffii Oct 12 '15 at 07:11
  • @zeffii Looking through the file you pointed to, it doesn't seem the MTL importing has any support for texture map arguments at all. Where would one report this? – Kruithne Oct 12 '15 at 18:08
  • generally follow the advice on this question: http://blender.stackexchange.com/questions/1377/best-place-to-put-bug-reports – zeffii Oct 12 '15 at 18:20
  • 1
    @zeffii Thanks, made a bug report here: https://developer.blender.org/T46459 – Kruithne Oct 12 '15 at 21:06
  • Thanks for doing the bug report, it seems not many people have needed that feature of the .mtl spec. Generally we close this kind of question because it is a bug report, and there is no obvious solution without modifying the importer code. Feel free to experiment with patching the importer, it's more likely to be fixed sooner by someone with a vested interest. – zeffii Oct 13 '15 at 07:46
  • 1
    @zeffii Talk about efficient, they patched it this morning. :) https://developer.blender.org/rBAecdc7c03ec14e6ed70dea808b61049017f46ad97 – Kruithne Oct 13 '15 at 16:44

0 Answers0