Fix #104730: Suppress using anonymous UV layers for rendering #105192

Closed
Martijn Versteegh wants to merge 5 commits from Baardaap/blender:suppressrenderingofanonymouslayers into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
5 changed files with 14 additions and 3 deletions

View File

@ -486,6 +486,8 @@ const char *CustomData_get_active_layer_name(const struct CustomData *data, int
*/
const char *CustomData_get_render_layer_name(const struct CustomData *data, int type);
bool CustomData_layer_is_anonymous(const struct CustomData *data, int type, int n);
void CustomData_bmesh_set(const struct CustomData *data,
void *block,
int type,

View File

@ -2686,6 +2686,15 @@ void CustomData_clear_layer_flag(CustomData *data, const int type, const int fla
}
}
bool CustomData_layer_is_anonymous(const struct CustomData *data, int type, int n)
{
const int layer_index = CustomData_get_layer_index_n(data, type, n);
BLI_assert(layer_index >= 0);
Baardaap marked this conversation as resolved Outdated

Can this be implemented with CustomData_get_layer_index_n?

Can this be implemented with `CustomData_get_layer_index_n`?
return data->layers[layer_index].anonymous_id != nullptr;
}
static bool customData_resize(CustomData *data, const int amount)
{
CustomDataLayer *tmp = static_cast<CustomDataLayer *>(

View File

@ -358,7 +358,7 @@ static DRW_MeshCDMask mesh_cd_calc_used_gpu_layers(const Object *object,
CustomData_get_named_layer(cd_ldata, CD_PROP_FLOAT2, name) :
CustomData_get_render_layer(cd_ldata, CD_PROP_FLOAT2);
}
if (layer != -1) {
if (layer != -1 && !CustomData_layer_is_anonymous(cd_ldata, CD_PROP_FLOAT2, layer)) {
cd_used.uv |= (1 << layer);
}
break;

View File

@ -248,7 +248,7 @@ static void extract_edituv_stretch_angle_init_subdiv(const DRWSubdivCache *subdi
/* HACK to fix #68857 */
if (mr->extract_type == MR_EXTRACT_BMESH && cache->cd_used.edit_uv == 1) {
int layer = CustomData_get_active_layer(cd_ldata, CD_PROP_FLOAT2);
if (layer != -1) {
if (layer != -1 && !CustomData_layer_is_anonymous(cd_ldata, CD_PROP_FLOAT2, layer)) {
uv_layers |= (1 << layer);
}
}

View File

@ -31,7 +31,7 @@ static bool mesh_extract_uv_format_init(GPUVertFormat *format,
/* HACK to fix #68857 */
if (extract_type == MR_EXTRACT_BMESH && cache->cd_used.edit_uv == 1) {
int layer = CustomData_get_active_layer(cd_ldata, CD_PROP_FLOAT2);
if (layer != -1) {
if (layer != -1 && !CustomData_layer_is_anonymous(cd_ldata, CD_PROP_FLOAT2, layer)) {
uv_layers |= (1 << layer);
}
}