[Bf-blender-cvs] [baf924a6a6b] soc-2019-bevel-profiles: Fixed profile orientation issue with 1 segment long bevel chains.
Hans Goudey
noreply at git.blender.org
Wed Jul 10 19:27:50 CEST 2019
Commit: baf924a6a6b7e32fb2a0ad41ca8e12b1d21d722b
Author: Hans Goudey
Date: Wed Jul 10 13:27:32 2019 -0400
Branches: soc-2019-bevel-profiles
https://developer.blender.org/rBbaf924a6a6b7e32fb2a0ad41ca8e12b1d21d722b
Fixed profile orientation issue with 1 segment long bevel chains.
Simple fix: The first edgehalf visited had the wrong orientation.
===================================================================
M source/blender/blenkernel/intern/profile_widget.c
M source/blender/bmesh/operators/bmo_bevel.c
M source/blender/bmesh/tools/bmesh_bevel.c
M source/blender/editors/interface/interface_handlers.c
M source/blender/editors/mesh/editmesh_bevel.c
===================================================================
diff --git a/source/blender/blenkernel/intern/profile_widget.c b/source/blender/blenkernel/intern/profile_widget.c
index 11f301e8421..9ddc415f3b5 100644
--- a/source/blender/blenkernel/intern/profile_widget.c
+++ b/source/blender/blenkernel/intern/profile_widget.c
@@ -651,8 +651,7 @@ void profilewidget_create_samples(const ProfileWidget *prwdgt,
}
calchandle_profile(&bezt[totpoints - 1], &bezt[totpoints - 2], NULL);
- /* First and last handle need correction, instead of pointing to center of next/prev,
- * we let it point to the closest handle */
+ /* HANS-TODO: Instead of this put the end handles pointing along the edge */
if (0 && prwdgt->totpoint > 2) {
float hlen, nlen, vec[3];
diff --git a/source/blender/bmesh/operators/bmo_bevel.c b/source/blender/bmesh/operators/bmo_bevel.c
index 31e5b474cd0..0a545ef81f0 100644
--- a/source/blender/bmesh/operators/bmo_bevel.c
+++ b/source/blender/bmesh/operators/bmo_bevel.c
@@ -31,7 +31,6 @@
void bmo_bevel_exec(BMesh *bm, BMOperator *op)
{
- printf("BMO BEVEL EXEC\n");
const float offset = BMO_slot_float_get(op->slots_in, "offset");
const int offset_type = BMO_slot_int_get(op->slots_in, "offset_type");
const int seg = BMO_slot_int_get(op->slots_in, "segments");
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c
index ef5542b0679..5c618e64ddc 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -62,7 +62,7 @@
#define DEBUG_CUSTOM_PROFILE_WELD 0
#define DEBUG_CUSTOM_PROFILE_ADJ 0
#define DEBUG_CUSTOM_PROFILE_ORIENTATION 0
-#define DEBUG_CUSTOM_PROFILE_ORIENTATION_DRAW DEBUG_CUSTOM_PROFILE_ORIENTATION | 1
+#define DEBUG_CUSTOM_PROFILE_ORIENTATION_DRAW DEBUG_CUSTOM_PROFILE_ORIENTATION | 0
#if DEBUG_CUSTOM_PROFILE_ORIENTATION_DRAW
extern void DRW_debug_sphere(const float center[3], const float radius, const float color[4]);
@@ -1716,9 +1716,6 @@ static void calculate_profile(BevelParams *bp, BoundVert *bndv, bool reversed)
else {
if (map_ok) {
if (reversed) {
-#if DEBUG_CUSTOM_PROFILE_ORIENTATION
- printf("(reversed)\n");
-#endif
p[0] = (float)yvals[ns - k];
p[1] = (float)xvals[ns - k];
}
@@ -3135,13 +3132,13 @@ static void debug_RPO_edge_draw_profile_orientation(BevelParams* bp, BMEdge* e)
DRW_debug_sphere(edge_half->rightv->nv.co, 0.05f, debug_color_2);
mid_v3_v3v3(co, e->v1->co, e->v2->co);
DRW_debug_line_v3v3(co, edge_half->rightv->nv.co, debug_color_2);
- DRW_debug_line_v3v3(e->v1->co, edge_half->rightv->nv.co, debug_color_2);
+ DRW_debug_line_v3v3(e->v2->co, edge_half->rightv->nv.co, debug_color_2);
}
else {
DRW_debug_sphere(edge_half->leftv->nv.co, 0.05f, debug_color_2);
mid_v3_v3v3(co, e->v1->co, e->v2->co);
DRW_debug_line_v3v3(co, edge_half->leftv->nv.co, debug_color_2);
- DRW_debug_line_v3v3(e->v1->co, edge_half->leftv->nv.co, debug_color_2);
+ DRW_debug_line_v3v3(e->v2->co, edge_half->leftv->nv.co, debug_color_2);
}
}
#endif
@@ -3150,14 +3147,11 @@ static void debug_RPO_edge_draw_profile_orientation(BevelParams* bp, BMEdge* e)
* the profiles can start from opposite sides of the edge. In order to fix this we
* need to travel along the beveled edges marking consistent boundverts for the
* bevels to start from. */
-/* HANS-TODO: Fix the problem near impassible verts like on a single beveled edge. Add a green
- * debug sphere to the start edgehalf to see if the problem is at that point of the process. */
static void regularize_profile_orientation(BevelParams *bp, BMEdge *bme)
{
BevVert *start_bv;
BevVert *bv;
- EdgeHalf *start_edgehalf;
- EdgeHalf *edgehalf;
+ EdgeHalf *start_edgehalf, *edgehalf;
bool toward_bv;
#if DEBUG_CUSTOM_PROFILE_ORIENTATION
printf("REGULARIZE PROFILE ORIENTATION\n");
@@ -3166,7 +3160,6 @@ static void regularize_profile_orientation(BevelParams *bp, BMEdge *bme)
/* Start at the first EdgeHalf. Once the travelling is finished for that EdgeHalf,
* go to the next non-visited one and start the travel process from there. */
start_bv = find_bevvert(bp, bme->v1);
- /* HANS-TODO: Maybe implement better choice of start BevVert */
start_edgehalf = find_edge_half(start_bv, bme);
if (!start_edgehalf->is_bev || start_edgehalf->visited_custom) {
#if DEBUG_CUSTOM_PROFILE_ORIENTATION
@@ -3181,9 +3174,9 @@ static void regularize_profile_orientation(BevelParams *bp, BMEdge *bme)
}
/* Pick a BoundVert on one side of the profile to use for the start of the profile */
- /* HANS-TODO: Possibly use a more advanced metric here for the start edge */
- start_edgehalf->rightv->is_profile_start = true;
- start_edgehalf->leftv->is_profile_start = false;
+ start_edgehalf->rightv->is_profile_start = false;
+ start_edgehalf->leftv->is_profile_start = true;
+ start_edgehalf->visited_custom = true;
/* Travel the path in the direction of the BevVert the EdgeHalf is attached to */
edgehalf = start_edgehalf;
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 430b2901fb0..e58bdbae516 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -2632,7 +2632,6 @@ static void ui_but_paste(bContext *C, uiBut *but, uiHandleButtonData *data, cons
void ui_but_clipboard_free(void)
{
- printf("UI BUT CLIPBOARD FREE\n");
curvemapping_free_data(&but_copypaste_curve);
profilewidget_free_data(&but_copypaste_profile);
}
diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c
index 2023e43a439..7935f85fd03 100644
--- a/source/blender/editors/mesh/editmesh_bevel.c
+++ b/source/blender/editors/mesh/editmesh_bevel.c
@@ -889,7 +889,7 @@ static void edbm_bevel_ui(bContext *C, wmOperator *op)
uiItemR(layout, &ptr, "spread", 0, NULL, ICON_NONE);
}
uiItemR(layout, &ptr, "use_custom_profile", 0, NULL, ICON_NONE);
- uiLayoutRow(layout, false); /* HANS-TODO: Need this? */
+// uiLayoutRow(layout, false); /* HANS-TODO: Need this? */
if (RNA_boolean_get(&ptr, "use_custom_profile")) {
uiTemplateProfileWidget(layout, &toolsettings_ptr, "prwdgt");
uiItemR(layout, &ptr, "sample_straight_edges", 0, NULL, ICON_NONE);
More information about the Bf-blender-cvs
mailing list