Running save_as_mainfile breaks relative texture paths
Closed, ResolvedPublic

Description

Relates to: T32734

When running save_as_mainfile, the relative texture paths for Cycles textures get changed to a invalid paths.

How to recreate:
1. Download the attached sample.tar.gz, unpack and open the project/shot/sample.blend file.
2. Hit F12 to render, you should get a plane with a picture on it.
3. Run the following in the python console (replace /tmp path with something else if you're on Windows)
bpy.ops.wm.save_as_mainfile(filepath="/tmp/foo.blend", copy=True, relative_remap=True)
4. Hit F12 to re-render, and you get a purple plane where there used to be a picture.

The /tmp/foo.blend file that is saved out has working texture paths, but not the original one. In the original file the texture path has gone from:

//../txtr/kermit.jpg
to
//../home/ragtag/project/txtr/kermit.jpg

Alternately, if you set relative_remap to False, the reverse is true. Your original file remains intact, but the texture paths in the copy file (/tmp/foo.blend) are broken.

-

Tested using both official release blender-2.64a-linux-glibc27-x86_64 and blender-2.64-r51699-linux-glibc27-x86_64 on Ubuntu 12.04 64-bit using AMD Radeon HD 5800 graphix card.

Bug #32734 seems like it might possibly be related.

Note that this only happens with Cycles textures, not Blender Internal Render textures.

Details

Type
Bug