From 2f772520862db0ad7edfa614dad0e8d2d65201e2 Mon Sep 17 00:00:00 2001 From: Leon Leno Date: Thu, 25 Mar 2021 20:59:29 -0400 Subject: [PATCH] Fix: Geometry Nodes: Incorrect offsets for plane primitive The recent commit that changed the size (rB83df3545246aada) left out a few changed. This patch also adjusts the positioning and UV scale of the generated plane accordingly. Differential Revision: https://developer.blender.org/D10822 --- .../nodes/geometry/nodes/node_geo_mesh_primitive_plane.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_plane.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_plane.cc index eff84d7d1ad..b2d418d3c80 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_plane.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_plane.cc @@ -51,8 +51,8 @@ static void calculate_uvs(Mesh *mesh, Span verts, Span loops, cons for (const int i : loops.index_range()) { const float3 &co = verts[loops[i].v].co; - uvs[i].x = (co.x + size) / (size * 2.0f); - uvs[i].y = (co.y + size) / (size * 2.0f); + uvs[i].x = (co.x + (size * 0.5)) / size; + uvs[i].y = (co.y + (size * 0.5)) / size; } uv_attribute.apply_span_and_save(); @@ -75,9 +75,9 @@ static Mesh *create_plane_mesh(const int verts_x, const int verts_y, const float { const float dx = size / edges_x; const float dy = size / edges_y; - float x = -size; + float x = -size * 0.5; for (const int x_index : IndexRange(verts_x)) { - float y = -size; + float y = -size * 0.5; for (const int y_index : IndexRange(verts_y)) { const int vert_index = x_index * verts_y + y_index; verts[vert_index].co[0] = x;