Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2020-07-21 23:32:00 +0300
committerHans Goudey <h.goudey@me.com>2020-07-21 23:32:00 +0300
commit4aa2a5481cec4edc4694ee1edbde4ed3f3986313 (patch)
tree0dd39e7392e62963a2bcb7d82249e9c84e032fb2 /source/blender/modifiers/intern/MOD_bevel.c
parenta39da2cbca19102589d5141c80a6bc013bd4c963 (diff)
Bevel: Refactor "Vertex Only" to an enum
This matches the change that was done to the bevel modifier so that the interface for the modifier, the active tool, and the operator are consistent. This commit extends the refactor to the bmesh implementation too, so that the parameters in the implementation don't stray too far from what is exposed. Tests are adjusted and still pass.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_bevel.c')
-rw-r--r--source/blender/modifiers/intern/MOD_bevel.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c
index ae392458539..a9708de83bf 100644
--- a/source/blender/modifiers/intern/MOD_bevel.c
+++ b/source/blender/modifiers/intern/MOD_bevel.c
@@ -117,7 +117,6 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
MDeformVert *dvert = NULL;
BevelModifierData *bmd = (BevelModifierData *)md;
const float threshold = cosf(bmd->bevel_angle + 0.000000175f);
- 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 profile_type = bmd->profile_type;
@@ -131,7 +130,6 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
const int miter_outer = bmd->miter_outer;
const int miter_inner = bmd->miter_inner;
const float spread = bmd->spread;
- const int vmesh_method = bmd->vmesh_method;
const bool invert_vgroup = (bmd->flags & MOD_BEVEL_INVERT_VGROUP) != 0;
bm = BKE_mesh_to_bmesh_ex(mesh,
@@ -152,7 +150,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
MOD_get_vgroup(ctx->object, mesh, bmd->defgrp_name, &dvert, &vgroup);
}
- if (vertex_only) {
+ if (bmd->affect_type == MOD_BEVEL_AFFECT_VERTICES) {
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
if (bmd->lim_flags & MOD_BEVEL_WEIGHT) {
weight = BM_elem_float_data_get(&bm->vdata, v, CD_BWEIGHT);
@@ -230,7 +228,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
profile_type,
bmd->res,
bmd->profile,
- vertex_only,
+ bmd->affect_type,
bmd->lim_flags & MOD_BEVEL_WEIGHT,
do_clamp,
dvert,
@@ -246,7 +244,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
spread,
mesh->smoothresh,
bmd->custom_profile,
- vmesh_method);
+ bmd->vmesh_method);
result = BKE_mesh_from_bmesh_for_eval_nomain(bm, NULL, mesh);
@@ -286,7 +284,7 @@ static void panel_draw(const bContext *C, Panel *panel)
PointerRNA ob_ptr;
modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
- bool edge_bevel = RNA_enum_get(&ptr, "affect") != MOD_BEVEL_VERT;
+ bool edge_bevel = RNA_enum_get(&ptr, "affect") != MOD_BEVEL_AFFECT_VERTICES;
uiItemR(layout, &ptr, "affect", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
@@ -331,7 +329,7 @@ static void profile_panel_draw(const bContext *C, Panel *panel)
int profile_type = RNA_enum_get(&ptr, "profile_type");
int miter_inner = RNA_enum_get(&ptr, "miter_inner");
int miter_outer = RNA_enum_get(&ptr, "miter_outer");
- bool edge_bevel = RNA_enum_get(&ptr, "affect") != MOD_BEVEL_VERT;
+ bool edge_bevel = RNA_enum_get(&ptr, "affect") != MOD_BEVEL_AFFECT_VERTICES;
uiItemR(layout, &ptr, "profile_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
@@ -368,7 +366,7 @@ static void geometry_panel_draw(const bContext *C, Panel *panel)
PointerRNA ptr;
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
- bool edge_bevel = RNA_enum_get(&ptr, "affect") != MOD_BEVEL_VERT;
+ bool edge_bevel = RNA_enum_get(&ptr, "affect") != MOD_BEVEL_AFFECT_VERTICES;
uiLayoutSetPropSep(layout, true);
@@ -402,7 +400,7 @@ static void shading_panel_draw(const bContext *C, Panel *panel)
PointerRNA ptr;
modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
- bool edge_bevel = RNA_enum_get(&ptr, "affect") != MOD_BEVEL_VERT;
+ bool edge_bevel = RNA_enum_get(&ptr, "affect") != MOD_BEVEL_AFFECT_VERTICES;
uiLayoutSetPropSep(layout, true);