Commit Graph

145 Commits

Author SHA1 Message Date
37ef7f3537 Fix T38936 Bevel strange flickering on big meshes.
Last change to bevel had a check for what was supposed
to be an "on edge" new vertex being off the edge.
The test tolerance was too small. This fixes that.
2014-03-04 09:31:20 -05:00
1582dd5e4d Partial fix for T38871, Bevel could create a far-out spike.
There needed to be a check that when a newly created point is
supposed to be on an edge, that it stays within the bounds
of either end of the edge.
This fixes the hole-in-cube example in the bug, but not
the boolean modifier one, which still needs more work.
2014-02-28 13:56:17 -05:00
d3b9457991 Code cleanup: style/warnings 2014-02-28 11:04:15 +11:00
6de3a8a4fe Bevel fix for T38675, bad bevel on slanted L.
The test for a reflex angle used the vertex normal,
which was not a good test for a saddle point vertex.
Switched to using the face normal, if available, for that test.
Also added test for this in svn bevel_regression.blend.
2014-02-17 11:43:31 -05:00
68521841a8 Bevel: remove unused assignments.
Caught by coverity.
2014-02-03 09:53:27 -05:00
d900f5be55 Code cleanup: use bools where possible 2014-02-03 19:35:44 +11:00
1dc1d92dab Code cleanup: white space and cmake was broken on all platforms 2014-02-03 13:56:34 +11:00
39202a53b5 Bevel: fix glitch in "pipe" case with square profile.
The "pipe" case -- where two beveled edges are in line
and there is at least one more beveled edge -- needed better
handling when profile parameter = 1.0 (square outward).
2014-01-28 13:20:42 -05:00
37f1b717eb Bevel code cleanup: get rid of old 'ADJ' code.
The new subdiv 'adj' pattern is working well, so removing the
old code and taking opportunity to remove 'subdiv' from a number
of names.
2014-01-28 07:03:25 -05:00
a5c35fb27f Code cleanup: use booleans where appropriate 2014-01-28 04:00:04 +11:00
1c29fd77d3 Code Cleanup: style and correct API class ref 2014-01-26 22:17:01 +11:00
01c1790a11 Make multisegment bevel profiles even for all parameters.
The method for calculating points on the profile for non-circles
and non-lines meant that the segments making up an edge had
uneven widths.
Use a numeric search technique to find superellipse evaluation
points that lead to equal-sized chords across the profile.
Also calculate the actual profile points sooner, so that they
don't have to be recalculated again and again.
This also sets up for a possible later feature of arbitrary
profile shapes, set by user.
2014-01-24 10:07:24 -05:00
45b9822259 Fix T38300: Bevel didn't always reconstruct faces properly.
With new subdivision method for making the vertex mesh, we always
subdivide the edges between the new vertices around a vertex
(we used to not subdivide edges between two non-beveled edges).
This fixes a bug related to this change.
2014-01-21 09:02:27 -05:00
37242e6b0b Code Cleanup: style 2014-01-21 12:05:27 +11:00
a502959e4b Bevel: fixed problems with vertex bevel and some 'weld' cases.
Vertex bevel was completely messed up after last change,
and this fixes.
'Weld' bevels, where there are exactly two beveled edges
meeting at a vertex, now look better in cases where one
of the beveled edges is on a flat plane.
2014-01-20 08:55:07 -05:00
621bf47e91 Docs: doxygen file descriptions for BLF, GPU and WM 2014-01-19 23:15:25 +11:00
af93ebcb50 Code Cleanup: style and redundant casts 2014-01-16 19:15:53 +11:00
e5c7535beb Code Cleanup: float/double promotions 2014-01-15 13:40:40 +11:00
c5d3abc863 Bevel fix to clamping for percent type.
The clamp code is still very crude and over-conservative,
but was totally wrong for the percent amount type.
2014-01-14 11:21:56 -05:00
c925b5bbb2 Bevel fixes for profiles: better way to calculate.
It is better to keep the profile as it is perpedicular
to the edge, and then project it onto a given plane
at the corners. Also fixed the interpolation to a
different number of segments when the profile is not
round.
2014-01-12 14:10:39 -05:00
62aa004c25 Style Cleanup: whitespace 2014-01-12 22:05:24 +11:00
e47a41e3fc Code Cleanup: style 2014-01-09 11:44:59 +11:00
8305fd8841 Code Cleanup: style edits to bevel and remove unneeded boundvert_rep_face call 2014-01-09 00:50:32 +11:00
49aa701645 Add profile control parameter to Bevel.
Parameter controls concavity / convexity.
    <.25 means: concave inward
    .25 means: straight slanted
    >.25 means: concave outward
    .5 means: circular (the default)
    1 means: straight along original sides
For now, there is a hard lower limit of .15
because more work is needed to get decent
results in the range below that.

The profile is actually a superellipse, and the
parameter is 1/4 of the exponent in the implicit equation
for a superellipse, except at the extreme values of 0 and 1.
2014-01-08 07:40:01 -05:00
e164a500c8 Fix to own previous commit for bevel vertex only case.
In separating out the adj mesh change from a profile change,
I'd forgotten that some profiles need to be flat (in particular,
for vertex-only bevels). This fixes that.
2014-01-06 15:53:22 -05:00
bdd20e18ef Bevel: use stack memory for interp_vmesh()
Rather then using the memarena and never freeing.
2014-01-07 03:17:32 +11:00
e0a4a4afc3 Bevel: change 'adj' pattern to use subdivision.
This gets rid of a hacky way of setting the mesh
coordinates at corners, which created overlaps
in some cases.
Also, special case a cube-like corner with all
edges beveled, to snap to a sphere, giving more
expected curvature in that case.
2014-01-06 10:52:31 -05:00
04a902965e BMesh optimize face splitting by taking loops rather then verts
- add BM_vert_pair_share_face
- add BM_loop_is_adjacent
- remove BM_verts_connect
2013-12-24 11:13:58 +11:00
da91575206 Bevel: add width consistency pass.
When the desired widths (offsets) of beveled edges cannot be
satisfied, often because we want them to meet on an intermediate
non-beveled edge, we need to compromise on the widths somehow.
This code changes the compromise to minimize the sum of squares
of errors in the offsets.  It also adds a global width consistency
pass: starting from a vertex that needed width adjustment, it
uses a breadth-first search to try to propagate the adjustments
and keep the bevel widths from having to taper along the edges.

Also fixed a case where a reflex angle would cause bad results.
Also fixed the way the 'percentage' width method was calculated.
2013-12-02 07:24:22 -05:00
1158c1f7c0 Bevel Fix for nonplanar faces / reflex angles
When beveling two adjacent edges, code used face normal instead
of the face-corner normal (these can be different for nonplanar
faces); the bevel may look uneven in such cases.
Switched to using corner normal, and needed to fix the case
where the edges meet at a reflex angle. Fixed a similar case
when beveling two edges with one non-beveled in between.
Also removed unnecessary argument from offset_meet.
2013-11-20 07:18:18 -05:00
8f7f8d679c Style Cleanup: whitespace 2013-11-17 22:00:57 +11:00
7a899ce9fc Fix T37476 Bevel modifier got weight from wrong edge
The bevel modifier with 'weight' activated was reading
the weights from the wrong edges.
2013-11-16 08:10:12 -05:00
9a78cda321 Fix Bevel artifacts bug T37053
In the case that there are two beveled edges with one unbeveled
one in between, and the widths don't allow them to magically
line up, it is better to slide along unbeveled edge.

Sometimes bevel widths are uneven (this was the case before)
and it is a followup TODO to do a width cleanup pass afterwards
to even the edges up as much as possible.
2013-11-15 10:47:45 -05:00
bfb9cefccb Added options for how bevel amount is measured.
Now there is an 'Offset Type' dropdown on tool
shelf with types:
Offset - current method, offset of new edge
  from old along sliding face
Width - width of new bevel face (if segments=1)
Depth - amount a chamfering plane moves down
  from original edge
Percent - percent of way sliding edges move
  along their adjacent edges

The different options mainly are useful when
beveling more than one edge at once.

Leaving as a TODO to put these in the modifier,
as doing that has more permanent effects so
want to let users shake out problems with this
first.
2013-11-10 12:31:57 +00:00
e220d3228f add MEM_SIZE_OPTIMAL to avoid memory fragmentation & waste lost to slop-space. 2013-10-10 18:18:13 +00:00
5b5bc63396 fix [#36923] Merge / Delete vertices crashes for some meshes
add BM_ITER_MESH_MUTABLE which steps before entering the for() loop body and prevents the assert from complaining about removing mesh data while iterating as well as the crash.

this was done in quite a few areas, more may turn up.
2013-10-03 07:06:56 +00:00
6c83806a00 fix [#36435] Crash on unwrap with specific mesh 2013-10-01 12:48:32 +00:00
95bfe69704 Let vertex bevel work on boundary verts of polys.
Suggestion by Jonathan Williamson, and thanks to
Walid Shouman for noticing that the existing code
worked if a test to prohibit it were removed.

Limitation: treats segments > 1 the same as
segments == 1 in this case; a TODO to do
something more intelligent.
2013-09-20 12:50:34 +00:00
77fa1aaab5 modify closest_to_plane_v3 not to use point-normal form. 2013-08-23 05:15:12 +00:00
6cba2b8d73 move bmesh tools into their own include,
changes to tool args would rebuild far too many files and these are mainly by modifiers outside of bmesh.
2013-08-23 04:22:07 +00:00
9470754fd3 bmesh api cleanup, face creation args now accept an example face (as with vertex and edge),
also replace BM_face_create_quad_tri_v with BM_face_create_verts
2013-08-21 07:51:47 +00:00
8937a8b839 use BM_CREATE_NOP arg rather then zero, with pointer and bool args in either side in some cases it gets a bit confusing.
also correct edge-rotate where bool->flag conversion worked by accident.
2013-08-21 05:39:46 +00:00
5fafc222f0 style cleanup 2013-08-17 08:21:40 +00:00
4982f200fa move alloca define into its own header since its not related to BLI_array 2013-07-28 10:38:25 +00:00
b2a0255539 Fix bevel when there is a gap in faces around vertex.
Fixes bug #35927 (Vertex Bevel bug) but even edge
bevel didn't work on the example there. Problem
was with forming the proper ccw ordering of edges
around the bevel.
Also appears to fix bug #35582 (Bevel, weird results).
2013-07-11 13:29:52 +00:00
0a006cce9c Fix bevel bugs 34445 and 35109, copying over edge data.
The bugs were about not respecting edge smoothness and
not respecting edge crease.  This change copies the
edge attributes from a beveled edge to the two outside
edges of the bevel.
2013-07-08 13:02:21 +00:00
2e7776b95a Fix bevel crash bug 35990. Sometimes no face to interpolate from. 2013-07-03 20:52:31 +00:00
4848ca09c0 style cleanup 2013-07-02 20:36:52 +00:00
994a937a97 Fix Bevel bug #34321, making bevel keep UVs contiguous when possible. 2013-07-02 13:18:56 +00:00
fad1da062d correct typos in comments. 2013-06-25 22:58:23 +00:00