Fix #106430: Index the right UVmap in BMesh #106537
|
@ -20,14 +20,13 @@
|
|||
#include "bmesh.h"
|
||||
#include "intern/bmesh_private.h"
|
||||
|
||||
|
||||
|
||||
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 = layer == -1 ?
|
||||
HooglyBoogly marked this conversation as resolved
Outdated
Hans Goudey
commented
It might be simper/clearer if 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.
|
||||
CustomData_get_active_layer_index(&bm->ldata, CD_PROP_FLOAT2) :
|
||||
CustomData_get_layer_index_n(&bm->ldata, CD_PROP_FLOAT2, layer);
|
||||
if (layer_index == -1) {
|
||||
return {-1, -1, -1, -1};
|
||||
}
|
||||
|
@ -49,10 +48,9 @@ BMUVOffsets BM_uv_map_get_offsets_n(const BMesh *bm, int layer)
|
|||
|
||||
BMUVOffsets BM_uv_map_get_offsets(const BMesh *bm)
|
||||
HooglyBoogly marked this conversation as resolved
Outdated
Hans Goudey
commented
Missing clang format here (line is 101 characters long) Missing clang format here (line is 101 characters long)
|
||||
{
|
||||
return BM_uv_map_get_offsets_n(bm, -1);
|
||||
return BM_uv_map_get_offsets_n(bm, -1);
|
||||
}
|
||||
|
||||
|
||||
static void uv_aspect(const BMLoop *l,
|
||||
const float aspect[2],
|
||||
const int cd_loop_uv_offset,
|
||||
|
|
|
@ -11,7 +11,8 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/**
|
||||
* Retrieve the custom data offsets for layers used for user interaction with a UV map, returns the active uv map if layer is -1.
|
||||
* Retrieve the custom data offsets for layers used for user interaction with a UV map, returns the
|
||||
* active uv map if layer is -1.
|
||||
*/
|
||||
BMUVOffsets BM_uv_map_get_offsets(const BMesh *bm);
|
||||
BMUVOffsets BM_uv_map_get_offsets_n(const BMesh *bm, int layer);
|
||||
|
|
Loading…
Reference in New Issue
int layer
->const int layer