Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-05-12 19:46:13 +0300
committerHans Goudey <h.goudey@me.com>2021-05-12 19:46:13 +0300
commit50bf033d3f31b9939a79dea0652731f94da9a3ed (patch)
tree055a9ae0ca4bc1560b74b9ed58cd15fd87e5033f /source/blender/nodes
parent3ef01692c8f068ccc083dd3d6a49ed055fe7224b (diff)
Cleanup: Splines: Add accessors to spline vector
Not allowing external direct access to the vector of splines in the curve will help for things like reallocating custom data when a spline is added or removed.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc6
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc10
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc4
3 files changed, 10 insertions, 10 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc
index c8733955a32..d7d31a4ef92 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc
@@ -139,16 +139,16 @@ static std::unique_ptr<CurveEval> resample_curve(const CurveEval &input_curve,
{
std::unique_ptr<CurveEval> output_curve = std::make_unique<CurveEval>();
- for (const SplinePtr &spline : input_curve.splines) {
+ for (const SplinePtr &spline : input_curve.splines()) {
if (mode_param.mode == GEO_NODE_CURVE_SAMPLE_COUNT) {
BLI_assert(mode_param.count);
- output_curve->splines.append(resample_spline(*spline, *mode_param.count));
+ output_curve->add_spline(resample_spline(*spline, *mode_param.count));
}
else if (mode_param.mode == GEO_NODE_CURVE_SAMPLE_LENGTH) {
BLI_assert(mode_param.length);
const float length = spline->length();
const int count = length / *mode_param.length;
- output_curve->splines.append(resample_spline(*spline, count));
+ output_curve->add_spline(resample_spline(*spline, count));
}
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc
index bb5169c819c..da275ce0521 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc
@@ -211,7 +211,7 @@ static Mesh *curve_to_mesh_calculate(const CurveEval &curve, const CurveEval &pr
{
int profile_vert_total = 0;
int profile_edge_total = 0;
- for (const SplinePtr &profile_spline : profile_curve.splines) {
+ for (const SplinePtr &profile_spline : profile_curve.splines()) {
profile_vert_total += profile_spline->evaluated_points_size();
profile_edge_total += profile_spline->evaluated_edges_size();
}
@@ -219,7 +219,7 @@ static Mesh *curve_to_mesh_calculate(const CurveEval &curve, const CurveEval &pr
int vert_total = 0;
int edge_total = 0;
int poly_total = 0;
- for (const SplinePtr &spline : curve.splines) {
+ for (const SplinePtr &spline : curve.splines()) {
const int spline_vert_len = spline->evaluated_points_size();
const int spline_edge_len = spline->evaluated_edges_size();
vert_total += spline_vert_len * profile_vert_total;
@@ -247,8 +247,8 @@ static Mesh *curve_to_mesh_calculate(const CurveEval &curve, const CurveEval &pr
int edge_offset = 0;
int loop_offset = 0;
int poly_offset = 0;
- for (const SplinePtr &spline : curve.splines) {
- for (const SplinePtr &profile_spline : profile_curve.splines) {
+ for (const SplinePtr &spline : curve.splines()) {
+ for (const SplinePtr &profile_spline : profile_curve.splines()) {
spline_extrude_to_mesh_data(*spline,
*profile_spline,
verts,
@@ -272,7 +272,7 @@ static CurveEval get_curve_single_vert()
CurveEval curve;
std::unique_ptr<PolySpline> spline = std::make_unique<PolySpline>();
spline->add_point(float3(0), 0, 0.0f);
- curve.splines.append(std::move(spline));
+ curve.add_spline(std::move(spline));
return curve;
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc b/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc
index 68bb3614751..a6e78048ea6 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc
@@ -305,8 +305,8 @@ static void join_curve_components(MutableSpan<GeometrySet> src_geometry_sets, Ge
CurveEval *dst_curve = new CurveEval();
for (CurveComponent *component : src_components) {
CurveEval *src_curve = component->get_for_write();
- for (SplinePtr &spline : src_curve->splines) {
- dst_curve->splines.append(std::move(spline));
+ for (SplinePtr &spline : src_curve->splines()) {
+ dst_curve->add_spline(std::move(spline));
}
}