[Bf-committers] Bug with linked library objects?

Ken Hughes khughes at pacific.edu
Wed Apr 18 17:27:55 CEST 2007


While working on the Python bpy.libraries module yesterday I was 
surprised by something I saw:

(1) add a linked object, such as a mesh with a material, from a library
(2) delete the object
(3) add the object again

When the object is relinked, the mesh no longer has materials.

At first I was sure this was a bug; with Shift-F4 I could see the 
originally linked material but it had no users (and of course, since the 
object is linked you can't edit it and add the material back to its 
mesh).  Then I realized this was happening because the user counts of 
the mesh and material were decremented to zero and "freed" on deletion 
of the object, and then the object was relinked the library system found 
the previous mesh and reused it, now without a material.  It's the same 
behavior as deleting a non-library object in the UI, then creating a new 
object and reusing its data.

Even though I understand now (I think) what happens, I still think this 
is unexpected behavior.  If you're linking something from a library, you 
don't expect the system to be changing the linked object.  I know that 
save/load will "fix" this, but fixing it implies to me it's broken.

Ken


More information about the Bf-committers mailing list