Commit Graph

1413 Commits

Author SHA1 Message Date
Campbell Barton
19b1da2b7b Polyfill2d: avoid calculating polygon winding (its known in all cases) 2014-06-14 08:21:52 +10:00
Campbell Barton
365ff66987 GSet, GHash: Add BLI_gset_add, since its common to add members to a set
also rename BLI_edgeset_reinsert -> BLI_edgeset_add, in this case its the same.
2014-06-14 00:47:12 +10:00
Campbell Barton
9f0466fb6b Quiet double promotion warning & ws edit 2014-06-13 02:22:40 +10:00
Howard Trickey
8c2b5ffb11 Fix Bevel bug T39746, small scale gives flat profile.
With very small meshes or very small bevel amounts, the bevel
profile would be flat even if a round one was requested.
Problem was that the code was checking the length of a cross
product for closeness to zero to test coplanarity. Needed
to normalize things before making that test to account for scale.
2014-06-12 10:22:10 -04:00
Howard Trickey
84767a29f1 Fix Bevel multisegment profile bugs T39184, T37502 and last part of T40365.
When doing a 'weld' type join where there are two non-beveled edges
in the same plane one beveled one but not the other, then there
should be a curved profile; bug was creating a straight one.
2014-06-10 11:21:52 -04:00
Campbell Barton
c6ea6e368b BMesh: avoid recursion for BM_mesh_edgenet, runs out stack memory on large nets 2014-06-08 22:20:03 +10:00
Campbell Barton
d53ed58c57 BMesh: avoid OpenMP use for low poly meshes (counting selection)
also use schedule(static) for simple for loops.
2014-06-06 23:54:15 +10:00
Campbell Barton
0b0bac846c Fix T40508: Calculating normals crashes 2014-06-06 11:27:09 +10:00
Campbell Barton
8355955058 Avoid openmp sections in BM_mesh_elem_index_ensure 2014-06-05 18:50:10 +10:00
Campbell Barton
6f47d054ff Code cleanup: mixup hflag/htype 2014-06-05 18:37:53 +10:00
Campbell Barton
df94a773b6 BMesh: avoid using OpenMP when nothing to do
Gave slowdown drawing on high poly meshes
2014-06-05 08:13:55 +10:00
Howard Trickey
d504b325fb Fix T37618 Bevel mismatched offsets and bad profile plane.
Used a different technique to resolve "impossible" offset cases
that makes more consistency. Also changed the plane in which
the profile lies for the case with only one beveled edge and
more than 3 other edges.
2014-05-30 16:07:45 -04:00
Howard Trickey
6bde9a52f9 Fix T39174 Bevel didn't maintain edge attributes.
When rebuilding the polygons that touch bevel-involved vertices,
need to copy the edge attributes from corresponding original edges.
Special treatment of corner segments, to maintain continuity of
smooth and seam attributes.
Another fix: if have four meeting edges, two opposite ones beveled
and the other two not, propgate the non-beveled-edges attributes
across the line that joins them (perpendicular to the bevel).
2014-05-29 07:32:16 -04:00
Bastien Montagne
74cc3974fe Fix T40405: Blender crashes on FBX export instantly.
Better fix than rBbef5cb3aa2e5a: consider edges between faces with opposed normals as sharp.

In fact, previous code was broken more deeply in this case (inconsistent normals across
a 'smooth fan') - some loop normals would even never be computed!

Fixing this is possible (even wrote it, actually), but this adds more complexity
to a piece of code that is already awfully complicated, *and* normals in that kind
of smooth fan do not make much sense anyway. So simpler and nicer results with
assuming sharp edges between such 'opposed' faces!

Note that there is some face (loop) ordering black magic at work here, added more comments
to try to explain how and why all this works.

As a bonus, we do not need to check for already computed loop normals anymore, since we
know each 'smooth fan' will be walked once, and only once.
2014-05-28 18:55:46 +02:00
Bastien Montagne
9913da2b7f Found another bmesh func that invalidates loop indices... 2014-05-28 18:55:45 +02:00
Campbell Barton
fad267bf57 BMesh Walker: add face-shell walker 2014-05-23 20:50:27 +10:00
Campbell Barton
7e78322eef BMesh Walker: rename BMW_SHELL -> BMW_VERT_SHELL 2014-05-23 20:50:27 +10:00
Campbell Barton
d82cd4d5ef BMesh Walker: typecheck args for walker->begin() 2014-05-23 20:50:27 +10:00
Bastien Montagne
a217db0d63 Fix T40297: Crash while ripping an edge when autosmooth is activated.
Turned out there was still quite a few cases were indices were set dirty,
but elem_index_dirty was not tagged accordingly (mostly for BM_LOOP,
but a few others as well). So probably this crash was not the only one
hidden here.

Hopefully all possible cases were catched this time!
2014-05-21 22:37:50 +02:00
Campbell Barton
d9dd29054f Style cleanup 2014-05-20 00:11:16 +10:00
Howard Trickey
758bdcd6c2 Fix Bevel bugs T39726 and T39108, bevels with wire edges.
This updates the fix in rB27db75363, which had to be undone
because it broke other bevels.
It also fixes cases where edges went away went doing vertex
bevel on vertices with some wire edges.
2014-05-16 10:28:15 -04:00
Campbell Barton
48881ad1e0 Code cleanup: doxy comments 2014-05-14 15:00:47 +10:00
Antony Riakiotakis
33df6aa12e Fix T39196, Dynamic Topology Undo Applied to Wrong Mesh
Undoing nodes that do not belong to the current object will cause the
saved bmesh log entry to be reverted instead. This entry can belong to
another object though.
This is easy to fix by enforcing name matching (this was borrowed by
edit mode but can definitely be improved) between current object name
and undo node name and deleting older entries.

However there are complications. Deleting dyntopo entries in this way
can leave a brush stroke as first dyntopo log entry. This can present
issues if we attempt to delete that entry since it's deleted mesh
elements may now have had their ids (which would still be valid at the
time) cleaned up. This can result in crashing if we attempt to resculpt
on the mesh. To fix this I have disabled releasing the deleted entries.

This entanglement between bm_log and undo is quite volatile but I hope
the system works better now.

Also minor cleanup, fix unneeded check warning
2014-05-13 22:05:23 +03:00
Campbell Barton
b12bf2216f Correct last commit, check not to split along edges already used 2014-05-13 18:41:04 +10:00
Campbell Barton
dd8a9eee3b Fix T40162: Vert connect creates extra face cutting across concave NGon.
We need to support cutting degenerate ngons, see: T39418
This commit disallows cuts across faces where the same vertices can create better cuts on different faces.
2014-05-13 17:56:26 +10:00
Campbell Barton
46bd759964 Code cleanup: rename BM_face_legal_splits -> BM_face_splits_check_legal 2014-05-13 17:48:25 +10:00
Campbell Barton
bdf477d19a BMesh: add check to BM_vert_pair_share_face to allow adjacent loops
Add BM_vert_pair_share_face_by_angle to avoid selecting concave splits.
2014-05-13 16:49:57 +10:00
Campbell Barton
f14df29777 BMesh: make BM_face_calc_normal_subset apart of the bmesh api
also make face normal calculation functions return normal length
2014-05-13 14:58:05 +10:00
Campbell Barton
c3a3664e8c Utility macros for linklist stack & asserts for bmesh 2014-05-10 09:29:34 +10:00
Campbell Barton
65d54f34b1 Code cleanup: spelling/indentation 2014-05-08 04:53:05 +10:00
Campbell Barton
95b93b5d46 Add BLI_compiler_compat.h to help with portability 2014-05-02 01:14:15 +10:00
Campbell Barton
af86b008b2 Include removal gave problems with windows, ifdef some back in for windows only 2014-05-01 07:21:08 +10:00
Campbell Barton
cb48c0ceea Revert "Fix msvc 2013 compiler errors after the ingenious cleanup in 4ca67869cc7a."
This reverts commit a47a4ef82f.
2014-05-01 07:20:46 +10:00
Thomas Dinges
a47a4ef82f Fix msvc 2013 compiler errors after the ingenious cleanup in 4ca67869cc. 2014-04-30 23:16:12 +02:00
Campbell Barton
4ca67869cc Code cleanup: remove unused includes
Opted to keep includes if they are used indirectly (even if removing is possible).
2014-05-01 04:47:51 +10:00
Howard Trickey
a197d02b03 Fix T39939: Undo change of rB27db75363e67, which broke bevel.
The test for wire edges when reattaching was wrong, because
some newly made edges are wire at the point of the test.
This made some duplicate edges.
Need to track the original wire edges a different way.
2014-04-28 18:41:33 -04:00
Campbell Barton
fdcb9fcb7e Bevel: Avoid sqrt comparing lengths 2014-04-29 00:35:32 +10:00
Howard Trickey
27db75363e Fix T39726: wire edges cause bevel artifacts.
Now code explicity excludes wire edges from beveling
and reattaches the wire edges to one of the newly
created vertices after beveling.
Also fixes a bug where vertex-beveling a wire-edge-only
vertex would not reattach the wire edges.
2014-04-28 09:07:47 -04:00
Campbell Barton
d7d2e71a03 Correct some errors in auto-cleanup 2014-04-27 22:02:59 +10:00
Campbell Barton
b6e967be63 Code cleanup: const args and arrays 2014-04-27 08:56:54 +10:00
Campbell Barton
88a0fe5f1b Code cleanup: use 'const' for arrays (bmesh) 2014-04-27 00:25:16 +10:00
Campbell Barton
f2c483d108 Fix T39429: Project paint error with UV bleed 2014-04-23 04:33:07 +10:00
Campbell Barton
2108a61691 BMesh: minor optimizations for shapekey lookups on conversion 2014-04-23 00:49:28 +10:00
Campbell Barton
9d5ed605fe BMesh Inset: remove hack to store coords in normals 2014-04-22 01:36:59 +10:00
Bastien Montagne
dcd2a8fcc4 Fix stupid typo that broke split normal shading in edit mode, when there was some deform modifiers. 2014-04-20 23:12:18 +02:00
Campbell Barton
a51a0ca772 Math Lib: add shell_v3v3_normalized_to_dist and v2 version
bypass angle calculation to avoids (asin, sqrt, cos).
2014-04-19 22:17:10 +10:00
Antony Riakiotakis
0ba3f76470 Recreating a bmesh log did not account for modified faces.
It shouldn't create issues in practice because modified face ids should
have been reclaimed from an added face on a previous entry, but add for
completeness.
2014-04-17 19:03:07 +03:00
Campbell Barton
b3972aeea0 Math Lib: optimize axis_dominant_v3_to_m3, approx 6x speedup
build the matrix directly rather then calculating with axis/angle

also remove unused function calc_poly_plane
2014-04-16 21:07:28 +10:00
Antony Riakiotakis
556590fa3a Dyntopo:
Store PBVH node ID in CustomData. This avoids a number of hash deletions
and checks/insertions on big hashes.
2014-04-16 05:31:02 +03:00
Campbell Barton
5c4bb81e49 Fix T39685: triangulation modifier creates zero-area faces 2014-04-16 02:24:21 +10:00