diff options
author | Hans Goudey <h.goudey@me.com> | 2019-11-21 00:12:32 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2019-11-21 00:25:28 +0300 |
commit | ba1e9ae4733ae956331c7e8899f6939997205298 (patch) | |
tree | 007362ed2c9ee4564b67404f552906d6e66848db /source/blender/bmesh/intern | |
parent | 8c6ce742391b2b8798143a4a2c2224ebbeb7f1ec (diff) |
Bevel: Custom Profile and CurveProfile Widget
Custom profiles in bevel allows the profile curve to be controlled by
manually placed control points. Orientation is regularized along
groups of edges, and the 'pipe case' is updated. This commit includes
many updates to comments and changed variable names as well.
A 'cutoff' vertex mesh method is added to bevel in addition to the
existing grid fill option for replacing vertices.
The UI of the bevel modifier and tool are updated and unified.
Also, a 'CurveProfile' widget is added to BKE for defining the profile
in the interface, which may be useful in other situations.
Many thanks to Howard, my mentor for this GSoC project.
Reviewers: howardt, campbellbarton
Differential Revision: https://developer.blender.org/D5516
Diffstat (limited to 'source/blender/bmesh/intern')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_opdefines.c | 20 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_operator_api.h | 5 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_operators.h | 6 |
3 files changed, 25 insertions, 6 deletions
diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c index 7086cea1ace..74d01dca66a 100644 --- a/source/blender/bmesh/intern/bmesh_opdefines.c +++ b/source/blender/bmesh/intern/bmesh_opdefines.c @@ -1725,6 +1725,12 @@ static BMO_FlagSet bmo_enum_bevel_miter_type[] = { {0, NULL}, }; +static BMO_FlagSet bmo_enum_bevel_vmesh_method[] = { + {BEVEL_VMESH_ADJ, "ADJ"}, + {BEVEL_VMESH_CUTOFF, "CUTOFF"}, + {0, NULL}, +}; + /* * Bevel. * @@ -1735,7 +1741,8 @@ static BMOpDefine bmo_bevel_def = { /* slots_in */ {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input edges and vertices */ {"offset", BMO_OP_SLOT_FLT}, /* amount to offset beveled edge */ - {"offset_type", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, bmo_enum_bevel_offset_type}, /* how to measure the offset */ + {"offset_type", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, + bmo_enum_bevel_offset_type}, /* how to measure the offset */ {"segments", BMO_OP_SLOT_INT}, /* number of segments in bevel */ {"profile", BMO_OP_SLOT_FLT}, /* profile shape, 0->1 (.5=>round) */ {"vertex_only", BMO_OP_SLOT_BOOL}, /* only bevel vertices, not edges */ @@ -1746,13 +1753,18 @@ static BMOpDefine bmo_bevel_def = { {"mark_sharp", BMO_OP_SLOT_BOOL}, /* extend edge data to allow sharp edges to run across bevels */ {"harden_normals", BMO_OP_SLOT_BOOL}, /* harden normals */ {"face_strength_mode", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, - bmo_enum_bevel_face_strength_type}, /* whether to set face strength, and which faces to set if so */ + bmo_enum_bevel_face_strength_type}, /* whether to set face strength, and which faces to set if so */ {"miter_outer", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, - bmo_enum_bevel_miter_type}, /* outer miter kind */ + bmo_enum_bevel_miter_type}, /* outer miter kind */ {"miter_inner", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, - bmo_enum_bevel_miter_type}, /* outer miter kind */ + bmo_enum_bevel_miter_type}, /* outer miter kind */ {"spread", BMO_OP_SLOT_FLT}, /* amount to offset beveled edge */ {"smoothresh", BMO_OP_SLOT_FLT}, /* for passing mesh's smoothresh, used in hardening */ + {"use_custom_profile", BMO_OP_SLOT_BOOL}, /* Whether to use custom profile feature */ + /* the ProfileWiget struct for the custom profile shape */ + {"custom_profile", BMO_OP_SLOT_PTR, {(int)BMO_OP_SLOT_SUBTYPE_PTR_STRUCT}}, + {"vmesh_method", BMO_OP_SLOT_INT, {(int)BMO_OP_SLOT_SUBTYPE_INT_ENUM}, + bmo_enum_bevel_vmesh_method}, {{'\0'}}, }, /* slots_out */ diff --git a/source/blender/bmesh/intern/bmesh_operator_api.h b/source/blender/bmesh/intern/bmesh_operator_api.h index 2039289dcd7..dbd2bf076c6 100644 --- a/source/blender/bmesh/intern/bmesh_operator_api.h +++ b/source/blender/bmesh/intern/bmesh_operator_api.h @@ -237,6 +237,7 @@ typedef enum eBMOpSlotSubType_Ptr { BMO_OP_SLOT_SUBTYPE_PTR_SCENE = 101, BMO_OP_SLOT_SUBTYPE_PTR_OBJECT = 102, BMO_OP_SLOT_SUBTYPE_PTR_MESH = 103, + BMO_OP_SLOT_SUBTYPE_PTR_STRUCT = 104, } eBMOpSlotSubType_Ptr; typedef enum eBMOpSlotSubType_Int { BMO_OP_SLOT_SUBTYPE_INT_ENUM = 200, @@ -294,8 +295,8 @@ typedef struct BMOpSlot { BLI_assert(((slot >= (op)->slots_in) && (slot < &(op)->slots_in[BMO_OP_MAX_SLOTS])) || \ ((slot >= (op)->slots_out) && (slot < &(op)->slots_out[BMO_OP_MAX_SLOTS]))) -/* way more than probably needed, compiler complains if limit hit */ -#define BMO_OP_MAX_SLOTS 20 +/* Limit hit, so expanded for bevel operator. Compiler complains if limit is hit. */ +#define BMO_OP_MAX_SLOTS 21 /* BMOpDefine->type_flag */ typedef enum { diff --git a/source/blender/bmesh/intern/bmesh_operators.h b/source/blender/bmesh/intern/bmesh_operators.h index 78e8ce04115..9f0107db693 100644 --- a/source/blender/bmesh/intern/bmesh_operators.h +++ b/source/blender/bmesh/intern/bmesh_operators.h @@ -126,6 +126,12 @@ enum { BEVEL_MITER_ARC, }; +/* Bevel vertex mesh creation methods */ +enum { + BEVEL_VMESH_ADJ, + BEVEL_VMESH_CUTOFF, +}; + /* Normal Face Strength values */ enum { FACE_STRENGTH_WEAK = -16384, |