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
path: root/source
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2018-12-06 16:34:29 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-12-06 16:42:25 +0300
commitb576e14902061868f040a59d60225752ac4b55c7 (patch)
tree28cb83995da705702302d464b21c9ee2663ab183 /source
parentda7f00b9c954c7eea83e88690dd9c18aa7907bc7 (diff)
DRW: Fix Uvs not working in solid mode + edit mesh
Diffstat (limited to 'source')
-rw-r--r--source/blender/draw/intern/draw_cache_impl_mesh.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 2c924ebce74..d8d17d1bab7 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -2730,7 +2730,18 @@ static GPUVertBuf *mesh_batch_cache_get_tri_uv_active(
if (cache->tri_aligned_uv == NULL) {
const MLoopUV *mloopuv = rdata->mloopuv;
- if (mloopuv == NULL) {
+ int layer_offset;
+ BMEditMesh *embm = rdata->edit_bmesh;
+
+ /* edit mode */
+ if (rdata->edit_bmesh) {
+ BMesh *bm = embm->bm;
+ layer_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
+ if (layer_offset == -1) {
+ return NULL;
+ }
+ }
+ else if (mloopuv == NULL) {
return NULL;
}
@@ -2750,14 +2761,8 @@ static GPUVertBuf *mesh_batch_cache_get_tri_uv_active(
int vbo_len_used = 0;
GPU_vertbuf_data_alloc(vbo, vbo_len_capacity);
-
- BMEditMesh *embm = rdata->edit_bmesh;
/* get uv's from active UVMap */
if (rdata->edit_bmesh) {
- /* edit mode */
- BMesh *bm = embm->bm;
-
- const int layer_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
for (uint i = 0; i < tri_len; i++) {
const BMLoop **bm_looptri = (const BMLoop **)embm->looptris[i];
if (BM_elem_flag_test(bm_looptri[0]->f, BM_ELEM_HIDDEN)) {
@@ -2785,7 +2790,10 @@ static GPUVertBuf *mesh_batch_cache_get_tri_uv_active(
vbo_len_used = vidx;
- BLI_assert(vbo_len_capacity == vbo_len_used);
+ if (vbo_len_capacity != vbo_len_used) {
+ GPU_vertbuf_data_resize(vbo, vbo_len_used);
+ }
+
UNUSED_VARS_NDEBUG(vbo_len_used);
}