forked from blender/blender
main sync #3
@ -384,6 +384,13 @@ class CurvesGeometry : public ::CurvesGeometry {
|
|||||||
{
|
{
|
||||||
return this->adapt_domain(GVArray(varray), from, to).typed<T>();
|
return this->adapt_domain(GVArray(varray), from, to).typed<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------
|
||||||
|
* File Read/Write.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void blend_read(BlendDataReader &reader);
|
||||||
|
void blend_write(BlendWriter &writer, ID &id);
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(sizeof(blender::bke::CurvesGeometry) == sizeof(::CurvesGeometry));
|
static_assert(sizeof(blender::bke::CurvesGeometry) == sizeof(::CurvesGeometry));
|
||||||
|
@ -130,30 +130,12 @@ static void curves_blend_write(BlendWriter *writer, ID *id, const void *id_addre
|
|||||||
{
|
{
|
||||||
Curves *curves = (Curves *)id;
|
Curves *curves = (Curves *)id;
|
||||||
|
|
||||||
Vector<CustomDataLayer, 16> point_layers;
|
|
||||||
Vector<CustomDataLayer, 16> curve_layers;
|
|
||||||
CustomData_blend_write_prepare(curves->geometry.point_data, point_layers);
|
|
||||||
CustomData_blend_write_prepare(curves->geometry.curve_data, curve_layers);
|
|
||||||
|
|
||||||
/* Write LibData */
|
/* Write LibData */
|
||||||
BLO_write_id_struct(writer, Curves, id_address, &curves->id);
|
BLO_write_id_struct(writer, Curves, id_address, &curves->id);
|
||||||
BKE_id_blend_write(writer, &curves->id);
|
BKE_id_blend_write(writer, &curves->id);
|
||||||
|
|
||||||
/* Direct data */
|
/* Direct data */
|
||||||
CustomData_blend_write(writer,
|
curves->geometry.wrap().blend_write(*writer, curves->id);
|
||||||
&curves->geometry.point_data,
|
|
||||||
point_layers,
|
|
||||||
curves->geometry.point_num,
|
|
||||||
CD_MASK_ALL,
|
|
||||||
&curves->id);
|
|
||||||
CustomData_blend_write(writer,
|
|
||||||
&curves->geometry.curve_data,
|
|
||||||
curve_layers,
|
|
||||||
curves->geometry.curve_num,
|
|
||||||
CD_MASK_ALL,
|
|
||||||
&curves->id);
|
|
||||||
|
|
||||||
BLO_write_int32_array(writer, curves->geometry.curve_num + 1, curves->geometry.curve_offsets);
|
|
||||||
|
|
||||||
BLO_write_string(writer, curves->surface_uv_map);
|
BLO_write_string(writer, curves->surface_uv_map);
|
||||||
|
|
||||||
@ -170,10 +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 */
|
||||||
CustomData_blend_read(reader, &curves->geometry.point_data, curves->geometry.point_num);
|
curves->geometry.wrap().blend_read(*reader);
|
||||||
CustomData_blend_read(reader, &curves->geometry.curve_data, curves->geometry.curve_num);
|
|
||||||
|
|
||||||
BLO_read_int32_array(reader, curves->geometry.curve_num + 1, &curves->geometry.curve_offsets);
|
|
||||||
|
|
||||||
BLO_read_data_address(reader, &curves->surface_uv_map);
|
BLO_read_data_address(reader, &curves->surface_uv_map);
|
||||||
|
|
||||||
|
@ -17,11 +17,14 @@
|
|||||||
#include "BLI_math_rotation_legacy.hh"
|
#include "BLI_math_rotation_legacy.hh"
|
||||||
#include "BLI_task.hh"
|
#include "BLI_task.hh"
|
||||||
|
|
||||||
|
#include "BLO_read_write.h"
|
||||||
|
|
||||||
#include "DNA_curves_types.h"
|
#include "DNA_curves_types.h"
|
||||||
|
|
||||||
#include "BKE_attribute_math.hh"
|
#include "BKE_attribute_math.hh"
|
||||||
#include "BKE_curves.hh"
|
#include "BKE_curves.hh"
|
||||||
#include "BKE_curves_utils.hh"
|
#include "BKE_curves_utils.hh"
|
||||||
|
#include "BKE_customdata.h"
|
||||||
|
|
||||||
namespace blender::bke {
|
namespace blender::bke {
|
||||||
|
|
||||||
@ -1572,4 +1575,33 @@ GVArray CurvesGeometry::adapt_domain(const GVArray &varray,
|
|||||||
|
|
||||||
/** \} */
|
/** \} */
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------- */
|
||||||
|
/** \name File reading/writing.
|
||||||
|
* \{ */
|
||||||
|
|
||||||
|
void CurvesGeometry::blend_read(BlendDataReader &reader)
|
||||||
|
{
|
||||||
|
CustomData_blend_read(&reader, &this->point_data, this->point_num);
|
||||||
|
CustomData_blend_read(&reader, &this->curve_data, this->curve_num);
|
||||||
|
|
||||||
|
BLO_read_int32_array(&reader, this->curve_num + 1, &this->curve_offsets);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CurvesGeometry::blend_write(BlendWriter &writer, ID &id)
|
||||||
|
{
|
||||||
|
Vector<CustomDataLayer, 16> point_layers;
|
||||||
|
Vector<CustomDataLayer, 16> curve_layers;
|
||||||
|
CustomData_blend_write_prepare(this->point_data, point_layers);
|
||||||
|
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);
|
||||||
|
CustomData_blend_write(
|
||||||
|
&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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \} */
|
||||||
|
|
||||||
} // namespace blender::bke
|
} // namespace blender::bke
|
||||||
|
Loading…
Reference in New Issue
Block a user