Blender Git Loki
Git Commits -> Revision 85c9aef
Revision 85c9aef by Bastien Montagne (master) July 1, 2016, 16:29 (GMT) |
"Fix" crash when deleting linked object which has indirect usages. This is in fact very hairy situation here... Objects are only refcounted by scenes, any other usage is 'free', which means once all object instanciations are gone Blender considers it can delete it. There is a trap here though: indirect usages. Typically, we should never modify linked data (because it is essencially useless, changes would be ignored and ost on next reload or even undo/redo). This means indirect usages are not affected by default 'safe' remapping/unlinking. For unlinking preceeding deletion however, this is not acceptable - we are likely to end with a zero-user ID (aka deletable one) which is still actually used by other linked data. Solution choosen here is double: I) From 'user-space' (i.e. outliner, operators...), we check for cases where deleting datablocks should not be allowed (indirect data or indirectly used data), and abort (with report) if needed. II) From 'lower' level (BKE_library_remap and RNA), we also unlink from linked data, which makes actual deletion possible and safe. Note that with previous behavior (2.77 one), linked object would be deleted, including from linked data - but then, once file is saved and reloaded, indirect usage would link back the deleted object, without any instanciation in scene, which made it somehow virtual and unreachable... With new behavior, this is no more possible, but on the other hand it means that in situations of dependency cycles (two linked objects using each other), linked objects become impossible to delete (from user space). Not sure what's best here, behavior with those corner cases of library linking is very poorly defined... :( |
Commit Details:
Full Hash: 85c9aefe0fef6d9f862d34ca66beb0bb4c2bcf6c
Parent Commit: ad717fe
Lines Changed: +147, -19
9 Modified Paths:
/source/blender/blenkernel/BKE_library_query.h (+3, -1) (Diff)
/source/blender/blenkernel/BKE_library_remap.h (+3, -1) (Diff)
/source/blender/blenkernel/intern/library_query.c (+50, -0) (Diff)
/source/blender/blenkernel/intern/library_remap.c (+14, -5) (Diff)
/source/blender/editors/object/object_add.c (+28, -1) (Diff)
/source/blender/editors/object/object_group.c (+1, -1) (Diff)
/source/blender/editors/space_outliner/outliner_edit.c (+17, -4) (Diff)
/source/blender/editors/space_outliner/outliner_tools.c (+30, -5) (Diff)
/source/blender/render/intern/source/pipeline.c (+1, -1) (Diff)
/source/blender/blenkernel/BKE_library_remap.h (+3, -1) (Diff)
/source/blender/blenkernel/intern/library_query.c (+50, -0) (Diff)
/source/blender/blenkernel/intern/library_remap.c (+14, -5) (Diff)
/source/blender/editors/object/object_add.c (+28, -1) (Diff)
/source/blender/editors/object/object_group.c (+1, -1) (Diff)
/source/blender/editors/space_outliner/outliner_edit.c (+17, -4) (Diff)
/source/blender/editors/space_outliner/outliner_tools.c (+30, -5) (Diff)
/source/blender/render/intern/source/pipeline.c (+1, -1) (Diff)