[Bf-blender-cvs] [2f772520862] master: Fix: Geometry Nodes: Incorrect offsets for plane primitive

Leon Leno noreply at git.blender.org
Fri Mar 26 02:00:38 CET 2021


Commit: 2f772520862db0ad7edfa614dad0e8d2d65201e2
Author: Leon Leno
Date:   Thu Mar 25 20:59:29 2021 -0400
Branches: master
https://developer.blender.org/rB2f772520862db0ad7edfa614dad0e8d2d65201e2

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

===================================================================

M	source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_plane.cc

===================================================================

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<MVert> verts, Span<MLoop> 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;



More information about the Bf-blender-cvs mailing list