[Bf-blender-cvs] [5ef1821] master: Fix copy-materials resetting objects material indices

Campbell Barton noreply at git.blender.org
Wed Jul 20 21:58:00 CEST 2016


Commit: 5ef1821a0fcba14a29dd11e44b2a4180fd6ffe14
Author: Campbell Barton
Date:   Thu Jul 21 06:00:58 2016 +1000
Branches: master
https://developer.blender.org/rB5ef1821a0fcba14a29dd11e44b2a4180fd6ffe14

Fix copy-materials resetting objects material indices

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

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

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

diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 0387a63..340eab8 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -874,7 +874,11 @@ void assign_matarar(struct Object *ob, struct Material ***matar, short totcol)
 	int actcol_orig = ob->actcol;
 	short i;
 
-	while (BKE_object_material_slot_remove(ob)) {}
+	while ((ob->totcol > totcol) &&
+	       BKE_object_material_slot_remove(ob))
+	{
+		/* pass */
+	}
 
 	/* now we have the right number of slots */
 	for (i = 0; i < totcol; i++)




More information about the Bf-blender-cvs mailing list