Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-05-31 15:04:16 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-05-31 18:17:03 +0300
commit692891f69ea42af0ba890f5f92cbd1a3260442c9 (patch)
tree1aeb9469b7a2b26a8a25a09c6045faa51d34944b /source/blender/blenkernel/intern/paint.c
parent9899999e944c0d954dbe5a7aa96c8e1680e7b3f8 (diff)
Fix sculpt mode drawing with modifiers still being wrong in some cases
Centralize logic for when to use the PBVH for drawing, fix missing tests in mask drawing, fix missing tests for multiple windows, only do more expensive update for all viewports at end of the stroke.
Diffstat (limited to 'source/blender/blenkernel/intern/paint.c')
-rw-r--r--source/blender/blenkernel/intern/paint.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 5849d691b03..4de425acfc0 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -1512,3 +1512,23 @@ void BKE_sculpt_bvh_update_from_ccg(PBVH *pbvh, SubdivCCG *subdiv_ccg)
subdiv_ccg->grid_flag_mats,
subdiv_ccg->grid_hidden);
}
+
+/* Test if PBVH can be used directly for drawing, which is faster than
+ * drawing the mesh and all updates that come with it. */
+bool BKE_sculptsession_use_pbvh_draw(const Object *ob, const View3D *v3d)
+{
+ SculptSession *ss = ob->sculpt;
+ if (ss == NULL || ss->pbvh == NULL || ss->mode_type != OB_MODE_SCULPT) {
+ return false;
+ }
+
+ if (BKE_pbvh_type(ss->pbvh) == PBVH_FACES) {
+ /* Regular mesh only draws from PBVH without modifiers and shape keys. */
+ const bool full_shading = (v3d && (v3d->shading.type > OB_SOLID));
+ return !(ss->kb || ss->modifiers_active || full_shading);
+ }
+ else {
+ /* Multires and dyntopo always draw directly from the PBVH. */
+ return true;
+ }
+}