diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2019-05-31 11:20:48 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2019-05-31 13:39:21 +0300 |
commit | d0fb602e2c365025131c782c1bc9b7d60013a678 (patch) | |
tree | 87259398ab6c5f540b4df31164bbf370ed033d4a /source | |
parent | 2f78bd1d5220deb31f3db3dabb905d7dc4cf6ee3 (diff) |
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
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 20 |
1 files changed, 19 insertions, 1 deletions
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) |