Fix #106430: Index the right UVmap in BMesh #106537

Closed
Martijn Versteegh wants to merge 5 commits from Baardaap:fix-named-uvmap_bmesh into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
1 changed files with 2 additions and 4 deletions
Showing only changes of commit 49dcec1cd7 - Show all commits

View File

@ -24,9 +24,7 @@ BMUVOffsets BM_uv_map_get_offsets_n(const BMesh *bm, int layer)
{
using namespace blender;
using namespace blender::bke;
const int layer_index = layer == -1 ?
CustomData_get_active_layer_index(&bm->ldata, CD_PROP_FLOAT2) :
CustomData_get_layer_index_n(&bm->ldata, CD_PROP_FLOAT2, layer);
const int layer_index = CustomData_get_layer_index_n(&bm->ldata, CD_PROP_FLOAT2, layer);
HooglyBoogly marked this conversation as resolved Outdated

It might be simper/clearer if BM_uv_map_get_offsets called CustomData_get_active_layer_index directly. Then BM_uv_map_get_offsets_n wouldn't have to have a special case for -1.

It might be simper/clearer if `BM_uv_map_get_offsets` called `CustomData_get_active_layer_index` directly. Then `BM_uv_map_get_offsets_n` wouldn't have to have a special case for -1.
if (layer_index == -1) {
return {-1, -1, -1, -1};
}
@ -48,7 +46,7 @@ BMUVOffsets BM_uv_map_get_offsets_n(const BMesh *bm, int layer)
BMUVOffsets BM_uv_map_get_offsets(const BMesh *bm)
{
return BM_uv_map_get_offsets_n(bm, -1);
return BM_uv_map_get_offsets_n(bm, CustomData_get_active_layer_index(&bm->ldata, CD_PROP_FLOAT2));
HooglyBoogly marked this conversation as resolved Outdated

Missing clang format here (line is 101 characters long)

Missing clang format here (line is 101 characters long)
}
static void uv_aspect(const BMLoop *l,