Commit: d0fb602e2c365025131c782c1bc9b7d60013a678
Author: Jeroen Bakker
Date:   Fri May 31 10:20:48 2019 +0200
Branches: master
https://developer.blender.org/rBd0fb602e2c365025131c782c1bc9b7d60013a678

DrawManager: Sculpt Mesh Drawing

More accurate determination when to draw the PBVH and when to draw the
regular mesh. PBVH drawing is done for Multires, Dyntopo and normal
sculpting with no active modifiers.

Maniphest Tasks: T62070

Differential Revision: https://developer.blender.org/D4731

===================================================================

M       source/blender/draw/intern/draw_manager.c

===================================================================

diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index cee00a359c1..10e9b8fbdf0 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -44,6 +44,7 @@
 #include "BKE_object.h"
 #include "BKE_particle.h"
 #include "BKE_paint.h"
+#include "BKE_pbvh.h"
 #include "BKE_pointcache.h"
 
 #include "draw_manager.h"
@@ -216,9 +217,26 @@ bool DRW_object_use_hide_faces(const struct Object *ob)
   return false;
 }
 
+/* Should we use PBVH drawing or regular mesh drawing
+ * PBVH drawing should be used for
+ *  - Multires
+ *  - Dyntopo
+ *  - Normal sculpt without any active modifiers
+ */
 bool DRW_object_use_pbvh_drawing(const struct Object *ob)
 {
-  return ob->sculpt && (ob->sculpt->mode_type == OB_MODE_SCULPT);
+  SculptSession *ss = ob->sculpt;
+  if (ss == NULL || ss->pbvh == NULL || ob->sculpt->mode_type != 
OB_MODE_SCULPT) {
+    return false;
+  }
+
+  if (BKE_pbvh_type(ss->pbvh) == PBVH_FACES) {
+    return !(ss->kb || ss->modifiers_active);
+  }
+  else {
+    /* Multires/Dyntopo */
+    return true;
+  }
 }
 
 bool DRW_object_is_visible_psys_in_active_context(const Object *object, const 
ParticleSystem *psys)

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to