[Bf-blender-cvs] [c8bf45c] master: Fix T48806: mesh.materials.clear() does not decrement users counts.

Bastien Montagne noreply at git.blender.org
Thu Nov 19 18:04:06 CET 2015


Commit: c8bf45c3232874c720acd6aca6ebb1ad8a4af1f7
Author: Bastien Montagne
Date:   Thu Nov 19 18:03:38 2015 +0100
Branches: master
https://developer.blender.org/rBc8bf45c3232874c720acd6aca6ebb1ad8a4af1f7

Fix T48806: mesh.materials.clear() does not decrement users counts.

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

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

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

diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index ba81f68..8614ded 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -669,6 +669,10 @@ void BKE_material_clear_id(struct ID *id, bool update_data)
 	Material ***matar;
 	if ((matar = give_matarar_id(id))) {
 		short *totcol = give_totcolp_id(id);
+
+		while ((*totcol)--) {
+			id_us_min((ID *)((*matar)[*totcol]));
+		}
 		*totcol = 0;
 		if (*matar) {
 			MEM_freeN(*matar);




More information about the Bf-blender-cvs mailing list