Fix #109670: attribute shared between geometries even when edited (backport to 3.6) #115234

Closed
Jacques Lucke wants to merge 1 commits from JacquesLucke/blender:backport-109670 into blender-v3.6-release

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

View File

@ -430,6 +430,12 @@ void CustomData_swap_corners(struct CustomData *data, int index, const int *corn
*/
void CustomData_swap(struct CustomData *data, int index_a, int index_b, const int totelem);
/**
* Custom data layers can be shared through implicit sharing (`BLI_implicit_sharing.h`). This
* function makes sure that the layer is unshared if it was shared, which makes it mutable.
*/
void CustomData_ensure_data_is_mutable(struct CustomDataLayer *layer, int totelem);
/**
* Retrieve a pointer to an element of the active layer of the given \a type, chosen by the
* \a index, if it exists.

View File

@ -2422,6 +2422,11 @@ static void ensure_layer_data_is_mutable(CustomDataLayer &layer, const int totel
}
}
void CustomData_ensure_data_is_mutable(CustomDataLayer *layer, const int totelem)
{
ensure_layer_data_is_mutable(*layer, totelem);
}
void CustomData_realloc(CustomData *data, const int old_size, const int new_size)
{
BLI_assert(new_size >= 0);

View File

@ -305,6 +305,7 @@ static void rna_Attribute_data_begin(CollectionPropertyIterator *iter, PointerRN
break;
}
CustomData_ensure_data_is_mutable(layer, length);
rna_iterator_array_begin(iter, layer->data, struct_size, length, 0, NULL);
}