[Bf-blender-cvs] [8197b247d9d] blender2.8: Fix 'id_single_user' wrongly reseting usercount to 0.

Bastien Montagne noreply at git.blender.org
Fri Nov 2 15:12:20 CET 2018


Commit: 8197b247d9d4df29ae55bc03a0687fce744eed05
Author: Bastien Montagne
Date:   Fri Nov 2 14:31:13 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB8197b247d9d4df29ae55bc03a0687fce744eed05

Fix 'id_single_user' wrongly reseting usercount to 0.

We want to undo the initial usercount from low-level ID duplication, not
to erase all possible extra processing (like e.g. setting Fake User...).

Fixes part of mess in brush usercount.

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

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

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

diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 21424f4be53..ff663cfab01 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -776,9 +776,9 @@ bool id_single_user(bContext *C, ID *id, PointerRNA *ptr, PropertyRNA *prop)
 			if (id_copy(bmain, id, &newid, false) && newid) {
 				/* copy animation actions too */
 				BKE_animdata_copy_id_action(bmain, id, false);
-				/* us is 1 by convention, but RNA_property_pointer_set
-				 * will also increment it, so set it to zero */
-				newid->us = ID_FAKE_USERS(newid);
+				/* us is 1 by convention with new IDs, but RNA_property_pointer_set
+				 * will also increment it, decrement it here. */
+				id_us_min(newid);
 
 				/* assign copy */
 				RNA_id_pointer_create(newid, &idptr);



More information about the Bf-blender-cvs mailing list