[Bf-blender-cvs] [57d70b3c87e] fracture_modifier: fix for autogenerating inner material, just append at the end of the stack instead taking always the 2nd one
Martin Felke
noreply at git.blender.org
Sun Oct 8 21:43:12 CEST 2017
Commit: 57d70b3c87e472a6db3482aeca9ae63eead2ecb1
Author: Martin Felke
Date: Sun Oct 8 21:42:48 2017 +0200
Branches: fracture_modifier
https://developer.blender.org/rB57d70b3c87e472a6db3482aeca9ae63eead2ecb1
fix for autogenerating inner material, just append at the end of the stack instead taking always the 2nd one
===================================================================
M source/blender/modifiers/intern/MOD_fracture.c
===================================================================
diff --git a/source/blender/modifiers/intern/MOD_fracture.c b/source/blender/modifiers/intern/MOD_fracture.c
index 113593ecbf2..4c772a1abe5 100644
--- a/source/blender/modifiers/intern/MOD_fracture.c
+++ b/source/blender/modifiers/intern/MOD_fracture.c
@@ -1405,7 +1405,7 @@ static short do_materials(FractureModifierData *fmd, Object* obj)
BLI_strncpy(name, obj->id.name + 2, strlen(obj->id.name));
if (*totmat == 0)
{
- /*create both materials*/
+ /*create both materials if no material is present*/
Material* mat_inner;
char *matname = BLI_strdupcat(name, "_Outer");
Material* mat_outer = find_material(matname);
@@ -1423,9 +1423,11 @@ static short do_materials(FractureModifierData *fmd, Object* obj)
matname = NULL;
fmd->inner_material = mat_inner;
+ mat_index = 1;
}
- else if (*totmat == 1)
+ else if (*totmat > 0)
{
+ /* append inner material to the stack if materials are present */
char* matname = BLI_strdupcat(name, "_Inner");
Material* mat_inner = find_material(matname);
BKE_object_material_slot_add(obj);
@@ -1434,15 +1436,8 @@ static short do_materials(FractureModifierData *fmd, Object* obj)
matname = NULL;
fmd->inner_material = mat_inner;
+ mat_index = *totmat;
}
- else /*use 2nd material slot*/
- {
- Material* mat_inner = give_current_material(obj, 2);
-
- fmd->inner_material = mat_inner;
- }
-
- mat_index = 2;
}
return mat_index;
More information about the Bf-blender-cvs
mailing list