From 70453c578dcdce5577015e1cd7be99d1b810215d Mon Sep 17 00:00:00 2001 From: Howard Trickey Date: Thu, 17 Jul 2014 09:20:22 -0400 Subject: Fix T34664: bevel face material can be set in tool and modifier. Now the bevel tool, modifier, and internal operator have a material slot # parameter that the user can set. If left at default of -1, behavior is as current -- bevel face material is taken from the closest original face (this may be ambiguous). If material slot is >= 0, it gives the material slot index number for the material to use. --- source/blender/modifiers/intern/MOD_bevel.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index fc65990df20..2de3220e683 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -57,6 +57,7 @@ static void initData(ModifierData *md) bmd->val_flags = MOD_BEVEL_AMT_OFFSET; bmd->lim_flags = 0; bmd->e_flags = 0; + bmd->mat = -1; bmd->profile = 0.5f; bmd->bevel_angle = DEG2RADF(30.0f); bmd->defgrp_name[0] = '\0'; @@ -73,6 +74,7 @@ static void copyData(ModifierData *md, ModifierData *target) tbmd->val_flags = bmd->val_flags; tbmd->lim_flags = bmd->lim_flags; tbmd->e_flags = bmd->e_flags; + tbmd->mat = bmd->mat; tbmd->profile = bmd->profile; tbmd->bevel_angle = bmd->bevel_angle; BLI_strncpy(tbmd->defgrp_name, bmd->defgrp_name, sizeof(tbmd->defgrp_name)); @@ -109,6 +111,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob, const bool vertex_only = (bmd->flags & MOD_BEVEL_VERT) != 0; const bool do_clamp = !(bmd->flags & MOD_BEVEL_OVERLAP_OK); const int offset_type = bmd->val_flags; + const int mat = CLAMPIS(bmd->mat, -1, ob->totcol - 1); bm = DM_to_bmesh(dm, true); if ((bmd->lim_flags & MOD_BEVEL_VGROUP) && bmd->defgrp_name[0]) @@ -165,7 +168,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob, BM_mesh_bevel(bm, bmd->value, offset_type, bmd->res, bmd->profile, vertex_only, bmd->lim_flags & MOD_BEVEL_WEIGHT, do_clamp, - dvert, vgroup); + dvert, vgroup, mat); result = CDDM_from_bmesh(bm, true); -- cgit v1.2.3