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-03-02 07:19:17 +0300
committerHans Goudey <h.goudey@me.com>2020-03-02 07:21:51 +0300
commitf78ca97cfcce148eba96e656a235442d3e3e37d1 (patch)
tree8bd717e1dcf06aba9f7a2463de42b7ecbf5000a1 /source/blender/bmesh
parente9e4f6af9e79ea73eb26a2ce57f10bf600d9c6e3 (diff)
Bevel: Z-Up Custom Profile Orientation
When beveling architectural objects like baseboards or crown mouldings that may consist of multiple islands, it's useful if the orientation is at least conistent. This changes the arbitrary decision of how the orientation should start at a chain beginning to use the highest side of the profile in the Z direction. Reviewed By: howardt Differential Revision: https://developer.blender.org/D6946
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r--source/blender/bmesh/tools/bmesh_bevel.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c
index 0ff89aa3127..e99f6699173 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -3132,22 +3132,22 @@ static EdgeHalf *next_edgehalf_bev(BevelParams *bp,
*/
static void regularize_profile_orientation(BevelParams *bp, BMEdge *bme)
{
- BevVert *start_bv;
- BevVert *bv;
- EdgeHalf *start_edgehalf, *edgehalf;
- bool toward_bv;
-
- start_bv = find_bevvert(bp, bme->v1);
- start_edgehalf = find_edge_half(start_bv, bme);
+ BevVert *start_bv = find_bevvert(bp, bme->v1);
+ EdgeHalf *start_edgehalf = find_edge_half(start_bv, bme);
if (!start_edgehalf->is_bev || start_edgehalf->visited_rpo) {
return;
}
- /* Pick a BoundVert on one side of the profile to use for the start of the profile. */
- start_edgehalf->leftv->is_profile_start = false;
+ /* Pick a BoundVert on one side of the profile to use for the starting side. Use the one highest
+ * on the Z axis because even any rule is better than an arbitrary decision. */
+ bool right_highest = start_edgehalf->leftv->nv.co[2] < start_edgehalf->rightv->nv.co[2];
+ start_edgehalf->leftv->is_profile_start = right_highest;
start_edgehalf->visited_rpo = true;
/* First loop starts in the away from BevVert direction and the second starts toward it. */
+ bool toward_bv;
+ BevVert *bv;
+ EdgeHalf *edgehalf;
for (int i = 0; i < 2; i++) {
edgehalf = start_edgehalf;
bv = start_bv;
@@ -3160,11 +3160,11 @@ static void regularize_profile_orientation(BevelParams *bp, BMEdge *bme)
* The direction relative to the BevVert switches every step, so also switch
* the orientation every step. */
if (i == 0) {
- edgehalf->leftv->is_profile_start = toward_bv;
+ edgehalf->leftv->is_profile_start = toward_bv ^ right_highest;
}
else {
/* The opposite side as the first direction because we're moving the other way. */
- edgehalf->leftv->is_profile_start = !toward_bv;
+ edgehalf->leftv->is_profile_start = !toward_bv ^ right_highest;
}
/* The next jump will in the opposite direction relative to the BevVert. */