Refactor: Extract CurvesGeometry read/write function #105737
|
@ -390,7 +390,7 @@ class CurvesGeometry : public ::CurvesGeometry {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void blend_read(BlendDataReader &reader);
|
void blend_read(BlendDataReader &reader);
|
||||||
filedescriptor marked this conversation as resolved
Outdated
|
|||||||
void blend_write(BlendWriter &writer, ID *id);
|
void blend_write(BlendWriter &writer, ID &id);
|
||||||
filedescriptor marked this conversation as resolved
Outdated
Hans Goudey
commented
If the If the `id` argument is expected to be non-null, it should be a reference too
|
|||||||
};
|
};
|
||||||
|
|
||||||
static_assert(sizeof(blender::bke::CurvesGeometry) == sizeof(::CurvesGeometry));
|
static_assert(sizeof(blender::bke::CurvesGeometry) == sizeof(::CurvesGeometry));
|
||||||
|
|
|
@ -135,7 +135,7 @@ static void curves_blend_write(BlendWriter *writer, ID *id, const void *id_addre
|
||||||
BKE_id_blend_write(writer, &curves->id);
|
BKE_id_blend_write(writer, &curves->id);
|
||||||
|
|
||||||
/* Direct data */
|
/* 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);
|
BLO_write_string(writer, curves->surface_uv_map);
|
||||||
|
|
||||||
|
|
|
@ -1587,7 +1587,7 @@ void CurvesGeometry::blend_read(BlendDataReader &reader)
|
||||||
BLO_read_int32_array(&reader, this->curve_num + 1, &this->curve_offsets);
|
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> point_layers;
|
||||||
Vector<CustomDataLayer, 16> curve_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_prepare(this->curve_data, curve_layers);
|
||||||
|
|
||||||
CustomData_blend_write(
|
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(
|
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);
|
BLO_write_int32_array(&writer, this->curve_num + 1, this->curve_offsets);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Use references here instead of pointers