Refactor: Extract CurvesGeometry read/write function #105737

Merged
Falk David merged 3 commits from filedescriptor/blender:refactor-curves-extract-read-write-functions into main 2023-03-13 18:43:03 +01:00
3 changed files with 5 additions and 5 deletions
Showing only changes of commit 2976a75fe1 - Show all commits

View File

@ -390,7 +390,7 @@ class CurvesGeometry : public ::CurvesGeometry {
*/
void blend_read(BlendDataReader &reader);
filedescriptor marked this conversation as resolved Outdated

Use references here instead of pointers

Use references here instead of pointers
void blend_write(BlendWriter &writer, ID *id);
void blend_write(BlendWriter &writer, ID &id);
filedescriptor marked this conversation as resolved Outdated

If the id argument is expected to be non-null, it should be a reference too

If the `id` argument is expected to be non-null, it should be a reference too
};
static_assert(sizeof(blender::bke::CurvesGeometry) == sizeof(::CurvesGeometry));

View File

@ -135,7 +135,7 @@ static void curves_blend_write(BlendWriter *writer, ID *id, const void *id_addre
BKE_id_blend_write(writer, &curves->id);
/* Direct data */
curves->geometry.wrap().blend_write(*writer, &curves->id);
curves->geometry.wrap().blend_write(*writer, curves->id);
BLO_write_string(writer, curves->surface_uv_map);

View File

@ -1587,7 +1587,7 @@ void CurvesGeometry::blend_read(BlendDataReader &reader)
BLO_read_int32_array(&reader, this->curve_num + 1, &this->curve_offsets);
}
void CurvesGeometry::blend_write(BlendWriter &writer, ID *id)
void CurvesGeometry::blend_write(BlendWriter &writer, ID &id)
{
Vector<CustomDataLayer, 16> point_layers;
Vector<CustomDataLayer, 16> curve_layers;
@ -1595,9 +1595,9 @@ void CurvesGeometry::blend_write(BlendWriter &writer, ID *id)
CustomData_blend_write_prepare(this->curve_data, curve_layers);
CustomData_blend_write(
&writer, &this->point_data, point_layers, this->point_num, CD_MASK_ALL, id);
&writer, &this->point_data, point_layers, this->point_num, CD_MASK_ALL, &id);
CustomData_blend_write(
&writer, &this->curve_data, curve_layers, this->curve_num, CD_MASK_ALL, id);
&writer, &this->curve_data, curve_layers, this->curve_num, CD_MASK_ALL, &id);
BLO_write_int32_array(&writer, this->curve_num + 1, this->curve_offsets);
}