Commit Graph

93 Commits

Author SHA1 Message Date
e08db08a84 Fix T39997: Multiple boolean modifiers sharing the same right operand crashes
The issue was caused by the temporary CD layers being allocated for subsurf
meshes, same as we've got back in 881fb43.

In the long run this temporary storage is to be re-considered, but it'll also
imply re-considering of the Derivedmesh interaction as well. For now let's
use a simpler solution which is forbidding modifiers to call getArray for other
objects' derivedMeshes but use an API calls which would allocate local copy of
the data preventing race condition of shared data in DM.
2014-05-03 16:13:01 +02:00
a2c107aef1 Code cleanup: use 'const' for arrays (blenkernel) 2014-04-27 00:25:15 +10:00
55d75f5020 Code cleanup: correct abs use
also minor cleanup to rotation code
2014-04-21 02:02:21 +10:00
fed1b8b16d Code cleanup: suffix vars to make obvious they are squared 2014-02-03 02:46:45 +11:00
4503f82ba2 Fix T38312: Crash when using snap transform in edit mode
Issue was caused by uninitialized boolean flag.
2014-01-22 16:32:52 +06:00
881fb43878 Make bvhutil safe for multi-threaded usage
There were couple of reasons why it wasn't safe for usage from
multiple threads.

First of all, it was trying to cache BVH in derived mesh, which
wasn't safe because multiple threads might have requested BVH
tree and simultaneous reading and writing to the cache became a
big headache.

Solved this with RW lock so now access to BVH cache is safe.

Another issue is causes by the fact that it's not guaranteed
DM to have vert/edge/face arrays pre-allocated and when one
was calling functions like getVertDataArray() array could
have been allocated and marked as temporary. This is REALLY
bad, because NO ONE is ever allowed to modify data which
doesn't belong to him. This lead to situations when multiple
threads were using BVH tree and they run into race condition
with this temporary allocated arrays.

Now bvhtree owns allocated arrays and keeps track of them, so
no race condition happens with temporary data stored in the
derived mesh. This solved threading issues and likely wouldn't
introduce noticeable slowdown. Even when DM was keeping track
of this arrays, they were re-allocated on every BVH creation
anyway, because those arrays were temporary and were freed
with dm->release() call.

We might re-consider this a bit and make it so BVH trees are
allocated when DM itself is being allocated based on the DAG
layout, but that i'd consider an optimization and not something
we need to do 1st priority.

Fixes crash happening with 05_4g_track.blend from Mango after
the threaded object update landed to master.
2014-01-13 15:57:52 +06:00
2b946f4297 Fix T37445: Crash with snapping and shrink-wrap modifier.
Developer note:
BVHTREE_FROM_FACES was being used for both edit-mesh and derived-mesh
bvh-trees, this could cause index lookup errors in editmode.
Fix by adding a new type for editmesh so theres no confusion.
2013-11-19 14:31:26 +11:00
beae4f498d code cleanup: spelling 2013-10-31 14:10:01 +00:00
b20c3f97a4 rename presets not to use '+' character, also some typo fixes. 2013-10-05 14:19:39 +00:00
3e4db4969c code cleanup: remove unused 'dm' arg from BVHTreeFromMesh. 2013-05-08 12:53:34 +00:00
3b8221045f simple optimizations for bvhtree_from_mesh_faces() for editmesh, was quite inefficient (unneeded loops, not breaking out of face loop early).
also correct own oversight - use TRANSFORM_DIST_MAX_RAY rather then when checking for max value in snapDerivedMesh.
2013-04-24 00:25:12 +00:00
b64ec6c51e alternate fix for [#24887] - r33294.
Casting a ray onto an editmesh was building a derivedMesh, raytree, then freeing for every ray-cast.
Noticed while using ruler+snapping in editmode.

Instead of attempting to align the MFace and edit-mesh tessfaces, just use editmesh for ray-casting.
2013-04-23 23:57:27 +00:00
6da961775f code cleanup: rename BKE_tessmesh -> BKE_editmesh, rename EditDerivedBMesh.tc -> em. ('tc' is odd name which isn't used elsewhere). 2013-04-13 20:31:52 +00:00
c411cde415 header cleanup, include BLI before BKE, also use bool for ntreeShaderExecTree 2013-01-24 21:57:13 +00:00
f3ece5a108 style cleanup: trailing tabs & expand some non prefix tabs into spaces. 2012-10-21 05:46:41 +00:00
c56a911cd9 style cleanup: comments 2012-10-20 20:20:02 +00:00
84bf3e48c0 style cleanup: use c style comments in C code 2012-07-06 23:56:59 +00:00
be21080cb6 Provide ray hit/nearest information on which side of the quad the ray hit.
Patch by MiikaH.
2012-05-30 12:53:13 +00:00
ffed654ff2 style cleanup: blenkernel 2012-05-06 17:22:54 +00:00
343edf2722 style cleanup: function calls & whitespace. 2012-04-29 17:11:40 +00:00
e701f9b670 style cleanup: whitespace / commas 2012-04-29 15:47:02 +00:00
b340f930ec style cleanup: changes to brace placement / newlines - for/while/if/switch 2012-04-28 06:31:57 +00:00
475ecbb0ce remove BM_ITER, BM_ITER_INDEX macros, use ELEM or MESH variants only (the maceros had unused args in both cases). 2012-04-19 13:47:58 +00:00
75b869e428 style cleanup: BM_ITER / BM_ITER_INDEX / BMO_ITER 2012-04-19 11:44:12 +00:00
69e6894b15 style cleanup: follow style guide for formatting of if/for/while loops, and else if's 2012-03-24 06:18:31 +00:00
9773f87891 bmesh docs:
- add examples for custom-data access
- group BMesh types logically in docs
- added missing docstrings

needed to add grouping functionality to sphinx for this.
2012-03-21 05:33:37 +00:00
303cecf139 spelling cleanup: tesselate -> tessellate (last of these found) 2012-03-20 22:56:26 +00:00
4f19c1a995 spelling cleanup 2012-03-18 07:38:51 +00:00
c21c58f44c style cleanup, also remove unused externs. 2012-03-11 19:09:01 +00:00
46045fbb09 style cleanup - braces & else / if's 2012-03-07 04:53:43 +00:00
95670e03a0 style cleanup / comment formatting for bli/bke/bmesh 2012-03-03 20:19:11 +00:00
7bbf4b7831 style cleanup
- spelling - turns out we had tessellation spelt wrong all over.
- use \directive for doxy (not @directive)
- remove BLI_sparsemap.h - was from bmesh merge IIRC but entire file commented and not used.
2012-03-02 16:05:54 +00:00
a368e6771a - remove some unused editmesh functions.
- copy & rename EditMesh stricts for use with scanfill (remove unused members)
2012-02-19 22:17:30 +00:00
b6dcdb065d code refactor, function renaming for bmesh.
These changes are to make the bmesh api more consistent and easier to learn, grouping similar functions which is convenient for autocomplete.
This uses similar convention to RNA. 

* use face/loop/edge/vert as a prefix for functions.
* use 'elem' as a prefix too for functions that can take any type with a BMHeader.
* changed from camel case to underscore separated (like RNA).
2012-02-12 10:51:45 +00:00
8b43813b69 rename BM_ flags for BMHeader->hflag to BM_ELEM_ to be more clear that these flags apply to bmesh elements. 2012-02-12 06:24:12 +00:00
d65a5a92f9 assertion when bvhtree_from_mesh_faces is called and tessfaces dont exist. 2012-01-23 20:46:38 +00:00
b64f352270 svn merge ^/trunk/blender -r43033:43062 2012-01-02 02:57:36 +00:00
ab097223d4 Fix [#29556] shrinkwrap generates spikes if vertices fall exactly on the edge
bvhtree_ray_tri_intersection now using isect_ray_tri_epsilon_v3 with FLT_EPSILON. All devs I asked (incuding ones in physics/painting areas) were rather OK with this change, and better to do it now, with more than one month to detect regressions, if any!
2012-01-01 16:37:01 +00:00
f07df7287e manual sync with trunk - pulling in changes where the issues are not bmesh spesific
- some merges added lines in multiple times
- removed some NULL checks that were only in bmesh
- enable cycles by default (was disabled because it used not to work)
- make formatting match
2011-12-04 23:13:28 +00:00
92d35b74e7 svn merge -r41722:41723 ^/trunk/blender 2011-11-11 06:25:45 +00:00
edec46b0a6 Merge with trunk r41625 2011-11-07 16:36:49 +00:00
7508540c53 svn merge -r41575:41602 ^/trunk/blender 2011-11-07 07:01:24 +00:00
85540d5aa7 more macro --> BLI math lib, mainly replace VECCOPY in render and blenkernel. 2011-11-06 16:38:21 +00:00
ec3b0c6a96 misc macro --> bli math lib functions 2011-11-06 15:17:43 +00:00
46ae692710 Merge with trunk r41342 2011-10-28 17:00:53 +00:00
fae903e263 Dynamic Paint:
* More code changes pointed by Brecht in codereview.
* Some user interface improvements.
* Updating brush settings now also updates canvas preview.
2011-10-28 14:46:09 +00:00
15e6d6cd75 svn merge ^/trunk/blender -r41226:41227 . 2011-10-24 12:43:08 +00:00
ad1d3dd30f svn merge ^/trunk/blender -r41175:41200 --- will need to apply fix after 2011-10-24 07:56:42 +00:00
4a04f72069 remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n 2011-10-23 17:52:20 +00:00
d4541fd891 Merge with trunk r41197 2011-10-22 16:43:23 +00:00