[Bf-blender-cvs] [875c131] master: Fix broken proxy object deletion.

Bastien Montagne noreply at git.blender.org
Thu Jul 21 23:07:32 CEST 2016


Commit: 875c1313b12db97ad7dc00868566d4652be3316a
Author: Bastien Montagne
Date:   Thu Jul 21 23:02:37 2016 +0200
Branches: master
https://developer.blender.org/rB875c1313b12db97ad7dc00868566d4652be3316a

Fix broken proxy object deletion.

Check to ensure we do not delete last instancing of an indirectly used object (forbidden
because it creates 'ghost' objects user have no real way to re-instance) was defeated by
the backward pointer 'proxy_from', which generated a 'false' indirect usage of (local)
proxy object itself (the one we are trying to delete).

Fixed by actually considering that ID usage as local if proxy object itself is local
(because that pointer actually does not 'pertain' to the object holding it, but to its proxy).

Yeah, it's... complicated, twisted and ugly - it's proxy.

===================================================================

M	source/blender/blenkernel/intern/library_query.c

===================================================================

diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c
index 0413211..1ded6f6 100644
--- a/source/blender/blenkernel/intern/library_query.c
+++ b/source/blender/blenkernel/intern/library_query.c
@@ -442,7 +442,16 @@ void BKE_library_foreach_ID_link(ID *id, LibraryIDLinkCallback callback, void *u
 				/* object->proxy is refcounted, but not object->proxy_group... *sigh* */
 				CALLBACK_INVOKE(object->proxy, IDWALK_USER);
 				CALLBACK_INVOKE(object->proxy_group, IDWALK_NOP);
+
+				/* Special case!
+				 * Since this field is set/owned by 'user' of this ID (and not ID itself), it is only indirect usage
+				 * if proxy object is linked... Twisted. */
+				if (object->proxy_from) {
+					data.cd_flag = ID_IS_LINKED_DATABLOCK(object->proxy_from) ? IDWALK_INDIRECT_USAGE : 0;
+				}
 				CALLBACK_INVOKE(object->proxy_from, IDWALK_NOP);
+				data.cd_flag = data_cd_flag;
+
 				CALLBACK_INVOKE(object->poselib, IDWALK_USER);
 
 				data.cd_flag |= proxy_cd_flag;




More information about the Bf-blender-cvs mailing list