Changes around update normals from PBVH to CDDM
- Only do this if PBVH is not used for display, this should correspond to whats' happening in sculpt.c now. - No need to do such synchronization for solid drawing, it supports optimal display from PBVH. In fact, such synchronization is only needed in the following case: Drawing callback does not support PBVH draw and sculpt session is configured to use PBVH for display and related operations.
This commit is contained in:
parent
2414832bf1
commit
7776f03873
Notes:
blender-bot
2023-02-14 08:18:19 +01:00
Referenced by issue #47170, Sculpt mode with Mask modifier enabled result an instant crash
|
@ -343,8 +343,19 @@ static void cdDM_update_normals_from_pbvh(DerivedMesh *dm)
|
|||
CDDerivedMesh *cddm = (CDDerivedMesh *) dm;
|
||||
float (*face_nors)[3];
|
||||
|
||||
/* constructive modifiers handle their own normals */
|
||||
if (!dm->deformedOnly) {
|
||||
/* Some callbacks do not use optimal PBVH draw, so needs all the
|
||||
* possible data (like normals) to be copied from PBVH back to DM.
|
||||
*
|
||||
* This is safe to do if PBVH and DM are representing the same mesh,
|
||||
* which could be wrong when modifiers are enabled for sculpt.
|
||||
* So here we only doing update when there's no modifiers applied
|
||||
* during sculpt.
|
||||
*
|
||||
* It's safe to do nothing if there are modifiers, because in this
|
||||
* case modifier stack is re-constructed from scratch on every
|
||||
* update.
|
||||
*/
|
||||
if(!cddm->pbvh_draw) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -456,9 +467,6 @@ static void cdDM_drawFacesSolid(
|
|||
glShadeModel(GL_FLAT);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
cdDM_update_normals_from_pbvh(dm);
|
||||
}
|
||||
}
|
||||
|
||||
GPU_vertex_setup(dm);
|
||||
|
|
Loading…
Reference in New Issue