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-04-27 01:01:56 +0300
committerHans Goudey <h.goudey@me.com>2021-04-27 01:01:56 +0300
commit14b26fc976590c6daa752d4327270540b757b652 (patch)
treea2a6ab33f39f8f87ca6b93f3c5e2016c07cbbbc0 /source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc
parent49b3d00c10b8df7fad21ca664b1eebe171c2c361 (diff)
Fix T87702: Cannot generate one point with line node in end points mode
Counts of less than one weren't allowed in end points mode mostly to avoid a division by zero when calculating the delta. It's trivial to allow a count of one, so this commit does that, with the point placed at the start location.
Diffstat (limited to 'source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc')
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc
index 1634569f9e9..2eeb87695a8 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc
@@ -151,7 +151,10 @@ static void geo_node_mesh_primitive_line_exec(GeoNodeExecParams params)
}
else if (count_mode == GEO_NODE_MESH_LINE_COUNT_TOTAL) {
const int count = params.extract_input<int>("Count");
- if (count > 1) {
+ if (count == 1) {
+ mesh = create_line_mesh(start, float3(0), count);
+ }
+ else {
const float3 delta = total_delta / (float)(count - 1);
mesh = create_line_mesh(start, delta, count);
}