[Bf-blender-cvs] [716682365c6] master: Fix T91119: Curve to mesh node inverted face normals

Hans Goudey noreply at git.blender.org
Fri Sep 3 23:50:00 CEST 2021


Commit: 716682365c6bcc1b5f757232ce1d2499b0d062a9
Author: Hans Goudey
Date:   Fri Sep 3 16:48:47 2021 -0500
Branches: master
https://developer.blender.org/rB716682365c6bcc1b5f757232ce1d2499b0d062a9

Fix T91119: Curve to mesh node inverted face normals

Previously I thought I fixed this by reversing the face corner indices
in quads created by the curve to mesh node. But then we fixed a problem
with the transforms used in that node by inverting one of their
components, so the required direction also reversed. This commit
reverts rBcf28398471c84 and reverses the default direction of the
quadrilateral primitive so it's the same as the others.

Tests will be updated.

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

M	source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadrilateral.cc
M	source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc

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

diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadrilateral.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadrilateral.cc
index 0d78d6c08d1..07ddaa8f61e 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadrilateral.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadrilateral.cc
@@ -30,10 +30,10 @@ static void geo_node_curve_primitive_quadrilateral_declare(NodeDeclarationBuilde
   b.add_input<decl::Float>("Offset").default_value(1.0f).subtype(PROP_DISTANCE);
   b.add_input<decl::Float>("Bottom Height").default_value(3.0f).min(0.0f).subtype(PROP_DISTANCE);
   b.add_input<decl::Float>("Top Height").default_value(1.0f).subtype(PROP_DISTANCE);
-  b.add_input<decl::Vector>("Point 1").default_value({-1.0f, 1.0f, 0.0f}).subtype(PROP_DISTANCE);
-  b.add_input<decl::Vector>("Point 2").default_value({1.0f, 1.0f, 0.0f}).subtype(PROP_DISTANCE);
-  b.add_input<decl::Vector>("Point 3").default_value({1.0f, -1.0f, 0.0f}).subtype(PROP_DISTANCE);
-  b.add_input<decl::Vector>("Point 4").default_value({-1.0f, -1.0f, 0.0f}).subtype(PROP_DISTANCE);
+  b.add_input<decl::Vector>("Point 1").default_value({-1.0f, -1.0f, 0.0f}).subtype(PROP_DISTANCE);
+  b.add_input<decl::Vector>("Point 2").default_value({1.0f, -1.0f, 0.0f}).subtype(PROP_DISTANCE);
+  b.add_input<decl::Vector>("Point 3").default_value({1.0f, 1.0f, 0.0f}).subtype(PROP_DISTANCE);
+  b.add_input<decl::Vector>("Point 4").default_value({-1.0f, 1.0f, 0.0f}).subtype(PROP_DISTANCE);
   b.add_output<decl::Geometry>("Curve");
 }
 
@@ -106,10 +106,10 @@ static void create_rectangle_curve(MutableSpan<float3> positions,
                                    const float height,
                                    const float width)
 {
-  positions[0] = float3(width / 2.0f, -height / 2.0f, 0.0f);
-  positions[1] = float3(-width / 2.0f, -height / 2.0f, 0.0f);
-  positions[2] = float3(-width / 2.0f, height / 2.0f, 0.0f);
-  positions[3] = float3(width / 2.0f, height / 2.0f, 0.0f);
+  positions[0] = float3(width / 2.0f, height / 2.0f, 0.0f);
+  positions[1] = float3(-width / 2.0f, height / 2.0f, 0.0f);
+  positions[2] = float3(-width / 2.0f, -height / 2.0f, 0.0f);
+  positions[3] = float3(width / 2.0f, -height / 2.0f, 0.0f);
 }
 
 static void create_points_curve(MutableSpan<float3> positions,
@@ -129,10 +129,10 @@ static void create_parallelogram_curve(MutableSpan<float3> positions,
                                        const float width,
                                        const float offset)
 {
-  positions[0] = float3(width / 2.0f - offset / 2.0f, -height / 2.0f, 0.0f);
-  positions[1] = float3(-width / 2.0f - offset / 2.0f, -height / 2.0f, 0.0f);
-  positions[2] = float3(-width / 2.0f + offset / 2.0f, height / 2.0f, 0.0f);
-  positions[3] = float3(width / 2.0f + offset / 2.0f, height / 2.0f, 0.0f);
+  positions[0] = float3(width / 2.0f + offset / 2.0f, height / 2.0f, 0.0f);
+  positions[1] = float3(-width / 2.0f + offset / 2.0f, height / 2.0f, 0.0f);
+  positions[2] = float3(-width / 2.0f - offset / 2.0f, -height / 2.0f, 0.0f);
+  positions[3] = float3(width / 2.0f - offset / 2.0f, -height / 2.0f, 0.0f);
 }
 static void create_trapezoid_curve(MutableSpan<float3> positions,
                                    const float bottom,
@@ -140,10 +140,10 @@ static void create_trapezoid_curve(MutableSpan<float3> positions,
                                    const float offset,
                                    const float height)
 {
-  positions[0] = float3(bottom / 2.0f, -height / 2.0f, 0.0f);
-  positions[1] = float3(-bottom / 2.0f, -height / 2.0f, 0.0f);
-  positions[2] = float3(-top / 2.0f + offset, height / 2.0f, 0.0f);
-  positions[3] = float3(top / 2.0f + offset, height / 2.0f, 0.0f);
+  positions[0] = float3(top / 2.0f + offset, height / 2.0f, 0.0f);
+  positions[1] = float3(-top / 2.0f + offset, height / 2.0f, 0.0f);
+  positions[2] = float3(-bottom / 2.0f, -height / 2.0f, 0.0f);
+  positions[3] = float3(bottom / 2.0f, -height / 2.0f, 0.0f);
 }
 
 static void create_kite_curve(MutableSpan<float3> positions,
@@ -151,10 +151,10 @@ static void create_kite_curve(MutableSpan<float3> positions,
                               const float bottom_height,
                               const float top_height)
 {
-  positions[0] = float3(-width / 2.0f, 0, 0);
-  positions[1] = float3(0, top_height, 0);
-  positions[2] = float3(width / 2, 0, 0);
-  positions[3] = float3(0, -bottom_height, 0);
+  positions[0] = float3(0, -bottom_height, 0);
+  positions[1] = float3(width / 2, 0, 0);
+  positions[2] = float3(0, top_height, 0);
+  positions[3] = float3(-width / 2.0f, 0, 0);
 }
 
 static void geo_node_curve_primitive_quadrilateral_exec(GeoNodeExecParams params)
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc
index ebaae59fbd6..b0c763c7d06 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc
@@ -164,16 +164,16 @@ static void spline_extrude_to_mesh_data(const Spline &spline,
 
       MLoop &loop_a = r_loops[ring_segment_loop_offset];
       loop_a.v = ring_vert_offset + i_profile;
-      loop_a.e = spline_edge_start + i_ring;
+      loop_a.e = ring_edge_start + i_profile;
       MLoop &loop_b = r_loops[ring_segment_loop_offset + 1];
-      loop_b.v = next_ring_vert_offset + i_profile;
-      loop_b.e = next_ring_edge_offset + i_profile;
+      loop_b.v = ring_vert_offset + i_next_profile;
+      loop_b.e = next_spline_edge_start + i_ring;
       MLoop &loop_c = r_loops[ring_segment_loop_offset + 2];
       loop_c.v = next_ring_vert_offset + i_next_profile;
-      loop_c.e = next_spline_edge_start + i_ring;
+      loop_c.e = next_ring_edge_offset + i_profile;
       MLoop &loop_d = r_loops[ring_segment_loop_offset + 3];
-      loop_d.v = ring_vert_offset + i_next_profile;
-      loop_d.e = ring_edge_start + i_profile;
+      loop_d.v = next_ring_vert_offset + i_profile;
+      loop_d.e = spline_edge_start + i_ring;
     }
   }



More information about the Bf-blender-cvs mailing list