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.
This commit is contained in:
Hans Goudey 2021-04-26 17:01:56 -05:00
parent 49b3d00c10
commit 14b26fc976
Notes: blender-bot 2023-02-14 09:36:46 +01:00
Referenced by issue #87702, Generating one point with Line node in End Points mode
1 changed files with 4 additions and 1 deletions

View File

@ -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);
}