Cleanup: Slightly CurvesGeometry reorganize read function

The curve types and the runtime always have to be created when reading
the file from disk, so we might as well do that in `blend_read`, which
will help in the future when the offsets use implicit sharing.
This commit is contained in:
Hans Goudey
2023-04-12 14:54:18 -04:00
parent 87cd22f643
commit dd229a9d54
2 changed files with 5 additions and 5 deletions

View File

@@ -156,11 +156,6 @@ static void curves_blend_read_data(BlendDataReader *reader, ID *id)
BLO_read_data_address(reader, &curves->surface_uv_map);
curves->geometry.runtime = MEM_new<blender::bke::CurvesGeometryRuntime>(__func__);
/* Recalculate curve type count cache that isn't saved in files. */
curves->geometry.wrap().update_curve_types();
/* Materials */
BLO_read_pointer_array(reader, (void **)&curves->mat);
}

View File

@@ -1582,10 +1582,15 @@ GVArray CurvesGeometry::adapt_domain(const GVArray &varray,
void CurvesGeometry::blend_read(BlendDataReader &reader)
{
this->runtime = MEM_new<blender::bke::CurvesGeometryRuntime>(__func__);
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);
/* Recalculate curve type count cache that isn't saved in files. */
this->update_curve_types();
}
void CurvesGeometry::blend_write(BlendWriter &writer, ID &id)