From dd229a9d54dbbe50a01acd9d230154f052ca4184 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Wed, 12 Apr 2023 14:54:18 -0400 Subject: [PATCH] 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. --- source/blender/blenkernel/intern/curves.cc | 5 ----- source/blender/blenkernel/intern/curves_geometry.cc | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/blender/blenkernel/intern/curves.cc b/source/blender/blenkernel/intern/curves.cc index 0dbdbaf0a57..8e2c8506032 100644 --- a/source/blender/blenkernel/intern/curves.cc +++ b/source/blender/blenkernel/intern/curves.cc @@ -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(__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); } diff --git a/source/blender/blenkernel/intern/curves_geometry.cc b/source/blender/blenkernel/intern/curves_geometry.cc index 829bcfbf91b..0809a6c0c7a 100644 --- a/source/blender/blenkernel/intern/curves_geometry.cc +++ b/source/blender/blenkernel/intern/curves_geometry.cc @@ -1582,10 +1582,15 @@ GVArray CurvesGeometry::adapt_domain(const GVArray &varray, void CurvesGeometry::blend_read(BlendDataReader &reader) { + this->runtime = MEM_new(__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)