Commit Graph

38 Commits

Author SHA1 Message Date
45e929dc12 Cleanup: redundant casts 2015-04-18 00:16:05 +10:00
02fba106fa Dyntopo: save 4 bytes per BMLogVert 2015-04-17 18:07:08 +10:00
e05f719b8b Dyntopo: avoid redundant lookup on original data 2015-04-17 17:34:14 +10:00
6d2c3a2456 BMesh: avoid ghash realloc's making log entry 2015-04-12 17:38:14 +10:00
17b4f57bf0 Missed this last commit (dyntopo hashing) 2015-04-12 11:12:57 +10:00
ccf44c400c BMesh: simplify hashing for dyntopo
Was using pointer hashing when the keys are in fact uint's.
Since they're well distributed from the rangetree,
no need to do bit-shifting tricks. just use int as hash.
Gives ~8% speedup in own tests.
2015-04-11 23:36:37 +10:00
26e50295ce Use BKE_ghash_ensure_p where possible 2015-04-06 20:41:37 +10:00
7d040d2a08 Cleanup: use BLI_listbase_*** prefix for count,sort,sort_r 2014-11-16 13:57:58 +01:00
a8705e99ee Sculpt: minor speedup for dyntopo
Add retake to range-tree to avoid double lookup.
2014-10-07 21:02:08 +02:00
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
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
0b50ea5a88 Fix redraw and undo issues with hidden parts in dyntopo after recent
changes.
2014-04-11 15:02:31 +03:00
69d2af7643 Support logging of modified faces in dyntopo.
This is meant to support undo when hiding parts of the mesh.
Also avoid rebuilding the PBVH in that case as well (no nodes split)
2014-04-11 02:29:59 +03:00
412826a504 Mempool: delay allocating an initial chunk, its not always used 2014-04-08 12:58:56 +10:00
212717416b Dyntopo: avoid mask layer lookups while adding/removing verts 2014-04-07 13:05:39 +10:00
af59ee340f Mempool: remove BLI_MEMPOOL_SYSMALLOC, MEM_* allocs are more efficient now 2014-04-05 12:14:05 +11: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
5873160242 Code cleanup: strict flags for bmesh_log 2014-04-03 17:13:31 +11:00
8beb565c59 code cleanup: headers - doxy comments. 2013-09-12 03:02:50 +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
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
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
754b4ab3bc add hash function BLI_ghash_assign, BLI_edgehash_assign
avoids remove,insert and only hashes the key once.
2013-08-18 03:41:39 +00:00
0d5b028d43 patch [#34103] use boolean in path functions and add comments.
path_util_1.patch from Lawrence D'Oliveiro (ldo)
2013-03-04 19:27:51 +00:00
89bda7899d style cleanup & some spelling 2013-02-03 10:28:28 +00:00
f0d4b85fef improve BMesh api use from r54265, no need to do edge lookups from the faces verts since the face stores these already.
also remove ScrArea.cursor, historic runtime variable.
2013-02-03 02:54:24 +00:00
ad2b4c6e54 Remove loose edges created during undo in dynamic-topology sculpt mode
Fixes [#34043] "Dyntopo: noise appear during sculpting (parasite edges)"
projects.blender.org/tracker/index.php?func=detail&aid=34043&group_id=9&atid=498
2013-02-02 16:54:18 +00:00
c37bc8fa76 minor optimization - don't do double lookups on vertex mask layer for vert_mask_get(), vert_mask_set().
add an assert because if the mesh is in an invalid state the mask layer can exist but the mask pointer still be NULL (noticed this while looking into a different bug).
2013-01-28 04:10:47 +00:00
774ff1c246 style cleanup: also remove unneeded NULL check. 2013-01-28 01:59:59 +00:00
38cee985bb code cleanup: style & warnings. 2013-01-21 02:30:40 +00:00
f251eb3f0c minor dyntopo speedup: was doing 2x ghash lookups for BM_log_face_removed(), BM_log_vert_removed(), only one needed. 2013-01-19 00:53:33 +00:00
5ddc7d64a8 optimize bmesh operations that use triangle BMFace's (dyn-topo and mesh conversion). 2013-01-16 21:09:54 +00:00
b27854bd47 use booleans for bmesh api. 2013-01-14 16:42:43 +00:00
e24443b79a style cleanup 2013-01-09 03:30:15 +00:00
1aebc0e790 style cleanup 2012-12-31 02:37:28 +00:00
2e9cb31c02 Add BMLog for efficiently storing changes to vertices and faces
The BMLog is an interface for storing undo/redo steps as a BMesh is
modified. It only stores changes to the BMesh, not full copies.

Currently it supports the following types of changes:
- Adding and removing vertices
- Adding and removing faces
- Moving vertices
- Setting vertex paint-mask values
- Setting vertex hflags
2012-12-30 18:24:08 +00:00