Severe problem with multiple instances of a library (save and reload)
Closed, ResolvedPublic

Description

System Information
Linux Mint 18 Sarah (Ubuntu 16.04.3 LTS)

Blender Version
Broken: 2.79 5bd8ac9abfa

Short description of error
When renaming a library filepath to match another already linked, blender mixed libraries.
Example : lib_v01.blend, other_lib.blend and lib_v02.blend are linked in a blendfile (the link order is important).
When I rename lib_v01.blend to lib_v02.blend, save and reopen, Blender "merge" the multiple instances of lib_v02.blend.
But one of the Suzanne is now "attached" to other_lib.blend (instead of lib_v02.blend), and obvioulsy Blender doesn't find it.

Exact steps for others to reproduce the error

  1. Create a new blender file.
  2. Link the "Suzanne" group from lib_v01.blend
  3. Link the "Sphere" group from other_lib.blend
  4. Link the "Suzanne" group from lib_v02.blend
  5. Save the file.
  6. In the outliner, rename lib_v01.blend to lib_v02.blend
  7. Save and reopen the blendfile

Details

Type
Bug

Sorry. But I don't understand what behaviour you are expecting.

You linked one suzanne from lib_v01, one suzanne from lib_v02 and one sphere from other_lib.

You renamed lib_v01 and only lib_v01. You did not rename other_lib. You did not do anything to sphere.
So when .blend is saved and reloaded, why do you expect link to other_lib to be removed ? Sphere is still attached to it.

Blender does not go further away than changes made by user.

Manuel Rais (g-lul) added a comment.EditedThu, Feb 1, 7:22 PM

Hi,
I'm not expecting other_lib.blend to be removed but the second Suzanne (from lib_v01.blend) to be linked to lib_v02.blend. And this is not happening. After save reopen, for blender, the second Suzanne is linked to other_lib.blend (but Suzanne has never be part of it).
Did you try the steps to reproduce this bug ?

ronan ducluzeau (zeauro) triaged this task as Confirmed priority.Thu, Feb 1, 11:32 PM

Sorry. I did not follow correct order.

So, instances are removed on name basis but links are remapped according to their creation order.

Hi,
The issue is here since blender 2.76a I think.
2.75a does not have it.

Well, at least library relocation (rightclick on a lib in outliner, Relocate) does work correctly it seems.

Will see whether we can fix the issue with mere lib renaming, but I doubt this was ever supported, setting same paths for two different lib objects is really, really pulling Blender to its limits…

Ok Bastien,
Thanks :)

Can I call the relocate operator from a python file ? I can't see any parameters with it. Or maybe bpy.ops.wm.lib_relocate can do the job ?

Can I call the relocate operator from a python file ? I can't see any parameters with it. Or maybe bpy.ops.wm.lib_relocate can do the job ?

Yes, outside of outliner you should use bpy.ops.wm.lib_relocate directly (outliner version is a mere wrapper around that one anyway).

Ok found the core of the issue.

@Sergey Sharybin (sergey) I would not be surprised if this was also the cause of the mysterious problems with disappearing libs at the studio.

Have a partial fix, but now we get multiple copies of same linked datablock (like, two copies of Suzanne group from lib_v02 in this report's demo), which is not a good thing either. Still investigating how to fix that second half of the issue…

Manuel Rais (g-lul) added a comment.EditedThu, Feb 15, 2:31 PM

Hi,
I've tried to use the bpy.ops.wm.lib_relocate but I've got an issue with proxy relinking (I know you're in love with proxies Bastien :) ).
I've also tried with the bpy.ops.outliner.relocate in the outliner through the interface and the same error appears.
Result : the armature proxy become an empty.

Pose copy error, pose to:0x7f07ec228c28 from:(nil)
Proxy copy error, lib Object: Armature proxy Object: cube_proxy
Error: Not freed memory blocks: 1, total unfreed memory 0.001144 M

Is this a known bug ? If not, I'll try to do a bug report. I have a simple case to reproduce it.

Yep, would appreciate a report about this, relocate *should* work (but indeed most likely not all corner cases with ugly proxies are ironed out yet :( ).

@Bastien Montagne (mont29) Apparently, the "relocate bug" is not in the 2.79 release but in the 2.78a.
Should I report it nonetheless ?

@Manuel Rais (g-lul) Nope, in fact if a bug does not affect current master, there’s no point in reporting it, since it has already (presumably) been solved. :)