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>2022-05-13 19:44:09 +0300
committerHans Goudey <h.goudey@me.com>2022-05-13 19:44:09 +0300
commitee363ee7b3a26e3236f2107b8a8324877404db04 (patch)
tree8241af9ac1af84b3c3ac08354aa4b639f85ec44d /source/blender/blenkernel
parentcf69652618fefcd22b2cde9a2e0338b63f9a003e (diff)
Cleanup: Use standard variable names for curves
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/curve_eval.cc52
-rw-r--r--source/blender/blenkernel/intern/curves.cc25
-rw-r--r--source/blender/blenkernel/intern/geometry_component_curves.cc6
3 files changed, 42 insertions, 41 deletions
diff --git a/source/blender/blenkernel/intern/curve_eval.cc b/source/blender/blenkernel/intern/curve_eval.cc
index c507e7934a8..dd2bd982506 100644
--- a/source/blender/blenkernel/intern/curve_eval.cc
+++ b/source/blender/blenkernel/intern/curve_eval.cc
@@ -373,15 +373,15 @@ static void copy_attributes_between_components(const GeometryComponent &src_comp
});
}
-std::unique_ptr<CurveEval> curves_to_curve_eval(const Curves &curves)
+std::unique_ptr<CurveEval> curves_to_curve_eval(const Curves &curves_id)
{
CurveComponent src_component;
- src_component.replace(&const_cast<Curves &>(curves), GeometryOwnershipType::ReadOnly);
- const blender::bke::CurvesGeometry &geometry = blender::bke::CurvesGeometry::wrap(
- curves.geometry);
+ src_component.replace(&const_cast<Curves &>(curves_id), GeometryOwnershipType::ReadOnly);
+ const blender::bke::CurvesGeometry &curves = blender::bke::CurvesGeometry::wrap(
+ curves_id.geometry);
- VArray<int> resolution = geometry.resolution();
- VArray<int8_t> normal_mode = geometry.normal_mode();
+ VArray<int> resolution = curves.resolution();
+ VArray<int8_t> normal_mode = curves.normal_mode();
VArray_Span<float> nurbs_weights{
src_component.attribute_get_for_read<float>("nurbs_weight", ATTR_DOMAIN_POINT, 0.0f)};
@@ -396,34 +396,34 @@ std::unique_ptr<CurveEval> curves_to_curve_eval(const Curves &curves)
src_component.attribute_get_for_read<int8_t>("handle_type_left", ATTR_DOMAIN_POINT, 0)};
/* Create splines with the correct size and type. */
- VArray<int8_t> curve_types = geometry.curve_types();
+ VArray<int8_t> curve_types = curves.curve_types();
std::unique_ptr<CurveEval> curve_eval = std::make_unique<CurveEval>();
for (const int curve_index : curve_types.index_range()) {
- const IndexRange point_range = geometry.points_for_curve(curve_index);
+ const IndexRange points = curves.points_for_curve(curve_index);
std::unique_ptr<Spline> spline;
/* #CurveEval does not support catmull rom curves, so convert those to poly splines. */
switch (std::max<int8_t>(1, curve_types[curve_index])) {
case CURVE_TYPE_POLY: {
spline = std::make_unique<PolySpline>();
- spline->resize(point_range.size());
+ spline->resize(points.size());
break;
}
case CURVE_TYPE_BEZIER: {
std::unique_ptr<BezierSpline> bezier_spline = std::make_unique<BezierSpline>();
- bezier_spline->resize(point_range.size());
+ bezier_spline->resize(points.size());
bezier_spline->set_resolution(resolution[curve_index]);
- bezier_spline->handle_types_left().copy_from(handle_types_left.slice(point_range));
- bezier_spline->handle_types_right().copy_from(handle_types_right.slice(point_range));
+ bezier_spline->handle_types_left().copy_from(handle_types_left.slice(points));
+ bezier_spline->handle_types_right().copy_from(handle_types_right.slice(points));
spline = std::move(bezier_spline);
break;
}
case CURVE_TYPE_NURBS: {
std::unique_ptr<NURBSpline> nurb_spline = std::make_unique<NURBSpline>();
- nurb_spline->resize(point_range.size());
+ nurb_spline->resize(points.size());
nurb_spline->set_resolution(resolution[curve_index]);
- nurb_spline->weights().copy_from(nurbs_weights.slice(point_range));
+ nurb_spline->weights().copy_from(nurbs_weights.slice(points));
nurb_spline->set_order(nurbs_orders[curve_index]);
nurb_spline->knots_mode = static_cast<KnotsMode>(nurbs_knots_modes[curve_index]);
@@ -463,14 +463,14 @@ std::unique_ptr<CurveEval> curves_to_curve_eval(const Curves &curves)
Curves *curve_eval_to_curves(const CurveEval &curve_eval)
{
- Curves *curves = blender::bke::curves_new_nomain(curve_eval.total_control_point_num(),
- curve_eval.splines().size());
+ Curves *curves_id = blender::bke::curves_new_nomain(curve_eval.total_control_point_num(),
+ curve_eval.splines().size());
CurveComponent dst_component;
- dst_component.replace(curves, GeometryOwnershipType::Editable);
+ dst_component.replace(curves_id, GeometryOwnershipType::Editable);
- blender::bke::CurvesGeometry &geometry = blender::bke::CurvesGeometry::wrap(curves->geometry);
- geometry.offsets_for_write().copy_from(curve_eval.control_point_offsets());
- MutableSpan<int8_t> curve_types = geometry.curve_types_for_write();
+ blender::bke::CurvesGeometry &curves = blender::bke::CurvesGeometry::wrap(curves_id->geometry);
+ curves.offsets_for_write().copy_from(curve_eval.control_point_offsets());
+ MutableSpan<int8_t> curve_types = curves.curve_types_for_write();
OutputAttribute_Typed<int8_t> normal_mode =
dst_component.attribute_try_get_for_output_only<int8_t>("normal_mode", ATTR_DOMAIN_CURVE);
@@ -498,22 +498,22 @@ Curves *curve_eval_to_curves(const CurveEval &curve_eval)
const Spline &spline = *curve_eval.splines()[curve_index];
curve_types[curve_index] = curve_eval.splines()[curve_index]->type();
normal_mode.as_span()[curve_index] = curve_eval.splines()[curve_index]->normal_mode;
- const IndexRange point_range = geometry.points_for_curve(curve_index);
+ const IndexRange points = curves.points_for_curve(curve_index);
switch (spline.type()) {
case CURVE_TYPE_POLY:
break;
case CURVE_TYPE_BEZIER: {
const BezierSpline &src = static_cast<const BezierSpline &>(spline);
- handle_type_right.as_span().slice(point_range).copy_from(src.handle_types_right());
- handle_type_left.as_span().slice(point_range).copy_from(src.handle_types_left());
+ handle_type_right.as_span().slice(points).copy_from(src.handle_types_right());
+ handle_type_left.as_span().slice(points).copy_from(src.handle_types_left());
break;
}
case CURVE_TYPE_NURBS: {
const NURBSpline &src = static_cast<const NURBSpline &>(spline);
nurbs_knots_mode.as_span()[curve_index] = static_cast<int8_t>(src.knots_mode);
nurbs_order.as_span()[curve_index] = src.order();
- nurbs_weight.as_span().slice(point_range).copy_from(src.weights());
+ nurbs_weight.as_span().slice(points).copy_from(src.weights());
break;
}
case CURVE_TYPE_CATMULL_ROM: {
@@ -523,7 +523,7 @@ Curves *curve_eval_to_curves(const CurveEval &curve_eval)
}
}
- geometry.update_curve_types();
+ curves.update_curve_types();
normal_mode.save();
nurbs_weight.save();
@@ -537,7 +537,7 @@ Curves *curve_eval_to_curves(const CurveEval &curve_eval)
copy_attributes_between_components(src_component, dst_component, {});
- return curves;
+ return curves_id;
}
void CurveEval::assert_valid_point_attributes() const
diff --git a/source/blender/blenkernel/intern/curves.cc b/source/blender/blenkernel/intern/curves.cc
index 84ba98db54b..d38bc790978 100644
--- a/source/blender/blenkernel/intern/curves.cc
+++ b/source/blender/blenkernel/intern/curves.cc
@@ -247,7 +247,7 @@ void *BKE_curves_add(Main *bmain, const char *name)
BoundBox *BKE_curves_boundbox_get(Object *ob)
{
BLI_assert(ob->type == OB_CURVES);
- Curves *curves = static_cast<Curves *>(ob->data);
+ const Curves *curves_id = static_cast<const Curves *>(ob->data);
if (ob->runtime.bb != nullptr && (ob->runtime.bb->flag & BOUNDBOX_DIRTY) == 0) {
return ob->runtime.bb;
@@ -256,11 +256,12 @@ BoundBox *BKE_curves_boundbox_get(Object *ob)
if (ob->runtime.bb == nullptr) {
ob->runtime.bb = MEM_cnew<BoundBox>(__func__);
- blender::bke::CurvesGeometry &geometry = blender::bke::CurvesGeometry::wrap(curves->geometry);
+ const blender::bke::CurvesGeometry &curves = blender::bke::CurvesGeometry::wrap(
+ curves_id->geometry);
float3 min(FLT_MAX);
float3 max(-FLT_MAX);
- if (!geometry.bounds_min_max(min, max)) {
+ if (!curves.bounds_min_max(min, max)) {
min = float3(-1);
max = float3(1);
}
@@ -364,19 +365,19 @@ namespace blender::bke {
Curves *curves_new_nomain(const int points_num, const int curves_num)
{
- Curves *curves = static_cast<Curves *>(BKE_id_new_nomain(ID_CV, nullptr));
- CurvesGeometry &geometry = CurvesGeometry::wrap(curves->geometry);
- geometry.resize(points_num, curves_num);
- return curves;
+ Curves *curves_id = static_cast<Curves *>(BKE_id_new_nomain(ID_CV, nullptr));
+ CurvesGeometry &curves = CurvesGeometry::wrap(curves_id->geometry);
+ curves.resize(points_num, curves_num);
+ return curves_id;
}
Curves *curves_new_nomain_single(const int points_num, const CurveType type)
{
- Curves *curves = curves_new_nomain(points_num, 1);
- CurvesGeometry &geometry = CurvesGeometry::wrap(curves->geometry);
- geometry.offsets_for_write().last() = points_num;
- geometry.fill_curve_types(type);
- return curves;
+ Curves *curves_id = curves_new_nomain(points_num, 1);
+ CurvesGeometry &curves = CurvesGeometry::wrap(curves_id->geometry);
+ curves.offsets_for_write().last() = points_num;
+ curves.fill_curve_types(type);
+ return curves_id;
}
Curves *curves_new_nomain(CurvesGeometry curves)
diff --git a/source/blender/blenkernel/intern/geometry_component_curves.cc b/source/blender/blenkernel/intern/geometry_component_curves.cc
index b565143d08f..d23918215ba 100644
--- a/source/blender/blenkernel/intern/geometry_component_curves.cc
+++ b/source/blender/blenkernel/intern/geometry_component_curves.cc
@@ -313,13 +313,13 @@ int CurveComponent::attribute_domain_num(const AttributeDomain domain) const
if (curves_ == nullptr) {
return 0;
}
- const blender::bke::CurvesGeometry &geometry = blender::bke::CurvesGeometry::wrap(
+ const blender::bke::CurvesGeometry &curves = blender::bke::CurvesGeometry::wrap(
curves_->geometry);
if (domain == ATTR_DOMAIN_POINT) {
- return geometry.points_num();
+ return curves.points_num();
}
if (domain == ATTR_DOMAIN_CURVE) {
- return geometry.curves_num();
+ return curves.curves_num();
}
return 0;
}