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:
authorGermano Cavalcante <germano.costa@ig.com.br>2020-03-09 17:59:57 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2020-03-09 18:00:11 +0300
commit93f636957346f33e7a69b0b4caf0ac48a0a9bf42 (patch)
tree4b374acdb6d9ae599ecf20bba3129a6b25064422 /source/blender/gpu/intern/gpu_buffers.c
parent598ab525da3df3fef2033c159c570688c7282a8f (diff)
Fix T74533: Crash when entering sculpt mode
Apparently this happened when the object is in a flat view and has customdata `CD_SCULPT_FACE_SETS` Differential Revision: https://developer.blender.org/D7073
Diffstat (limited to 'source/blender/gpu/intern/gpu_buffers.c')
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index 4f02e3d9a2a..09d97dcdb84 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -367,6 +367,15 @@ void GPU_pbvh_mesh_buffers_update(GPU_PBVH_Buffers *buffers,
buffers->mvert = mvert;
}
+static bool gpu_pbvh_is_looptri_visible(const MLoopTri *lt,
+ const MVert *mvert,
+ const MLoop *mloop,
+ const int *sculpt_face_sets)
+{
+ return (!paint_is_face_hidden(lt, mvert, mloop) && sculpt_face_sets &&
+ sculpt_face_sets[lt->poly] > 0);
+}
+
/* Threaded - do not call any functions that use OpenGL calls! */
GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build(const int (*face_vert_indices)[3],
const MPoly *mpoly,
@@ -392,8 +401,7 @@ GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build(const int (*face_vert_indices)[3],
/* Count the number of visible triangles */
for (i = 0, tottri = 0; i < face_indices_len; i++) {
const MLoopTri *lt = &looptri[face_indices[i]];
- if (!paint_is_face_hidden(lt, mvert, mloop) && sculpt_face_sets &&
- sculpt_face_sets[lt->poly] > 0) {
+ if (gpu_pbvh_is_looptri_visible(lt, mvert, mloop, sculpt_face_sets)) {
int r_edges[3];
BKE_mesh_looptri_get_real_edges(mesh, lt, r_edges);
for (int j = 0; j < 3; j++) {
@@ -430,7 +438,7 @@ GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build(const int (*face_vert_indices)[3],
const MLoopTri *lt = &looptri[face_indices[i]];
/* Skip hidden faces */
- if (paint_is_face_hidden(lt, mvert, mloop)) {
+ if (!gpu_pbvh_is_looptri_visible(lt, mvert, mloop, sculpt_face_sets)) {
continue;
}
@@ -461,8 +469,7 @@ GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build(const int (*face_vert_indices)[3],
const MLoopTri *lt = &looptri[face_indices[i]];
/* Skip hidden faces */
- if (paint_is_face_hidden(lt, mvert, mloop) ||
- (sculpt_face_sets && sculpt_face_sets[lt->poly] < 0)) {
+ if (!gpu_pbvh_is_looptri_visible(lt, mvert, mloop, sculpt_face_sets)) {
continue;
}