3
$\begingroup$

I imported an .OBJ that has large amount of image textures onto my desktop but I don't want to keep them there as I want to place the textures into the another folder.

Do I have to manually reassign every texture or is there a better way to change the location of a large amount of texture images?

$\endgroup$
  • 1
    $\begingroup$ Normally, in Wavefront, the texture paths are relative to the main obj file. If you move the obj file along all used files, there should be no problem. Is this your case? $\endgroup$ – piegames Nov 10 '16 at 16:37
  • $\begingroup$ Thing is I want to keep textures in their own folder and the prop in another instead of all in one. $\endgroup$ – Eric Huelin Nov 10 '16 at 18:16
  • $\begingroup$ Use Find Missing Files after moving folder somewhere and point Blender to that somewhere, blender.stackexchange.com/a/5372/1245 $\endgroup$ – Mr Zak Nov 10 '16 at 21:20
1
$\begingroup$

If you don't have many Wavefront materials and you are copying all images from the same location to another location (also same for all pictures), open the .mtl file and replace all texture paths manually. You can try to speed this process up by using well-placed replace commands.

Otherwise, you'll need to write a script that reads all the path and edits them manually.

  • Read the file line-wise
  • Split each line by space. The first sub string will be the command
  • on "map_kd" and other map commands, read the rest of the string a path.
  • Edit the path. In Java you move a path path from path from to path to with the following code: to.resolve(from.toAbsolutePath().relativize(path));
  • Overwrite the line

You can also import the file as is if the program you used for importing supports moving source files.

And don't forget:

Always back up your files!

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.