WIP: Core: use generic copy-on-write system to avoid redundant copies #104478

Closed
Jacques Lucke wants to merge 66 commits from JacquesLucke/blender:temp-copy-on-write into main

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

View File

@ -219,18 +219,18 @@ static bool add_builtin_type_custom_data_layer_from_init(CustomData &custom_data
static void *add_generic_custom_data_layer(CustomData &custom_data, static void *add_generic_custom_data_layer(CustomData &custom_data,
const eCustomDataType data_type, const eCustomDataType data_type,
const eCDAllocType alloctype, const eCDAllocType alloctype,
const int domain_num, const int domain_size,
const AttributeIDRef &attribute_id) const AttributeIDRef &attribute_id)
{ {
if (!attribute_id.is_anonymous()) { if (!attribute_id.is_anonymous()) {
char attribute_name_c[MAX_CUSTOMDATA_LAYER_NAME]; char attribute_name_c[MAX_CUSTOMDATA_LAYER_NAME];
attribute_id.name().copy(attribute_name_c); attribute_id.name().copy(attribute_name_c);
return CustomData_add_layer_named( return CustomData_add_layer_named(
&custom_data, data_type, alloctype, domain_num, attribute_name_c); &custom_data, data_type, alloctype, domain_size, attribute_name_c);
} }
const AnonymousAttributeID &anonymous_id = attribute_id.anonymous_id(); const AnonymousAttributeID &anonymous_id = attribute_id.anonymous_id();
return CustomData_add_layer_anonymous( return CustomData_add_layer_anonymous(
&custom_data, data_type, alloctype, domain_num, &anonymous_id); &custom_data, data_type, alloctype, domain_size, &anonymous_id);
} }
static const void *add_generic_custom_data_layer_with_existing_data( static const void *add_generic_custom_data_layer_with_existing_data(