Running save_as_mainfile breaks relative texture paths from textures linked from a library #41328

Closed
opened 2014-08-05 18:06:33 +02:00 by Jonas Eschenburg · 6 comments

Relates to #33108, but with a twist: save_as_mainfile messes up texture paths from textures linked from a library blend file.

How to recreate:

  1. Download the attached sample.tar.gz, unpack and open the project/user_in_parentdir.blend file. (Alternatively, open project/shot/subdir_user_in_subdir.blend for the same effect)
  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/copy.blend", copy=True)`
  1. Hit F12 to re-render, and you get a purple plane where there used to be a picture.

This can be analyzed in Python:

>>> for img in D.images: print(img.filepath)

... 

//../txtr/kermit.jpg

>>> bpy.ops.wm.save_as_mainfile(filepath="/tmp/copy.blend", copy=True)

{'FINISHED'}

>>> for img in D.images: print(img.filepath)

... 

//txtr/kermit.jpg

As copy=True was used, it looks like an error that any path has changed at all, especially the path of a file referenced by a library.

Relates to #33108, but with a twist: save_as_mainfile messes up texture paths from textures linked from a library blend file. How to recreate: 1. Download the attached sample.tar.gz, unpack and open the `project/user_in_parentdir.blend` file. (Alternatively, open `project/shot/subdir_user_in_subdir.blend` for the same effect) 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/copy.blend", copy=True)` ``` 4. Hit F12 to re-render, and you get a purple plane where there used to be a picture. This can be analyzed in Python: ``` >>> for img in D.images: print(img.filepath) ... //../txtr/kermit.jpg >>> bpy.ops.wm.save_as_mainfile(filepath="/tmp/copy.blend", copy=True) {'FINISHED'} >>> for img in D.images: print(img.filepath) ... //txtr/kermit.jpg ``` As `copy=True` was used, it looks like an error that any path has changed at all, especially the path of a file referenced by a library.

Changed status to: 'Open'

Changed status to: 'Open'

Added subscriber: @JonasEschenburg

Added subscriber: @JonasEschenburg

sample.tar.gz Here is the promised sample file

[sample.tar.gz](https://archive.blender.org/developer/F101537/sample.tar.gz) Here is the promised sample file
Campbell Barton self-assigned this 2014-08-05 18:31:54 +02:00

This issue was referenced by blender/blender@9855edcacf

This issue was referenced by blender/blender@9855edcacf998a01a057a2875a7732489ac858c6

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Closed by commit blender/blender@9855edcacf.

Closed by commit blender/blender@9855edcacf.
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#41328
No description provided.