[Bf-blender-cvs] [1a64f97b9e1] master: Fix T81126: Assert going to Texture Paint workspace without a UVMap
Jeroen Bakker
noreply at git.blender.org
Fri Sep 25 11:29:09 CEST 2020
Commit: 1a64f97b9e1227f67052a00c1eccc636e806c97d
Author: Jeroen Bakker
Date: Fri Sep 25 11:27:34 2020 +0200
Branches: master
https://developer.blender.org/rB1a64f97b9e1227f67052a00c1eccc636e806c97d
Fix T81126: Assert going to Texture Paint workspace without a UVMap
Assert happened as it could not create uv batches without an UVMap.
Solution is to only request those batches when the UVMaps are available.
===================================================================
M source/blender/draw/engines/overlay/overlay_edit_uv.c
===================================================================
diff --git a/source/blender/draw/engines/overlay/overlay_edit_uv.c b/source/blender/draw/engines/overlay/overlay_edit_uv.c
index adbf7168394..bc41042ef02 100644
--- a/source/blender/draw/engines/overlay/overlay_edit_uv.c
+++ b/source/blender/draw/engines/overlay/overlay_edit_uv.c
@@ -24,6 +24,7 @@
#include "draw_cache_impl.h"
#include "draw_manager_text.h"
+#include "BKE_editmesh.h"
#include "BKE_image.h"
#include "DNA_mesh_types.h"
@@ -286,12 +287,18 @@ void OVERLAY_edit_uv_cache_populate(OVERLAY_Data *vedata, Object *ob)
OVERLAY_StorageList *stl = vedata->stl;
OVERLAY_PrivateData *pd = stl->pd;
GPUBatch *geom;
- const bool is_edit_object = DRW_object_is_in_edit_mode(ob);
const DRWContextState *draw_ctx = DRW_context_state_get();
+ const bool is_edit_object = DRW_object_is_in_edit_mode(ob);
+ Mesh *me = (Mesh *)ob->data;
+ const bool has_active_object_uvmap = CustomData_get_active_layer(&me->ldata, CD_MLOOPUV) != -1;
+ const bool has_active_edit_uvmap = is_edit_object &&
+ (CustomData_get_active_layer(&me->edit_mesh->bm->ldata,
+ CD_MLOOPUV) != -1);
const bool draw_shadows = (draw_ctx->object_mode != OB_MODE_OBJECT) &&
(ob->mode == draw_ctx->object_mode);
- if (is_edit_object) {
+
+ if (has_active_edit_uvmap) {
if (pd->edit_uv.do_uv_overlay) {
geom = DRW_mesh_batch_cache_get_edituv_edges(ob->data);
if (geom) {
@@ -316,8 +323,6 @@ void OVERLAY_edit_uv_cache_populate(OVERLAY_Data *vedata, Object *ob)
}
if (pd->edit_uv.do_uv_stretching_overlay) {
- Mesh *me = ob->data;
-
if (pd->edit_uv.draw_type == SI_UVDT_STRETCH_ANGLE) {
geom = DRW_mesh_batch_cache_get_edituv_faces_stretch_angle(me);
}
@@ -328,14 +333,13 @@ void OVERLAY_edit_uv_cache_populate(OVERLAY_Data *vedata, Object *ob)
geom = DRW_mesh_batch_cache_get_edituv_faces_stretch_area(
me, &totals->total_area, &totals->total_area_uv);
}
-
if (geom) {
DRW_shgroup_call_obmat(pd->edit_uv_stretching_grp, geom, NULL);
}
}
}
- if (draw_shadows) {
+ if (draw_shadows && (has_active_object_uvmap || has_active_edit_uvmap)) {
if (pd->edit_uv.do_uv_shadow_overlay) {
geom = DRW_mesh_batch_cache_get_uv_edges(ob->data);
if (geom) {
More information about the Bf-blender-cvs
mailing list