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-04-09 01:50:00 +0300
committerHans Goudey <h.goudey@me.com>2022-04-09 01:50:00 +0300
commit502d16e66788487113ba18f85f44ebd7eff6c492 (patch)
treed03f9dddde8937c1013d9316e8461eaa2c284102
parent4f961901226470446bb6de9ac3d8469ff3453671 (diff)
Fix: Various fixes and cleanups in new curves code
- Use "curve" instead of "spline" in comments - Use non-plural variable names - Tag topology dirty after resolution modified rather than positions - Reorder enum values to change which value is zero (and the default) - Remove a duplicate unused variable
-rw-r--r--source/blender/blenkernel/BKE_curves.hh12
-rw-r--r--source/blender/blenkernel/intern/curves_geometry.cc1
-rw-r--r--source/blender/blenkernel/intern/geometry_component_curves.cc2
-rw-r--r--source/blender/makesdna/DNA_curves_types.h6
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc3
5 files changed, 12 insertions, 12 deletions
diff --git a/source/blender/blenkernel/BKE_curves.hh b/source/blender/blenkernel/BKE_curves.hh
index 9061bb9fb81..c4edeae99a4 100644
--- a/source/blender/blenkernel/BKE_curves.hh
+++ b/source/blender/blenkernel/BKE_curves.hh
@@ -40,7 +40,7 @@ namespace curves::nurbs {
struct BasisCache {
/**
* For each evaluated point, the weight for all control points that influences it.
- * The vector's size is the evaluated point count multiplied by the spline's order.
+ * The vector's size is the evaluated point count multiplied by the curve's order.
*/
Vector<float> weights;
/**
@@ -61,7 +61,7 @@ class CurvesGeometryRuntime {
public:
/**
* Cache of offsets into the evaluated array for each curve, accounting for all previous
- * evaluated points, Bezier curve vector segments, different resolutions per spline, etc.
+ * evaluated points, Bezier curve vector segments, different resolutions per curve, etc.
*/
mutable Vector<int> evaluated_offsets_cache;
mutable Vector<int> bezier_evaluated_offsets;
@@ -86,13 +86,13 @@ class CurvesGeometryRuntime {
mutable std::mutex length_cache_mutex;
mutable bool length_cache_dirty = true;
- /** Direction of the spline at each evaluated point. */
- mutable Vector<float3> evaluated_tangents_cache;
+ /** Direction of the curve at each evaluated point. */
+ mutable Vector<float3> evaluated_tangent_cache;
mutable std::mutex tangent_cache_mutex;
mutable bool tangent_cache_dirty = true;
/** Normal direction vectors for each evaluated point. */
- mutable Vector<float3> evaluated_normals_cache;
+ mutable Vector<float3> evaluated_normal_cache;
mutable std::mutex normal_cache_mutex;
mutable bool normal_cache_dirty = true;
};
@@ -515,7 +515,7 @@ int calculate_evaluated_size(
int knots_size(int points_num, int8_t order, bool cyclic);
/**
- * Calculate the knots for a spline given its properties, based on built-in standards defined by
+ * Calculate the knots for a curve given its properties, based on built-in standards defined by
* #KnotsMode.
*
* \note Theoretically any sorted values can be used for NURBS knots, but calculating based
diff --git a/source/blender/blenkernel/intern/curves_geometry.cc b/source/blender/blenkernel/intern/curves_geometry.cc
index a76d8b08a16..7d89892f69b 100644
--- a/source/blender/blenkernel/intern/curves_geometry.cc
+++ b/source/blender/blenkernel/intern/curves_geometry.cc
@@ -629,6 +629,7 @@ Span<float3> CurvesGeometry::evaluated_positions() const
});
});
+ this->runtime->position_cache_dirty = false;
return this->runtime->evaluated_position_cache;
}
diff --git a/source/blender/blenkernel/intern/geometry_component_curves.cc b/source/blender/blenkernel/intern/geometry_component_curves.cc
index 27c1a2f2f33..de986fec951 100644
--- a/source/blender/blenkernel/intern/geometry_component_curves.cc
+++ b/source/blender/blenkernel/intern/geometry_component_curves.cc
@@ -490,7 +490,7 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
curve_access,
make_array_read_attribute<int>,
make_array_write_attribute<int>,
- tag_component_positions_changed);
+ tag_component_topology_changed);
static BuiltinCustomDataLayerProvider cyclic("cyclic",
ATTR_DOMAIN_CURVE,
diff --git a/source/blender/makesdna/DNA_curves_types.h b/source/blender/makesdna/DNA_curves_types.h
index 0aa4ebc61d0..bb53dbafdc8 100644
--- a/source/blender/makesdna/DNA_curves_types.h
+++ b/source/blender/makesdna/DNA_curves_types.h
@@ -51,8 +51,8 @@ typedef enum KnotsMode {
/** Method used to calculate the normals of a curve's evaluated points. */
typedef enum NormalMode {
- NORMAL_MODE_Z_UP = 0,
- NORMAL_MODE_MINIMUM_TWIST = 1,
+ NORMAL_MODE_MINIMUM_TWIST = 0,
+ NORMAL_MODE_Z_UP = 1,
} NormalMode;
/**
@@ -84,7 +84,7 @@ typedef struct CurvesGeometry {
/**
* The start index of each curve in the point data. The size of each curve can be calculated by
* subtracting the offset from the next offset. That is valid even for the last curve because
- * this array is allocated with a length one larger than the number of splines. This is allowed
+ * this array is allocated with a length one larger than the number of curves. This is allowed
* to be null when there are no curves.
*
* \note This is *not* stored in #CustomData because its size is one larger than #curve_data.
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc
index be17918609f..5d97720a4f8 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc
@@ -59,11 +59,10 @@ static Array<float> curve_length_point_domain(const bke::CurvesGeometry &curves)
{
curves.ensure_evaluated_lengths();
const VArray<int8_t> types = curves.curve_types();
- const VArray<int> resolution = curves.resolution();
+ const VArray<int> resolutions = curves.resolution();
const VArray<bool> cyclic = curves.cyclic();
Array<float> result(curves.points_num());
- VArray<int> resolutions = curves.resolution();
threading::parallel_for(curves.curves_range(), 128, [&](IndexRange range) {
for (const int i_curve : range) {