Fix #133198: Overlay-Next: Texture Paint workspace crash

Regression from 1406b9e656
Ensure it matches the Overlay Legacy behavior.
This commit is contained in:
Miguel Pozo 2025-01-17 22:59:39 +01:00
parent e8bc7ec68b
commit 0a72db9f94

View file

@ -718,49 +718,51 @@ class MeshUVs : Overlay {
Object &ob = *ob_ref.object; Object &ob = *ob_ref.object;
Mesh &mesh = *static_cast<Mesh *>(ob.data); Mesh &mesh = *static_cast<Mesh *>(ob.data);
const bool has_active_edit_uvmap = const bool is_edit_object = DRW_object_is_in_edit_mode(&ob);
(CustomData_get_active_layer(&mesh.runtime->edit_mesh->bm->ldata, CD_PROP_FLOAT2) != -1); const bool has_active_object_uvmap = CustomData_get_active_layer(&mesh.corner_data,
CD_PROP_FLOAT2) != -1;
if (!has_active_edit_uvmap) { const bool has_active_edit_uvmap = is_edit_object && (CustomData_get_active_layer(
return; &mesh.runtime->edit_mesh->bm->ldata,
} CD_PROP_FLOAT2) != -1);
ResourceHandle res_handle = manager.unique_handle(ob_ref); ResourceHandle res_handle = manager.unique_handle(ob_ref);
if (show_uv_edit) { if (has_active_edit_uvmap) {
gpu::Batch *geom = DRW_mesh_batch_cache_get_edituv_edges(ob, mesh); if (show_uv_edit) {
edges_ps_.draw_expand(geom, GPU_PRIM_TRIS, 2, 1, res_handle); gpu::Batch *geom = DRW_mesh_batch_cache_get_edituv_edges(ob, mesh);
} edges_ps_.draw_expand(geom, GPU_PRIM_TRIS, 2, 1, res_handle);
if (show_vert_) { }
gpu::Batch *geom = DRW_mesh_batch_cache_get_edituv_verts(ob, mesh); if (show_vert_) {
verts_ps_.draw(geom, res_handle); gpu::Batch *geom = DRW_mesh_batch_cache_get_edituv_verts(ob, mesh);
} verts_ps_.draw(geom, res_handle);
if (show_face_dots_) { }
gpu::Batch *geom = DRW_mesh_batch_cache_get_edituv_facedots(ob, mesh); if (show_face_dots_) {
facedots_ps_.draw(geom, res_handle); gpu::Batch *geom = DRW_mesh_batch_cache_get_edituv_facedots(ob, mesh);
} facedots_ps_.draw(geom, res_handle);
if (show_face_) { }
gpu::Batch *geom = DRW_mesh_batch_cache_get_edituv_faces(ob, mesh); if (show_face_) {
faces_ps_.draw(geom, res_handle); gpu::Batch *geom = DRW_mesh_batch_cache_get_edituv_faces(ob, mesh);
} faces_ps_.draw(geom, res_handle);
if (show_mesh_analysis_) {
int index_3d, index_2d;
if (mesh_analysis_type_ == SI_UVDT_STRETCH_AREA) {
index_3d = per_mesh_area_3d_.append_and_get_index(nullptr);
index_2d = per_mesh_area_2d_.append_and_get_index(nullptr);
} }
gpu::Batch *geom = if (show_mesh_analysis_) {
mesh_analysis_type_ == SI_UVDT_STRETCH_ANGLE ? int index_3d, index_2d;
DRW_mesh_batch_cache_get_edituv_faces_stretch_angle(ob, mesh) : if (mesh_analysis_type_ == SI_UVDT_STRETCH_AREA) {
DRW_mesh_batch_cache_get_edituv_faces_stretch_area( index_3d = per_mesh_area_3d_.append_and_get_index(nullptr);
ob, mesh, &per_mesh_area_3d_[index_3d], &per_mesh_area_2d_[index_2d]); index_2d = per_mesh_area_2d_.append_and_get_index(nullptr);
}
analysis_ps_.draw(geom, res_handle); gpu::Batch *geom =
mesh_analysis_type_ == SI_UVDT_STRETCH_ANGLE ?
DRW_mesh_batch_cache_get_edituv_faces_stretch_angle(ob, mesh) :
DRW_mesh_batch_cache_get_edituv_faces_stretch_area(
ob, mesh, &per_mesh_area_3d_[index_3d], &per_mesh_area_2d_[index_2d]);
analysis_ps_.draw(geom, res_handle);
}
} }
if (show_wireframe_) { if (show_wireframe_ && (has_active_object_uvmap || has_active_edit_uvmap)) {
gpu::Batch *geom = DRW_mesh_batch_cache_get_uv_edges(ob, mesh); gpu::Batch *geom = DRW_mesh_batch_cache_get_uv_edges(ob, mesh);
wireframe_ps_.draw_expand(geom, GPU_PRIM_TRIS, 2, 1, res_handle); wireframe_ps_.draw_expand(geom, GPU_PRIM_TRIS, 2, 1, res_handle);
} }