Refactor: Extract CurvesGeometry read/write function #105737
|
@ -389,8 +389,8 @@ class CurvesGeometry : public ::CurvesGeometry {
|
||||||
* File Read/Write.
|
* File Read/Write.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void blend_read(BlendDataReader *reader);
|
void blend_read(BlendDataReader &reader);
|
||||||
void blend_write(BlendWriter *writer, ID *id);
|
void blend_write(BlendWriter &writer, ID *id);
|
||||||
};
|
};
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ static void curves_blend_read_data(BlendDataReader *reader, ID *id)
|
||||||
BKE_animdata_blend_read_data(reader, curves->adt);
|
BKE_animdata_blend_read_data(reader, curves->adt);
|
||||||
|
|
||||||
/* Geometry */
|
/* Geometry */
|
||||||
curves->geometry.wrap().blend_read(reader);
|
curves->geometry.wrap().blend_read(*reader);
|
||||||
|
|
||||||
BLO_read_data_address(reader, &curves->surface_uv_map);
|
BLO_read_data_address(reader, &curves->surface_uv_map);
|
||||||
|
|
||||||
|
|
|
@ -1579,15 +1579,15 @@ GVArray CurvesGeometry::adapt_domain(const GVArray &varray,
|
||||||
/** \name File reading/writing.
|
/** \name File reading/writing.
|
||||||
* \{ */
|
* \{ */
|
||||||
|
|
||||||
void CurvesGeometry::blend_read(BlendDataReader *reader)
|
void CurvesGeometry::blend_read(BlendDataReader &reader)
|
||||||
{
|
{
|
||||||
CustomData_blend_read(reader, &this->point_data, this->point_num);
|
CustomData_blend_read(&reader, &this->point_data, this->point_num);
|
||||||
CustomData_blend_read(reader, &this->curve_data, this->curve_num);
|
CustomData_blend_read(&reader, &this->curve_data, this->curve_num);
|
||||||
|
|
||||||
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,11 +1595,11 @@ 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