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
This commit is contained in:
Jeroen Bakker 2019-05-31 10:20:48 +02:00
parent 2f78bd1d52
commit d0fb602e2c
Notes: blender-bot 2023-04-14 15:37:01 +02:00
Referenced by issue #70564, Sculpt Mask not visible (Show mask enabled)
Referenced by issue #67303, mask visibility in sculpt mode using shape keys or generative modifiers
1 changed files with 19 additions and 1 deletions

View File

@ -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)