Commit Graph

132 Commits

Author SHA1 Message Date
230c272fe3 Comments: note on bmesh_region_match
also correct buffer type
2014-10-03 08:21:14 +02:00
58305c9403 Sculpt: check mask is present before reading 2014-09-14 17:46:48 +10:00
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
312d3edee5 Hidden PBVH nodes:
Set hidden when rebuilding the PBVH tree if all primitives are hidden.
2014-05-05 22:24:13 +03:00
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
169f831394 Make sure we invalidate the node ID layer each time the PBVH is reset.
It makes code more tidy (avoids having to call invalidation on a myriad
places). Also makes sure other invalidation cases (some mesh change,
e.g.) work as expected.
2014-04-17 20:53:40 +03:00
38eef8deee Refactor to Dyntopo node customdata commit.
Don't use a dedicated node layer but use temporary int layer instead.
Works like a charm as long as we are careful resetting the layer when
needed (after pbvh clearing and always after bmesh has been filled in
undo)

Tip by Campbell, thanks!
2014-04-17 19:03:08 +03:00
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
b179647d52 Dyntopo: slightly change node invalidation, only vertices can change BB
recalculation, only faces can change normal invalidation.
2014-04-16 02:10:24 +03:00
2025e4cbb9 Code cleanup: quiet warnings & style 2014-04-13 11:26:31 +10:00
0b50ea5a88 Fix redraw and undo issues with hidden parts in dyntopo after recent
changes.
2014-04-11 15:02:31 +03:00
a15b3c4d11 Code cleanup: use bool 2014-04-11 11:33:29 +10:00
7cdaf56b30 Dyntopo: use hidden face flags in more places 2014-04-11 07:51:14 +10:00
6292b60a3f Dyntopo: Minor display optimization.
While hiding, flush the hidden flags to the faces. This avoids iterating
through all the loops while updating the GPU buffers.
2014-04-10 22:31:39 +03:00
ebaf3781fa Dyntopo: replace GHash with GSet, saves some memory 2014-04-08 14:45:48 +10:00
412826a504 Mempool: delay allocating an initial chunk, its not always used 2014-04-08 12:58:56 +10:00
b95e826841 Code cleanup: remove unused functions and convert int -> bool 2014-04-07 17:00:08 +10:00
2527d0ce8f Dyntopo: minor speedups with bmesh use. 2014-04-07 13:48:36 +10:00
212717416b Dyntopo: avoid mask layer lookups while adding/removing verts 2014-04-07 13:05:39 +10:00
1e504bc123 Dyntopo: minor optimizations for edge queue 2014-04-05 16:30:55 +11:00
61c73b49d3 Remove redundant call to CustomData_get_offset 2014-04-05 12:32:25 +11:00
af59ee340f Mempool: remove BLI_MEMPOOL_SYSMALLOC, MEM_* allocs are more efficient now 2014-04-05 12:14:05 +11:00
321c35ec6c Solve issue with dyntopo collapse.
It was possible to delete a masked vertex during collapsing. Looks like
this is one of the causes for hangs during masked flood filling.
2014-04-05 02:31:36 +03:00
45b02cee47 Code cleanup: no need to use calloc when memory is initialized after
also replace AT with __func__ since AT expands the full pathname
2014-04-04 14:26:01 +11:00
7c513f5913 Fix some redrawing and possibly other issues in dyntopo:
When node face gets deleted, added or exchanged, the nodes should update
their draw buffers, normals and bounding boxes. This was not being done
before so there were graphical glitches apparent, especially in collapse
mode.
2014-04-02 00:57:33 +03:00
617557b08e Code cleanup: remove TRUE/FALSE & WITH_BOOL_COMPAT define 2014-04-01 15:22:28 +11:00
3214d4fd5a Code Cleanup: PBVH, avoid sqrt and use bool for raycast functions 2014-03-24 13:21:58 +11:00
7d64054798 Change to sampling: Take biggest triangle side as detail size on
intersection, since detail determines the maximum allowed triangle edge
size
2014-03-23 21:49:01 +02:00
e732c5809c Detail sampling operator
Located on topology panel.

To use just click on button and click on mesh.
Operator will just use the dimensions of the triangles below to set the
constant detail setting.

Also changed pair of scale/detail size with nice separate float
percentage value.
2014-03-22 23:35:41 +02:00
0ef416722e Flood fill for dyntopo constant detail mode.
Nothing spectacular here, fill tools are easy. Just take the dyntopo
code and repeat until nothing more to do.

The tool can be located in the dyntopo panel when the dyntopo constant
detail is on.

Also added scale factor for constant detail. This may change when detail
sampling gets in, I am not very happy with having two numbers here,
still it will give some more control for now.
2014-03-22 17:47:18 +02:00
37026b12ec Code cleanup: use bool for static methods 2014-02-05 22:36:15 +11:00
62aa004c25 Style Cleanup: whitespace 2014-01-12 22:05:24 +11:00
d9697bc145 Fix T38024 crash when rebuilding sculpt mode buffers.
Main issue here is that glBuf* calls were invoked from threads different than
main thread. This caused a crash (since those do not have a GL context active).

Fix here is twofold:
* add an ID buffer in buffer pool that handles pbvh buffers and is freed
from main thread when gpu_buffer_pool_free_unused is called.

* do not create glbuffers in derivedmesh creation routine, rather tag nodes
for update and create those in the draw function
(guaranteed to be called from main thread)

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D169
2014-01-05 04:58:27 +02:00
ba8d65a9a7 Code clean-up change naming of gpu buffers used by pbvh to better
reflect that. Previous name GPU_Buffers was very similar to GPU_Buffer,
renamed to GPU_PBVH_Buffers
2014-01-03 12:48:12 +02:00
c1c26c36f6 Style Cleanup: remove preprocessor indentation (updated wiki style guide too) 2013-12-22 14:12:19 +11:00
cbba50a3a1 fix for over-alloc in dyntopo, was allocating the vertex size, not pointer size (~85% wasted space). 2013-10-13 05:13:38 +00:00
ea8b44cc15 style cleanup 2013-10-09 21:19:25 +00:00
cdb8736f83 Fix #36930: dynamic topology sculpting with masks gave bad results:
* The mask was not subdivided properly on splitting edges, which gave interesting
  but definitely wrong fractal-like borders around masks.

* Edge splitting was only done where the mask was < 50%, with the reasoning that
  you can't do a 50% topology update. But this gives an ugly border in the mesh.
  The mask should already make the brush move the vertices only 50%, which means
  that topology updates will also happen less frequent, that should be enough.
2013-10-04 13:40:21 +00:00
98ee7fdd9a Fix an own regression introduced in the dyntopo cleanup commits. Do not
remove a vertex from the pbvh if the only face it was part of was
removed from the pbvh. This should work but no time to investigate now
properly, and better have a solid release. The problem could be seen
when sculpting to open meshes. Some vertices and faces on the boundaries
would become stuck and unresponsive.
2013-10-02 22:18:23 +00:00
8beb565c59 code cleanup: headers - doxy comments. 2013-09-12 03:02:50 +00:00
ba9b7e6a20 avoid calling CustomData_bmesh_get to get CD_PAINT_MASK per vertex while sculpting, store offset directly. 2013-08-27 20:39:08 +00:00
bbce51d116 replace hashes with sets where possible. 2013-08-25 20:03:45 +00:00
09a52f18b6 ghash: reserve size when its known or can be guessed close enough.
also avoid allocs per node in pbvh_bmesh_node_limit_ensure()
2013-08-24 17:33:47 +00:00
a31db0c7e9 rename recently added BLI_ghash_assign() -> BLI_ghash_reinsert() 2013-08-21 16:06:03 +00:00
dcddd32c45 Scultping: Growing the pbvh node container should use malloc instead of
calloc. Since we copy the first 1/1.3 part of the new array from the
existing nodes, only the rest 0.3/1.3 should be initialized to zero.
This should in theory cut down the times of occasional hangs with
dyntopo, since my guess is that it is caused by dynamic reallocations.
Maybe a linked list structure would help here? This is a bigger change
though, leaving as is for now.

Also, minor cleanup, delete duplicate ghash deletion and remove unneeded
commented code.
2013-08-21 15:21:56 +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
89c7cf1a49 style cleanup: also use ARRAY_HAS_ITEM macro for mempool check 2013-08-21 02:29:13 +00:00
789ee1bfcc Dyntopo:
* Actually check if normal recalculation flags exists and set it when
splitting nodes in dyntopo. Right now, nodes that need GPU buffer update
will always get in the list to get their normals generated, but to avoid
a possible future breakage better do it right now.
* Avoid keeping deleted/removed vertices in vertex-to-node and unique
vertex hashes, since some checks rely on those and may go awry if these
still exist. Also they pollute the hashes, and may hurt performance
somewhat.
2013-08-19 17:37:21 +00:00
6f88dca9c3 Dyntopo:
Turn off pbvh normal update flag after recalculation, saves
recalculating normals every frame when not stroking the mesh.

For this to work reliably with undo we need to support original normals
in the bm_log (was marked as a TODO already in the code), so that
undoing avoids having invalid normals in the mesh (since we don't update
every frame anymore). This was added in this commit as well.

Also added some (disabled) quite paranoid checks in the bmesh valication
code for dyntopo hoping to catch the real normal update issue. No luck
there yet.
2013-08-19 14:08:59 +00:00