[Bf-blender-cvs] [ab934e7] blender-v2.78-release: Fix T49228: Separate by material, materials dissappear after reload.

Bastien Montagne noreply at git.blender.org
Wed Sep 14 10:38:00 CEST 2016


Commit: ab934e7d6156138550825f207a72789fa555d82a
Author: Bastien Montagne
Date:   Sat Sep 3 12:51:50 2016 +0200
Branches: blender-v2.78-release
https://developer.blender.org/rBab934e7d6156138550825f207a72789fa555d82a

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