[Bf-blender-cvs] [6c0307f] master: Fix T49228: Separate by material, materials dissappear after reload.

Bastien Montagne noreply at git.blender.org
Sat Sep 3 17:18:01 CEST 2016


Commit: 6c0307f88854aada929359ff1eaad133e950188d
Author: Bastien Montagne
Date:   Sat Sep 3 12:51:50 2016 +0200
Branches: master
https://developer.blender.org/rB6c0307f88854aada929359ff1eaad133e950188d

Fix T49228: Separate by material, materials dissappear after reload.

Yet another mismatch where code would decrease usercount (of Material here) but never increase it again
when re-assigning the datablock...

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

M	source/blender/editors/mesh/editmesh_tools.c

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

diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 999d5b2..7e31deb 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -3121,8 +3121,10 @@ static void mesh_separate_material_assign_mat_nr(Main *bmain, Object *ob, const
 		BKE_material_resize_id(bmain, obdata, 1, true);
 
 		ob->mat[0] = ma_ob;
+		id_us_plus((ID *)ma_ob);
 		ob->matbits[0] = matbit;
 		(*matarar)[0] = ma_obdata;
+		id_us_plus((ID *)ma_obdata);
 	}
 	else {
 		BKE_material_clear_id(bmain, obdata, true);




More information about the Bf-blender-cvs mailing list