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.
This commit is contained in:
parent
c67873e49b
commit
1a64f97b9e
Notes:
blender-bot
2023-02-14 10:11:54 +01:00
Referenced by issue #81161, Scene "bread crumbs" in the middle of the panels when opening old files Referenced by issue #81126, Assert going to Texture Paint workspace without a UVMap
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue