[Bf-blender-cvs] [3a2899cc317] master: Fix T103942 ASAN crash in math_boolean function.

2023-01-22 Thread Howard Trickey
Commit: 3a2899cc31777308dd16d1f0e6916499564df711
Author: Howard Trickey
Date:   Sun Jan 22 12:48:45 2023 -0500
Branches: master
https://developer.blender.org/rB3a2899cc31777308dd16d1f0e6916499564df711

Fix T103942 ASAN crash in math_boolean function.

The code in questions comes from Shewchuk's triangle code, which
hasn't been updated to fix the out-of-buffer access problem
that ASAN finds in the delaunay unit test. The problem is benign:
the code would exit the loop before using the value fetched from
beyond the end of the buffer, but to make ASAN happy, I put in
a couple extra tests to not fetch values that aren't going to be used.

===

M   source/blender/blenlib/intern/math_boolean.cc

===

diff --git a/source/blender/blenlib/intern/math_boolean.cc 
b/source/blender/blenlib/intern/math_boolean.cc
index 689c23ce092..7c0cf165174 100644
--- a/source/blender/blenlib/intern/math_boolean.cc
+++ b/source/blender/blenlib/intern/math_boolean.cc
@@ -501,11 +501,15 @@ static int fast_expansion_sum_zeroelim(
 while ((eindex < elen) && (findex < flen)) {
   if ((fnow > enow) == (fnow > -enow)) {
 Two_Sum(Q, enow, Qnew, hh);
-enow = e[++eindex];
+if (++eindex < elen) {
+  enow = e[eindex];
+}
   }
   else {
 Two_Sum(Q, fnow, Qnew, hh);
-fnow = f[++findex];
+if (++findex < flen) {
+  fnow = f[findex];
+}
   }
   Q = Qnew;
   if (hh != 0.0) {
@@ -515,7 +519,9 @@ static int fast_expansion_sum_zeroelim(
   }
   while (eindex < elen) {
 Two_Sum(Q, enow, Qnew, hh);
-enow = e[++eindex];
+if (++eindex < elen) {
+  enow = e[eindex];
+}
 Q = Qnew;
 if (hh != 0.0) {
   h[hindex++] = hh;
@@ -523,7 +529,9 @@ static int fast_expansion_sum_zeroelim(
   }
   while (findex < flen) {
 Two_Sum(Q, fnow, Qnew, hh);
-fnow = f[++findex];
+if (++findex < flen) {
+  fnow = f[findex];
+}
 Q = Qnew;
 if (hh != 0.0) {
   h[hindex++] = hh;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b544199c566] master: Fix T102532: bevel spikes with loop slide.

2023-01-22 Thread Howard Trickey
Commit: b544199c566bbb9529b5925ce96ae2d2abbf04c1
Author: Howard Trickey
Date:   Sun Jan 22 10:28:12 2023 -0500
Branches: master
https://developer.blender.org/rBb544199c566bbb9529b5925ce96ae2d2abbf04c1

Fix T102532: bevel spikes with loop slide.

There's a compromise of a code parameter called BEVEL_GOOD_ANGLE,
and bugs T44961, T86768, T95335, and this one, are all about problems
with various values of that parameter. If an angle of an adjacent
non-beveled edge is too close to that of the beveled edge, then you
get spikes. The BEVEL_GOOD_ANGLE says that if you are within that
angle difference, then no bevel happens. If the value is too small
then one gets spikes for certain models people build; if the value
is too large, then other people are annoyed that no bevel happens.
Hopefully this compromise in this commit is the final one I will do
before switching to Bevel v2, where none of this should be an issue.

===

M   source/blender/bmesh/tools/bmesh_bevel.c

===

diff --git a/source/blender/bmesh/tools/bmesh_bevel.c 
b/source/blender/bmesh/tools/bmesh_bevel.c
index d3888e31da6..9e17efb2cd0 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -1506,7 +1506,7 @@ static void offset_meet(BevelParams *bp,
  * Update: changed again from 0.0001f to fix bug T95335.
  * Original two bugs remained fixed.
  */
-#define BEVEL_GOOD_ANGLE 0.001f
+#define BEVEL_GOOD_ANGLE 0.1f
 
 /**
  * Calculate the meeting point between e1 and e2 (one of which should have 
zero offsets),

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [60dccd4e6f8] bevelv2: Merge branch 'master' into bevelv2

2022-12-10 Thread Howard Trickey
Commit: 60dccd4e6f87d7603266c2023740ed740d727df9
Author: Howard Trickey
Date:   Sat Dec 10 13:38:57 2022 -0500
Branches: bevelv2
https://developer.blender.org/rB60dccd4e6f87d7603266c2023740ed740d727df9

Merge branch 'master' into bevelv2

===



===

diff --cc source/blender/nodes/NOD_static_types.h
index 7cd3101ad14,d94b0b56072..94bd2034ad7
--- a/source/blender/nodes/NOD_static_types.h
+++ b/source/blender/nodes/NOD_static_types.h
@@@ -283,10 -283,10 +283,11 @@@ DefNode(FunctionNode, FN_NODE_VALUE_TO_
  DefNode(GeometryNode, GEO_NODE_ACCUMULATE_FIELD, def_geo_accumulate_field, 
"ACCUMULATE_FIELD", AccumulateField, "Accumulate Field", "Add the values of an 
evaluated field together and output the running total for each element")
  DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_DOMAIN_SIZE, 
def_geo_attribute_domain_size, "ATTRIBUTE_DOMAIN_SIZE", AttributeDomainSize, 
"Domain Size", "Retrieve the number of elements in a geometry for each 
attribute domain")
  DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_STATISTIC, 
def_geo_attribute_statistic, "ATTRIBUTE_STATISTIC",AttributeStatistic, 
"Attribute Statistic","Calculate statistics about a data set from a field 
evaluated on a geometry")
 +DefNode(GeometryNode, GEO_NODE_BEVEL_MESH, def_geo_bevel_mesh, "BEVEL_MESH", 
BevelMesh, "Bevel Mesh", "")
+ DefNode(GeometryNode, GEO_NODE_BLUR_ATTRIBUTE, def_geo_blur_attribute, 
"BLUR_ATTRIBUTE", BlurAttribute, "Blur Attribute", "Mix attribute values of 
neighboring elements")
  DefNode(GeometryNode, GEO_NODE_BOUNDING_BOX, 0, "BOUNDING_BOX", BoundBox, 
"Bounding Box", "Calculate the limits of a geometry's positions and generate a 
box mesh with those dimensions")
  DefNode(GeometryNode, GEO_NODE_CAPTURE_ATTRIBUTE, 
def_geo_attribute_capture,"CAPTURE_ATTRIBUTE", CaptureAttribute, "Capture 
Attribute", "Store the result of a field on a geometry and output the data as a 
node socket. Allows remembering or interpolating data as the geometry changes, 
such as positions before deformation")
- DefNode(GeometryNode, GEO_NODE_COLLECTION_INFO, def_geo_collection_info, 
"COLLECTION_INFO", CollectionInfo, "Collection Info", "Retrieve geometry from a 
collection")
+ DefNode(GeometryNode, GEO_NODE_COLLECTION_INFO, def_geo_collection_info, 
"COLLECTION_INFO", CollectionInfo, "Collection Info", "Retrieve geometry 
instances from a collection")
  DefNode(GeometryNode, GEO_NODE_CONVEX_HULL, 0, "CONVEX_HULL", ConvexHull, 
"Convex Hull", "Create a mesh that encloses all points in the input geometry 
with the smallest number of points")
  DefNode(GeometryNode, GEO_NODE_CURVE_ENDPOINT_SELECTION, 0, 
"CURVE_ENDPOINT_SELECTION", CurveEndpointSelection, "Endpoint Selection", 
"Provide a selection for an arbitrary number of endpoints in each spline")
  DefNode(GeometryNode, GEO_NODE_CURVE_HANDLE_TYPE_SELECTION, 
def_geo_curve_handle_type_selection, "CURVE_HANDLE_TYPE_SELECTION", 
CurveHandleTypeSelection, "Handle Type Selection", "Provide a selection based 
on the handle types of Bézier control points")
diff --cc source/blender/nodes/geometry/CMakeLists.txt
index 7852d0a94b3,c6151022ac5..aa2b3a32c97
--- a/source/blender/nodes/geometry/CMakeLists.txt
+++ b/source/blender/nodes/geometry/CMakeLists.txt
@@@ -29,7 -29,7 +29,8 @@@ set(SR
nodes/node_geo_attribute_capture.cc
nodes/node_geo_attribute_domain_size.cc
nodes/node_geo_attribute_statistic.cc
 +  nodes/node_geo_bevel_mesh.cc
+   nodes/node_geo_blur_attribute.cc
nodes/node_geo_boolean.cc
nodes/node_geo_bounding_box.cc
nodes/node_geo_collection_info.cc

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [63e0bd1da62] bevelv2: Fix after merge for bevel_mesh node init.

2022-12-10 Thread Howard Trickey
Commit: 63e0bd1da62a9e3428b44a5bd5385badd7300040
Author: Howard Trickey
Date:   Sat Dec 10 14:06:02 2022 -0500
Branches: bevelv2
https://developer.blender.org/rB63e0bd1da62a9e3428b44a5bd5385badd7300040

Fix after merge for bevel_mesh node init.

===

M   source/blender/nodes/geometry/node_geometry_register.cc
M   source/blender/nodes/geometry/node_geometry_register.hh

===

diff --git a/source/blender/nodes/geometry/node_geometry_register.cc 
b/source/blender/nodes/geometry/node_geometry_register.cc
index 6518e8a62f7..aa1f43834f9 100644
--- a/source/blender/nodes/geometry/node_geometry_register.cc
+++ b/source/blender/nodes/geometry/node_geometry_register.cc
@@ -14,6 +14,7 @@ void register_geometry_nodes()
   register_node_type_geo_attribute_capture();
   register_node_type_geo_attribute_domain_size();
   register_node_type_geo_attribute_statistic();
+  register_node_type_geo_bevel_mesh();
   register_node_type_geo_blur_attribute();
   register_node_type_geo_boolean();
   register_node_type_geo_bounding_box();
diff --git a/source/blender/nodes/geometry/node_geometry_register.hh 
b/source/blender/nodes/geometry/node_geometry_register.hh
index 66ab1d32af0..df79e59802e 100644
--- a/source/blender/nodes/geometry/node_geometry_register.hh
+++ b/source/blender/nodes/geometry/node_geometry_register.hh
@@ -11,6 +11,7 @@ void register_node_type_geo_attribute_capture();
 void register_node_type_geo_attribute_domain_size();
 void register_node_type_geo_attribute_separate_xyz();
 void register_node_type_geo_attribute_statistic();
+void register_node_type_geo_bevel_mesh();
 void register_node_type_geo_blur_attribute();
 void register_node_type_geo_boolean();
 void register_node_type_geo_bounding_box();

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e737fe70617] bevelv2: Fix bugs exposed by using non-zero slope in all tests.

2022-12-07 Thread Howard Trickey
Commit: e737fe706177d56f2124a66ebb52740ed7904606
Author: Howard Trickey
Date:   Wed Dec 7 13:43:57 2022 -0500
Branches: bevelv2
https://developer.blender.org/rBe737fe706177d56f2124a66ebb52740ed7904606

Fix bugs exposed by using non-zero slope in all tests.

Using a non-zero slope in all tests causes some normal calculations
at the end, which in turn exposed a number of places where the trimesh
invariants were not properly maintained. This fixes all the problems
exposed by the current tests (there were several, mostly related
to how to reassign the representative edge for a vertex when
triangles and edges are collapsed.

===

M   source/blender/blenlib/intern/mesh_inset.cc
M   source/blender/blenlib/tests/BLI_mesh_inset_test.cc

===

diff --git a/source/blender/blenlib/intern/mesh_inset.cc 
b/source/blender/blenlib/intern/mesh_inset.cc
index 3d04a21a1d4..5ea16a49a73 100644
--- a/source/blender/blenlib/intern/mesh_inset.cc
+++ b/source/blender/blenlib/intern/mesh_inset.cc
@@ -164,7 +164,8 @@ class Triangle {
 TSPOKE0 = 1 << 3,
 TSPOKE1 = 1 << 4,
 TSPOKE2 = 1 << 5,
-/* TORIGi means the ith edge is an edge that was in the incoming mesh 
(before triangulation). */
+/* TORIGi means the ith edge is an edge that was in the incoming mesh 
(before triangulation).
+ */
 TORIG0 = 1 << 6,
 TORIG1 = 1 << 7,
 TORIG2 = 1 << 8,
@@ -322,7 +323,7 @@ class Triangle {
 
 void Triangle::calculate_normal()
 {
-  BLI_assert(!this->is_ghost());
+  BLI_assert(!this->is_ghost() && !this->is_deleted());
   float3 v0v1 = vert_[1]->co - vert_[0]->co;
   float3 v0v2 = vert_[2]->co - vert_[0]->co;
   normal_ = math::normalize(math::cross_high_precision(v0v1, v0v2));
@@ -332,7 +333,7 @@ void Triangle::calculate_normal()
 /* For use when we may not have calculated tri->normal_ (mostly for 
debugging). */
 static float3 triangle_normal(const Triangle *tri)
 {
-  if (tri->is_ghost()) {
+  if (tri->is_ghost() || tri->is_deleted()) {
 return float3(0.0f, 0.0f, 0.0f);
   }
   BLI_assert(!tri->is_ghost());
@@ -443,12 +444,14 @@ static Vector triangles_of_vert(const Vert *v)
  */
 static float3 vertex_normal(const Vert *vert)
 {
+  BLI_assert(!vert->is_deleted());
   float3 ans{0.0f, 0.0f, 0.0f};
   Edge e0 = vert->e;
   BLI_assert(!e0.is_null());
   Edge ecur = e0;
   do {
 Triangle *tri = ecur.tri();
+BLI_assert(!tri->is_deleted());
 if (!tri->is_ghost()) {
   Edge eprev = ecur.triangle_pred();
   float3 din = math::normalize(vert->co - v_src(eprev)->co);
@@ -548,6 +551,14 @@ class TriangleMesh {
*/
   Vert *collapse_triangle(Triangle *tri, int pos);
 
+  /** Delete \a tri, which should have a repeated vertex and therefore is 
degenerate.
+   * This means merging the two non-degenerate sides, which means properly 
setting
+   * the neighbor relations across the new single edge.
+   * Also, if any vertex was using an edge in \a tri for its representative, 
then a
+   * new representaative must be found.
+   */
+  Edge delete_degenerate_triangle(Triangle *tri);
+
   Span all_verts() const
   {
 return verts_.as_span();
@@ -561,6 +572,8 @@ class TriangleMesh {
 
   void calculate_all_tri_normals();
 
+  void validate();
+
   friend std::ostream <<(std::ostream , const TriangleMesh 
);
 };
 
@@ -627,6 +640,9 @@ std::ostream <<(std::ostream , const Triangle 
)
   os << " o" << i;
 }
   }
+  if (tri.is_deleted()) {
+os << " deleted";
+  }
   return os;
 }
 
@@ -798,7 +814,7 @@ static void trimesh_draw(const std::string , const 
TriangleMesh )
 void TriangleMesh::calculate_all_tri_normals()
 {
   for (Triangle *tri : triangles_) {
-if (!tri->is_ghost()) {
+if (!tri->is_ghost() && !tri->is_deleted()) {
   tri->calculate_normal();
 }
   }
@@ -913,6 +929,62 @@ Vert *TriangleMesh::split_vert(Vert *v, Edge e1, Edge e2)
   return v_new;
 }
 
+/** Find and set a `v->e` that is not part of Triangle `tri`. */
+static void set_rep_excluding(Vert *v, const Triangle *tri)
+{
+  Edge e0 = v->e;
+  Edge ecur = e0;
+  do {
+/* It is possible that, triangles around v may be deleted as we are in the 
process of deleting
+ * v. */
+if (ecur.tri() != tri && !ecur.tri()->is_deleted()) {
+  v->e = ecur;
+  return;
+}
+ecur = rot_ccw(ecur);
+  } while (ecur != e0);
+  BLI_assert_unreachable();
+}
+
+/** Delete \a tri, which should have a repeated vertex and therefore is 
degenerate.
+ * This means merging the two non-degenerate sides, which means properly 
setting
+ * the neighbor relations across the new single edge.
+ * Also, if any vertex was using an edge in \a tri for its representative, 
then a
+ * new representaative m

[Bf-blender-cvs] [c024d6f47db] blender-v3.3-release: Fix T95335 Bevel operator Loop Slide overshoot.

2022-11-28 Thread Howard Trickey
Commit: c024d6f47dbd14da2397fa3818d0ea4e8c6a5329
Author: Howard Trickey
Date:   Sun Nov 13 14:09:27 2022 -0500
Branches: blender-v3.3-release
https://developer.blender.org/rBc024d6f47dbd14da2397fa3818d0ea4e8c6a5329

Fix T95335 Bevel operator Loop Slide overshoot.

If the edge you are going to slide along is very close to in line
with the adjacent beveled edge, then there will be sharp overshoots.
There is an epsilon comparison to just abandon loop slide if this
situation is happening. That epsilon used to be 0.25 radians, but
bug T86768 complained that that value was too high, so it was changed
to .0001 radians (5 millidegrees). Now this current bug shows that
that was too aggressively small, so this change ups it by a factor
of 10, to .001 radians (5 centidegrees). All previous bug reports
remained fixed.

===

M   source/blender/bmesh/tools/bmesh_bevel.c

===

diff --git a/source/blender/bmesh/tools/bmesh_bevel.c 
b/source/blender/bmesh/tools/bmesh_bevel.c
index aa2c93f7c5a..20ea8a4db08 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -1502,8 +1502,11 @@ static void offset_meet(BevelParams *bp,
 }
 
 /* This was changed from 0.25f to fix bug T86768.
- * Original bug T44961 remains fixed with this value. */
-#define BEVEL_GOOD_ANGLE 0.0001f
+ * Original bug T44961 remains fixed with this value.
+ * Update: changed again from 0.0001f to fix bug T95335.
+ * Original two bugs remained fixed.
+ */
+#define BEVEL_GOOD_ANGLE 0.001f
 
 /**
  * Calculate the meeting point between e1 and e2 (one of which should have 
zero offsets),

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [0a7fea09d36] bevelv2: Merge branch 'master' into bevelv2

2022-11-19 Thread Howard Trickey
Commit: 0a7fea09d36d4be88933c702fec4f95153f36434
Author: Howard Trickey
Date:   Sat Nov 19 10:40:21 2022 -0500
Branches: bevelv2
https://developer.blender.org/rB0a7fea09d36d4be88933c702fec4f95153f36434

Merge branch 'master' into bevelv2

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [5cea3e5500b] bevelv2: Fix way of dealing with loose eddges, as per commit rB1ea169d90e39.

2022-11-19 Thread Howard Trickey
Commit: 5cea3e5500bf23ea5668950dd6972ed99203afe5
Author: Howard Trickey
Date:   Sat Nov 19 11:01:06 2022 -0500
Branches: bevelv2
https://developer.blender.org/rB5cea3e5500bf23ea5668950dd6972ed99203afe5

Fix way of dealing with loose eddges, as per commit rB1ea169d90e39.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc 
b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
index 512fb9df06c..28c16143a86 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
@@ -887,7 +887,7 @@ Mesh *MeshDelta::apply_delta_to_mesh(GeometrySet 
_set, const MeshCompon
 copy_v3_v3(mesh_out->verts_for_write()[v + keep_vertices.size()].co, 
new_verts_[v].co);
   }
 
-  BKE_mesh_calc_edges_loose(mesh_out);
+  BKE_mesh_runtime_clear_cache(mesh_out);
   if (dbglevel > 0) {
 std::cout << "\nFinal Mesh\n" << mesh_out;
   }
@@ -2014,8 +2014,8 @@ void register_node_type_geo_bevel_mesh()
   static bNodeType ntype;
   geo_node_type_base(, GEO_NODE_BEVEL_MESH, "Bevel Mesh", 
NODE_CLASS_GEOMETRY);
   ntype.declare = file_ns::node_declare;
-  node_type_init(, file_ns::node_init);
-  node_type_update(, file_ns::node_update);
+  ntype.initfunc = file_ns::node_init;
+  ntype.updatefunc = file_ns::node_update;
   ntype.geometry_node_execute = file_ns::node_geo_exec;
   node_type_storage(
   , "NodeGeometryBevelMesh", node_free_standard_storage, 
node_copy_standard_storage);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [c2a68c066b5] blender-v3.4-release: Fix T95335 Bevel operator Loop Slide overshoot.

2022-11-16 Thread Howard Trickey
Commit: c2a68c066b59c87375e3169f50cfd5ac8f18465d
Author: Howard Trickey
Date:   Wed Nov 16 08:23:29 2022 -0500
Branches: blender-v3.4-release
https://developer.blender.org/rBc2a68c066b59c87375e3169f50cfd5ac8f18465d

Fix T95335 Bevel operator Loop Slide overshoot.

If the edge you are going to slide along is very close to in line
with the adjacent beveled edge, then there will be sharp overshoots.
There is an epsilon comparison to just abandon loop slide if this
situation is happening. That epsilon used to be 0.25 radians, but
bug T86768 complained that that value was too high, so it was changed
to .0001 radians (5 millidegrees). Now this current bug shows that
that was too aggressively small, so this change ups it by a factor
of 10, to .001 radians (5 centidegrees). All previous bug reports
remained fixed.

===

M   source/blender/bmesh/tools/bmesh_bevel.c

===

diff --git a/source/blender/bmesh/tools/bmesh_bevel.c 
b/source/blender/bmesh/tools/bmesh_bevel.c
index c45f9dbe49c..acbdab55444 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -1502,8 +1502,10 @@ static void offset_meet(BevelParams *bp,
 }
 
 /* This was changed from 0.25f to fix bug T86768.
- * Original bug T44961 remains fixed with this value. */
-#define BEVEL_GOOD_ANGLE 0.0001f
+ * Original bug T44961 remains fixed with this value.
+ * Update : changed again from 0.0001f to fix bug T95335.*Original two bugs 
remained fixed.
+ */
+#define BEVEL_GOOD_ANGLE 0.001f
 
 /**
  * Calculate the meeting point between e1 and e2 (one of which should have 
zero offsets),

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] SVN commit: bf-blender [63100] trunk/lib/tests/modeling/modifiers.blend: Making modifiers test pass, previous try didn't work

2022-11-13 Thread Howard Trickey
Revision: 63100
  https://developer.blender.org/rBL63100
Author:   howardt
Date: 2022-11-13 23:18:08 +0100 (Sun, 13 Nov 2022)
Log Message:
---
Making modifiers test pass, previous try didn't work

Modified Paths:
--
trunk/lib/tests/modeling/modifiers.blend

Modified: trunk/lib/tests/modeling/modifiers.blend
===
(Binary files differ)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] SVN commit: bf-blender [63099] trunk/lib/tests/modeling/modifiers.blend: Update modifiers test to go with fix for loop slide spike

2022-11-13 Thread Howard Trickey
Revision: 63099
  https://developer.blender.org/rBL63099
Author:   howardt
Date: 2022-11-13 20:19:33 +0100 (Sun, 13 Nov 2022)
Log Message:
---
Update modifiers test to go with fix for loop slide spike

Modified Paths:
--
trunk/lib/tests/modeling/modifiers.blend

Modified: trunk/lib/tests/modeling/modifiers.blend
===
(Binary files differ)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d17f5bcd8f2] master: Fix T95335 Bevel operator Loop Slide overshoot.

2022-11-13 Thread Howard Trickey
Commit: d17f5bcd8f26d32b26bc945658e6d308316cd3fe
Author: Howard Trickey
Date:   Sun Nov 13 14:09:27 2022 -0500
Branches: master
https://developer.blender.org/rBd17f5bcd8f26d32b26bc945658e6d308316cd3fe

Fix T95335 Bevel operator Loop Slide overshoot.

If the edge you are going to slide along is very close to in line
with the adjacent beveled edge, then there will be sharp overshoots.
There is an epsilon comparison to just abandon loop slide if this
situation is happening. That epsilon used to be 0.25 radians, but
bug T86768 complained that that value was too high, so it was changed
to .0001 radians (5 millidegrees). Now this current bug shows that
that was too aggressively small, so this change ups it by a factor
of 10, to .001 radians (5 centidegrees). All previous bug reports
remained fixed.

===

M   source/blender/bmesh/tools/bmesh_bevel.c

===

diff --git a/source/blender/bmesh/tools/bmesh_bevel.c 
b/source/blender/bmesh/tools/bmesh_bevel.c
index c45f9dbe49c..fbc47505924 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -1502,8 +1502,11 @@ static void offset_meet(BevelParams *bp,
 }
 
 /* This was changed from 0.25f to fix bug T86768.
- * Original bug T44961 remains fixed with this value. */
-#define BEVEL_GOOD_ANGLE 0.0001f
+ * Original bug T44961 remains fixed with this value.
+ * Update: changed again from 0.0001f to fix bug T95335.
+ * Original two bugs remained fixed.
+ */
+#define BEVEL_GOOD_ANGLE 0.001f
 
 /**
  * Calculate the meeting point between e1 and e2 (one of which should have 
zero offsets),

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [2ce0bb13589] bevelv2: Better comments and fixing implicit precision conversion warnings.

2022-11-12 Thread Howard Trickey
Commit: 2ce0bb135892024ffb125acf74a51218ee4eb0bb
Author: Howard Trickey
Date:   Sat Nov 12 14:16:47 2022 -0500
Branches: bevelv2
https://developer.blender.org/rB2ce0bb135892024ffb125acf74a51218ee4eb0bb

Better comments and fixing implicit precision conversion warnings.

===

M   source/blender/blenlib/BLI_mesh_inset.hh
M   source/blender/blenlib/intern/mesh_inset.cc

===

diff --git a/source/blender/blenlib/BLI_mesh_inset.hh 
b/source/blender/blenlib/BLI_mesh_inset.hh
index 599ea061b2e..98a0ec762ce 100644
--- a/source/blender/blenlib/BLI_mesh_inset.hh
+++ b/source/blender/blenlib/BLI_mesh_inset.hh
@@ -17,6 +17,60 @@
 
 namespace blender::meshinset {
 
+/*
+ * This is the library interface to a function that can inset
+ * contours (closed sequences of vertices) of a 3D mesh.
+ * For generality, the mesh is specified by #Span of faces,
+ * where each face has the sequence of vertex indices that
+ * are traversed in CCW order to form the face.
+ * The indices given the position in a #Span of #float3 entries,
+ * which are 3D coordinates.
+ *
+ * An "inset" of a contour by a given amount is conceptually
+ * formed as follows: offset each edge of the contour on its left
+ * side by the specified amount, shortening and joining up each
+ * offset edge with its neighbor offset edges. If the contour
+ * forms a face, this is typically known as a "face inset".
+ * However, that conceptual description fails to describe what
+ * to do if an offset edge shortens so much that it vanishes,
+ * or if advancing intersection points of offset edges collide
+ * into offset edges from another part of the contour (or another
+ * contour).
+ *
+ * An algorithm called the "Straight Skeleton Algorithm"
+ * (see https://wikipedia.org/wiki/Straight_skeleton)
+ * deals with such complications, and is what is used in this
+ * library routine. That algorithm regards each edge of the
+ * contour as a wavefront that advances at a constant speed,
+ * dealing with topological changes as wavefront edges collapse
+ * or crash into opposite ones. The Straight Skeleton is what
+ * remains if you advance the wavefronts as far as they can go,
+ * but we can stop at any particular amount of advancement to
+ * achieve an inset by that amount.
+ *
+ * However, the Straight Skeleton Algorithm is a 2D algorithm,
+ * doesn't deal with internal geometry. This library function
+ * is adapted to work in 3D and "flow over" internal geometry
+ * as the wavefronts advance.
+ *
+ * Also, an extra feature of this library is to allow the advancing
+ * wavefronts to raise (along face normals) at a given slope.
+ * Users like this as an option to a "face inset" function.
+ *
+ * Usage:
+ * Populate a #MeshInset_Input structure with the mesh
+ * (vertex coordinates and faces), the contours to inset
+ * (vertex indices forming closed loops to inset),
+ * and the amount to inset and the slope.
+ * Pass this to #mesh_inset_calc, and receive a #MeshInset_Result
+ * as output.
+ * The #MeshInset_Result has a new mesh, also give by vertex
+ * coordinates and faces. It also has some data to help understand
+ * how to map the output back to the input:
+ * TODO: Document the extras when this interface finally settles down.
+ */
+
+/** #MeshInset_Input is the input structure for #mesh_inset_calc. */
 class MeshInset_Input {
 public:
   /** The vertices. Can be a superset of the needed vertices. */
@@ -30,6 +84,7 @@ public:
   bool need_ids;
 };
 
+/** #MeshInset_Result is the output structure for #mesh_inset_calc. */
 class MeshInset_Result {
 public:
   /** The output vertices. A subset (perhaps) of input vertices, plus some new 
ones. */
@@ -44,6 +99,12 @@ public:
   Array orig_face;
 };
 
+/**
+ * Calculate a mesh inset -- the offset of a set of contours, dealing with 
collisions.
+ *
+ * \param input: a #MeshInset_Input containing a mesh, contours to offet, and 
offset parameters.
+ * \return a #MeshInset_Result giving a new mesh and data to relate the output 
to the input.
+ */
 MeshInset_Result mesh_inset_calc(const MeshInset_Input );
 
 }  // namespace blender::meshinset
diff --git a/source/blender/blenlib/intern/mesh_inset.cc 
b/source/blender/blenlib/intern/mesh_inset.cc
index 228507bdda2..3d04a21a1d4 100644
--- a/source/blender/blenlib/intern/mesh_inset.cc
+++ b/source/blender/blenlib/intern/mesh_inset.cc
@@ -502,7 +502,7 @@ class TriangleMesh {
   Vert *add_vert(const float3 co)
   {
 Vert *vert = new Vert(co);
-int v = verts_.append_and_get_index(vert);
+int v = int(verts_.append_and_get_index(vert));
 vert->id = v;
 return vert;
   }
@@ -515,7 +515,7 @@ class TriangleMesh {
   Triangle *add_triangle(Vert *v0, Vert *v1, Vert *v2)
   {
 Triangle *tri = new Triangle(v0, v1, v2);
-int t = triangles_.append_and_get_index(tri);
+int t = int(tria

[Bf-blender-cvs] [58b6976a27f] bevelv2: Fix a bug re slope on vertex events.

2022-11-05 Thread Howard Trickey
Commit: 58b6976a27f2de5a607d18b5700aa9b3a9a0add7
Author: Howard Trickey
Date:   Sat Nov 5 14:38:46 2022 -0400
Branches: bevelv2
https://developer.blender.org/rB58b6976a27f2de5a607d18b5700aa9b3a9a0add7

Fix a bug re slope on vertex events.

When insetting a square face with a slope, not all center
vertices got raised. This fixes that.
Also disabled the grid inset test, which doesn't work yet.

===

M   source/blender/blenlib/intern/mesh_inset.cc
M   source/blender/blenlib/tests/BLI_mesh_inset_test.cc

===

diff --git a/source/blender/blenlib/intern/mesh_inset.cc 
b/source/blender/blenlib/intern/mesh_inset.cc
index 6690e28e738..228507bdda2 100644
--- a/source/blender/blenlib/intern/mesh_inset.cc
+++ b/source/blender/blenlib/intern/mesh_inset.cc
@@ -154,12 +154,17 @@ class Vert {
 class Triangle {
 
   enum TriangleFlags {
+/* TDELETED means the triangle is no longer part of its TriangleMesh. */
 TDELETED = 1,
+/* TNORMAL_VALID means the normal_ member is the normal using current 
coordinates. */
 TNORMAL_VALID = 1 << 1,
+/* TREGION means the triangle is part of the region still being inset. */
 TREGION = 1 << 2,
+/* TSPOKEi means the ith edge is a spoke in the Straight Skeleton 
construction. */
 TSPOKE0 = 1 << 3,
 TSPOKE1 = 1 << 4,
 TSPOKE2 = 1 << 5,
+/* TORIGi means the ith edge is an edge that was in the incoming mesh 
(before triangulation). */
 TORIG0 = 1 << 6,
 TORIG1 = 1 << 7,
 TORIG2 = 1 << 8,
@@ -1481,6 +1486,7 @@ void StraightSkeleton::dump_state() const
   std::cout << "State\n";
   dump_event_queue();
   std::cout << trimesh_;
+  trimesh_draw("dump_state", trimesh_);
   for (int i : IndexRange(trimesh_.all_tris().size())) {
 SkeletonVertex *skv = skel_vertex_map_.lookup_default(i, nullptr);
 if (skv != nullptr) {
@@ -2030,7 +2036,7 @@ void StraightSkeleton::add_triangle(Edge edge, float 
min_height)
  * wavefront too). Suppose we have the following, where e
  * is the argument edge, and ep--e--en are part of the wavefront,
  * and s and sn are spokes.
- * We need to collapse edge e (deleting tirangles X and C and vertex v).
+ * We need to collapse edge e (deleting triangles X and C and vertex vn).
  * Then we need to split the remaining vertex v, splitting off edges
  * en to ep CCW. Note: it is possible that en is a side of X, so be
  * careful about that after collapsing e.
@@ -2428,6 +2434,8 @@ void StraightSkeleton::compute()
   set_skel_vertex_map(v_src(new_spoke)->id, skv);
   new_v->co = event.final_pos();
   vertex_height_map.add(new_v->id, height);
+  /* Also need to set the height for the other end of the spoke, which has 
0 length right now. */
+  vertex_height_map.add(v_src(new_spoke)->id, height);
 
   if (dbg_level > 0) {
 std::cout << "add_events for v" << new_v->id << " at height " << height
diff --git a/source/blender/blenlib/tests/BLI_mesh_inset_test.cc 
b/source/blender/blenlib/tests/BLI_mesh_inset_test.cc
index 51f8132b21d..b1313d536b0 100644
--- a/source/blender/blenlib/tests/BLI_mesh_inset_test.cc
+++ b/source/blender/blenlib/tests/BLI_mesh_inset_test.cc
@@ -149,12 +149,13 @@ TEST(mesh_inset, Square)
   0 1 2 3
   )";
 
-  InputHolder in1(spec, 0.3);
+  InputHolder in1(spec, 0.4);
   MeshInset_Result out1 = mesh_inset_calc(in1.input);
   EXPECT_EQ(out1.vert.size(), 8);
   EXPECT_EQ(out1.face.size(), 5);
 
-  InputHolder in2(spec, 1.0);
+  InputHolder in2(spec, 0.51);
+  in2.input.slope = 0.5f;
   MeshInset_Result out2 = mesh_inset_calc(in2.input);
   /* Note: current code wants all 3-valence vertices in
* straight skeleton, so the center doesn't collapse to
@@ -162,6 +163,15 @@ TEST(mesh_inset, Square)
* length edge between them. */
   EXPECT_EQ(out2.vert.size(), 6);
   EXPECT_EQ(out2.face.size(), 4);
+  /* The last two verts should be in the center, with height 0.25. */
+  const float3  = out2.vert[4];
+  const float3  = out2.vert[5];
+  EXPECT_NEAR(v4.x, 0.5, 1e-5);
+  EXPECT_NEAR(v4.y, 0.5, 1e-5);
+  EXPECT_NEAR(v4.z, 0.25, 1e-5);
+  EXPECT_NEAR(v5.x, 0.5, 1e-5);
+  EXPECT_NEAR(v5.y, 0.5, 1e-5);
+  EXPECT_NEAR(v5.z, 0.25, 1e-5);
 }
 
 TEST(mesh_inset, Pentagon)
@@ -339,6 +349,7 @@ TEST(mesh_inset, Flipper)
   EXPECT_EQ(out11.face.size(), 20);
 }
 
+#if 0
 TEST(mesh_inset, Grid)
 {
   const char *spec = R"(16 9 1
@@ -375,6 +386,7 @@ TEST(mesh_inset, Grid)
   EXPECT_EQ(out1.vert.size(), 28);
   EXPECT_EQ(out1.face.size(), 21);
 }
+#endif
 
 }  // namespace test

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [cb83c88bf9a] bevelv2: Fix crash in vertex bevel due to bad face reconstruct.

2022-10-25 Thread Howard Trickey
Commit: cb83c88bf9afdf3b284216af6a1579cdac1fd46a
Author: Howard Trickey
Date:   Tue Oct 25 21:09:00 2022 +0200
Branches: bevelv2
https://developer.blender.org/rBcb83c88bf9afdf3b284216af6a1579cdac1fd46a

Fix crash in vertex bevel due to bad face reconstruct.

The logic for face reconstruction was wrong when the start of
a face was a beveled vertex.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc 
b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
index 9f0a54ea9c3..512fb9df06c 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
@@ -479,7 +479,7 @@ void MeshDelta::delete_face(int f)
   }
 }
 
-#if 0
+#if 1
 /* For debugging. */
 static std::ostream <<(std::ostream , const Mesh *mesh)
 {
@@ -739,6 +739,11 @@ static void 
copy_attributes_based_on_fn(Map 
 
 Mesh *MeshDelta::apply_delta_to_mesh(GeometrySet _set, const 
MeshComponent _component)
 {
+  constexpr int dbglevel = 0;
+  if (dbglevel > 0) {
+std::cout << "\nApply delta to mesh\n";
+this->print("final delta");
+  }
   /* The keep_... vectors hold the indices of elements in the original mesh to 
keep. */
   Vector keep_vertices;
   Vector keep_edges;
@@ -883,6 +888,9 @@ Mesh *MeshDelta::apply_delta_to_mesh(GeometrySet 
_set, const MeshCompon
   }
 
   BKE_mesh_calc_edges_loose(mesh_out);
+  if (dbglevel > 0) {
+std::cout << "\nFinal Mesh\n" << mesh_out;
+  }
   return mesh_out;
 }
 
@@ -1787,6 +1795,10 @@ void BevelData::calculate_vertex_bevel()
 lfirst = lnew;
   }
   num_loops++;
+  /* IF we are back tot he beginning, the following was already done. */
+  if (l == mpoly.loopstart + mpoly.totloop - 1) {
+break;
+  }
   std::pair lnew_and_cnt = new_loops_for_beveled_vert(bvd2, v2i, 
v2o);
   num_loops += lnew_and_cnt.second;
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [fc8f9e42042] bevelv2: Refactored vertex data structures.

2022-10-24 Thread Howard Trickey
Commit: fc8f9e420426570dcb3e026ecbe8145cd0fae5ca
Author: Howard Trickey
Date:   Mon Oct 24 19:25:22 2022 +0200
Branches: bevelv2
https://developer.blender.org/rBfc8f9e420426570dcb3e026ecbe8145cd0fae5ca

Refactored vertex data structures.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc 
b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
index ab6b24515e6..9f0a54ea9c3 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
@@ -9,6 +9,8 @@
 #include "BKE_mesh_runtime.h"
 
 #include "BLI_array.hh"
+#include "BLI_hash.hh"
+#include "BLI_map.hh"
 #include "BLI_math_vec_types.hh"
 #include "BLI_math_vector.hh"
 #include "BLI_mesh_inset.hh"
@@ -245,1246 +247,1286 @@ float3 
MeshTopology::edge_dir_from_vert_normalized(int e, int v) const
   return math::normalize(edge_dir_from_vert(e, v));
 }
 
-/** A Vertex Cap consists of a vertex in a mesh and an CCW ordering of
- * alternating edges and faces around it, as viewed from the face's
- * normal side. Some faces may be missing (i.e., gaps).
- * (If there are other edges and faces attached to the vertex that
- * don't fit into this pattern, they need to go into other Vertex Caps
- * or ignored, for the sake of beveling.)
+/** Canon
+ * CanonVertPair is a pair of vertex indices in canonical order (first index 
<= second index).
+ * This is suitable for a key to look up edges by.
  */
-class VertexCap {
-  Array edges_;
-  Array faces_;  // face_[i] is between edges i and i+1
-
+class CanonVertPair {
  public:
-  /* The vertex (as index into a mesh) that the cap is around. */
-  int vert;
+  int v1;
+  int v2;
 
-  VertexCap() : vert(-1)
+  CanonVertPair(int a, int b)
   {
+if (a < b) {
+  v1 = a;
+  v2 = b;
+}
+else {
+  v1 = b;
+  v2 = a;
+}
   }
-  VertexCap(int vert, Span edges, Span faces) : edges_(edges), 
faces_(faces), vert(vert)
+
+  uint64_t hash() const
   {
+return get_default_hash_2(v1, v2);
   }
 
-  /* Initialize for vertex v, given a mesh topo. */
-  void init_from_topo(const int vert, const MeshTopology );
+  friend bool operator==(const CanonVertPair a, const CanonVertPair b);
+};
 
-  /* The number of edges around the cap. */
-  int size() const
-  {
-return edges_.size();
-  }
+bool operator==(const CanonVertPair a, const CanonVertPair b){
+  return a.v1 == b.v1 && a.v2 == b.v2;
+}
 
-  /* Edges in CCW order (viewed from top) around the cap. */
-  Span edges() const
-  {
-return edges_.as_span();
-  }
+/** IndexAlloc allocates sequential integers, starting from a given start 
value. */
+class IndexAlloc {
+  int start_;
+  int first_free_;
 
-  /* Faces in CCW order (viewed from top) around the cap. -1 means a gap. */
-  Span faces() const
+ public:
+  IndexAlloc(int start) : start_(start), first_free_(start)
   {
-return faces_.as_span();
   }
 
-  /* The ith edge. */
-  int edge(int i) const
+  int alloc()
   {
-return edges_[i];
+return first_free_++;
   }
-  /* The edge after the ith edge (with wraparound). */
-  int next_edge(int i) const
+  int start() const
   {
-return i < edges_.size() - 1 ? edges_[i + 1] : edges_[0];
+return start_;
   }
-  /* The edge before the ith edge (with wraparound). */
-  int prev_edge(int i) const
+  int allocated_size() const
   {
-return i > 1 ? edges_[i - 1] : edges_.last();
+return first_free_ - start_;
   }
+};
 
-  /* The face returned may be -1, meaning "gap". */
-  /* The face betwen edge(i) and next_edge(i). */
-  int face(int i) const
+/** MeshDelta represents a delta to a Mesh: additions and deletions
+ * of Mesh elements.
+ * New elements will get index numbers starting at the end of the current
+ * range of the elements in the base mesh, `mesh_`.
+ * There is also a fast method for finding an edge, if any, joining two
+ * vertices (either in the base mesh, or in the added vertices, or mixed).
+ */
+class MeshDelta {
+  const Mesh _;
+  const MeshTopology _;
+  IndexAlloc vert_alloc_;
+  IndexAlloc edge_alloc_;
+  IndexAlloc poly_alloc_;
+  IndexAlloc loop_alloc_;
+  Set vert_deletes_;
+  Set edge_deletes_;
+  Set poly_deletes_;
+  Set loop_deletes_;
+  Vector new_verts_;
+  Vector new_edges_;
+  Vector new_polys_;
+  Vector new_loops_;
+  Vector new_vert_rep_;
+  Vector new_edge_rep_;
+  Vector new_poly_rep_;
+  Vector new_loop_rep_;
+  /* Lookup map for added edges. */
+  Map new_edge_map_;
+
+ public:
+  MeshDelta(const Mesh , const MeshTopology );
+
+  /* In the following, `rep` is the index of the old mesh element to base 
attributes on.  */
+  int new_vert(const float3 , int rep);
+  int new_edge(int v1, int v

[Bf-blender-cvs] [a41a1bfc494] bevelv2: Merge branch 'master' into bevelv2

2022-10-24 Thread Howard Trickey
Commit: a41a1bfc494e4015406549e137114ef5a450aaf0
Author: Howard Trickey
Date:   Mon Oct 24 19:33:11 2022 +0200
Branches: bevelv2
https://developer.blender.org/rBa41a1bfc494e4015406549e137114ef5a450aaf0

Merge branch 'master' into bevelv2

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [6df669a0bd5] bevelv2: Refactor bevel calculation in bevel node.

2022-10-09 Thread Howard Trickey
Commit: 6df669a0bd573eb46b10b324bf21a5fbf6ac3760
Author: Howard Trickey
Date:   Sun Oct 9 14:51:31 2022 -0400
Branches: bevelv2
https://developer.blender.org/rB6df669a0bd573eb46b10b324bf21a5fbf6ac3760

Refactor bevel calculation in bevel node.

Unified the general calculation framework for each of vertex,
edge, and face bevels.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc 
b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
index 91898834baf..ab6b24515e6 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
@@ -709,117 +709,130 @@ HalfEdge *BevelVertexData::find_half_edge(int edge) 
const
   return nullptr;
 }
 
-/** BevelData holds the global data needed for a bevel. */
-class BevelData {
-  /* BevelVertexData for just the affected vertices. */
-  Array bevel_vert_data_;
-  /* A map from mesh vertex index to index in bevel_vert_data_.
-   * If we wanted  more speed at expense of space, we could also use
-   * an Array of size equal to the number of mesh vertices here.
-   */
-  Map vert_to_bvd_index_;
-  /* All the BevelEdges, when edge beveling. */
-  Array bevel_edge_;
-  /* Map from mesh edge indiex inot bevel_edge_. */
-  Map edge_to_bevel_edge_;
-
+/** BevelSpec holds the data the specifies what the user wants beveled.
+ * There will be a derived class for each type of bevel.
+ */
+class BevelSpec {
  public:
-  MeshTopology topo;
+  /* Are we beveling vertices, edges, or faces? */
+  GeometryNodeBevelMeshMode bevel_mode;
+  /* A mask over the elements of the beveled type, saying what is to bovel. */
+  IndexMask to_bevel;
 
-  BevelData(const Mesh ) : topo(mesh)
-  {
-  }
-  ~BevelData()
+  BevelSpec(GeometryNodeBevelMeshMode mode, IndexMask to_bevel)
+  : bevel_mode(mode), to_bevel(to_bevel)
   {
   }
 
-  /* Initial calculation of vertex bevels. */
-  void calculate_vertex_bevels(const IndexMask to_bevel, VArray 
amounts);
-
-  /* Calculation of edge bevels. */
-  void calculate_edge_bevels(const IndexMask to_bevel, VArray amounts);
+  virtual void dump_spec() = 0;
+};
 
-  /* Sets up internal Map for fast access to the BevelVertexData for a given 
mesh vert. */
-  void setup_vert_map();
+class VertexBevelSpec : public BevelSpec {
+ public:
+  /* Indexed by Mesh vertex index, the amount to slide along all edges
+   * attached to the vertex. */
+  VArray amount;
 
-  /* What is the BevelVertexData for mesh vertex `vert`? May return nullptr if 
`vert` isn't
-   * involved in beveling. */
-  BevelVertexData *bevel_vertex_data(int vert)
+  VertexBevelSpec(IndexMask to_bevel, VArray amount)
+  : BevelSpec{GEO_NODE_BEVEL_MESH_VERTICES, to_bevel}, amount(amount)
   {
-int slot = vert_to_bvd_index_.lookup_default(vert, -1);
-if (slot != -1) {
-  return _vert_data_[slot];
-}
-return nullptr;
   }
 
-  Span beveled_vertices_data() const
-  {
-return bevel_vert_data_.as_span();
+  void dump_spec();
+};
+
+void VertexBevelSpec::dump_spec()
+{
+  std::cout << "VertexBevelSpec\n";
+  for (const int v : to_bevel.index_range()) {
+if (to_bevel[v]) {
+  std::cout << v << ": " << amount[v] << "\n";
+}
   }
+}
 
-  MutableSpan mutable_beveled_vertices_data()
+class FaceBevelSpec : public BevelSpec {
+ public:
+  /* Indexed by Mesh poly index, the amount to inset the face by. */
+  VArray amount;
+  /* Indexed by Mesh poly index, the slope to follow when insetting the face. 
*/
+  VArray slope;
+  bool use_regions;
+
+  FaceBevelSpec(IndexMask to_bevel, VArray amount, VArray slope, 
bool use_regions)
+  : BevelSpec{GEO_NODE_BEVEL_MESH_FACES, to_bevel},
+amount(amount),
+slope(slope),
+use_regions(use_regions)
   {
-return bevel_vert_data_.as_mutable_span();
   }
 
-  void print(const std::string ) const;
+  void dump_spec();
 };
 
-/** Make a transation map from mesh vertex index to indices in 
bevel_vert_data_. */
-void BevelData::setup_vert_map()
+void FaceBevelSpec::dump_spec()
 {
-  vert_to_bvd_index_.reserve(bevel_vert_data_.size());
-  for (const int i : bevel_vert_data_.index_range()) {
-vert_to_bvd_index_.add_new(bevel_vert_data_[i].vertex_cap().vert, i);
+  std::cout << "FaceBevelSpec\n";
+  if (use_regions) {
+std::cout << "use regions\n";
+  }
+  for (const int f : to_bevel.index_range()) {
+if (to_bevel[f]) {
+  std::cout << f << ": " << amount[f] << ", slope=" << slope[f] << "\n";
+}
   }
 }
 
-void BevelData::print(const std::string ) const
-{
-  if (label.size() > 0) {
-std::cout << label << " ";
-  }

[Bf-blender-cvs] [c5049d3ad11] bevelv2: Merge branch 'master' into bevelv2

2022-10-09 Thread Howard Trickey
Commit: c5049d3ad1164d91083cc1b7e1ea13c6d70208f6
Author: Howard Trickey
Date:   Sun Oct 9 13:15:51 2022 -0400
Branches: bevelv2
https://developer.blender.org/rBc5049d3ad1164d91083cc1b7e1ea13c6d70208f6

Merge branch 'master' into bevelv2

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [0a35a7bd311] bevelv2: Some edge data structures added.

2022-10-06 Thread Howard Trickey
Commit: 0a35a7bd311ebffef2ea1542297349e13a7872da
Author: Howard Trickey
Date:   Thu Oct 6 16:34:41 2022 -0400
Branches: bevelv2
https://developer.blender.org/rB0a35a7bd311ebffef2ea1542297349e13a7872da

Some edge data structures added.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc 
b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
index cf1602f964c..91898834baf 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
@@ -718,6 +718,10 @@ class BevelData {
* an Array of size equal to the number of mesh vertices here.
*/
   Map vert_to_bvd_index_;
+  /* All the BevelEdges, when edge beveling. */
+  Array bevel_edge_;
+  /* Map from mesh edge indiex inot bevel_edge_. */
+  Map edge_to_bevel_edge_;
 
  public:
   MeshTopology topo;
@@ -808,6 +812,14 @@ void BevelData::calculate_vertex_bevels(const IndexMask 
to_bevel, VArray
  */
 void BevelData::calculate_edge_bevels(const IndexMask to_bevel, VArray 
amounts)
 {
+  bevel_edge_.reinitialize(to_bevel.size());
+  Set need_vert;
+  for (const int e : to_bevel) {
+need_vert.add(topo.edge_v1(e));
+need_vert.add(topo.edge_v2(e));
+  }
+  const int tot_need_vert = need_vert.size();
+  bevel_vert_data_.reinitialize(tot_need_vert);
 }
 
 /** IndexAlloc allocates sequential integers, starting from a given start 
value. */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [5070ffda470] bevelv2: Start of Edge beveling.

2022-10-05 Thread Howard Trickey
Commit: 5070ffda470c4977b4e206891fe6acaf93c3e85f
Author: Howard Trickey
Date:   Wed Oct 5 14:25:10 2022 -0400
Branches: bevelv2
https://developer.blender.org/rB5070ffda470c4977b4e206891fe6acaf93c3e85f

Start of Edge beveling.

Also renamed BoundaryEdge -> HalfEdge.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc 
b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
index 79706b00147..cf1602f964c 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
@@ -34,16 +34,15 @@ static void node_declare(NodeDeclarationBuilder )
   b.add_input("Mesh").supported_type(GEO_COMPONENT_TYPE_MESH);
   
b.add_input(N_("Selection")).default_value(true).supports_field().hide_value();
   b.add_input(N_("Amount")).default_value(1.0f).supports_field();
-  b.add_input(N_("Slope")).default_value(0.0f).supports_field()
-.description(N_("Face inset will raise up with this slope"))
-.make_available([](bNode ) {
-  node_storage(node).mode = GEO_NODE_BEVEL_MESH_FACES;
-});
-  b.add_input(N_("Use Regions")).default_value(false)
-.description(N_("Combine adjacent faces into regions and inset regions as 
a whole"))
-.make_available([](bNode ) {
-  node_storage(node).mode = GEO_NODE_BEVEL_MESH_FACES;
-});
+  b.add_input(N_("Slope"))
+  .default_value(0.0f)
+  .supports_field()
+  .description(N_("Face inset will raise up with this slope"))
+  .make_available([](bNode ) { node_storage(node).mode = 
GEO_NODE_BEVEL_MESH_FACES; });
+  b.add_input(N_("Use Regions"))
+  .default_value(false)
+  .description(N_("Combine adjacent faces into regions and inset regions 
as a whole"))
+  .make_available([](bNode ) { node_storage(node).mode = 
GEO_NODE_BEVEL_MESH_FACES; });
   b.add_output("Mesh");
 }
 
@@ -460,47 +459,47 @@ static std::ostream <<(std::ostream , const 
BoundaryVert )
   return os;
 }
 
-/** The different types of BoundaryEdges (see below). */
-typedef enum eBoundaryEdgeType {
-  BE_UNBEVELED = 0,
-  BE_BEVELED = 1,
-  BE_FACE_BEVEL_BOTH = 2,
-  BE_FACE_BEVEL_LEFT = 3,
-  BE_FACE_BEVEL_RIGHT = 4,
+/** The different types of HalfEdges (see below). */
+typedef enum eHalfEdgeType {
+  HE_UNBEVELED = 0,
+  HE_BEVELED = 1,
+  HE_FACE_BEVEL_BOTH = 2,
+  HE_FACE_BEVEL_LEFT = 3,
+  HE_FACE_BEVEL_RIGHT = 4,
   BE_OTHER = 5,
-} eBoundaryEdgeType;
+} eHalfEdgeType;
 
-static const char *be_type_name[6] = {
+static const char *he_type_name[6] = {
 "unbev", "bev", "facebev_both", "facebev_l", "facebev_r", "other"};
 
-/** A BoundaryEdge is one end of an edge, attached to a vertex in a VertexCap.
+/** A HalfEdge is one end of an edge, attached to a vertex in a VertexCap.
  * This data describes how it is involved in beveling, and how it is attached
  * to BoundaryVerts.
  * Note: when the descriptors "left" and "right" are used to refer to sides of
  * edges, these are to be taken as left and right when looking down the edge
  * towards the VertexCap's vertex.
  */
-class BoundaryEdge {
+class HalfEdge {
  public:
   /* The mesh index of the edge. */
   int edge;
   /* Where it is found in the list of edges in the VertexCap. */
   int vc_index;
   /* The boundary vertex index where the edge is attached,
-   * only used for BE_UNBEVELED and BE_FACE_BEVEL_* types. */
+   * only used for HE_UNBEVELED and HE_FACE_BEVEL_* types. */
   int bv_index;
-  /* The boundary vertex index where the left half of a BE_BEVELED,
-   * BE_FACE_BEVEL_BOTH, or BE_FACE_BEVEL_LEFT attached. */
+  /* The boundary vertex index where the left half of a HE_BEVELED,
+   * HE_FACE_BEVEL_BOTH, or HE_FACE_BEVEL_LEFT attached. */
   int bv_left_index;
-  /* The boundary vertex index where the left half of a BE_BEVELED,
-   * BE_FACE_BEVEL_BOTH, or BE_FACE_BEVEL_RIGHT attached. */
+  /* The boundary vertex index where the left half of a HE_BEVELED,
+   * HE_FACE_BEVEL_BOTH, or HE_FACE_BEVEL_RIGHT attached. */
   int bv_right_index;
   /* The index of this edge, if unbeveled, in output mesh. */
   int mesh_index;
-  /* The type of this BoundaryEdge. */
-  eBoundaryEdgeType type;
+  /* The type of this HalfEdge. */
+  eHalfEdgeType type;
 
-  BoundaryEdge()
+  HalfEdge()
   : edge(-1),
 vc_index(-1),
 bv_index(-1),
@@ -512,6 +511,37 @@ class BoundaryEdge {
   }
 };
 
+/** A BevelEdge holds the two ends (HalfEdges) of an edge that is to be 
beveled.
+ * The underlying edge has a direction, and he1 is the HalfEdge at the source 
end,
+ * while he2 is the HalfEdge at the dest

[Bf-blender-cvs] [e4abaa67486] bevelv2: Merge branch 'master' into bevelv2

2022-10-01 Thread Howard Trickey
Commit: e4abaa67486c3fc2c9182e5a5c3ef34dff8416b8
Author: Howard Trickey
Date:   Sat Oct 1 15:13:01 2022 -0400
Branches: bevelv2
https://developer.blender.org/rBe4abaa67486c3fc2c9182e5a5c3ef34dff8416b8

Merge branch 'master' into bevelv2

Had to fix a conflict with the way the bevel node
is added to the menu, and deal with some deprecated
MVert and MEdge data members.

===



===

diff --cc release/scripts/startup/bl_ui/node_add_menu_geometry.py
index 000,3544c9a4925..7ed9b978289
mode 00,100644..100644
--- a/release/scripts/startup/bl_ui/node_add_menu_geometry.py
+++ b/release/scripts/startup/bl_ui/node_add_menu_geometry.py
@@@ -1,0 -1,444 +1,445 @@@
+ # SPDX-License-Identifier: GPL-2.0-or-later
+ import bpy
+ from bpy.types import Menu
+ from bl_ui import node_add_menu
+ from bpy.app.translations import pgettext_iface as iface_
+ 
+ 
+ class NODE_MT_geometry_node_GEO_ATTRIBUTE(Menu):
+ bl_idname = "NODE_MT_geometry_node_GEO_ATTRIBUTE"
+ bl_label = "Attribute"
+ 
+ def draw(self, _context):
+ layout = self.layout
+ node_add_menu.add_node_type(layout, "GeometryNodeAttributeStatistic")
+ node_add_menu.add_node_type(layout, "GeometryNodeCaptureAttribute")
+ node_add_menu.add_node_type(layout, "GeometryNodeAttributeDomainSize")
+ node_add_menu.add_node_type(layout, "GeometryNodeRemoveAttribute")
+ node_add_menu.add_node_type(layout, "GeometryNodeStoreNamedAttribute")
+ 
+ 
+ class NODE_MT_geometry_node_GEO_COLOR(Menu):
+ bl_idname = "NODE_MT_geometry_node_GEO_COLOR"
+ bl_label = "Color"
+ 
+ def draw(self, _context):
+ layout = self.layout
+ node_add_menu.add_node_type(layout, "ShaderNodeValToRGB")
+ node_add_menu.add_node_type(layout, "FunctionNodeCombineColor")
+ props = node_add_menu.add_node_type(layout, "ShaderNodeMix", 
label=iface_("Mix Color"))
+ ops = props.settings.add()
+ ops.name = "data_type"
+ ops.value = "'RGBA'"
+ node_add_menu.add_node_type(layout, "ShaderNodeRGBCurve")
+ node_add_menu.add_node_type(layout, "FunctionNodeSeparateColor")
+ 
+ 
+ class NODE_MT_geometry_node_GEO_CURVE(Menu):
+ bl_idname = "NODE_MT_geometry_node_GEO_CURVE"
+ bl_label = "Curve"
+ 
+ def draw(self, _context):
+ layout = self.layout
+ node_add_menu.add_node_type(layout, "GeometryNodeCurveLength")
+ node_add_menu.add_node_type(layout, "GeometryNodeCurveToMesh")
+ node_add_menu.add_node_type(layout, "GeometryNodeCurveToPoints")
+ node_add_menu.add_node_type(layout, 
"GeometryNodeDeformCurvesOnSurface")
+ node_add_menu.add_node_type(layout, "GeometryNodeFillCurve")
+ node_add_menu.add_node_type(layout, "GeometryNodeFilletCurve")
+ node_add_menu.add_node_type(layout, "GeometryNodeResampleCurve")
+ node_add_menu.add_node_type(layout, "GeometryNodeReverseCurve")
+ node_add_menu.add_node_type(layout, "GeometryNodeSampleCurve")
+ node_add_menu.add_node_type(layout, "GeometryNodeSubdivideCurve")
+ node_add_menu.add_node_type(layout, "GeometryNodeTrimCurve")
+ layout.separator()
+ node_add_menu.add_node_type(layout, 
"GeometryNodeInputCurveHandlePositions")
+ node_add_menu.add_node_type(layout, "GeometryNodeInputTangent")
+ node_add_menu.add_node_type(layout, "GeometryNodeInputCurveTilt")
+ node_add_menu.add_node_type(layout, 
"GeometryNodeCurveEndpointSelection")
+ node_add_menu.add_node_type(layout, 
"GeometryNodeCurveHandleTypeSelection")
+ node_add_menu.add_node_type(layout, "GeometryNodeInputSplineCyclic")
+ node_add_menu.add_node_type(layout, "GeometryNodeSplineLength")
+ node_add_menu.add_node_type(layout, "GeometryNodeSplineParameter")
+ node_add_menu.add_node_type(layout, 
"GeometryNodeInputSplineResolution")
+ layout.separator()
+ node_add_menu.add_node_type(layout, "GeometryNodeSetCurveRadius")
+ node_add_menu.add_node_type(layout, "GeometryNodeSetCurveTilt")
+ node_add_menu.add_node_type(layout, 
"GeometryNodeSetCurveHandlePositions")
+ node_add_menu.add_node_type(layout, "GeometryNodeCurveSetHandles")
+ node_add_menu.add_node_type(layout, "GeometryNodeSetSplineCyclic")
+ node_add_menu.add_node_type(layout, "GeometryNodeSetSplineResolution")
+ nod

[Bf-blender-cvs] [bb20c44bac4] bevelv2: Merge branch 'master' into bevelv2

2022-09-20 Thread Howard Trickey
Commit: bb20c44bac44b3d8f1823a0f55a905413ae6a54d
Author: Howard Trickey
Date:   Tue Sep 20 08:26:34 2022 -0400
Branches: bevelv2
https://developer.blender.org/rBbb20c44bac44b3d8f1823a0f55a905413ae6a54d

Merge branch 'master' into bevelv2

===



===

diff --cc source/blender/makesrna/intern/rna_nodetree.c
index 89e1b38a2cc,971043158e1..afcb3f9c677
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@@ -9614,27 -9614,31 +9614,52 @@@ static void def_geo_extrude_mesh(Struct
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
  }
  
 +static void def_geo_bevel_mesh(StructRNA *srna)
 +{
 +  PropertyRNA *prop;
 +
 +  static const EnumPropertyItem mode_items[] = {
 +  {GEO_NODE_BEVEL_MESH_VERTICES, "VERTICES", 0, "Vertices", ""},
 +  {GEO_NODE_BEVEL_MESH_EDGES, "EDGES", 0, "Edges", ""},
 +  {GEO_NODE_BEVEL_MESH_FACES, "FACES", 0, "Faces", ""},
 +  {0, NULL, 0, NULL, NULL},
 +  };
 +
 +  RNA_def_struct_sdna_from(srna, "NodeGeometryBevelMesh", "storage");
 +
 +  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
 +  RNA_def_property_enum_sdna(prop, NULL, "mode");
 +  RNA_def_property_enum_items(prop, mode_items);
 +  RNA_def_property_enum_default(prop, GEO_NODE_BEVEL_MESH_FACES);
 +  RNA_def_property_ui_text(prop, "Mode", "");
 +  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
 +}
 +
+ static void def_geo_distribute_points_in_volume(StructRNA *srna)
+ {
+   PropertyRNA *prop;
+ 
+   static const EnumPropertyItem mode_items[] = {
+   {GEO_NODE_DISTRIBUTE_POINTS_IN_VOLUME_DENSITY_RANDOM,
+"DENSITY_RANDOM",
+0,
+"Random",
+"Distribute points randomly inside of the volume"},
+   {GEO_NODE_DISTRIBUTE_POINTS_IN_VOLUME_DENSITY_GRID,
+"DENSITY_GRID",
+0,
+"Grid",
+"Distribute the points in a grid pattern inside of the volume"},
+   {0, NULL, 0, NULL, NULL},
+   };
+ 
+   RNA_def_struct_sdna_from(srna, "NodeGeometryDistributePointsInVolume", 
"storage");
+   prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+   RNA_def_property_enum_items(prop, mode_items);
+   RNA_def_property_ui_text(prop, "Distribution Method", "Method to use for 
scattering points");
+   RNA_def_property_update(prop, NC_NODE | NA_EDITED, 
"rna_Node_socket_update");
+ }
+ 
  static void def_geo_distribute_points_on_faces(StructRNA *srna)
  {
PropertyRNA *prop;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [05cc4cd0047] bevelv2: Initialize slope in mesh inset tests.

2022-09-20 Thread Howard Trickey
Commit: 05cc4cd0047492edf62c21c030ab131958b98da7
Author: Howard Trickey
Date:   Tue Sep 20 08:01:19 2022 -0400
Branches: bevelv2
https://developer.blender.org/rB05cc4cd0047492edf62c21c030ab131958b98da7

Initialize slope in mesh inset tests.

Also some format fixes, removal of unused functions, and fix
of a potential infinite loop in vertex normal calculation.

===

M   source/blender/blenlib/intern/mesh_inset.cc
M   source/blender/blenlib/tests/BLI_mesh_inset_test.cc

===

diff --git a/source/blender/blenlib/intern/mesh_inset.cc 
b/source/blender/blenlib/intern/mesh_inset.cc
index 58513280a69..6690e28e738 100644
--- a/source/blender/blenlib/intern/mesh_inset.cc
+++ b/source/blender/blenlib/intern/mesh_inset.cc
@@ -294,7 +294,8 @@ class Triangle {
 
   /* Our algorithm cares about which edges are original edges
* (i.e., not triangulation edges). */
-  void mark_orig(int pos) {
+  void mark_orig(int pos)
+  {
 flags_ |= (TORIG0 << pos);
 Edge en = neighbor_[pos];
 if (!en.is_null()) {
@@ -353,11 +354,6 @@ void set_mutual_neighbors(Triangle *t1, int pos1, Edge e2)
   t2->neighbor_[e2.tri_edge_index()] = Edge(t1, pos1);
 }
 
-static bool triangle_id_less(const Triangle *a, const Triangle *b)
-{
-  return a->id() < b->id();
-}
-
 /** Return the vertex at the source end of \a e. */
 static Vert *v_src(Edge e)
 {
@@ -448,14 +444,13 @@ static float3 vertex_normal(const Vert *vert)
   Edge ecur = e0;
   do {
 Triangle *tri = ecur.tri();
-if (tri->is_ghost()) {
-  continue;
+if (!tri->is_ghost()) {
+  Edge eprev = ecur.triangle_pred();
+  float3 din = math::normalize(vert->co - v_src(eprev)->co);
+  float3 dout = math::normalize(v_dst(ecur)->co - vert->co);
+  float fac = saacos(-math::dot(din, dout));
+  ans = ans + fac * tri->normal();
 }
-Edge eprev = ecur.triangle_pred();
-float3 din = math::normalize(vert->co - v_src(eprev)->co);
-float3 dout = math::normalize(v_dst(ecur)->co - vert->co);
-float fac = saacos(-math::dot(din, dout));
-ans = ans + fac * tri->normal();
 ecur = rot_ccw(ecur);
   } while (ecur != e0);
   ans = math::normalize(ans);
@@ -1104,17 +1099,6 @@ static Vector> 
init_contour_inset(TriangleMesh , Span triangle_set_to_sorted_array(const Set 
tri_set)
-{
-  Array ans(tri_set.size());
-  int i = 0;
-  for (Triangle *tri : tri_set) {
-ans[i++] = tri;
-  }
-  std::sort(ans.begin(), ans.end(), triangle_id_less);
-  return ans;
-}
-
 static float det(const float3 , const float3 , const float3 )
 {
   return math::dot(math::cross_high_precision(v1, v2), n);
@@ -3016,8 +3000,10 @@ static Vector> find_cycle_partition(const 
Vector )
   return ans;
 }
 
-/** Find and append the faces inside the wavefront cycle \a contour and append 
them to \a out_faces.  */
-static void append_interior_faces_for_cycle(Vector> _faces, 
const Vector contour)
+/** Find and append the faces inside the wavefront cycle \a contour and append 
them to \a
+ * out_faces.  */
+static void append_interior_faces_for_cycle(Vector> _faces,
+const Vector contour)
 {
   constexpr int dbg_level = 0;
   if (dbg_level > 0) {
diff --git a/source/blender/blenlib/tests/BLI_mesh_inset_test.cc 
b/source/blender/blenlib/tests/BLI_mesh_inset_test.cc
index cf133bceea8..51f8132b21d 100644
--- a/source/blender/blenlib/tests/BLI_mesh_inset_test.cc
+++ b/source/blender/blenlib/tests/BLI_mesh_inset_test.cc
@@ -84,6 +84,7 @@ class InputHolder {
 input.face = spec_arrays_.face.as_span();
 input.contour = spec_arrays_.contour.as_span();
 input.inset_amount = amount;
+input.slope = 0.0f;
 input.need_ids = false;
   }
 };

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [845d525099c] bevelv2: Add slope parameter to mesh_inset and use that in face bevel.

2022-09-14 Thread Howard Trickey
Commit: 845d525099cc1c16ee3ea0a3cad7289781d0cf75
Author: Howard Trickey
Date:   Wed Sep 14 18:04:46 2022 -0400
Branches: bevelv2
https://developer.blender.org/rB845d525099cc1c16ee3ea0a3cad7289781d0cf75

Add slope parameter to mesh_inset and use that in face bevel.

===

M   source/blender/blenlib/BLI_mesh_inset.hh
M   source/blender/blenlib/intern/mesh_inset.cc
M   source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc

===

diff --git a/source/blender/blenlib/BLI_mesh_inset.hh 
b/source/blender/blenlib/BLI_mesh_inset.hh
index cd7dfcb57df..599ea061b2e 100644
--- a/source/blender/blenlib/BLI_mesh_inset.hh
+++ b/source/blender/blenlib/BLI_mesh_inset.hh
@@ -26,6 +26,7 @@ public:
   /** The contours to inset; ints are vert indices; contour is on left side of 
implied edges. */
   Span> contour;
   float inset_amount;
+  float slope;
   bool need_ids;
 };
 
diff --git a/source/blender/blenlib/intern/mesh_inset.cc 
b/source/blender/blenlib/intern/mesh_inset.cc
index 0a862b106bb..58513280a69 100644
--- a/source/blender/blenlib/intern/mesh_inset.cc
+++ b/source/blender/blenlib/intern/mesh_inset.cc
@@ -462,6 +462,28 @@ static float3 vertex_normal(const Vert *vert)
   return ans;
 }
 
+/** Analog of BM_vert_calc_shell_factor. */
+static float vertex_shell_factor(Vert *vert)
+{
+  float accum_shell = 0.0f;
+  float accum_angle = 0.0f;
+  Edge e = vert->e;
+  float3 vnorm = vertex_normal(vert);
+  do {
+if (!e.tri()->is_ghost()) {
+  Edge eprev = e.triangle_pred();
+  float face_angle = angle_v3v3v3(v_src(eprev)->co, v_src(e)->co, 
v_dst(e)->co);
+  accum_shell += shell_v3v3_normalized_to_dist(vnorm, e.tri()->normal()) * 
face_angle;
+  accum_angle += face_angle;
+}
+e = rot_ccw(e);
+  } while (e != vert->e);
+  if (accum_angle != 0.0f) {
+return accum_shell / accum_angle;
+  }
+  return 1.0f;
+}
+
 class TriangleMesh {
   Vector triangles_;
   Vector verts_;
@@ -3186,10 +3208,27 @@ MeshInset_Result mesh_inset_calc(const MeshInset_Input 
)
   TriangleMesh trimesh = triangulate_input(input);
   StraightSkeleton ss(trimesh, input.contour, input.inset_amount);
   ss.compute();
-  Array remaining_triangles = 
triangle_set_to_sorted_array(ss.remaining_triangles_set);
-  /* TODO: take in slope and offset arguments and use to adjust position of 
results in the normal
-   * direction, using ss.vertex_height_map
-   */
+  if (input.slope != 0.0f) {
+/* Gather all the deltas before applying, as changing height changes the 
vertex normals. */
+Array vco_delta(trimesh.all_verts().size(), float3(0.0f, 0.0f, 
0.0f));
+trimesh.calculate_all_tri_normals();
+for (int v_index : trimesh.all_verts().index_range()) {
+  Vert *v = trimesh.get_vert_by_index(v_index);
+  if (!v->is_deleted()) {
+if (ss.vertex_height_map.contains(v->id)) {
+  float h = ss.vertex_height_map.lookup(v->id);
+  if (h != 0.0f) {
+float shell_factor = vertex_shell_factor(v);
+vco_delta[v_index] = vertex_normal(v) * shell_factor * h * 
input.slope;
+  }
+}
+  }
+}
+for (int v_index : trimesh.all_verts().index_range()) {
+  Vert *v = trimesh.get_vert_by_index(v_index);
+  v->co += vco_delta[v->id];
+}
+  }
   if (dbg_level > 0) {
 trimesh_draw("after ss " + std::to_string(input.inset_amount), trimesh);
 std::cout << trimesh << "\n";
diff --git a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc 
b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
index dcbada546fb..088b2d06ece 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
@@ -34,6 +34,16 @@ static void node_declare(NodeDeclarationBuilder )
   b.add_input("Mesh").supported_type(GEO_COMPONENT_TYPE_MESH);
   
b.add_input(N_("Selection")).default_value(true).supports_field().hide_value();
   b.add_input(N_("Amount")).default_value(1.0f).supports_field();
+  b.add_input(N_("Slope")).default_value(0.0f).supports_field()
+.description(N_("Face inset will raise up with this slope"))
+.make_available([](bNode ) {
+  node_storage(node).mode = GEO_NODE_BEVEL_MESH_FACES;
+});
+  b.add_input(N_("Use Regions")).default_value(false)
+.description(N_("Combine adjacent faces into regions and inset regions as 
a whole"))
+.make_available([](bNode ) {
+  node_storage(node).mode = GEO_NODE_BEVEL_MESH_FACES;
+});
   b.add_output("Mesh");
 }
 
@@ -51,8 +61,13 @@ static void node_init(bNodeTree *UNUSED(tree), bNode *node)
   node->storage = data;
 }
 
-static void node_update(bNodeTree *UNUSED(ntree), bNode *UNUSED(node))
+static void node_update

[Bf-blender-cvs] [2bc4a34343a] bevelv2: Stop using deprecated bweight field in MVert.

2022-09-14 Thread Howard Trickey
Commit: 2bc4a34343a25be107cf128f5bea298b3a1e662c
Author: Howard Trickey
Date:   Wed Sep 14 08:35:56 2022 -0400
Branches: bevelv2
https://developer.blender.org/rB2bc4a34343a25be107cf128f5bea298b3a1e662c

Stop using deprecated bweight field in MVert.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc 
b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
index a0c1c2b2205..dcbada546fb 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
@@ -850,7 +850,6 @@ int MeshDelta::new_vert(const float3 , int rep)
   MVert mvert;
   copy_v3_v3(mvert.co, co);
   mvert.flag = 0;
-  mvert.bweight = 0;
   new_verts_.append(mvert);
   new_vert_rep_.append(rep);
   return v;
@@ -863,7 +862,6 @@ int MeshDelta::new_edge(int v1, int v2, int rep)
   medge.v1 = v1;
   medge.v2 = v2;
   medge.crease = 0;
-  medge.bweight = 0;
   medge.flag = ME_EDGEDRAW;
   new_edges_.append(medge);
   new_edge_rep_.append(rep);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [7826cd74ba7] bevelv2: Merge branch 'master' into bevelv2

2022-09-14 Thread Howard Trickey
Commit: 7826cd74ba772377b7ec1413b54784ee7f498939
Author: Howard Trickey
Date:   Wed Sep 14 08:17:01 2022 -0400
Branches: bevelv2
https://developer.blender.org/rB7826cd74ba772377b7ec1413b54784ee7f498939

Merge branch 'master' into bevelv2

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [f789cf6ac37] bevelv2: Fix mesh_inset to recover leftofer interior geometry.

2022-09-12 Thread Howard Trickey
Commit: f789cf6ac3768cb2663d1e5a039ed29f7d269418
Author: Howard Trickey
Date:   Mon Sep 12 12:50:07 2022 -0400
Branches: bevelv2
https://developer.blender.org/rBf789cf6ac3768cb2663d1e5a039ed29f7d269418

Fix mesh_inset to recover leftofer interior geometry.

===

M   source/blender/blenlib/intern/mesh_inset.cc
M   source/blender/blenlib/tests/BLI_mesh_inset_test.cc

===

diff --git a/source/blender/blenlib/intern/mesh_inset.cc 
b/source/blender/blenlib/intern/mesh_inset.cc
index ceb8d26060f..0a862b106bb 100644
--- a/source/blender/blenlib/intern/mesh_inset.cc
+++ b/source/blender/blenlib/intern/mesh_inset.cc
@@ -160,12 +160,15 @@ class Triangle {
 TSPOKE0 = 1 << 3,
 TSPOKE1 = 1 << 4,
 TSPOKE2 = 1 << 5,
+TORIG0 = 1 << 6,
+TORIG1 = 1 << 7,
+TORIG2 = 1 << 8,
   };
   Edge neighbor_[3];
   Vert *vert_[3];
   float3 normal_;
   int id_{0};
-  uint8_t flags_{0};
+  uint16_t flags_{0};
 
  public:
   Triangle(Vert *v0, Vert *v1, Vert *v2)
@@ -289,6 +292,22 @@ class Triangle {
 return (flags_ & (TSPOKE0 << pos)) != 0;
   }
 
+  /* Our algorithm cares about which edges are original edges
+   * (i.e., not triangulation edges). */
+  void mark_orig(int pos) {
+flags_ |= (TORIG0 << pos);
+Edge en = neighbor_[pos];
+if (!en.is_null()) {
+  Triangle *tn = en.tri();
+  tn->flags_ |= (TORIG0 << en.tri_edge_index());
+}
+  }
+
+  bool is_orig(int pos) const
+  {
+return (flags_ & (TORIG0 << pos)) != 0;
+  }
+
   friend void set_mutual_neighbors(Triangle *t1, int pos1, Triangle *t2, int 
pos2);
   friend void set_mutual_neighbors(Triangle *t1, int pos1, Edge e2);
 
@@ -582,6 +601,9 @@ std::ostream <<(std::ostream , const Triangle 
)
 if (tri.is_spoke(i)) {
   os << " s" << i;
 }
+if (tri.is_orig(i)) {
+  os << " o" << i;
+}
   }
   return os;
 }
@@ -1558,6 +1580,18 @@ static Edge find_cw_spoke_or_wavefront_edge(Edge edge)
   return null_edge;
 }
 
+static Edge find_cw_wavefront_or_orig_edge(Edge edge)
+{
+  Edge e = rot_cw(edge);
+  do {
+if (is_wavefront_edge(e) || e.tri()->is_orig(e.tri_edge_index())) {
+  return e;
+}
+e = rot_cw(e);
+  } while (e != edge);
+  return null_edge;
+}
+
 static constexpr float dhdl_epsilon = 1e-5f;
 static constexpr float collision_epsilon = 1e-5;
 
@@ -2714,11 +2748,19 @@ static Vector triangulate_face(int f,
   t0 = new Triangle(v0, v1, v3);
   t1 = new Triangle(v1, v2, v3);
   set_mutual_neighbors(t0, 1, t1, 2);
+  t0->mark_orig(0);
+  t0->mark_orig(2);
+  t1->mark_orig(0);
+  t1->mark_orig(1);
 }
 else {
   t0 = new Triangle(v0, v1, v2);
   t1 = new Triangle(v0, v2, v3);
   set_mutual_neighbors(t0, 2, t1, 0);
+  t0->mark_orig(0);
+  t0->mark_orig(1);
+  t1->mark_orig(1);
+  t1->mark_orig(2);
 }
 ans.append(t0);
 ans.append(t1);
@@ -2733,9 +2775,10 @@ static Vector triangulate_face(int f,
 tris = static_cast(MEM_malloc_arrayN(totfilltri, 
sizeof(*tris), __func__));
 projverts = static_cast(MEM_malloc_arrayN(flen, 
sizeof(*projverts), __func__));
 axis_dominant_v3_to_m3_negate(axis_mat, norm);
-;
+Map vert_index_to_facepos;
 for (int j : IndexRange(flen)) {
   mul_v2_m3v3(projverts[j], axis_mat, 
base_trimesh.get_vert_by_index(face[j])->co);
+  vert_index_to_facepos.add(face[j], j);
 }
 MemArena *pf_arena = BLI_memarena_new(BLI_POLYFILL_ARENA_SIZE, __func__);
 Heap *pf_heap = BLI_heap_new_ex(BLI_POLYFILL_ALLOC_NGON_RESERVE);
@@ -2750,7 +2793,20 @@ static Vector triangulate_face(int f,
 BLI_assert(tri[k] < flen);
 v[k] = fvert[tri[k]];
   }
-  ans.append(new Triangle(v[0], v[1], v[2]));
+  Triangle *newtri = new Triangle(v[0], v[1], v[2]);
+  /* Find and mark the original edges. */
+  for (int k = 0; k < 3; k++) {
+int v1 = newtri->vert(k)->id;
+int v2 = newtri->vert((k + 1) % 3)->id;
+int pos = vert_index_to_facepos.lookup_default(v1, -1);
+if (pos != -1) {
+  BLI_assert(face[pos] == v1);
+  if (face[(pos + 1) % flen] == v2) {
+newtri->mark_orig(k);
+  }
+}
+  }
+  ans.append(newtri);
 }
 
 MEM_freeN(tris);
@@ -2938,6 +2994,64 @@ static Vector> find_cycle_partition(const 
Vector )
   return ans;
 }
 
+/** Find and append the faces inside the wavefront cycle \a contour and append 
them to \a out_faces.  */
+static void append_interior_faces_for_cycle(Vector> _faces, 
const Vector contour)
+{
+  constexpr int dbg_level = 0;
+  if (dbg_level > 0) {
+std::cout << "append_interior_faces_for_cycle ";
+for (Edge e : contour

[Bf-blender-cvs] [d22cfad9604] bevelv2: Initial hook up of face bevel to geometry nodes.

2022-09-11 Thread Howard Trickey
Commit: d22cfad9604b738a734e0566cb10a6633134dc3c
Author: Howard Trickey
Date:   Sun Sep 11 09:52:22 2022 -0400
Branches: bevelv2
https://developer.blender.org/rBd22cfad9604b738a734e0566cb10a6633134dc3c

Initial hook up of face bevel to geometry nodes.

Only works for individual face insets (bevels) so far,
and doesn't preserve attributes yet.

===

M   source/blender/blenlib/intern/mesh_inset.cc
M   source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc

===

diff --git a/source/blender/blenlib/intern/mesh_inset.cc 
b/source/blender/blenlib/intern/mesh_inset.cc
index 69bddbb8035..ceb8d26060f 100644
--- a/source/blender/blenlib/intern/mesh_inset.cc
+++ b/source/blender/blenlib/intern/mesh_inset.cc
@@ -2964,10 +2964,14 @@ static MeshInset_Result trimesh_to_output(const 
TriangleMesh ,
 }
   }
   result.vert = Array(totv);
+  result.orig_vert = Array(totv, -1);
   int out_v_index = 0;
   for (int i : IndexRange(tot_all_verts)) {
 const Vert *v = trimesh.get_vert_by_index(i);
 if (!v->is_deleted()) {
+  if (i < input.vert.size()) {
+result.orig_vert[out_v_index] = i;
+  }
   result.vert[out_v_index++] = v->co;
 }
   }
@@ -3031,6 +3035,23 @@ static MeshInset_Result trimesh_to_output(const 
TriangleMesh ,
   for (int fi : out_faces.index_range()) {
 result.face[fi] = out_faces[fi];
   }
+  if (dbg_level > 0) {
+std::cout << "result:\n";
+for (int i : result.vert.index_range()) {
+  std::cout << "vert[" << i << "] = " << result.vert[i] << "\n";
+}
+for (int i : result.face.index_range()) {
+  const Vector  = result.face[i];
+  std::cout << "face[" << i << "] =";
+  for (int j : f.index_range()) {
+std::cout << " " << f[j];
+  }
+  std::cout << "\n";
+}
+for (int i : result.orig_vert.index_range()) {
+  std::cout << "orig_vert[" << i << "] = " << result.orig_vert[i] << "\n";
+}
+  }
   return result;
 }
 
@@ -3038,7 +3059,29 @@ MeshInset_Result mesh_inset_calc(const MeshInset_Input 
)
 {
   constexpr int dbg_level = 0;
   if (dbg_level > 0) {
-std::cout << "mesh_inset_calc, input has " << input.face.size() << " 
faces\n";
+std::cout << "mesh_inset_calc\n";
+if (dbg_level > 1) {
+  std::cout << "input\n";
+  for (int i : input.vert.index_range()) {
+std::cout << "vert[" << i << "] = " << input.vert[i] << "\n";
+  }
+  for (int i : input.face.index_range()) {
+std::cout << "face[" << i << "] =";
+const Vector  = input.face[i];
+for (int j : f.index_range()) {
+  std::cout << " " << f[j];
+}
+std::cout << "\n";
+  }
+  for (int i : input.contour.index_range()) {
+std::cout << "contour[" << i << "] =";
+const Vector  = input.contour[i];
+for (int j : c.index_range()) {
+  std::cout << " " << c[j];
+}
+std::cout << "\n";
+  }
+}
   }
   TriangleMesh trimesh = triangulate_input(input);
   StraightSkeleton ss(trimesh, input.contour, input.inset_amount);
diff --git a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc 
b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
index eb5c2584300..a0c1c2b2205 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
@@ -11,6 +11,7 @@
 #include "BLI_array.hh"
 #include "BLI_math_vec_types.hh"
 #include "BLI_math_vector.hh"
+#include "BLI_mesh_inset.hh"
 #include "BLI_set.hh"
 #include "BLI_sort.hh"
 #include "BLI_task.hh"
@@ -781,6 +782,7 @@ class IndexAlloc {
  */
 class MeshDelta {
   const Mesh _;
+  const MeshTopology _;
   IndexAlloc vert_alloc_;
   IndexAlloc edge_alloc_;
   IndexAlloc poly_alloc_;
@@ -799,13 +801,15 @@ class MeshDelta {
   Vector new_loop_rep_;
 
  public:
-  MeshDelta(const Mesh );
+  MeshDelta(const Mesh , const MeshTopology );
 
   /* In the following, `rep` is the index of the old mesh element to base 
attributes on.  */
   int new_vert(const float3 , int rep);
   int new_edge(int v1, int v2, int rep);
   int new_loop(int v, int e, int rep);
   int new_face(int loopstart, int totloop, int rep);
+  /* Find the edge either in mesh or new_edges_, or make a new one if not 
there. */
+  int find_or_add_edge(

[Bf-blender-cvs] [3b2bc5d1463] bevelv2: Added a mesh_inset Blenlib function.

2022-09-08 Thread Howard Trickey
Commit: 3b2bc5d1463a10c445fb74e9a7888ef4d59e368c
Author: Howard Trickey
Date:   Thu Sep 8 10:04:20 2022 -0400
Branches: bevelv2
https://developer.blender.org/rB3b2bc5d1463a10c445fb74e9a7888ef4d59e368c

Added a mesh_inset Blenlib function.

Based on python code from Henrik Dick, this libray function
calculates a Straight Skeleton, and hence, deals properly
with cases where the advancing inset geometry would overlap
or pass through opposite edges. It still needs work but the
basic tests pass.
This function will be used for edge and face bevels but is
not yet hooked up for that.

===

A   source/blender/blenlib/BLI_mesh_inset.hh
M   source/blender/blenlib/CMakeLists.txt
A   source/blender/blenlib/intern/mesh_inset.cc
A   source/blender/blenlib/tests/BLI_mesh_inset_test.cc

===

diff --git a/source/blender/blenlib/BLI_mesh_inset.hh 
b/source/blender/blenlib/BLI_mesh_inset.hh
new file mode 100644
index 000..cd7dfcb57df
--- /dev/null
+++ b/source/blender/blenlib/BLI_mesh_inset.hh
@@ -0,0 +1,48 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#pragma once
+
+/** \file
+ * \ingroup bli
+ *
+ * This header file contains a C++ interface to a 3D mesh inset algorithm
+ * which is based on a 2D Straight Skeleton construction.
+ */
+
+#include "BLI_array.hh"
+#include "BLI_math_vec_types.hh"
+#include "BLI_span.hh"
+#include "BLI_vector.hh"
+
+
+namespace blender::meshinset {
+
+class MeshInset_Input {
+public:
+  /** The vertices. Can be a superset of the needed vertices. */
+  Span vert;
+  /** The faces, each a CCW ordering of vertex indices. */
+  Span> face;
+  /** The contours to inset; ints are vert indices; contour is on left side of 
implied edges. */
+  Span> contour;
+  float inset_amount;
+  bool need_ids;
+};
+
+class MeshInset_Result {
+public:
+  /** The output vertices. A subset (perhaps) of input vertices, plus some new 
ones. */
+  Array vert;
+  /** The output faces, each a CCW ordering of the output vertices. */
+  Array> face;
+  /** The output contours -- where the input contours ended up. */
+  Array> contour;
+  /** Maps output vertex indices to input vertex indices, -1 if there is none. 
*/
+  Array orig_vert;
+  /** Maps output faces tot input faces that they were part of. */
+  Array orig_face;
+};
+
+MeshInset_Result mesh_inset_calc(const MeshInset_Input );
+
+}  // namespace blender::meshinset
diff --git a/source/blender/blenlib/CMakeLists.txt 
b/source/blender/blenlib/CMakeLists.txt
index d87c60e6099..fea46237997 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -107,6 +107,7 @@ set(SRC
   intern/math_vector_inline.c
   intern/memory_utils.c
   intern/mesh_boolean.cc
+  intern/mesh_inset.cc
   intern/mesh_intersect.cc
   intern/noise.c
   intern/noise.cc
@@ -275,6 +276,7 @@ set(SRC
   BLI_memory_utils.hh
   BLI_mempool.h
   BLI_mesh_boolean.hh
+  BLI_mesh_inset.hh
   BLI_mesh_intersect.hh
   BLI_mmap.h
   BLI_multi_value_map.hh
@@ -473,6 +475,7 @@ if(WITH_GTESTS)
 tests/BLI_memiter_test.cc
 tests/BLI_memory_utils_test.cc
 tests/BLI_mesh_boolean_test.cc
+tests/BLI_mesh_inset_test.cc
 tests/BLI_mesh_intersect_test.cc
 tests/BLI_multi_value_map_test.cc
 tests/BLI_path_util_test.cc
diff --git a/source/blender/blenlib/intern/mesh_inset.cc 
b/source/blender/blenlib/intern/mesh_inset.cc
new file mode 100644
index 000..69bddbb8035
--- /dev/null
+++ b/source/blender/blenlib/intern/mesh_inset.cc
@@ -0,0 +1,3058 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+/** \file
+ * \ingroup bli
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include "BLI_array.hh"
+#include "BLI_heap.h"
+#include "BLI_map.hh"
+#include "BLI_math_vector.h"
+#include "BLI_math_vector.hh"
+#include "BLI_memarena.h"
+#include "BLI_mesh_inset.hh"
+#include "BLI_polyfill_2d.h"
+#include "BLI_polyfill_2d_beautify.h"
+#include "BLI_set.hh"
+#include "BLI_span.hh"
+#include "BLI_vector.hh"
+
+#include "BLI_mesh_inset.hh"
+
+namespace blender::meshinset {
+
+class Vert;
+class Edge;
+class Triangle;
+
+/** The predecessor index to \a i in a triangle. */
+static inline int pred_index(const int i)
+{
+  return (i + 2) % 3;
+}
+
+/** The successor index to \a i in a triangle. */
+static inline int succ_index(const int i)
+{
+  return (i + 1) % 3;
+}
+
+/** The ith edge of triangle tri. Not shared with the adjacent triangle. */
+class Edge {
+  /* Assume Triangles are allocated on at least 4 byte boundaries.
+   * Then, use the lower two bits of the pointer as the index (0,1,2)
+   * saying which edge of the triangle we refer to.
+   */
+
+  /** A pointer with lower two bits used for index. */
+  Tr

[Bf-blender-cvs] [81341d1e94c] bevelv2: Update for new Mesh API for verts, etc.

2022-09-08 Thread Howard Trickey
Commit: 81341d1e94c0ab320e15536f93e3032ef695bffb
Author: Howard Trickey
Date:   Thu Sep 8 09:16:55 2022 -0400
Branches: bevelv2
https://developer.blender.org/rB81341d1e94c0ab320e15536f93e3032ef695bffb

Update for new Mesh API for verts, etc.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc 
b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
index 79ff9c168dc..eb5c2584300 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
@@ -119,17 +119,17 @@ class MeshTopology {
 
   float3 vert_co(int v) const
   {
-return float3(mesh_.mvert[v].co);
+return float3(mesh_.verts()[v].co);
   }
 
   int edge_v1(int e) const
   {
-return mesh_.medge[e].v1;
+return mesh_.edges()[e].v1;
   }
 
   int edge_v2(int e) const
   {
-return mesh_.medge[e].v2;
+return mesh_.edges()[e].v2;
   }
 
   float3 edge_dir_from_vert(int e, int v) const;
@@ -140,14 +140,14 @@ MeshTopology::MeshTopology(const Mesh ) : mesh_(mesh)
 {
   // timeit::ScopedTimer t("MeshTopology construction");
   BKE_mesh_vert_edge_map_create(
-  _edge_map_, _edge_map_mem_, mesh.medge, mesh.totvert, 
mesh.totedge);
+  _edge_map_, _edge_map_mem_, BKE_mesh_edges(), 
mesh.totvert, mesh.totedge);
   BKE_mesh_edge_poly_map_create(_poly_map_,
 _poly_map_mem_,
-mesh.medge,
+BKE_mesh_edges(),
 mesh.totedge,
-mesh.mpoly,
+BKE_mesh_polys(),
 mesh.totpoly,
-mesh.mloop,
+BKE_mesh_loops(),
 mesh.totloop);
 }
 
@@ -172,20 +172,21 @@ int MeshTopology::edge_other_manifold_face(int e, int f) 
const
 
 int MeshTopology::face_other_edge_at_vert(int f, int v, int e) const
 {
-  const MPoly  = mesh_.mpoly[f];
+  const MPoly  = mesh_.polys()[f];
+  Span loops = mesh_.loops();
   const int loopstart = mpoly.loopstart;
   const int loopend = mpoly.loopstart + mpoly.totloop - 1;
   for (int l = loopstart; l <= loopend; l++) {
-const MLoop  = mesh_.mloop[l];
+const MLoop  = loops[l];
 if (mloop.e == e) {
   if (mloop.v == v) {
 /* The other edge with vertex v is the preceding (incoming) edge. */
-MLoop _prev = l == loopstart ? mesh_.mloop[loopend] : 
mesh_.mloop[l - 1];
+const MLoop _prev = l == loopstart ? loops[loopend] : loops[l - 
1];
 return mloop_prev.e;
   }
   else {
 /* The other edge with vertex v is the next (outgoing) edge, which 
should have vertex v. */
-MLoop _next = l == loopend ? mesh_.mloop[loopstart] : 
mesh_.mloop[l + 1];
+const MLoop _next = l == loopend ? loops[loopstart] : loops[l + 
1];
 BLI_assert(mloop_next.v == v);
 return mloop_next.e;
   }
@@ -198,13 +199,14 @@ int MeshTopology::face_other_edge_at_vert(int f, int v, 
int e) const
 
 bool MeshTopology::edge_is_successor_in_face(const int e0, const int e1, const 
int f) const
 {
-  const MPoly  = mesh_.mpoly[f];
+  const MPoly  = mesh_.polys()[f];
   const int loopstart = mpoly.loopstart;
   const int loopend = mpoly.loopstart + mpoly.totloop - 1;
+  Span loops = mesh_.loops();
   for (int l = loopstart; l <= loopend; l++) {
-const MLoop  = mesh_.mloop[l];
+const MLoop  = loops[l];
 if (mloop.e == e0) {
-  const MLoop _next = l == loopend ? mesh_.mloop[loopstart] : 
mesh_.mloop[l + 1];
+  const MLoop _next = l == loopend ? loops[loopstart] : loops[l + 1];
   return mloop_next.e == e1;
 }
   }
@@ -213,7 +215,7 @@ bool MeshTopology::edge_is_successor_in_face(const int e0, 
const int e1, const i
 
 float3 MeshTopology::edge_dir_from_vert(int e, int v) const
 {
-  const MEdge  = mesh_.medge[e];
+  const MEdge  = mesh_.edges()[e];
   if (medge.v1 == v) {
 return vert_co(medge.v2) - vert_co(medge.v1);
   }
@@ -880,7 +882,6 @@ int MeshDelta::new_face(int loopstart, int totloop, int rep)
   MPoly mpoly;
   mpoly.loopstart = loopstart;
   mpoly.totloop = totloop;
-  mpoly.mat_nr = 0;
   mpoly.flag = 0;
   new_polys_.append(mpoly);
   new_poly_rep_.append(rep);
@@ -894,7 +895,7 @@ void MeshDelta::delete_face(int f)
 {
   poly_deletes_.add(f);
   BLI_assert(f >= 0 && f < mesh_.totpoly);
-  const MPoly  = mesh_.mpoly[f];
+  const MPoly  = mesh_.polys()[f];
   for (int l = mpoly.loopstart; l < mpoly.loopstart + mpoly.totloop; l++) {
 loop_deletes_.add(l);
   }
@@ -907,18 +908,18 @@ static std::ostream <<(std::ostream , const 
Mesh *mesh)
   os << "Mesh, totvert=" << mes

[Bf-blender-cvs] [ba8dd18d343] bevelv2: Merge branch 'master' into bevelv2

2022-09-07 Thread Howard Trickey
Commit: ba8dd18d34320ccb5eedc239742a6ba0a2ed4f63
Author: Howard Trickey
Date:   Wed Sep 7 23:25:00 2022 -0400
Branches: bevelv2
https://developer.blender.org/rBba8dd18d34320ccb5eedc239742a6ba0a2ed4f63

Merge branch 'master' into bevelv2

===



===

diff --cc release/scripts/startup/nodeitems_builtins.py
index 724adf8f474,a6609eb80fc..efbc500a5f2
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@@ -108,8 -108,9 +108,10 @@@ def mesh_node_items(context)
  space = context.space_data
  if not space:
  return
 +yield NodeItem("GeometryNodeBevelMesh")
  yield NodeItem("GeometryNodeDualMesh")
+ yield NodeItem("GeometryNodeEdgePathsToCurves")
+ yield NodeItem("GeometryNodeEdgePathsToSelection")
  yield NodeItem("GeometryNodeExtrudeMesh")
  yield NodeItem("GeometryNodeFlipFaces")
  yield NodeItem("GeometryNodeMeshBoolean")
diff --cc source/blender/nodes/NOD_static_types.h
index a159d497fd6,d587da823f1..66c0bce809a
--- a/source/blender/nodes/NOD_static_types.h
+++ b/source/blender/nodes/NOD_static_types.h
@@@ -279,133 -280,135 +280,136 @@@ DefNode(FunctionNode, FN_NODE_SLICE_STR
  DefNode(FunctionNode, FN_NODE_STRING_LENGTH, 0, "STRING_LENGTH", 
StringLength, "String Length", "")
  DefNode(FunctionNode, FN_NODE_VALUE_TO_STRING, 0, "VALUE_TO_STRING", 
ValueToString, "Value to String", "")
  
- DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_DOMAIN_SIZE, 
def_geo_attribute_domain_size, "ATTRIBUTE_DOMAIN_SIZE", AttributeDomainSize, 
"Domain Size", "")
- DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_STATISTIC, 
def_geo_attribute_statistic, "ATTRIBUTE_STATISTIC", AttributeStatistic, 
"Attribute Statistic", "")
+ DefNode(GeometryNode, GEO_NODE_ACCUMULATE_FIELD, def_geo_accumulate_field, 
"ACCUMULATE_FIELD", AccumulateField, "Accumulate Field", "Add the values of an 
evaluated field together and output the running total for each element")
+ DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_DOMAIN_SIZE, 
def_geo_attribute_domain_size, "ATTRIBUTE_DOMAIN_SIZE", AttributeDomainSize, 
"Domain Size", "Retrieve the number of elements in a geometry for each 
attribute domain")
+ DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_STATISTIC, 
def_geo_attribute_statistic, "ATTRIBUTE_STATISTIC",AttributeStatistic, 
"Attribute Statistic","Calculate statistics about a data set from a field 
evaluated on a geometry")
 +DefNode(GeometryNode, GEO_NODE_BEVEL_MESH, def_geo_bevel_mesh, "BEVEL_MESH", 
BevelMesh, "Bevel Mesh", "")
- DefNode(GeometryNode, GEO_NODE_BOUNDING_BOX, 0, "BOUNDING_BOX", BoundBox, 
"Bounding Box", "")
- DefNode(GeometryNode, GEO_NODE_CAPTURE_ATTRIBUTE, def_geo_attribute_capture, 
"CAPTURE_ATTRIBUTE", CaptureAttribute, "Capture Attribute", "")
- DefNode(GeometryNode, GEO_NODE_COLLECTION_INFO, def_geo_collection_info, 
"COLLECTION_INFO", CollectionInfo, "Collection Info", "")
- DefNode(GeometryNode, GEO_NODE_CONVEX_HULL, 0, "CONVEX_HULL", ConvexHull, 
"Convex Hull", "")
- DefNode(GeometryNode, GEO_NODE_CURVE_ENDPOINT_SELECTION, 0, 
"CURVE_ENDPOINT_SELECTION", CurveEndpointSelection, "Endpoint Selection", "")
- DefNode(GeometryNode, GEO_NODE_CURVE_HANDLE_TYPE_SELECTION, 
def_geo_curve_handle_type_selection, "CURVE_HANDLE_TYPE_SELECTION", 
CurveHandleTypeSelection, "Handle Type Selection", "")
- DefNode(GeometryNode, GEO_NODE_CURVE_LENGTH, 0, "CURVE_LENGTH", CurveLength, 
"Curve Length", "")
- DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_ARC, 
def_geo_curve_primitive_arc, "CURVE_PRIMITIVE_ARC", CurveArc, "Arc", "")
- DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT, 
def_geo_curve_primitive_bezier_segment, "CURVE_PRIMITIVE_BEZIER_SEGMENT", 
CurvePrimitiveBezierSegment, "Bezier Segment", "")
- DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_CIRCLE, 
def_geo_curve_primitive_circle, "CURVE_PRIMITIVE_CIRCLE", CurvePrimitiveCircle, 
"Curve Circle", "")
- DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_LINE, 
def_geo_curve_primitive_line, "CURVE_PRIMITIVE_LINE", CurvePrimitiveLine, 
"Curve Line", "")
- DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_QUADRATIC_BEZIER, 0, 
"CURVE_PRIMITIVE_QUADRATIC_BEZIER", CurveQuadraticBezier, "Quadratic Bezier", 
"")
- DefNode

[Bf-blender-cvs] SVN commit: bf-blender [63000] tags/blender-3.3-release/lib/tests/modeling/modifiers.blend: Redoing fix for bevel revert

2022-08-06 Thread Howard Trickey
Revision: 63000
  https://developer.blender.org/rBL63000
Author:   howardt
Date: 2022-08-06 22:02:13 +0200 (Sat, 06 Aug 2022)
Log Message:
---
Redoing fix for bevel revert

Modified Paths:
--
tags/blender-3.3-release/lib/tests/modeling/modifiers.blend

Modified: tags/blender-3.3-release/lib/tests/modeling/modifiers.blend
===
(Binary files differ)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] SVN commit: bf-blender [62999] trunk/lib/tests/modeling/modifiers.blend: Another try at getting modifiers test to pass

2022-08-06 Thread Howard Trickey
Revision: 62999
  https://developer.blender.org/rBL62999
Author:   howardt
Date: 2022-08-06 21:53:08 +0200 (Sat, 06 Aug 2022)
Log Message:
---
Another try at getting modifiers test to pass

Modified Paths:
--
trunk/lib/tests/modeling/modifiers.blend

Modified: trunk/lib/tests/modeling/modifiers.blend
===
(Binary files differ)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] SVN commit: bf-blender [62998] trunk/lib/tests/modeling: Test files for bevel continuity reversion

2022-08-06 Thread Howard Trickey
Revision: 62998
  https://developer.blender.org/rBL62998
Author:   howardt
Date: 2022-08-06 19:37:12 +0200 (Sat, 06 Aug 2022)
Log Message:
---
Test files for bevel continuity reversion

Modified Paths:
--
trunk/lib/tests/modeling/bevel_regression.blend
trunk/lib/tests/modeling/modifiers.blend

Modified: trunk/lib/tests/modeling/bevel_regression.blend
===
(Binary files differ)

Modified: trunk/lib/tests/modeling/modifiers.blend
===
(Binary files differ)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [fecef2ae741] master: Merge branch 'blender-v3.3-release'

2022-08-06 Thread Howard Trickey
Commit: fecef2ae7415cd7d7cf7907b2e704ef264fbd242
Author: Howard Trickey
Date:   Sat Aug 6 13:16:34 2022 -0400
Branches: master
https://developer.blender.org/rBfecef2ae7415cd7d7cf7907b2e704ef264fbd242

Merge branch 'blender-v3.3-release'

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] SVN commit: bf-blender [62997] tags/blender-3.3-release/lib/tests/modeling: Fixes to test files to go with reversion of Bevel continuity fix

2022-08-06 Thread Howard Trickey
Revision: 62997
  https://developer.blender.org/rBL62997
Author:   howardt
Date: 2022-08-06 19:13:34 +0200 (Sat, 06 Aug 2022)
Log Message:
---
Fixes to test files to go with reversion of Bevel continuity fix

Modified Paths:
--
tags/blender-3.3-release/lib/tests/modeling/bevel_regression.blend
tags/blender-3.3-release/lib/tests/modeling/modifiers.blend

Modified: tags/blender-3.3-release/lib/tests/modeling/bevel_regression.blend
===
(Binary files differ)

Modified: tags/blender-3.3-release/lib/tests/modeling/modifiers.blend
===
(Binary files differ)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d58476049e2] blender-v3.3-release: Fix T98025: Revert "Fix Bevel intersection continuity."

2022-08-06 Thread Howard Trickey
Commit: d58476049e2ae2e407d66cbb4d5eac65b594509a
Author: Howard Trickey
Date:   Sat Aug 6 12:40:11 2022 -0400
Branches: blender-v3.3-release
https://developer.blender.org/rBd58476049e2ae2e407d66cbb4d5eac65b594509a

Fix T98025: Revert "Fix Bevel intersection continuity."

This reverts commit 94866ef84f1907116409f8fe9c1f313405
A number of reports of bevel regressions came after the
commit to fix bevel intersection continuity.
Since the fix for some of those regressions is not obvious
we will revert the continuity improvement and do it as
part of the Bevel V2 project.

===

M   source/blender/bmesh/tools/bmesh_bevel.c

===

diff --git a/source/blender/bmesh/tools/bmesh_bevel.c 
b/source/blender/bmesh/tools/bmesh_bevel.c
index fa852cdd6da..aa2c93f7c5a 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -437,16 +437,6 @@ static bool nearly_parallel_normalized(const float d1[3], 
const float d2[3])
   return compare_ff(fabsf(direction_dot), 1.0f, BEVEL_EPSILON_ANG_DOT);
 }
 
-/**
- * calculate the determinant of a matrix formed by three vectors
- * \return dot(a, cross(b, c)) = determinant(a, b, c)
- */
-static float determinant_v3v3v3(const float a[3], const float b[3], const 
float c[3])
-{
-  return a[0] * b[1] * c[2] + a[1] * b[2] * c[0] + a[2] * b[0] * c[1] - a[0] * 
b[2] * c[1] -
- a[1] * b[0] * c[2] - a[2] * b[1] * c[0];
-}
-
 /* Make a new BoundVert of the given kind, inserting it at the end of the 
circular linked
  * list with entry point bv->boundstart, and return it. */
 static BoundVert *add_new_bound_vert(MemArena *mem_arena, VMesh *vm, const 
float co[3])
@@ -4134,114 +4124,44 @@ static VMesh *cubic_subdiv(BevelParams *bp, VMesh 
*vm_in)
   VMesh *vm_out = new_adj_vmesh(bp->mem_arena, n_boundary, ns_out, 
vm_in->boundstart);
 
   /* First we adjust the boundary vertices of the input mesh, storing in 
output mesh. */
-  BoundVert *bndv = vm_in->boundstart;
   for (int i = 0; i < n_boundary; i++) {
-float co1[3], co2[3], acc[3];
-EdgeHalf *e = bndv->elast;
-/* Generate tangents. This is hacked together and would ideally be done 
elsewhere and then only
- * used here. */
-float tangent[3], tangent2[3], normal[3];
-bool convex = true;
-bool orthogonal = false;
-float stretch = 0.0f;
-if (e) {
-  /* Projection direction is direction of the edge. */
-  sub_v3_v3v3(tangent, e->e->v1->co, e->e->v2->co);
-  if (e->is_rev) {
-negate_v3(tangent);
-  }
-  normalize_v3(tangent);
-  if (bndv->is_arc_start || bndv->is_patch_start) {
-BMFace *face = e->fnext;
-if (face) {
-  copy_v3_v3(normal, face->no);
-}
-else {
-  zero_v3(normal);
-}
-madd_v3_v3v3fl(co2, bndv->profile.middle, normal, 0.1f);
-  }
-  if (bndv->is_arc_start || bp->affect_type == BEVEL_AFFECT_VERTICES) {
-EdgeHalf *e1 = bndv->next->elast;
-BLI_assert(e1);
-sub_v3_v3v3(tangent2, e1->e->v1->co, e1->e->v2->co);
-if (e1->is_rev) {
-  negate_v3(tangent2);
-}
-normalize_v3(tangent2);
-
-convex = determinant_v3v3v3(tangent2, tangent, normal) < 0;
-
-add_v3_v3(tangent2, tangent);
-normalize_v3(tangent2);
-copy_v3_v3(tangent, tangent2);
-  }
-  /* Calculate a factor which determines how much the interpolated mesh is
-   * going to be stretched out into the direction of the tangent.
-   * It is currently using the difference along the tangent of the
-   * central point on the profile and the current center vertex position. 
*/
-  get_profile_point(bp, >profile, ns_in2, ns_in, co);
-  stretch = dot_v3v3(tangent, mesh_vert(vm_in, i, ns_in2, ns_in2)->co) - 
dot_v3v3(tangent, co);
-  stretch = fabsf(stretch);
-  /* Scale the tangent by stretch. The divide by ns_in2 comes from the 
Levin Paper. */
-  mul_v3_fl(tangent, stretch / ns_in2);
-  orthogonal = bndv->is_patch_start;
-}
-else if (bndv->prev->is_patch_start) {
-  /* If this is the second edge of a patch and therefore #e is NULL,
-   * then e->fprev has to be used/not NULL. */
-  BLI_assert(bndv->prev->elast);
-  BMFace *face = bndv->prev->elast->fnext;
-  if (face) {
-copy_v3_v3(normal, face->no);
-  }
-  else {
-zero_v3(normal);
-  }
-  orthogonal = true;
-}
-else {
-  /** Should only come here from make_cube_corner_adj_vmesh. */
-  sub_v3_v3v3(co1, mesh_vert(vm_in, i, 0, 0)->co, mesh_vert(vm_in, i, 0, 
1)->co);
-  sub_v3_v3v3(co2, mesh_vert(vm_in, i, 0, 1)->co, mesh_vert(vm_in, i, 0, 
2)->co);
-  cross_v3_v3v3

[Bf-blender-cvs] [7c6d546f3a7] master: Fix an assert trip in boolean tickled by D11272 example.

2022-07-23 Thread Howard Trickey
Commit: 7c6d546f3a72569e15285bc046345b7f60df2aaa
Author: Howard Trickey
Date:   Sat Jul 23 12:15:59 2022 -0400
Branches: master
https://developer.blender.org/rB7c6d546f3a72569e15285bc046345b7f60df2aaa

Fix an assert trip in boolean tickled by D11272 example.

The face merging code in exact boolean made an assumption that
the tesselated original face was manifold except at the boundaries.
This should be true but sometimes (e.g., if the input faces have
self-intersection, as happens in the example), it is not.
This commit makes face merging tolerant of such a situation.
It might leave some stray edges from triangulation, but it should
only happen if the input is malformed.
Note: the input may be malformed if there were previous booleans
in the stack, since snapping the exact result to float coordinates
is not guaranteed to leave the mesh without defects.

This is the second try at this commit. The previous one had a typo
in it -- luckily, the tests caught the problem.

===

M   source/blender/blenlib/intern/mesh_boolean.cc

===

diff --git a/source/blender/blenlib/intern/mesh_boolean.cc 
b/source/blender/blenlib/intern/mesh_boolean.cc
index 700c126ca4c..d4586f95fe0 100644
--- a/source/blender/blenlib/intern/mesh_boolean.cc
+++ b/source/blender/blenlib/intern/mesh_boolean.cc
@@ -2966,6 +2966,11 @@ static std::ostream <<(std::ostream , const 
FaceMergeState )
  * \a tris all have the same original face.
  * Find the 2d edge/triangle topology for these triangles, but only the ones 
facing in the
  * norm direction, and whether each edge is dissolvable or not.
+ * If we did the initial triangulation properly, and any Delaunay 
triangulations of interections
+ * properly, then each triangle edge should have at most one neighbor.
+ * However, there can be anonalies. For example, if an input face is 
self-intersecting, we fall
+ * back on the floating poing polyfill triangulation, which, after which all 
bets are off.
+ * Hence, try to be tolerant of such unexpected topology.
  */
 static void init_face_merge_state(FaceMergeState *fms,
   const Vector ,
@@ -3053,16 +3058,35 @@ static void init_face_merge_state(FaceMergeState *fms,
   std::cout << "me.v1 == mf.vert[i] so set edge[" << me_index << 
"].left_face = " << f
 << "\n";
 }
-BLI_assert(me.left_face == -1);
-fms->edge[me_index].left_face = f;
+if (me.left_face != -1) {
+  /* Unexpected in the normal case: this means more than one triangle 
shares this
+   * edge in the same orientation. But be tolerant of this case. By 
making this
+   * edge not dissolvable, we'll avoid future problems due to this 
non-manifold topology.
+   */
+  if (dbg_level > 1) {
+std::cout << "me.left_face was already occupied, so triangulation 
wasn't good\n";
+  }
+  me.dissolvable = false;
+}
+else {
+  fms->edge[me_index].left_face = f;
+}
   }
   else {
 if (dbg_level > 1) {
   std::cout << "me.v1 != mf.vert[i] so set edge[" << me_index << 
"].right_face = " << f
 << "\n";
 }
-BLI_assert(me.right_face == -1);
-fms->edge[me_index].right_face = f;
+if (me.right_face != -1) {
+  /* Unexpected, analogous to the me.left_face != -1 case above. */
+  if (dbg_level > 1) {
+std::cout << "me.right_face was already occupied, so triangulation 
wasn't good\n";
+  }
+  me.dissolvable = false;
+}
+else {
+  fms->edge[me_index].right_face = f;
+}
   }
   fms->face[f].edge.append(me_index);
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b9a93465a0a] bevelv2: Modify to go with recent attribute access changes.

2022-07-16 Thread Howard Trickey
Commit: b9a93465a0a1d0877f5a99b29fca953913caf267
Author: Howard Trickey
Date:   Sat Jul 16 16:56:32 2022 -0400
Branches: bevelv2
https://developer.blender.org/rBb9a93465a0a1d0877f5a99b29fca953913caf267

Modify to go with recent attribute access changes.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc 
b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
index ee0f5c4c00a..22f68c269df 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
@@ -1118,30 +1118,34 @@ static void 
copy_attributes_based_on_fn(Map 
 const eAttrDomain domain,
 std::function mapfn)
 {
+  const AttributeAccessor src_attributes = *in_component.attributes();
+  MutableAttributeAccessor dst_attributes = 
*result_component.attributes_for_write();
+
   for (Map::Item entry : attributes.items()) {
 const AttributeIDRef attribute_id = entry.key;
-ReadAttributeLookup attribute = 
in_component.attribute_try_get_for_read(attribute_id);
-if (!attribute) {
+GAttributeReader src_attribute = src_attributes.lookup(attribute_id);
+if (!src_attribute) {
   continue;
 }
 
 /* Only copy if it is on a domain we want. */
-if (domain != attribute.domain) {
+if (domain != src_attribute.domain) {
   continue;
 }
-const eCustomDataType data_type = 
bke::cpp_type_to_custom_data_type(attribute.varray.type());
+const eCustomDataType data_type = bke::cpp_type_to_custom_data_type(
+src_attribute.varray.type());
 
-OutputAttribute result_attribute = 
result_component.attribute_try_get_for_output_only(
-attribute_id, attribute.domain, data_type);
+GSpanAttributeWriter dst_attribute = 
dst_attributes.lookup_or_add_for_write_only_span(
+attribute_id, domain, data_type);
 
-if (!result_attribute) {
+if (!dst_attribute) {
   continue;
 }
 
 attribute_math::convert_to_static_type(data_type, [&](auto dummy) {
   using T = decltype(dummy);
-  VArraySpan span{attribute.varray.typed()};
-  MutableSpan out_span = result_attribute.as_span();
+  VArraySpan span{src_attribute.varray.typed()};
+  MutableSpan out_span = dst_attribute.span.typed();
   for (const int i : out_span.index_range()) {
 const int src_i = mapfn(i);
 /* The unmapped entries of `out_span` have been initialized to the 
default value. */
@@ -1150,7 +1154,7 @@ static void 
copy_attributes_based_on_fn(Map 
 }
   }
 });
-result_attribute.save();
+dst_attribute.finish();
   }
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [3556fa2742c] bevelv2: The MeshDelta class can create a new Mesh.

2022-07-16 Thread Howard Trickey
Commit: 3556fa2742c364b17f29556c3252ad1c895f17c5
Author: Howard Trickey
Date:   Sat Jul 16 16:12:15 2022 -0400
Branches: bevelv2
https://developer.blender.org/rB3556fa2742c364b17f29556c3252ad1c895f17c5

The MeshDelta class can create a new Mesh.

This means that vertex bevel does something now.
Nothing has been done about UVs yet, and nothing about
edge and face bevels yet.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc 
b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
index 7de1138760c..ee0f5c4c00a 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
@@ -3,6 +3,7 @@
 #include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 
+#include "BKE_attribute_math.hh"
 #include "BKE_mesh.h"
 #include "BKE_mesh_mapping.h"
 #include "BKE_mesh_runtime.h"
@@ -53,7 +54,7 @@ static void node_update(bNodeTree *UNUSED(ntree), bNode 
*UNUSED(node))
 {
 }
 
-/* MeshTopology encapsulates data needed to answer topological queries about a 
mesh,
+/** MeshTopology encapsulates data needed to answer topological queries about 
a mesh,
  * such as "which edges are adjacent to a given vertex?".
  * While Mesh uses the term 'poly' for polygon, most of Blender uses the term 
'face',
  * so we'll go with 'face' in this code except in the final to/from mesh 
routines.
@@ -227,7 +228,7 @@ float3 MeshTopology::edge_dir_from_vert_normalized(int e, 
int v) const
   return math::normalize(edge_dir_from_vert(e, v));
 }
 
-/* A Vertex Cap consists of a vertex in a mesh and an CCW ordering of
+/** A Vertex Cap consists of a vertex in a mesh and an CCW ordering of
  * alternating edges and faces around it, as viewed from the face's
  * normal side. Some faces may be missing (i.e., gaps).
  * (If there are other edges and faces attached to the vertex that
@@ -304,7 +305,7 @@ class VertexCap {
   }
 };
 
-/* Construct and return the VertexCap for vertex vert. */
+/** Construct and return the VertexCap for vertex `vert`. */
 void VertexCap::init_from_topo(const int vert, const MeshTopology )
 {
   this->vert = vert;
@@ -441,7 +442,7 @@ static std::ostream <<(std::ostream , const 
BoundaryVert )
   return os;
 }
 
-/* The different types of BoundaryEdges (see below). */
+/** The different types of BoundaryEdges (see below). */
 typedef enum eBoundaryEdgeType {
   BE_UNBEVELED = 0,
   BE_BEVELED = 1,
@@ -454,7 +455,7 @@ typedef enum eBoundaryEdgeType {
 static const char *be_type_name[6] = {
 "unbev", "bev", "facebev_both", "facebev_l", "facebev_r", "other"};
 
-/* A BoundaryEdge is one end of an edge, attached to a vertex in a VertexCap.
+/** A BoundaryEdge is one end of an edge, attached to a vertex in a VertexCap.
  * This data describes how it is involved in beveling, and how it is attached
  * to BoundaryVerts.
  * Note: when the descriptors "left" and "right" are used to refer to sides of
@@ -476,11 +477,37 @@ class BoundaryEdge {
   /* The boundary vertex index where the left half of a BE_BEVELED,
* BE_FACE_BEVEL_BOTH, or BE_FACE_BEVEL_RIGHT attached. */
   int bv_right_index;
+  /* The index of this edge, if unbeveled, in output mesh. */
+  int mesh_index;
   /* The type of this BoundaryEdge. */
   eBoundaryEdgeType type;
 
   BoundaryEdge()
-  : edge(-1), vc_index(-1), bv_index(-1), bv_left_index(-1), 
bv_right_index(-1), type(BE_OTHER)
+  : edge(-1),
+vc_index(-1),
+bv_index(-1),
+bv_left_index(-1),
+bv_right_index(-1),
+mesh_index(-1),
+type(BE_OTHER)
+  {
+  }
+};
+
+/** A BoundaryConnector has the vertices and edges in the output mesh
+ * of the connection between two successive BoundaryVerts.
+ */
+class BoundaryConnector {
+ public:
+  /* Temporary: for now, just one edge. Will eventually be array
+   * of vertices with intervening edges. */
+  int edge;
+
+  BoundaryConnector() : edge(-1)
+  {
+  }
+
+  BoundaryConnector(int e) : edge(e)
   {
   }
 };
@@ -492,14 +519,18 @@ static std::ostream <<(std::ostream , const 
BoundaryEdge )
  << "vc#=" << be.vc_index << " "
  << "bv#=" << be.bv_index << " "
  << "bvl#=" << be.bv_left_index << " "
- << "bvr#=" << be.bv_right_index << "}";
+ << "bvr#=" << be.bv_right_index << " "
+ << "eout=" << be.mesh_index << "}";
   return os;
 }
 
+/** BevelVertexData holds the data used to bevel around a

[Bf-blender-cvs] [1f31645a1a0] bevelv2: Merge branch 'master' into bevelv2

2022-07-16 Thread Howard Trickey
Commit: 1f31645a1a0a0f2898474cce22ee26b830c58d98
Author: Howard Trickey
Date:   Sat Jul 16 16:32:53 2022 -0400
Branches: bevelv2
https://developer.blender.org/rB1f31645a1a0a0f2898474cce22ee26b830c58d98

Merge branch 'master' into bevelv2

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [62c97f107c3] bevelv2: Merge branch 'master' into bevelv2

2022-07-16 Thread Howard Trickey
Commit: 62c97f107c3d46ec4287be718bec1201f147bd7d
Author: Howard Trickey
Date:   Sat Jul 16 16:14:34 2022 -0400
Branches: bevelv2
https://developer.blender.org/rB62c97f107c3d46ec4287be718bec1201f147bd7d

Merge branch 'master' into bevelv2

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [bb345173420] temp-T97352-3d-texturing-seam-bleeding-b2: Revert "Fix an assert trip in boolean tickled by D11272 example."

2022-07-11 Thread Howard Trickey
Commit: bb345173420065182f4d6e16b61195d441d2f81d
Author: Howard Trickey
Date:   Sun Jul 10 18:50:11 2022 -0400
Branches: temp-T97352-3d-texturing-seam-bleeding-b2
https://developer.blender.org/rBbb345173420065182f4d6e16b61195d441d2f81d

Revert "Fix an assert trip in boolean tickled by D11272 example."

This reverts commit 65432901162c0dff124d55a04875050fd0f1ac22.
It broke tests and I don't know why, so reverting this while
figuring that out.

===

M   source/blender/blenlib/intern/mesh_boolean.cc

===

diff --git a/source/blender/blenlib/intern/mesh_boolean.cc 
b/source/blender/blenlib/intern/mesh_boolean.cc
index 464b8f4139e..700c126ca4c 100644
--- a/source/blender/blenlib/intern/mesh_boolean.cc
+++ b/source/blender/blenlib/intern/mesh_boolean.cc
@@ -2966,11 +2966,6 @@ static std::ostream <<(std::ostream , const 
FaceMergeState )
  * \a tris all have the same original face.
  * Find the 2d edge/triangle topology for these triangles, but only the ones 
facing in the
  * norm direction, and whether each edge is dissolvable or not.
- * If we did the initial triangulation properly, and any Delaunay 
triangulations of interections
- * properly, then each triangle edge should have at most one neighbor.
- * However, there can be anonalies. For example, if an input face is 
self-intersecting, we fall
- * back on the floating poing polyfill triangulation, which, after which all 
bets are off.
- * Hence, try to be tolerant of such unexpected topology.
  */
 static void init_face_merge_state(FaceMergeState *fms,
   const Vector ,
@@ -3058,35 +3053,16 @@ static void init_face_merge_state(FaceMergeState *fms,
   std::cout << "me.v1 == mf.vert[i] so set edge[" << me_index << 
"].left_face = " << f
 << "\n";
 }
-if (me.left_face != 1) {
-  /* Unexpected in the normal case: this means more than one triangle 
shares this
-   * edge in the same orientation. But be tolerant of this case. By 
making this
-   * edge not dissolvable, we'll avoid future problems due to this 
non-manifold topology.
-   */
-  if (dbg_level > 1) {
-std::cout << "me.left_face was already occupied, so triangulation 
wasn't good\n";
-  }
-  me.dissolvable = false;
-}
-else {
-  fms->edge[me_index].left_face = f;
-}
+BLI_assert(me.left_face == -1);
+fms->edge[me_index].left_face = f;
   }
   else {
 if (dbg_level > 1) {
   std::cout << "me.v1 != mf.vert[i] so set edge[" << me_index << 
"].right_face = " << f
 << "\n";
 }
-if (me.right_face != -1) {
-  /* Unexpected, analogous to the me.left_face != -1 case above. */
-  if (dbg_level > 1) {
-std::cout << "me.right_face was already occupied, so triangulation 
wasn't good\n";
-  }
-  me.dissolvable = false;
-}
-else {
-  fms->edge[me_index].right_face = f;
-}
+BLI_assert(me.right_face == -1);
+fms->edge[me_index].right_face = f;
   }
   fms->face[f].edge.append(me_index);
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [28754e9c538] temp-T97352-3d-texturing-seam-bleeding-b2: Fix an assert trip in boolean tickled by D11272 example.

2022-07-11 Thread Howard Trickey
Commit: 28754e9c538b5d50977dc0c22b589427fb460820
Author: Howard Trickey
Date:   Sun Jul 10 14:50:17 2022 -0400
Branches: temp-T97352-3d-texturing-seam-bleeding-b2
https://developer.blender.org/rB28754e9c538b5d50977dc0c22b589427fb460820

Fix an assert trip in boolean tickled by D11272 example.

The face merging code in exact boolean made an assumption that
the tesselated original face was manifold except at the boundaries.
This should be true but sometimes (e.g., if the input faces have
self-intersection, as happens in the example), it is not.
This commit makes face merging tolerant of such a situation.
It might leave some stray edges from triangulation, but it should
only happen if the input is malformed.
Note: the input may be malformed if there were previous booleans
in the stack, since snapping the exact result to float coordinates
is not guaranteed to leave the mesh without defects.

===

M   source/blender/blenlib/intern/mesh_boolean.cc

===

diff --git a/source/blender/blenlib/intern/mesh_boolean.cc 
b/source/blender/blenlib/intern/mesh_boolean.cc
index 700c126ca4c..464b8f4139e 100644
--- a/source/blender/blenlib/intern/mesh_boolean.cc
+++ b/source/blender/blenlib/intern/mesh_boolean.cc
@@ -2966,6 +2966,11 @@ static std::ostream <<(std::ostream , const 
FaceMergeState )
  * \a tris all have the same original face.
  * Find the 2d edge/triangle topology for these triangles, but only the ones 
facing in the
  * norm direction, and whether each edge is dissolvable or not.
+ * If we did the initial triangulation properly, and any Delaunay 
triangulations of interections
+ * properly, then each triangle edge should have at most one neighbor.
+ * However, there can be anonalies. For example, if an input face is 
self-intersecting, we fall
+ * back on the floating poing polyfill triangulation, which, after which all 
bets are off.
+ * Hence, try to be tolerant of such unexpected topology.
  */
 static void init_face_merge_state(FaceMergeState *fms,
   const Vector ,
@@ -3053,16 +3058,35 @@ static void init_face_merge_state(FaceMergeState *fms,
   std::cout << "me.v1 == mf.vert[i] so set edge[" << me_index << 
"].left_face = " << f
 << "\n";
 }
-BLI_assert(me.left_face == -1);
-fms->edge[me_index].left_face = f;
+if (me.left_face != 1) {
+  /* Unexpected in the normal case: this means more than one triangle 
shares this
+   * edge in the same orientation. But be tolerant of this case. By 
making this
+   * edge not dissolvable, we'll avoid future problems due to this 
non-manifold topology.
+   */
+  if (dbg_level > 1) {
+std::cout << "me.left_face was already occupied, so triangulation 
wasn't good\n";
+  }
+  me.dissolvable = false;
+}
+else {
+  fms->edge[me_index].left_face = f;
+}
   }
   else {
 if (dbg_level > 1) {
   std::cout << "me.v1 != mf.vert[i] so set edge[" << me_index << 
"].right_face = " << f
 << "\n";
 }
-BLI_assert(me.right_face == -1);
-fms->edge[me_index].right_face = f;
+if (me.right_face != -1) {
+  /* Unexpected, analogous to the me.left_face != -1 case above. */
+  if (dbg_level > 1) {
+std::cout << "me.right_face was already occupied, so triangulation 
wasn't good\n";
+  }
+  me.dissolvable = false;
+}
+else {
+  fms->edge[me_index].right_face = f;
+}
   }
   fms->face[f].edge.append(me_index);
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [7f4ee97b9ef] master: Revert "Fix an assert trip in boolean tickled by D11272 example."

2022-07-10 Thread Howard Trickey
Commit: 7f4ee97b9ef93b0c8f9fc89d47ee8535ab665327
Author: Howard Trickey
Date:   Sun Jul 10 18:50:11 2022 -0400
Branches: master
https://developer.blender.org/rB7f4ee97b9ef93b0c8f9fc89d47ee8535ab665327

Revert "Fix an assert trip in boolean tickled by D11272 example."

This reverts commit 65432901162c0dff124d55a04875050fd0f1ac22.
It broke tests and I don't know why, so reverting this while
figuring that out.

===

M   source/blender/blenlib/intern/mesh_boolean.cc

===

diff --git a/source/blender/blenlib/intern/mesh_boolean.cc 
b/source/blender/blenlib/intern/mesh_boolean.cc
index 464b8f4139e..700c126ca4c 100644
--- a/source/blender/blenlib/intern/mesh_boolean.cc
+++ b/source/blender/blenlib/intern/mesh_boolean.cc
@@ -2966,11 +2966,6 @@ static std::ostream <<(std::ostream , const 
FaceMergeState )
  * \a tris all have the same original face.
  * Find the 2d edge/triangle topology for these triangles, but only the ones 
facing in the
  * norm direction, and whether each edge is dissolvable or not.
- * If we did the initial triangulation properly, and any Delaunay 
triangulations of interections
- * properly, then each triangle edge should have at most one neighbor.
- * However, there can be anonalies. For example, if an input face is 
self-intersecting, we fall
- * back on the floating poing polyfill triangulation, which, after which all 
bets are off.
- * Hence, try to be tolerant of such unexpected topology.
  */
 static void init_face_merge_state(FaceMergeState *fms,
   const Vector ,
@@ -3058,35 +3053,16 @@ static void init_face_merge_state(FaceMergeState *fms,
   std::cout << "me.v1 == mf.vert[i] so set edge[" << me_index << 
"].left_face = " << f
 << "\n";
 }
-if (me.left_face != 1) {
-  /* Unexpected in the normal case: this means more than one triangle 
shares this
-   * edge in the same orientation. But be tolerant of this case. By 
making this
-   * edge not dissolvable, we'll avoid future problems due to this 
non-manifold topology.
-   */
-  if (dbg_level > 1) {
-std::cout << "me.left_face was already occupied, so triangulation 
wasn't good\n";
-  }
-  me.dissolvable = false;
-}
-else {
-  fms->edge[me_index].left_face = f;
-}
+BLI_assert(me.left_face == -1);
+fms->edge[me_index].left_face = f;
   }
   else {
 if (dbg_level > 1) {
   std::cout << "me.v1 != mf.vert[i] so set edge[" << me_index << 
"].right_face = " << f
 << "\n";
 }
-if (me.right_face != -1) {
-  /* Unexpected, analogous to the me.left_face != -1 case above. */
-  if (dbg_level > 1) {
-std::cout << "me.right_face was already occupied, so triangulation 
wasn't good\n";
-  }
-  me.dissolvable = false;
-}
-else {
-  fms->edge[me_index].right_face = f;
-}
+BLI_assert(me.right_face == -1);
+fms->edge[me_index].right_face = f;
   }
   fms->face[f].edge.append(me_index);
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [65432901162] master: Fix an assert trip in boolean tickled by D11272 example.

2022-07-10 Thread Howard Trickey
Commit: 65432901162c0dff124d55a04875050fd0f1ac22
Author: Howard Trickey
Date:   Sun Jul 10 14:50:17 2022 -0400
Branches: master
https://developer.blender.org/rB65432901162c0dff124d55a04875050fd0f1ac22

Fix an assert trip in boolean tickled by D11272 example.

The face merging code in exact boolean made an assumption that
the tesselated original face was manifold except at the boundaries.
This should be true but sometimes (e.g., if the input faces have
self-intersection, as happens in the example), it is not.
This commit makes face merging tolerant of such a situation.
It might leave some stray edges from triangulation, but it should
only happen if the input is malformed.
Note: the input may be malformed if there were previous booleans
in the stack, since snapping the exact result to float coordinates
is not guaranteed to leave the mesh without defects.

===

M   source/blender/blenlib/intern/mesh_boolean.cc

===

diff --git a/source/blender/blenlib/intern/mesh_boolean.cc 
b/source/blender/blenlib/intern/mesh_boolean.cc
index 700c126ca4c..464b8f4139e 100644
--- a/source/blender/blenlib/intern/mesh_boolean.cc
+++ b/source/blender/blenlib/intern/mesh_boolean.cc
@@ -2966,6 +2966,11 @@ static std::ostream <<(std::ostream , const 
FaceMergeState )
  * \a tris all have the same original face.
  * Find the 2d edge/triangle topology for these triangles, but only the ones 
facing in the
  * norm direction, and whether each edge is dissolvable or not.
+ * If we did the initial triangulation properly, and any Delaunay 
triangulations of interections
+ * properly, then each triangle edge should have at most one neighbor.
+ * However, there can be anonalies. For example, if an input face is 
self-intersecting, we fall
+ * back on the floating poing polyfill triangulation, which, after which all 
bets are off.
+ * Hence, try to be tolerant of such unexpected topology.
  */
 static void init_face_merge_state(FaceMergeState *fms,
   const Vector ,
@@ -3053,16 +3058,35 @@ static void init_face_merge_state(FaceMergeState *fms,
   std::cout << "me.v1 == mf.vert[i] so set edge[" << me_index << 
"].left_face = " << f
 << "\n";
 }
-BLI_assert(me.left_face == -1);
-fms->edge[me_index].left_face = f;
+if (me.left_face != 1) {
+  /* Unexpected in the normal case: this means more than one triangle 
shares this
+   * edge in the same orientation. But be tolerant of this case. By 
making this
+   * edge not dissolvable, we'll avoid future problems due to this 
non-manifold topology.
+   */
+  if (dbg_level > 1) {
+std::cout << "me.left_face was already occupied, so triangulation 
wasn't good\n";
+  }
+  me.dissolvable = false;
+}
+else {
+  fms->edge[me_index].left_face = f;
+}
   }
   else {
 if (dbg_level > 1) {
   std::cout << "me.v1 != mf.vert[i] so set edge[" << me_index << 
"].right_face = " << f
 << "\n";
 }
-BLI_assert(me.right_face == -1);
-fms->edge[me_index].right_face = f;
+if (me.right_face != -1) {
+  /* Unexpected, analogous to the me.left_face != -1 case above. */
+  if (dbg_level > 1) {
+std::cout << "me.right_face was already occupied, so triangulation 
wasn't good\n";
+  }
+  me.dissolvable = false;
+}
+else {
+  fms->edge[me_index].right_face = f;
+}
   }
   fms->face[f].edge.append(me_index);
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [cae7778db79] bevelv2: Added start of a class for a delta to a mesh.

2022-07-05 Thread Howard Trickey
Commit: cae7778db79cf08f7139002d8c018f204bd23312
Author: Howard Trickey
Date:   Tue Jul 5 15:58:03 2022 -0400
Branches: bevelv2
https://developer.blender.org/rBcae7778db79cf08f7139002d8c018f204bd23312

Added start of a class for a delta to a mesh.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc 
b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
index 838c67097d4..7de1138760c 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
@@ -660,6 +660,144 @@ void BevelData::calculate_vertex_bevels(const IndexMask 
to_bevel, VArray
   setup_vert_map();
 }
 
+/* IndexAlloc allocates sequential integers, starting from a given start 
value. */
+class IndexAlloc {
+  int start_;
+  int first_free_;
+
+ public:
+  IndexAlloc(int start) : start_(start), first_free_(start)
+  {
+  }
+
+  int alloc()
+  {
+return first_free_++;
+  }
+  int start() const
+  {
+return start_;
+  }
+  int allocated_size() const
+  {
+return first_free_ - start_;
+  }
+};
+
+/* MeshDelta represents a delta to a Mesh: additions and deletions
+ * of Mesh elements.
+ */
+class MeshDelta {
+  Mesh _;
+  IndexAlloc vert_alloc_;
+  IndexAlloc edge_alloc_;
+  IndexAlloc poly_alloc_;
+  IndexAlloc loop_alloc_;
+  Set vert_deletes_;
+  Set edge_deletes_;
+  Set poly_deletes_;
+  Set loop_deletes_;
+  Vector new_verts_;
+  Vector new_edges_;
+  Vector new_polys_;
+  Vector new_loops_;
+
+ public:
+  MeshDelta(Mesh );
+
+  /* TODO: provide arguments or methods to set the attributes. */
+  int new_vert(const float3 );
+  int new_edge(int v1, int v2);
+  int new_loop(int v, int e);
+  int new_face(int loopstart, int totloop);
+
+  void delete_vert(int v)
+  {
+vert_deletes_.add(v);
+  }
+  void delete_edge(int e)
+  {
+edge_deletes_.add(e);
+  }
+  void delete_face(int f);
+
+  /* Change Mesh in place to delete and add what is required, closing up the
+   * gaps in the index spaces. */
+  void apply_delta_to_mesh();
+};
+
+MeshDelta::MeshDelta(Mesh )
+: mesh_(mesh),
+  vert_alloc_(mesh_.totvert),
+  edge_alloc_(mesh_.totedge),
+  poly_alloc_(mesh_.totpoly),
+  loop_alloc_(mesh_.totloop)
+{
+}
+
+int MeshDelta::new_vert(const float3 )
+{
+  int v = vert_alloc_.alloc();
+  MVert mvert;
+  copy_v3_v3(mvert.co, co);
+  mvert.flag = 0;
+  mvert.bweight = 0;
+  new_verts_.append(mvert);
+  BLI_assert(v == new_verts_.size() - 1);
+  return v;
+}
+
+int MeshDelta::new_edge(int v1, int v2)
+{
+  int e = edge_alloc_.alloc();
+  MEdge medge;
+  medge.v1 = v1;
+  medge.v2 = v2;
+  medge.crease = 0;
+  medge.bweight = 0;
+  medge.flag = ME_EDGEDRAW;
+  new_edges_.append(medge);
+  BLI_assert(e == new_edges_.size() - 1);
+  return e;
+}
+
+int MeshDelta::new_loop(int v, int e)
+{
+  int l = loop_alloc_.alloc();
+  MLoop mloop;
+  mloop.v = v;
+  mloop.e = e;
+  new_loops_.append(mloop);
+  BLI_assert(l == new_loops_.size() - 1);
+  return l;
+}
+
+int MeshDelta::new_face(int loopstart, int totloop)
+{
+  int f = poly_alloc_.alloc();
+  MPoly mpoly;
+  mpoly.loopstart = loopstart;
+  mpoly.totloop = totloop;
+  mpoly.mat_nr = 0;
+  mpoly.flag = 0;
+  new_polys_.append(mpoly);
+  BLI_assert(f = new_polys_.size() - 1);
+  return f;
+}
+
+/* Delete the MPoly and the loops.
+ * The edges and vertices need to be deleted elsewhere, if necessary
+ */
+void MeshDelta::delete_face(int f)
+{
+  poly_deletes_.add(f);
+  BLI_assert(f >= 0 && f < mesh_.totpoly);
+  const MPoly  = mesh_.mpoly[f];
+  for (int l = mpoly.loopstart; l < mpoly.loopstart + mpoly.totloop; l++) {
+loop_deletes_.add(l);
+  }
+}
+
 static void bevel_mesh_vertices(MeshComponent ,
 const Field _field,
 const Field _field)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [38fadd7fc42] bevelv2: Added data structures to hold construction of bevel around a vert.

2022-07-04 Thread Howard Trickey
Commit: 38fadd7fc42d7916e99d52e0763cfc009074c7f2
Author: Howard Trickey
Date:   Mon Jul 4 12:06:12 2022 -0400
Branches: bevelv2
https://developer.blender.org/rB38fadd7fc42d7916e99d52e0763cfc009074c7f2

Added data structures to hold construction of bevel around a vert.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc 
b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
index dcc307034d1..f2a846c2094 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
@@ -8,6 +8,8 @@
 #include "BKE_mesh_runtime.h"
 
 #include "BLI_array.hh"
+#include "BLI_math_vec_types.hh"
+#include "BLI_math_vector.hh"
 #include "BLI_set.hh"
 #include "BLI_sort.hh"
 #include "BLI_task.hh"
@@ -51,8 +53,13 @@ static void node_update(bNodeTree *UNUSED(ntree), bNode 
*UNUSED(node))
 {
 }
 
-/* While Mesh uses the term 'poly' for polygon, most of Blender uses the term 
'face',
+/* MeshTopology encapsulates data needed to answer topological queries about a 
mesh,
+ * such as "which edges are adjacent to a given vertex?".
+ * While Mesh uses the term 'poly' for polygon, most of Blender uses the term 
'face',
  * so we'll go with 'face' in this code except in the final to/from mesh 
routines.
+ * This structure will also give some basic access to information about the 
Mesh elements
+ * themselves, in order to keep open the possibility that this code could be 
adapted
+ * for use with BMesh at some point in the future.
  */
 class MeshTopology {
   MeshElemMap *vert_edge_map_;
@@ -108,6 +115,24 @@ class MeshTopology {
   {
 return mesh_.totpoly;
   }
+
+  float3 vert_co(int v) const
+  {
+return float3(mesh_.mvert[v].co);
+  }
+
+  int edge_v1(int e) const
+  {
+return mesh_.medge[e].v1;
+  }
+
+  int edge_v2(int e) const
+  {
+return mesh_.medge[e].v2;
+  }
+
+  float3 edge_dir_from_vert(int e, int v) const;
+  float3 edge_dir_from_vert_normalized(int e, int v) const;
 };
 
 MeshTopology::MeshTopology(const Mesh ) : mesh_(mesh)
@@ -185,6 +210,23 @@ bool MeshTopology::edge_is_successor_in_face(const int e0, 
const int e1, const i
   return false;
 }
 
+float3 MeshTopology::edge_dir_from_vert(int e, int v) const
+{
+  const MEdge  = mesh_.medge[e];
+  if (medge.v1 == v) {
+return vert_co(medge.v2) - vert_co(medge.v1);
+  }
+  else {
+BLI_assert(medge.v2 == v);
+return vert_co(medge.v1) - vert_co(medge.v2);
+  }
+}
+
+float3 MeshTopology::edge_dir_from_vert_normalized(int e, int v) const
+{
+  return math::normalize(edge_dir_from_vert(e, v));
+}
+
 /* A Vertex Cap consists of a vertex in a mesh and an CCW ordering of
  * alternating edges and faces around it, as viewed from the face's
  * normal side. Some faces may be missing (i.e., gaps).
@@ -207,6 +249,9 @@ class VertexCap {
   {
   }
 
+  /* Initialize for vertex v, given a mesh topo. */
+  void init_from_topo(const int vert, const MeshTopology );
+
   /* The number of edges around the cap. */
   int size() const
   {
@@ -257,34 +302,16 @@ class VertexCap {
   {
 return face(i) == -1;
   }
-
-  /* Debug printing on std::cout. */
-  void print() const;
-};
-
-class BevelData {
-  Array bevel_vert_caps_;
-
- public:
-  MeshTopology topo;
-
-  BevelData(const Mesh ) : topo(mesh)
-  {
-  }
-  ~BevelData()
-  {
-  }
-
-  void init_caps_from_vertex_selection(const IndexMask selection);
 };
 
 /* Construct and return the VertexCap for vertex vert. */
-static VertexCap construct_cap(const int vert, const MeshTopology )
+void VertexCap::init_from_topo(const int vert, const MeshTopology )
 {
+  this->vert = vert;
   Span incident_edges = topo.vert_edges(vert);
   const int num_edges = incident_edges.size();
   if (num_edges == 0) {
-return VertexCap(vert, Span(), Span());
+return;
   }
 
   /* First check for the most common case: a complete manifold cap:
@@ -350,35 +377,254 @@ static VertexCap construct_cap(const int vert, const 
MeshTopology )
   std::reverse(ordered_faces.begin(), ordered_faces.end());
 }
   }
-  return VertexCap(vert, ordered_edges.as_span(), ordered_faces.as_span());
+  this->edges_ = ordered_edges;
+  this->faces_ = ordered_faces;
+  return;
 }
   }
   std::cout << "to implement: VertexCap for non-manifold edges\n";
-  BLI_assert(false);
-  return VertexCap();
 }
 
-void VertexCap::print() const
+static std::ostream <<(std::ostream , const VertexCap )
 {
-  std::cout << "cap at v" << vert << ": ";
-  for (const int i : edges_.index_range()) {
-std::cout << "e" << edges_[i] << " ";
-if (faces_

[Bf-blender-cvs] [b13451f3c31] bevelv2: Added map from vertex to BevelVertexData.

2022-07-04 Thread Howard Trickey
Commit: b13451f3c315e6bf96f262993fdac6c2d1bf29aa
Author: Howard Trickey
Date:   Mon Jul 4 13:38:12 2022 -0400
Branches: bevelv2
https://developer.blender.org/rBb13451f3c315e6bf96f262993fdac6c2d1bf29aa

Added map from vertex to BevelVertexData.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc 
b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
index f2a846c2094..838c67097d4 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc
@@ -583,7 +583,13 @@ void BevelVertexData::construct_vertex_bevel(int vert, 
float amount, const MeshT
 }
 
 class BevelData {
+  /* BevelVertexData for just the affected vertices. */
   Array bevel_vert_data_;
+  /* A map from mesh vertex index to index in bevel_vert_data_.
+   * If we wanted  more speed at expense of space, we could also use
+   * an Array of size equal to the number of mesh vertices here.
+   */
+  Map vert_to_bvd_index_;
 
  public:
   MeshTopology topo;
@@ -595,11 +601,35 @@ class BevelData {
   {
   }
 
+  /* Initial calculation of position of boundary and edge attachments for 
vertex bevel. */
   void calculate_vertex_bevels(const IndexMask to_bevel, VArray 
amounts);
 
+  /* Sets up internal Map for fast access to the BevelVertexData for a given 
mesh vert. */
+  void setup_vert_map();
+
+  /* What is the BevelVertexData for mesh vertex `vert`? May return nullptr if 
`vert` isn't
+   * involved in beveling. */
+  BevelVertexData *bevel_vertex_data(int vert)
+  {
+int slot = vert_to_bvd_index_.lookup_default(vert, -1);
+if (slot != -1) {
+  return _vert_data_[slot];
+}
+return nullptr;
+  }
+
   void print(const std::string ) const;
 };
 
+/* Make a transation map from mesh vertex index to indices in 
bevel_vert_data_. */
+void BevelData::setup_vert_map()
+{
+  vert_to_bvd_index_.reserve(bevel_vert_data_.size());
+  for (const int i : bevel_vert_data_.index_range()) {
+vert_to_bvd_index_.add_new(bevel_vert_data_[i].vertex_cap().vert, i);
+  }
+}
+
 void BevelData::print(const std::string ) const
 {
   if (label.size() > 0) {
@@ -627,6 +657,7 @@ void BevelData::calculate_vertex_bevels(const IndexMask 
to_bevel, VArray
   bevel_vert_data_[i].construct_vertex_bevel(vert, amounts[vert], topo);
 }
   });
+  setup_vert_map();
 }
 
 static void bevel_mesh_vertices(MeshComponent ,

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b0875a588bb] bevelv2: Start of Bevel V2, as being worked on with task T98674.

2022-07-02 Thread Howard Trickey
Commit: b0875a588bb7a7e500cb63add5561cda013d34aa
Author: Howard Trickey
Date:   Sat Jul 2 10:30:37 2022 -0400
Branches: bevelv2
https://developer.blender.org/rBb0875a588bb7a7e500cb63add5561cda013d34aa

Start of Bevel V2, as being worked on with task T98674.

This is the start of a geometry node to do edge, vertex, and face
bevels.

It doesn't yet do anything but analyze the "Vertex cap" around
selected vertices for vertex bevel.

===

M   release/scripts/startup/nodeitems_builtins.py
M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/intern/node.cc
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/makesrna/intern/rna_nodetree.c
M   source/blender/nodes/NOD_geometry.h
M   source/blender/nodes/NOD_static_types.h
M   source/blender/nodes/geometry/CMakeLists.txt
A   source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc

===

diff --git a/release/scripts/startup/nodeitems_builtins.py 
b/release/scripts/startup/nodeitems_builtins.py
index 21bb3d01616..e6c9d62905e 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -107,6 +107,7 @@ def mesh_node_items(context):
 space = context.space_data
 if not space:
 return
+yield NodeItem("GeometryNodeBevelMesh")
 yield NodeItem("GeometryNodeDualMesh")
 yield NodeItem("GeometryNodeExtrudeMesh")
 yield NodeItem("GeometryNodeFlipFaces")
diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index e13ac3180ec..dc86adc9046 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -1340,6 +1340,7 @@ void BKE_nodetree_remove_layer_n(struct bNodeTree *ntree, 
struct Scene *scene, i
 
 struct TexResult;
 
+#define GEO_NODE_BEVEL_MESH 1400
 #define TEX_NODE_OUTPUT 401
 #define TEX_NODE_CHECKER 402
 #define TEX_NODE_TEXTURE 403
diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index 5be912ffb2b..ba9b28b4a29 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -4722,6 +4722,7 @@ static void registerGeometryNodes()
   register_node_type_geo_attribute_capture();
   register_node_type_geo_attribute_domain_size();
   register_node_type_geo_attribute_statistic();
+  register_node_type_geo_bevel_mesh();
   register_node_type_geo_boolean();
   register_node_type_geo_bounding_box();
   register_node_type_geo_collection_info();
diff --git a/source/blender/makesdna/DNA_node_types.h 
b/source/blender/makesdna/DNA_node_types.h
index 76d8207eead..79e1c9c2c14 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -1221,6 +1221,11 @@ typedef struct NodeGeometryExtrudeMesh {
   uint8_t mode;
 } NodeGeometryExtrudeMesh;
 
+typedef struct NodeGeometryBevelMesh {
+  /* GeometryNodeBevelMode */
+  uint8_t mode;
+} NodeGeometryBevelMesh;
+
 typedef struct NodeGeometryObjectInfo {
   /* GeometryNodeTransformSpace. */
   uint8_t transform_space;
@@ -1966,6 +1971,12 @@ typedef enum GeometryNodeExtrudeMeshMode {
   GEO_NODE_EXTRUDE_MESH_FACES = 2,
 } GeometryNodeExtrudeMeshMode;
 
+typedef enum GeometryNodeBevelMeshMode {
+  GEO_NODE_BEVEL_MESH_VERTICES = 0,
+  GEO_NODE_BEVEL_MESH_EDGES = 1,
+  GEO_NODE_BEVEL_MESH_FACES = 2,
+} GeometryNodeBevelMeshMode;
+
 typedef enum FunctionNodeRotateEulerType {
   FN_NODE_ROTATE_EULER_TYPE_EULER = 0,
   FN_NODE_ROTATE_EULER_TYPE_AXIS_ANGLE = 1,
diff --git a/source/blender/makesrna/intern/rna_nodetree.c 
b/source/blender/makesrna/intern/rna_nodetree.c
index 386ef3f74a3..2966dc97519 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -9551,6 +9551,27 @@ static void def_geo_extrude_mesh(StructRNA *srna)
   RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
 }
 
+static void def_geo_bevel_mesh(StructRNA *srna)
+{
+  PropertyRNA *prop;
+
+  static const EnumPropertyItem mode_items[] = {
+  {GEO_NODE_BEVEL_MESH_VERTICES, "VERTICES", 0, "Vertices", ""},
+  {GEO_NODE_BEVEL_MESH_EDGES, "EDGES", 0, "Edges", ""},
+  {GEO_NODE_BEVEL_MESH_FACES, "FACES", 0, "Faces", ""},
+  {0, NULL, 0, NULL, NULL},
+  };
+
+  RNA_def_struct_sdna_from(srna, "NodeGeometryBevelMesh", "storage");
+
+  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+  RNA_def_property_enum_sdna(prop, NULL, "mode");
+  RNA_def_property_enum_items(prop, mode_items);
+  RNA_def_property_enum_default(prop, GEO_NODE_BEVEL_MESH_FACES);
+  RNA_def_property_ui_text(prop, "Mode", "");
+  RNA_def_proper

[Bf-blender-cvs] [01d7dedd745] master: Revert "Start of Bevel V2, as being worked on with task T98674."

2022-07-02 Thread Howard Trickey
Commit: 01d7dedd745e2dce6f0f7857367ad8507ed60178
Author: Howard Trickey
Date:   Sat Jul 2 10:14:26 2022 -0400
Branches: master
https://developer.blender.org/rB01d7dedd745e2dce6f0f7857367ad8507ed60178

Revert "Start of Bevel V2, as being worked on with task T98674."

This reverts commit 9bb2afb55e50f9353cfc76cf2d8df7521b0b5feb.
Oops, did not intend to commit this to master.

===

M   release/scripts/startup/nodeitems_builtins.py
M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/intern/node.cc
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/makesrna/intern/rna_nodetree.c
M   source/blender/nodes/NOD_geometry.h
M   source/blender/nodes/NOD_static_types.h
M   source/blender/nodes/geometry/CMakeLists.txt
D   source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc

===

diff --git a/release/scripts/startup/nodeitems_builtins.py 
b/release/scripts/startup/nodeitems_builtins.py
index e6c9d62905e..21bb3d01616 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -107,7 +107,6 @@ def mesh_node_items(context):
 space = context.space_data
 if not space:
 return
-yield NodeItem("GeometryNodeBevelMesh")
 yield NodeItem("GeometryNodeDualMesh")
 yield NodeItem("GeometryNodeExtrudeMesh")
 yield NodeItem("GeometryNodeFlipFaces")
diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index dc86adc9046..e13ac3180ec 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -1340,7 +1340,6 @@ void BKE_nodetree_remove_layer_n(struct bNodeTree *ntree, 
struct Scene *scene, i
 
 struct TexResult;
 
-#define GEO_NODE_BEVEL_MESH 1400
 #define TEX_NODE_OUTPUT 401
 #define TEX_NODE_CHECKER 402
 #define TEX_NODE_TEXTURE 403
diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index ba9b28b4a29..5be912ffb2b 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -4722,7 +4722,6 @@ static void registerGeometryNodes()
   register_node_type_geo_attribute_capture();
   register_node_type_geo_attribute_domain_size();
   register_node_type_geo_attribute_statistic();
-  register_node_type_geo_bevel_mesh();
   register_node_type_geo_boolean();
   register_node_type_geo_bounding_box();
   register_node_type_geo_collection_info();
diff --git a/source/blender/makesdna/DNA_node_types.h 
b/source/blender/makesdna/DNA_node_types.h
index 79e1c9c2c14..76d8207eead 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -1221,11 +1221,6 @@ typedef struct NodeGeometryExtrudeMesh {
   uint8_t mode;
 } NodeGeometryExtrudeMesh;
 
-typedef struct NodeGeometryBevelMesh {
-  /* GeometryNodeBevelMode */
-  uint8_t mode;
-} NodeGeometryBevelMesh;
-
 typedef struct NodeGeometryObjectInfo {
   /* GeometryNodeTransformSpace. */
   uint8_t transform_space;
@@ -1971,12 +1966,6 @@ typedef enum GeometryNodeExtrudeMeshMode {
   GEO_NODE_EXTRUDE_MESH_FACES = 2,
 } GeometryNodeExtrudeMeshMode;
 
-typedef enum GeometryNodeBevelMeshMode {
-  GEO_NODE_BEVEL_MESH_VERTICES = 0,
-  GEO_NODE_BEVEL_MESH_EDGES = 1,
-  GEO_NODE_BEVEL_MESH_FACES = 2,
-} GeometryNodeBevelMeshMode;
-
 typedef enum FunctionNodeRotateEulerType {
   FN_NODE_ROTATE_EULER_TYPE_EULER = 0,
   FN_NODE_ROTATE_EULER_TYPE_AXIS_ANGLE = 1,
diff --git a/source/blender/makesrna/intern/rna_nodetree.c 
b/source/blender/makesrna/intern/rna_nodetree.c
index 2966dc97519..386ef3f74a3 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -9551,27 +9551,6 @@ static void def_geo_extrude_mesh(StructRNA *srna)
   RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
 }
 
-static void def_geo_bevel_mesh(StructRNA *srna)
-{
-  PropertyRNA *prop;
-
-  static const EnumPropertyItem mode_items[] = {
-  {GEO_NODE_BEVEL_MESH_VERTICES, "VERTICES", 0, "Vertices", ""},
-  {GEO_NODE_BEVEL_MESH_EDGES, "EDGES", 0, "Edges", ""},
-  {GEO_NODE_BEVEL_MESH_FACES, "FACES", 0, "Faces", ""},
-  {0, NULL, 0, NULL, NULL},
-  };
-
-  RNA_def_struct_sdna_from(srna, "NodeGeometryBevelMesh", "storage");
-
-  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
-  RNA_def_property_enum_sdna(prop, NULL, "mode");
-  RNA_def_property_enum_items(prop, mode_items);
-  RNA_def_property_enum_default(prop, GEO_NODE_BEVEL_MESH_FACES);
-  RNA_def_property_ui_text(prop, "Mode", "");
-  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update&q

[Bf-blender-cvs] [9bb2afb55e5] master: Start of Bevel V2, as being worked on with task T98674.

2022-07-02 Thread Howard Trickey
Commit: 9bb2afb55e50f9353cfc76cf2d8df7521b0b5feb
Author: Howard Trickey
Date:   Sat Jul 2 10:09:18 2022 -0400
Branches: master
https://developer.blender.org/rB9bb2afb55e50f9353cfc76cf2d8df7521b0b5feb

Start of Bevel V2, as being worked on with task T98674.

This is the start of a geometry node to do edge, vertex, and face
bevels.

It doesn't yet do anything but analyze the "Vertex cap" around
selected vertices for vertex bevel.

===

M   release/scripts/startup/nodeitems_builtins.py
M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/intern/node.cc
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/makesrna/intern/rna_nodetree.c
M   source/blender/nodes/NOD_geometry.h
M   source/blender/nodes/NOD_static_types.h
M   source/blender/nodes/geometry/CMakeLists.txt
A   source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc

===

diff --git a/release/scripts/startup/nodeitems_builtins.py 
b/release/scripts/startup/nodeitems_builtins.py
index 21bb3d01616..e6c9d62905e 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -107,6 +107,7 @@ def mesh_node_items(context):
 space = context.space_data
 if not space:
 return
+yield NodeItem("GeometryNodeBevelMesh")
 yield NodeItem("GeometryNodeDualMesh")
 yield NodeItem("GeometryNodeExtrudeMesh")
 yield NodeItem("GeometryNodeFlipFaces")
diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index e13ac3180ec..dc86adc9046 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -1340,6 +1340,7 @@ void BKE_nodetree_remove_layer_n(struct bNodeTree *ntree, 
struct Scene *scene, i
 
 struct TexResult;
 
+#define GEO_NODE_BEVEL_MESH 1400
 #define TEX_NODE_OUTPUT 401
 #define TEX_NODE_CHECKER 402
 #define TEX_NODE_TEXTURE 403
diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index 5be912ffb2b..ba9b28b4a29 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -4722,6 +4722,7 @@ static void registerGeometryNodes()
   register_node_type_geo_attribute_capture();
   register_node_type_geo_attribute_domain_size();
   register_node_type_geo_attribute_statistic();
+  register_node_type_geo_bevel_mesh();
   register_node_type_geo_boolean();
   register_node_type_geo_bounding_box();
   register_node_type_geo_collection_info();
diff --git a/source/blender/makesdna/DNA_node_types.h 
b/source/blender/makesdna/DNA_node_types.h
index 76d8207eead..79e1c9c2c14 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -1221,6 +1221,11 @@ typedef struct NodeGeometryExtrudeMesh {
   uint8_t mode;
 } NodeGeometryExtrudeMesh;
 
+typedef struct NodeGeometryBevelMesh {
+  /* GeometryNodeBevelMode */
+  uint8_t mode;
+} NodeGeometryBevelMesh;
+
 typedef struct NodeGeometryObjectInfo {
   /* GeometryNodeTransformSpace. */
   uint8_t transform_space;
@@ -1966,6 +1971,12 @@ typedef enum GeometryNodeExtrudeMeshMode {
   GEO_NODE_EXTRUDE_MESH_FACES = 2,
 } GeometryNodeExtrudeMeshMode;
 
+typedef enum GeometryNodeBevelMeshMode {
+  GEO_NODE_BEVEL_MESH_VERTICES = 0,
+  GEO_NODE_BEVEL_MESH_EDGES = 1,
+  GEO_NODE_BEVEL_MESH_FACES = 2,
+} GeometryNodeBevelMeshMode;
+
 typedef enum FunctionNodeRotateEulerType {
   FN_NODE_ROTATE_EULER_TYPE_EULER = 0,
   FN_NODE_ROTATE_EULER_TYPE_AXIS_ANGLE = 1,
diff --git a/source/blender/makesrna/intern/rna_nodetree.c 
b/source/blender/makesrna/intern/rna_nodetree.c
index 386ef3f74a3..2966dc97519 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -9551,6 +9551,27 @@ static void def_geo_extrude_mesh(StructRNA *srna)
   RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
 }
 
+static void def_geo_bevel_mesh(StructRNA *srna)
+{
+  PropertyRNA *prop;
+
+  static const EnumPropertyItem mode_items[] = {
+  {GEO_NODE_BEVEL_MESH_VERTICES, "VERTICES", 0, "Vertices", ""},
+  {GEO_NODE_BEVEL_MESH_EDGES, "EDGES", 0, "Edges", ""},
+  {GEO_NODE_BEVEL_MESH_FACES, "FACES", 0, "Faces", ""},
+  {0, NULL, 0, NULL, NULL},
+  };
+
+  RNA_def_struct_sdna_from(srna, "NodeGeometryBevelMesh", "storage");
+
+  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+  RNA_def_property_enum_sdna(prop, NULL, "mode");
+  RNA_def_property_enum_items(prop, mode_items);
+  RNA_def_property_enum_default(prop, GEO_NODE_BEVEL_MESH_FACES);
+  RNA_def_property_ui_text(prop, "Mode", "");
+  RNA_def_proper

[Bf-blender-cvs] [f24d32f791a] master: Fix T98517: Curve Fill Node creating extra edges.

2022-06-11 Thread Howard Trickey
Commit: f24d32f791a92c72cd097afa76376caea003db1d
Author: Howard Trickey
Date:   Sat Jun 11 12:33:27 2022 -0400
Branches: master
https://developer.blender.org/rBf24d32f791a92c72cd097afa76376caea003db1d

Fix T98517: Curve Fill Node creating extra edges.

The delaunay2d function, with mode CDT_CONSTRAINTS_VALID_BMESH_WITH_HOLES
sometimes didn't eat away all of the edges. Doing a prepass to remove
the outer edges until they hit the constraints solves this problem.

===

M   source/blender/blenlib/intern/delaunay_2d.cc

===

diff --git a/source/blender/blenlib/intern/delaunay_2d.cc 
b/source/blender/blenlib/intern/delaunay_2d.cc
index ece22bcf82e..db6cb0824dc 100644
--- a/source/blender/blenlib/intern/delaunay_2d.cc
+++ b/source/blender/blenlib/intern/delaunay_2d.cc
@@ -2637,6 +2637,7 @@ void prepare_cdt_for_output(CDT_state *cdt_state, 
const CDT_output_type outpu
 remove_faces_in_holes(cdt_state);
   }
   else if (output_type == CDT_CONSTRAINTS_VALID_BMESH_WITH_HOLES) {
+remove_outer_edges_until_constraints(cdt_state);
 remove_non_constraint_edges_leave_valid_bmesh(cdt_state);
 remove_faces_in_holes(cdt_state);
   }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [cfce5a32a7d] master: Fix a failing bmesh_bevel test by fixing buffer overflow.

2022-04-22 Thread Howard Trickey
Commit: cfce5a32a7d8bf2479bbaf338b963c8e85efe9fd
Author: Howard Trickey
Date:   Fri Apr 22 22:39:05 2022 -0400
Branches: master
https://developer.blender.org/rBcfce5a32a7d8bf2479bbaf338b963c8e85efe9fd

Fix a failing bmesh_bevel test by fixing buffer overflow.

The uv fix just submitted had a bug where I forgot to wrap around
after adding 1. This apparently worked anyway in a debug build
but not in release build, hence the buildbot tests were failing.

===

M   source/blender/bmesh/tools/bmesh_bevel.c

===

diff --git a/source/blender/bmesh/tools/bmesh_bevel.c 
b/source/blender/bmesh/tools/bmesh_bevel.c
index e5006c2672c..1c184b1ae6e 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -5409,8 +5409,9 @@ static void snap_edges_for_vmesh_vert(int i,
 }
 else if (jj == ns2 && kk == ns2 + 1) {
   /* Center poly vert for boundvert i+1. */
+  int nexti = (i + 1) % n_bndv;
   r_snap_edges[corner] = snap_edge_for_center_vmesh_vert(
-  i + 1, n_bndv, enext, enextnext, bndv_rep_faces, center_frep, 
frep_beats_next);
+  nexti, n_bndv, enext, enextnext, bndv_rep_faces, center_frep, 
frep_beats_next);
 }
   }
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b38491b4077] master: Re-fix some comments in bmesh_bevel.c.

2022-04-22 Thread Howard Trickey
Commit: b38491b40776e84d27d5f63ecb535e4527f9180f
Author: Howard Trickey
Date:   Fri Apr 22 11:57:59 2022 -0400
Branches: master
https://developer.blender.org/rBb38491b40776e84d27d5f63ecb535e4527f9180f

Re-fix some comments in bmesh_bevel.c.

The UV fix just committed had gotten out of sync with some changes
that had been made inside some comments (spelling and folding).

===

M   source/blender/bmesh/tools/bmesh_bevel.c

===

diff --git a/source/blender/bmesh/tools/bmesh_bevel.c 
b/source/blender/bmesh/tools/bmesh_bevel.c
index ea2cc1c24d6..fa93faf1606 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -4138,7 +4138,7 @@ static VMesh *cubic_subdiv(BevelParams *bp, VMesh *vm_in)
   for (int i = 0; i < n_boundary; i++) {
 float co1[3], co2[3], acc[3];
 EdgeHalf *e = bndv->elast;
-/* Generate tangents. This is hacked together and would ideally be done 
elsewere and then only
+/* Generate tangents. This is hacked together and would ideally be done 
elsewhere and then only
  * used here. */
 float tangent[3], tangent2[3], normal[3];
 bool convex = true;
@@ -4205,7 +4205,7 @@ static VMesh *cubic_subdiv(BevelParams *bp, VMesh *vm_in)
   sub_v3_v3v3(co1, mesh_vert(vm_in, i, 0, 0)->co, mesh_vert(vm_in, i, 0, 
1)->co);
   sub_v3_v3v3(co2, mesh_vert(vm_in, i, 0, 1)->co, mesh_vert(vm_in, i, 0, 
2)->co);
   cross_v3_v3v3(tangent, co1, co2);
-  /** The following constant is choosen to best match the old results. */
+  /** The following constant is chosen to best match the old results. */
   normalize_v3_length(tangent, 1.5f / ns_out);
 }
 /** Copy corner vertex. */
@@ -5657,11 +5657,11 @@ static void bevel_build_rings(BevelParams *bp, BMesh 
*bm, BevVert *bv, BoundVert
  * Builds the vertex mesh when the vertex mesh type is set to "cut off" with a 
face closing
  * off each incoming edge's profile.
  *
- * TODO(Hans): Make cutoff VMesh work with outer miter != sharp. This should 
be possible but
- * there are two problems currently:
+ * TODO(Hans): Make cutoff VMesh work with outer miter != sharp. This should 
be possible but there
+ * are two problems currently:
  *  - Miter profiles don't have plane_no filled, so down direction is 
incorrect.
- *  - Indexing profile points of miters with (i, 0, k) seems to return zero 
except for the
- * first and last profile point.
+ *  - Indexing profile points of miters with (i, 0, k) seems to return zero 
except for the first
+ *   and last profile point.
  * TODO(Hans): Use repface / edge arrays for UV interpolation properly.
  */
 static void bevel_build_cutoff(BevelParams *bp, BMesh *bm, BevVert *bv)
@@ -5685,8 +5685,7 @@ static void bevel_build_cutoff(BevelParams *bp, BMesh 
*bm, BevVert *bv)
   negate_v3(down_direction);
 }
 
-/* Move down from the boundvert by average profile height from the two 
adjacent profiles.
- */
+/* Move down from the boundvert by average profile height from the two 
adjacent profiles. */
 float length = (bndv->profile.height / sqrtf(2.0f) +
 bndv->prev->profile.height / sqrtf(2.0f)) /
2;
@@ -5739,8 +5738,8 @@ static void bevel_build_cutoff(BevelParams *bp, BMesh 
*bm, BevVert *bv)
   }
 
   /* Build the profile cutoff faces. */
-  /* Extra one or two for corner vertices and one for last point along 
profile, or the size of
-   * the center face array if it's bigger. */
+  /* Extra one or two for corner vertices and one for last point along 
profile, or the size of the
+   * center face array if it's bigger. */
 #ifdef DEBUG_CUSTOM_PROFILE_CUTOFF
   printf("Building profile cutoff faces.\n");
 #endif
@@ -6102,8 +6101,7 @@ static void build_vmesh(BevelParams *bp, BMesh *bm, 
BevVert *bv)
 }
   }
 
-  /* Make sure the pipe case ADJ mesh is used for both the "Grid Fill" (ADJ) 
and cutoff
-   * options. */
+  /* Make sure the pipe case ADJ mesh is used for both the "Grid Fill" (ADJ) 
and cutoff options. */
   BoundVert *vpipe = NULL;
   if (ELEM(vm->count, 3, 4) && bp->seg > 1) {
 /* Result is passed to bevel_build_rings to avoid overhead. */
@@ -6224,8 +6222,8 @@ static int bevel_edge_order_extend(BMesh *bm, BevVert 
*bv, int i)
  * Assume the first edge is already in bv->edges[0].e and it is tagged. */
 #ifdef FASTER_FASTORDER
 /* The alternative older code is O(n^2) where n = # of edges incident to bv->v.
- * This implementation is O(n * m) where m = average number of faces attached 
to an edge
- * incident to bv->v, which is almost certainly a small constant except in 
very strange cases.
+ * This implementation is O(n * m) where m = average number of faces attached 
to an edge incident
+ * to bv->v, which is almost certainly a small const

[Bf-blender-cvs] SVN commit: bf-blender [62889] trunk/lib/tests/modeling: Changes to bevel and modifier tests to go with recent UV fix

2022-04-22 Thread Howard Trickey
Revision: 62889
  https://developer.blender.org/rBL62889
Author:   howardt
Date: 2022-04-22 17:36:43 +0200 (Fri, 22 Apr 2022)
Log Message:
---
Changes to bevel and modifier tests to go with recent UV fix

Modified Paths:
--
trunk/lib/tests/modeling/bevel_regression.blend
trunk/lib/tests/modeling/modifiers.blend

Modified: trunk/lib/tests/modeling/bevel_regression.blend
===
(Binary files differ)

Modified: trunk/lib/tests/modeling/modifiers.blend
===
(Binary files differ)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [984cd552f00] master: Fix T56625: Bevel sometimes made zero area UV faces.

2022-04-22 Thread Howard Trickey
Commit: 984cd552f0033c674b3cef6ec55d1facdcb81c2d
Author: Howard Trickey
Date:   Fri Apr 22 09:26:34 2022 -0400
Branches: master
https://developer.blender.org/rB984cd552f0033c674b3cef6ec55d1facdcb81c2d

Fix T56625: Bevel sometimes made zero area UV faces.

This substantially redoes the logic by which bevel chooses, for
the middle segment when there are an odd number of segments,
which face to interpolate in, and which vertices to snap to which
edges before doing that interpolation. It changes the UV layouts
of a number of the regression tests, for the better.
An example, in the reference bug, is a cube with all seams, unwrapped
and then packed with some margin around them, now looks much
better in UV space when there are an odd number of segments.

===

M   source/blender/bmesh/tools/bmesh_bevel.c

===

diff --git a/source/blender/bmesh/tools/bmesh_bevel.c 
b/source/blender/bmesh/tools/bmesh_bevel.c
index be5521d45ab..ea2cc1c24d6 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -675,7 +675,7 @@ static BMFace *bev_create_ngon(BMesh *bm,
const int totv,
BMFace **face_arr,
BMFace *facerep,
-   BMEdge **edge_arr,
+   BMEdge **snap_edge_arr,
int mat_nr,
bool do_interp)
 {
@@ -699,8 +699,8 @@ static BMFace *bev_create_ngon(BMesh *bm,
 }
 if (interp_f) {
   BMEdge *bme = NULL;
-  if (edge_arr) {
-bme = edge_arr[i];
+  if (snap_edge_arr) {
+bme = snap_edge_arr[i];
   }
   float save_co[3];
   if (bme) {
@@ -734,44 +734,6 @@ static BMFace *bev_create_ngon(BMesh *bm,
   return f;
 }
 
-static BMFace *bev_create_quad(BMesh *bm,
-   BMVert *v1,
-   BMVert *v2,
-   BMVert *v3,
-   BMVert *v4,
-   BMFace *f1,
-   BMFace *f2,
-   BMFace *f3,
-   BMFace *f4,
-   int mat_nr)
-{
-  BMVert *varr[4] = {v1, v2, v3, v4};
-  BMFace *farr[4] = {f1, f2, f3, f4};
-  return bev_create_ngon(bm, varr, 4, farr, f1, NULL, mat_nr, true);
-}
-
-static BMFace *bev_create_quad_ex(BMesh *bm,
-  BMVert *v1,
-  BMVert *v2,
-  BMVert *v3,
-  BMVert *v4,
-  BMFace *f1,
-  BMFace *f2,
-  BMFace *f3,
-  BMFace *f4,
-  BMEdge *e1,
-  BMEdge *e2,
-  BMEdge *e3,
-  BMEdge *e4,
-  BMFace *frep,
-  int mat_nr)
-{
-  BMVert *varr[4] = {v1, v2, v3, v4};
-  BMFace *farr[4] = {f1, f2, f3, f4};
-  BMEdge *earr[4] = {e1, e2, e3, e4};
-  return bev_create_ngon(bm, varr, 4, farr, frep, earr, mat_nr, true);
-}
-
 /* Is Loop layer layer_index contiguous across shared vertex of l1 and l2? */
 static bool contig_ldata_across_loops(BMesh *bm, BMLoop *l1, BMLoop *l2, int 
layer_index)
 {
@@ -828,6 +790,25 @@ static bool contig_ldata_across_edge(BMesh *bm, BMEdge *e, 
BMFace *f1, BMFace *f
   return true;
 }
 
+/**
+ * In array face_component of total totface elements, swap values c1 and c2
+ * whereever they occur.
+ */
+static void swap_face_components(int *face_component, int totface, int c1, int 
c2)
+{
+  if (c1 == c2) {
+return; /* Nothing to do. */
+  }
+  for (int f = 0; f < totface; f++) {
+if (face_component[f] == c1) {
+  face_component[f] = c2;
+}
+else if (face_component[f] == c2) {
+  face_component[f] = c1;
+}
+  }
+}
+
 /*
  * Set up the fields of bp->math_layer_info.
  * We always set has_math_layers to the correct value.
@@ -836,6 +817,7 @@ static bool contig_ldata_across_edge(BMesh *bm, BMEdge *e, 
BMFace *f1, BMFace *f
  */
 static void math_layer_info_init(BevelParams *bp, BMesh *bm)
 {
+  int f;
   bp->math_layer_info.has_math_layers = false;
   bp->math_layer_info.face_component = NULL;
   for (int i = 0; i < bm->ldata.totlayer; i++) {
@@ -860,12 +842,12 @@ static void math_layer_info_init(BevelParams *bp, BMesh 
*bm)
   bool *in_stack = MEM_malloc_arrayN(totface, sizeof(bool), __func__);
 
   /* Set all component ids by DFS from faces with unassigned components. */
-  for (int f = 0; f < totface; f++) {
+  for (

[Bf-blender-cvs] [082b063f2ae] master: Increase bevel segment limit in modifier from 100 to 1000.

2022-03-26 Thread Howard Trickey
Commit: 082b063f2aefdfaadca8b2f33b505b956959195f
Author: Howard Trickey
Date:   Sat Mar 26 13:20:16 2022 -0400
Branches: master
https://developer.blender.org/rB082b063f2aefdfaadca8b2f33b505b956959195f

Increase bevel segment limit in modifier from 100 to 1000.

A user asked for this increase. The performance lags when reaching
the upper limit of this number of segments, but if you need that
many segments, I guess you are willing to wait.

===

M   source/blender/makesrna/intern/rna_modifier.c

===

diff --git a/source/blender/makesrna/intern/rna_modifier.c 
b/source/blender/makesrna/intern/rna_modifier.c
index 2ef2e776842..24a020b156c 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -4081,7 +4081,7 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
 
   prop = RNA_def_property(srna, "segments", PROP_INT, PROP_NONE);
   RNA_def_property_int_sdna(prop, NULL, "res");
-  RNA_def_property_range(prop, 1, 100);
+  RNA_def_property_range(prop, 1, 1000);
   RNA_def_property_ui_text(prop, "Segments", "Number of segments for round 
edges/verts");
   RNA_def_property_update(prop, 0, "rna_BevelModifier_update_segments");

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [9d25418a52c] master: Fix T95901: Crash in Fill curve (set to N-gon)

2022-03-26 Thread Howard Trickey
Commit: 9d25418a52c4aef9210a11a0b4e2739ab6616e94
Author: Howard Trickey
Date:   Sat Mar 26 10:47:09 2022 -0400
Branches: master
https://developer.blender.org/rB9d25418a52c4aef9210a11a0b4e2739ab6616e94

Fix T95901: Crash in Fill curve (set to N-gon)

The code that eats away faces until you find input faces in
the Constrained Delaunay Triangulation goes too far and crashes
when there are no input faces. In the test case there were input
faces but they only had two vertices, so were all ignored.

===

M   source/blender/blenlib/intern/delaunay_2d.cc

===

diff --git a/source/blender/blenlib/intern/delaunay_2d.cc 
b/source/blender/blenlib/intern/delaunay_2d.cc
index e6164c98402..3039b72128d 100644
--- a/source/blender/blenlib/intern/delaunay_2d.cc
+++ b/source/blender/blenlib/intern/delaunay_2d.cc
@@ -2188,17 +2188,19 @@ static int power_of_10_greater_equal_to(int x)
 }
 
 /**
-   Incrementally each edge of each input face as an edge constraint.
+ * Incrementally each edge of each input face as an edge constraint.
  * The code will ensure that the #CDTEdge's created will have ids that tie them
  * back to the original face edge (using a numbering system for those edges
  * that starts with cdt->face_edge_offset, and continues with the edges in
  * order around each face in turn. And then the next face starts at
  * cdt->face_edge_offset beyond the start for the previous face.
+ * Return the number of faces added, which may be less than input.face.size()
+ * in the case that some faces have less than 3 sides.
  */
 template
-void add_face_constraints(CDT_state *cdt_state,
-  const CDT_input ,
-  CDT_output_type output_type)
+int add_face_constraints(CDT_state *cdt_state,
+ const CDT_input ,
+ CDT_output_type output_type)
 {
   int nv = input.vert.size();
   int nf = input.face.size();
@@ -2216,6 +2218,7 @@ void add_face_constraints(CDT_state *cdt_state,
* together the are >= INT_MAX, then the Delaunay calculation will take 
unreasonably long anyway.
*/
   BLI_assert(INT_MAX / cdt_state->face_edge_offset > nf);
+  int faces_added = 0;
   for (int f = 0; f < nf; f++) {
 int flen = input.face[f].size();
 if (flen <= 2) {
@@ -2231,6 +2234,7 @@ void add_face_constraints(CDT_state *cdt_state,
 /* Ignore face edges with invalid vertices. */
 continue;
   }
+  ++faces_added;
   CDTVert *v1 = cdt->get_vert_resolve_merge(iv1);
   CDTVert *v2 = cdt->get_vert_resolve_merge(iv2);
   LinkNode *edge_list;
@@ -2265,6 +2269,7 @@ void add_face_constraints(CDT_state *cdt_state,
   }
 }
   }
+  return faces_added;
 }
 
 /* Delete_edge but try not to mess up outer face.
@@ -2642,7 +2647,8 @@ CDT_result get_cdt_output(CDT_state *cdt_state,
  const CDT_input UNUSED(input),
  CDT_output_type output_type)
 {
-  prepare_cdt_for_output(cdt_state, output_type);
+  CDT_output_type oty = output_type;
+  prepare_cdt_for_output(cdt_state, oty);
   CDT_result result;
   CDTArrangement *cdt = _state->cdt;
   result.face_edge_offset = cdt_state->face_edge_offset;
@@ -2774,7 +2780,11 @@ CDT_result delaunay_calc(const CDT_input , 
CDT_output_type output_ty
   add_input_verts(_state, input);
   initial_triangulation(_state.cdt);
   add_edge_constraints(_state, input);
-  add_face_constraints(_state, input, output_type);
+  int actual_nf = add_face_constraints(_state, input, output_type);
+  if (actual_nf == 0 && !ELEM(output_type, CDT_FULL, CDT_INSIDE, 
CDT_CONSTRAINTS)) {
+/* Can't look for faces or holes if there were no valid input faces. */
+output_type = CDT_INSIDE;
+  }
   return get_cdt_output(_state, input, output_type);
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] SVN commit: bf-blender [62857] trunk/lib/tests/io_tests/obj: Add files to test material group writing of new obj exporter

2022-03-20 Thread Howard Trickey
Revision: 62857
  https://developer.blender.org/rBL62857
Author:   howardt
Date: 2022-03-20 14:02:23 +0100 (Sun, 20 Mar 2022)
Log Message:
---
Add files to test material group writing of new obj exporter

Added Paths:
---
trunk/lib/tests/io_tests/obj/all_objects_mat_groups.mtl
trunk/lib/tests/io_tests/obj/all_objects_mat_groups.obj

Added: trunk/lib/tests/io_tests/obj/all_objects_mat_groups.mtl
===
--- trunk/lib/tests/io_tests/obj/all_objects_mat_groups.mtl 
(rev 0)
+++ trunk/lib/tests/io_tests/obj/all_objects_mat_groups.mtl 2022-03-20 
13:02:23 UTC (rev 62857)
@@ -0,0 +1,72 @@
+# Blender 3.2.0 Alpha MTL File: 'all_objects.blend'
+# www.blender.org
+
+newmtl Blue
+Ns 250.00
+Ka 1.00 1.00 1.00
+Kd 0.00 0.00 1.00
+Ks 0.50 0.50 0.50
+Ke 0.00 0.00 0.00
+Ni 1.00
+d 1.00
+illum 2
+
+newmtl BlueDark
+Ns 250.00
+Ka 1.00 1.00 1.00
+Kd 0.00 0.00 0.50
+Ks 0.50 0.50 0.50
+Ke 0.00 0.00 0.00
+Ni 1.00
+d 1.00
+illum 2
+
+newmtl Green
+Ns 250.00
+Ka 1.00 1.00 1.00
+Kd 0.00 1.00 0.00
+Ks 0.50 0.50 0.50
+Ke 0.00 0.00 0.00
+Ni 1.00
+d 1.00
+illum 2
+
+newmtl GreenDark
+Ns 250.00
+Ka 1.00 1.00 1.00
+Kd 0.00 0.50 0.00
+Ks 0.50 0.50 0.50
+Ke 0.00 0.00 0.00
+Ni 1.00
+d 1.00
+illum 2
+
+newmtl Material
+Ns 250.00
+Ka 1.00 1.00 1.00
+Kd 0.80 0.80 0.80
+Ks 0.50 0.50 0.50
+Ke 0.00 0.00 0.00
+Ni 1.00
+d 1.00
+illum 2
+
+newmtl Red
+Ns 250.00
+Ka 1.00 1.00 1.00
+Kd 1.00 0.00 0.00
+Ks 0.50 0.50 0.50
+Ke 0.00 0.00 0.00
+Ni 1.00
+d 1.00
+illum 2
+
+newmtl RedDark
+Ns 250.00
+Ka 1.00 1.00 1.00
+Kd 0.50 0.00 0.00
+Ks 0.50 0.50 0.50
+Ke 0.00 0.00 0.00
+Ni 1.00
+d 1.00
+illum 2

Added: trunk/lib/tests/io_tests/obj/all_objects_mat_groups.obj
===
--- trunk/lib/tests/io_tests/obj/all_objects_mat_groups.obj 
(rev 0)
+++ trunk/lib/tests/io_tests/obj/all_objects_mat_groups.obj 2022-03-20 
13:02:23 UTC (rev 62857)
@@ -0,0 +1,9793 @@
+# Blender 3.2.0 Alpha
+# www.blender.org
+mtllib all_objects_mat_groups.mtl
+o EmptyText
+o EmptyMesh
+o SurfPatch
+v 12.50 -2.50 0.69
+v 12.57 -2.50 0.720370
+v 12.63 -2.50 0.742593
+v 12.70 -2.50 0.76
+v 12.76 -2.50 0.775926
+v 12.83 -2.50 0.787037
+v 12.90 -2.50 0.79
+v 12.96 -2.50 0.798148
+v 13.03 -2.50 0.798148
+v 13.09 -2.50 0.794445
+v 13.16 -2.50 0.787037
+v 13.23 -2.50 0.775926
+v 13.29 -2.50 0.76
+v 13.36 -2.50 0.742593
+v 13.42 -2.50 0.720371
+v 13.49 -2.50 0.694445
+v 12.50 -2.43 0.720370
+v 12.57 -2.43 0.747264
+v 12.63 -2.43 0.770316
+v 12.70 -2.43 0.789526
+v 12.76 -2.43 0.804894
+v 12.83 -2.43 0.816420
+v 12.90 -2.43 0.824104
+v 12.96 -2.43 0.827946
+v 13.03 -2.43 0.827946
+v 13.09 -2.43 0.824104
+v 13.16 -2.43 0.816420
+v 13.23 -2.43 0.804894
+v 13.29 -2.43 0.789526
+v 13.36 -2.43 0.770316
+v 13.42 -2.43 0.747265
+v 13.49 -2.43 0.720371
+v 12.50 -2.37 0.742593
+v 12.57 -2.37 0.770316
+v 12.63 -2.37 0.794079
+v 12.70 -2.37 0.813881
+v 12.76 -2.37 0.829723
+v 12.83 -2.37 0.841605
+v 12.90 -2.37 0.849526
+v 12.96 -2.37 0.853486
+v 13.03 -2.37 0.853486
+v 13.09 -2.37 0.849526
+v 13.16 -2.37 0.841605
+v 13.23 -2.37 0.829724
+v 13.29 -2.37 0.813882
+v 13.36 -2.37 0.794079
+v 13.42 -2.37 0.770316
+v 13.49 -2.37 0.742593
+v 12.50 -2.30 0.76
+v 12.57 -2.30 0.789526
+v 12.63 -2.30 0.813881
+v 12.70 -2.30 0.834178
+v 12.76 -2.30 0.850415
+v 12.83 -2.30 0.862593
+v 12.90 -2.30 0.870711
+v 12.96 -2.30 0.874770
+v 13.03 -2.30 0.874770
+v 13.09 -2.30 0.870711
+v 13.16 -2.30 0.862593
+v 13.23 -2.30 0.850415
+v 13.29 -2.30 0.834178
+v 13.36 -2.30 0.813882
+v 13.42 -2.30 0.789526
+v 13.49 -2.30 0.76
+v 12.50 -2.24 0.775926
+v 12.57 -2.24 0.804894
+v 12.63 -2.24 0.829723
+v 12.70 -2.24 0.850415
+v 12.76 -2.24 0.866968
+v 12.83 -2.24 0.879383
+v 12.90 -2.24 0.887659
+v 12.96 -2.24 0.891797
+v 13.03 -2.24 0.891798
+v 13.09 -2.24 0.887659
+v 13.16 -2.24 0.879383
+v 13.23 

[Bf-blender-cvs] SVN commit: bf-blender [62856] trunk/lib/tests/io_tests: Additional test files to test fix for OBJ export scale factor bug

2022-03-19 Thread Howard Trickey
Revision: 62856
  https://developer.blender.org/rBL62856
Author:   howardt
Date: 2022-03-19 22:18:24 +0100 (Sat, 19 Mar 2022)
Log Message:
---
Additional test files to test fix for OBJ export scale factor bug

Added Paths:
---
trunk/lib/tests/io_tests/blend_geometry/cubes_positioned.blend
trunk/lib/tests/io_tests/obj/cubes_positioned.obj

Added: trunk/lib/tests/io_tests/blend_geometry/cubes_positioned.blend
===
(Binary files differ)

Index: trunk/lib/tests/io_tests/blend_geometry/cubes_positioned.blend
===
--- trunk/lib/tests/io_tests/blend_geometry/cubes_positioned.blend  
2022-03-19 20:26:23 UTC (rev 62855)
+++ trunk/lib/tests/io_tests/blend_geometry/cubes_positioned.blend  
2022-03-19 21:18:24 UTC (rev 62856)

Property changes on: 
trunk/lib/tests/io_tests/blend_geometry/cubes_positioned.blend
___
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/lib/tests/io_tests/obj/cubes_positioned.obj
===
--- trunk/lib/tests/io_tests/obj/cubes_positioned.obj   
(rev 0)
+++ trunk/lib/tests/io_tests/obj/cubes_positioned.obj   2022-03-19 21:18:24 UTC 
(rev 62856)
@@ -0,0 +1,68 @@
+# Blender 3.2.0 Alpha
+# www.blender.org
+o CubeOrigin
+v 2.00 2.00 -2.00
+v 2.00 -2.00 -2.00
+v 2.00 2.00 2.00
+v 2.00 -2.00 2.00
+v -2.00 2.00 -2.00
+v -2.00 -2.00 -2.00
+v -2.00 2.00 2.00
+v -2.00 -2.00 2.00
+vn -0. 1. -0.
+vn -0. -0. 1.
+vn -1. -0. -0.
+vn -0. -1. -0.
+vn 1. -0. -0.
+vn -0. -0. -1.
+s 0
+f 1//1 5//1 7//1 3//1
+f 4//2 3//2 7//2 8//2
+f 8//3 7//3 5//3 6//3
+f 6//4 2//4 4//4 8//4
+f 2//5 1//5 3//5 4//5
+f 6//6 5//6 1//6 2//6
+o CubeNonOrigin
+v 8.00 2.00 -4.00
+v 8.00 -2.00 -4.00
+v 8.00 2.00 0.00
+v 8.00 -2.00 0.00
+v 4.00 2.00 -4.00
+v 4.00 -2.00 -4.00
+v 4.00 2.00 0.00
+v 4.00 -2.00 0.00
+vn -0. 1. -0.
+vn -0. -0. 1.
+vn -1. -0. -0.
+vn -0. -1. -0.
+vn 1. -0. -0.
+vn -0. -0. -1.
+s 0
+f 9//7 13//7 15//7 11//7
+f 12//8 11//8 15//8 16//8
+f 16//9 15//9 13//9 14//9
+f 14//10 10//10 12//10 16//10
+f 10//11 9//11 11//11 12//11
+f 14//12 13//12 9//12 10//12
+o CubeNonOriginRotated
+v 13.090771 1.121320 -1.090770
+v 10.992694 -2.224745 -0.456796
+v 15.456796 0.224745 2.007306
+v 13.358719 -3.121320 2.641280
+v 10.641281 3.121320 1.358720
+v 8.543204 -0.224745 1.992694
+v 13.007306 2.224745 4.456796
+v 10.909229 -1.121320 5.090770
+vn 0.5245 0.8365 -0.1585
+vn 0.5915 -0.2241 0.7745
+vn -0.6124 0.5000 0.6124
+vn -0.5245 -0.8365 0.1585
+vn 0.6124 -0.5000 -0.6124
+vn -0.5915 0.2241 -0.7745
+s 0
+f 17//13 21//13 23//13 19//13
+f 20//14 19//14 23//14 24//14
+f 24//15 23//15 21//15 22//15
+f 22//16 18//16 20//16 24//16
+f 18//17 17//17 19//17 20//17
+f 22//18 21//18 17//18 18//18

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] SVN commit: bf-blender [62855] trunk/lib/tests/io_tests: Fixes to OBJ export test files for fix for non-uniform scale and normals

2022-03-19 Thread Howard Trickey
Revision: 62855
  https://developer.blender.org/rBL62855
Author:   howardt
Date: 2022-03-19 21:26:23 +0100 (Sat, 19 Mar 2022)
Log Message:
---
Fixes to OBJ export test files for fix for non-uniform scale and normals

Modified Paths:
--
trunk/lib/tests/io_tests/obj/suzanne_all_data.obj

Added Paths:
---
trunk/lib/tests/io_tests/blend_geometry/non_uniform_scale.blend
trunk/lib/tests/io_tests/obj/non_uniform_scale.obj

Added: trunk/lib/tests/io_tests/blend_geometry/non_uniform_scale.blend
===
(Binary files differ)

Index: trunk/lib/tests/io_tests/blend_geometry/non_uniform_scale.blend
===
--- trunk/lib/tests/io_tests/blend_geometry/non_uniform_scale.blend 
2022-03-15 16:28:36 UTC (rev 62854)
+++ trunk/lib/tests/io_tests/blend_geometry/non_uniform_scale.blend 
2022-03-19 20:26:23 UTC (rev 62855)

Property changes on: 
trunk/lib/tests/io_tests/blend_geometry/non_uniform_scale.blend
___
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/lib/tests/io_tests/obj/non_uniform_scale.obj
===
--- trunk/lib/tests/io_tests/obj/non_uniform_scale.obj  
(rev 0)
+++ trunk/lib/tests/io_tests/obj/non_uniform_scale.obj  2022-03-19 20:26:23 UTC 
(rev 62855)
@@ -0,0 +1,560 @@
+# Blender 3.2.0 Alpha
+# www.blender.org
+o SphereNonUni
+v 0.00 0.212132 -0.707107
+v 0.00 -0.00 -1.00
+v 0.00 -0.212132 -0.707107
+v 0.612373 0.212132 -0.353553
+v 0.866026 -0.00 -0.50
+v 0.612373 -0.212132 -0.353553
+v 0.612372 0.212132 0.353554
+v 0.866025 -0.00 0.50
+v 0.612372 -0.212132 0.353554
+v -0.00 0.212132 0.707107
+v -0.00 -0.00 1.00
+v -0.00 -0.212132 0.707107
+v 0.00 -0.30 0.00
+v -0.00 0.30 0.00
+v -0.612373 0.212132 0.353553
+v -0.866026 -0.00 0.50
+v -0.612373 -0.212132 0.353553
+v -0.612372 0.212132 -0.353554
+v -0.866025 -0.00 -0.50
+v -0.612372 -0.212132 -0.353554
+vn 0.0710 -0.9899 -0.1230
+vn 0.3208 0.7671 -0.5556
+vn 0.3208 -0.7671 -0.5556
+vn 0.0710 0.9899 -0.1230
+vn 0.1420 -0.9899 -0.
+vn 0.6415 0.7671 -0.
+vn 0.6415 -0.7671 -0.
+vn 0.1420 0.9899 -0.
+vn 0.0710 -0.9899 0.1230
+vn 0.3208 0.7671 0.5556
+vn 0.3208 -0.7671 0.5556
+vn 0.0710 0.9899 0.1230
+vn -0.0710 -0.9899 0.1230
+vn -0.3208 0.7671 0.5556
+vn -0.3208 -0.7671 0.5556
+vn -0.0710 0.9899 0.1230
+vn -0.1420 -0.9899 -0.
+vn -0.6415 0.7671 -0.
+vn -0.6415 -0.7671 -0.
+vn -0.1420 0.9899 -0.
+vn -0.0710 0.9899 -0.1230
+vn -0.0710 -0.9899 -0.1230
+vn -0.3208 0.7671 -0.5556
+vn -0.3208 -0.7671 -0.5556
+s 0
+f 13//1 3//1 6//1
+f 2//2 1//2 4//2 5//2
+f 3//3 2//3 5//3 6//3
+f 1//4 14//4 4//4
+f 13//5 6//5 9//5
+f 5//6 4//6 7//6 8//6
+f 6//7 5//7 8//7 9//7
+f 4//8 14//8 7//8
+f 13//9 9//9 12//9
+f 8//10 7//10 10//10 11//10
+f 9//11 8//11 11//11 12//11
+f 7//12 14//12 10//12
+f 13//13 12//13 17//13
+f 11//14 10//14 15//14 16//14
+f 12//15 11//15 16//15 17//15
+f 10//16 14//16 15//16
+f 13//17 17//17 20//17
+f 16//18 15//18 18//18 19//18
+f 17//19 16//19 19//19 20//19
+f 15//20 14//20 18//20
+f 18//21 14//21 1//21
+f 13//22 20//22 3//22
+f 19//23 18//23 1//23 2//23
+f 20//24 19//24 2//24 3//24
+o SphereNonUniMirror
+v 2.00 -0.212132 -0.707107
+v 2.00 0.00 -1.00
+v 2.00 0.212132 -0.707107
+v 2.612372 -0.212132 -0.353553
+v 2.866025 0.00 -0.50
+v 2.612372 0.212132 -0.353553
+v 2.612372 -0.212132 0.353554
+v 2.866025 0.00 0.50
+v 2.612372 0.212132 0.353554
+v 2.00 -0.212132 0.707107
+v 2.00 0.00 1.00
+v 2.00 0.212132 0.707107
+v 2.00 0.30 0.00
+v 2.00 -0.30 0.00
+v 1.387627 -0.212132 0.353553
+v 1.133974 0.00 0.50
+v 1.387627 0.212132 0.353553
+v 1.387628 -0.212132 -0.353554
+v 1.133975 0.00 -0.50
+v 1.387628 0.212132 -0.353554
+vn 0.0710 0.9899 -0.1230
+vn 0.3208 -0.7671 -0.5556
+vn 0.3208 0.7671 -0.5556
+vn 0.0710 -0.9899 -0.1230
+vn 0.1420 0.9899 -0.
+vn 0.6415 -0.7671 -0.
+vn 0.6415 0.7671 -0.
+vn 0.1420 -0.9899 -0.
+vn 0.0710 0.9899 0.1230
+vn 0.3208 -0.7671 0.5556
+vn 0.3208 0.7671 0.5556
+vn 0.0710 -0.9899 0.1230
+vn -0.0710 0.9899 0.1230
+vn -0.3208 -0.7671 0.5556
+vn -0.3208 0.7671 0.5556
+vn -0.0710 -0.9899 0.1230
+vn -0.1420 0.9899 -0.
+vn -0.6415 -0.7671 -0.
+vn -0.6415 0.7671 -0.
+vn -0.1420 -0.9899 -0.
+vn -0.0710 -0.9899 -0.1230
+vn -0.0710 0.9899 -0.1230
+vn -0.3208 -0.7671 -0.5556
+vn -0.3208 0.7671 -0.5556
+s 0
+f 33//25 26//25 23//25
+f 22//26 25//26 24//26 21//26
+f 23//27 26//27 25//27 22//27
+f 21//28 24//28 34//28
+f 33//29 29//29 26//29
+f 25//30 28//30 27//30 24//30
+f 26//31 29//31 28//31 25//31
+f 24//32 27//32 34//32
+f 

[Bf-blender-cvs] [355dc28f725] master: Merge branch 'blender-v3.1-release'

2022-02-10 Thread Howard Trickey
Commit: 355dc28f725db7f5a36232f4c6853245a3710e22
Author: Howard Trickey
Date:   Thu Feb 10 19:24:43 2022 -0500
Branches: master
https://developer.blender.org/rB355dc28f725db7f5a36232f4c6853245a3710e22

Merge branch 'blender-v3.1-release'

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [467c16eab1e] master: Remove New from new obj exporter menu.

2022-02-10 Thread Howard Trickey
Commit: 467c16eab1ecb4fa516f691c21bee9d32a5d1890
Author: Howard Trickey
Date:   Thu Feb 10 19:32:30 2022 -0500
Branches: master
https://developer.blender.org/rB467c16eab1ecb4fa516f691c21bee9d32a5d1890

Remove New from new obj exporter menu.

===

M   release/scripts/startup/bl_ui/space_topbar.py

===

diff --git a/release/scripts/startup/bl_ui/space_topbar.py 
b/release/scripts/startup/bl_ui/space_topbar.py
index a096eff6a1f..493cad6d2db 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -465,7 +465,7 @@ class TOPBAR_MT_file_export(Menu):
 bl_owner_use_filter = False
 
 def draw(self, _context):
-self.layout.operator("wm.obj_export", text="Wavefront OBJ (.obj) - 
New")
+self.layout.operator("wm.obj_export", text="Wavefront OBJ (.obj)")
 if bpy.app.build_options.collada:
 self.layout.operator("wm.collada_export",
  text="Collada (Default) (.dae)")

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [4d29ec42bc9] master: Revert "Split Python OBJ importer and exporter, enabling only the importer."

2022-02-10 Thread Howard Trickey
Commit: 4d29ec42bc9f04bbf831fc8d3b255683f498c926
Author: Howard Trickey
Date:   Thu Feb 10 19:21:32 2022 -0500
Branches: master
https://developer.blender.org/rB4d29ec42bc9f04bbf831fc8d3b255683f498c926

Revert "Split Python OBJ importer and exporter, enabling only the importer."

This reverts commit ff9dc1986e6c9a54fd0bb228e8813551e6baa042.

===

M   release/scripts/startup/bl_ui/space_topbar.py
M   source/blender/blenkernel/intern/blendfile.c
M   source/blender/blenloader/intern/versioning_userdef.c
M   tests/python/CMakeLists.txt

===

diff --git a/release/scripts/startup/bl_ui/space_topbar.py 
b/release/scripts/startup/bl_ui/space_topbar.py
index 493cad6d2db..a096eff6a1f 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -465,7 +465,7 @@ class TOPBAR_MT_file_export(Menu):
 bl_owner_use_filter = False
 
 def draw(self, _context):
-self.layout.operator("wm.obj_export", text="Wavefront OBJ (.obj)")
+self.layout.operator("wm.obj_export", text="Wavefront OBJ (.obj) - 
New")
 if bpy.app.build_options.collada:
 self.layout.operator("wm.collada_export",
  text="Collada (Default) (.dae)")
diff --git a/source/blender/blenkernel/intern/blendfile.c 
b/source/blender/blenkernel/intern/blendfile.c
index b2ba82008ba..c32081b5d1c 100644
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@ -611,12 +611,12 @@ UserDef *BKE_blendfile_userdef_from_defaults(void)
 const char *addons[] = {
 "io_anim_bvh",
 "io_curve_svg",
-"io_import_obj",
 "io_mesh_ply",
 "io_mesh_stl",
 "io_mesh_uv_layout",
 "io_scene_fbx",
 "io_scene_gltf2",
+"io_scene_obj",
 "io_scene_x3d",
 "cycles",
 "pose_library",
diff --git a/source/blender/blenloader/intern/versioning_userdef.c 
b/source/blender/blenloader/intern/versioning_userdef.c
index d1a1436f74c..8685a0fa62d 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -959,13 +959,6 @@ void blo_do_versions_userdef(UserDef *userdef)
*/
   {
 /* Keep this block, even when empty. */
-if (!USER_VERSION_ATLEAST(301, 7)) {
-  /* io_scene_obj directory is gone, split into io_import_obj and 
io_export_obj,
-   * with io_import_obj enabled by default and io_export_obj replaced by 
the C++ version.
-   */
-  BKE_addon_remove_safe(>addons, "io_scene_obj");
-  BKE_addon_ensure(>addons, "io_import_obj");
-}
   }
 
   LISTBASE_FOREACH (bTheme *, btheme, >themes) {
diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt
index 013825d1dd9..2ca4e27bca5 100644
--- a/tests/python/CMakeLists.txt
+++ b/tests/python/CMakeLists.txt
@@ -316,10 +316,7 @@ add_blender_test(
 )
 endif()
 
-if(FALSE)
 # OBJ Export tests
-# Disabled because new C++ Obj exporter has C++ tests.
-
 add_blender_test(
   export_obj_cube
   ${TEST_SRC_DIR}/io_tests/blend_geometry/all_quads.blend
@@ -340,6 +337,8 @@ add_blender_test(
   --md5=a733ae4fa4a591ea9b0912da3af042de --md5_method=FILE
 )
 
+# disabled until updated & working
+if(FALSE)
 add_blender_test(
   export_obj_all_objects
   ${TEST_SRC_DIR}/io_tests/blend_scene/all_objects.blend

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [f39698de775] blender-v3.1-release: Revert "Split Python OBJ importer and exporter, enabling only the importer."

2022-02-10 Thread Howard Trickey
Commit: f39698de7757fa083dbe72f659d7442e0dd34eab
Author: Howard Trickey
Date:   Thu Feb 10 18:29:29 2022 -0500
Branches: blender-v3.1-release
https://developer.blender.org/rBf39698de7757fa083dbe72f659d7442e0dd34eab

Revert "Split Python OBJ importer and exporter, enabling only the importer."

This reverts commit ff9dc1986e6c9a54fd0bb228e8813551e6baa042.

===

M   release/scripts/startup/bl_ui/space_topbar.py
M   source/blender/blenkernel/intern/blendfile.c
M   source/blender/blenloader/intern/versioning_userdef.c
M   tests/python/CMakeLists.txt

===

diff --git a/release/scripts/startup/bl_ui/space_topbar.py 
b/release/scripts/startup/bl_ui/space_topbar.py
index 513c1c2ae2e..99abc60db6f 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -481,7 +481,7 @@ class TOPBAR_MT_file_export(Menu):
 bl_owner_use_filter = False
 
 def draw(self, _context):
-self.layout.operator("wm.obj_export", text="Wavefront OBJ (.obj)")
+self.layout.operator("wm.obj_export", text="Wavefront OBJ (.obj) - 
New")
 if bpy.app.build_options.collada:
 self.layout.operator("wm.collada_export",
  text="Collada (Default) (.dae)")
diff --git a/source/blender/blenkernel/intern/blendfile.c 
b/source/blender/blenkernel/intern/blendfile.c
index 53c9fe49fb7..6ae19c8036f 100644
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@ -603,12 +603,12 @@ UserDef *BKE_blendfile_userdef_from_defaults(void)
 const char *addons[] = {
 "io_anim_bvh",
 "io_curve_svg",
-"io_import_obj",
 "io_mesh_ply",
 "io_mesh_stl",
 "io_mesh_uv_layout",
 "io_scene_fbx",
 "io_scene_gltf2",
+"io_scene_obj",
 "io_scene_x3d",
 "cycles",
 "pose_library",
diff --git a/source/blender/blenloader/intern/versioning_userdef.c 
b/source/blender/blenloader/intern/versioning_userdef.c
index 520059649e6..064d7977c68 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -973,13 +973,6 @@ void blo_do_versions_userdef(UserDef *userdef)
*/
   {
 /* Keep this block, even when empty. */
-if (!USER_VERSION_ATLEAST(301, 7)) {
-  /* io_scene_obj directory is gone, split into io_import_obj and 
io_export_obj,
-   * with io_import_obj enabled by default and io_export_obj replaced by 
the C++ version.
-   */
-  BKE_addon_remove_safe(>addons, "io_scene_obj");
-  BKE_addon_ensure(>addons, "io_import_obj");
-}
   }
 
   LISTBASE_FOREACH (bTheme *, btheme, >themes) {
diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt
index 63dcdc0f925..d6575436bd6 100644
--- a/tests/python/CMakeLists.txt
+++ b/tests/python/CMakeLists.txt
@@ -324,10 +324,7 @@ add_blender_test(
 )
 endif()
 
-if(FALSE)
 # OBJ Export tests
-# Disabled because new C++ Obj exporter has C++ tests.
-
 add_blender_test(
   export_obj_cube
   ${TEST_SRC_DIR}/io_tests/blend_geometry/all_quads.blend
@@ -348,6 +345,8 @@ add_blender_test(
   --md5=a733ae4fa4a591ea9b0912da3af042de --md5_method=FILE
 )
 
+# disabled until updated & working
+if(FALSE)
 add_blender_test(
   export_obj_all_objects
   ${TEST_SRC_DIR}/io_tests/blend_scene/all_objects.blend

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [0263c8238bd] blender-v3.1-release: Remove 'New' from new Obj exporter menu entry.

2022-02-10 Thread Howard Trickey
Commit: 0263c8238bda6859032fe8d495d41f30bd9b4166
Author: Howard Trickey
Date:   Thu Feb 10 19:00:40 2022 -0500
Branches: blender-v3.1-release
https://developer.blender.org/rB0263c8238bda6859032fe8d495d41f30bd9b4166

Remove 'New' from new Obj exporter menu entry.

===

M   release/scripts/startup/bl_ui/space_topbar.py

===

diff --git a/release/scripts/startup/bl_ui/space_topbar.py 
b/release/scripts/startup/bl_ui/space_topbar.py
index 99abc60db6f..513c1c2ae2e 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -481,7 +481,7 @@ class TOPBAR_MT_file_export(Menu):
 bl_owner_use_filter = False
 
 def draw(self, _context):
-self.layout.operator("wm.obj_export", text="Wavefront OBJ (.obj) - 
New")
+self.layout.operator("wm.obj_export", text="Wavefront OBJ (.obj)")
 if bpy.app.build_options.collada:
 self.layout.operator("wm.collada_export",
  text="Collada (Default) (.dae)")

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] SVN commit: bf-blender [62836] trunk/lib/tests/modeling/bevel_regression.blend: fix bevel regression to go with recent bevel fix

2022-02-07 Thread Howard Trickey
Revision: 62836
  https://developer.blender.org/rBL62836
Author:   howardt
Date: 2022-02-08 03:56:24 +0100 (Tue, 08 Feb 2022)
Log Message:
---
fix bevel regression to go with recent bevel fix

Modified Paths:
--
trunk/lib/tests/modeling/bevel_regression.blend

Modified: trunk/lib/tests/modeling/bevel_regression.blend
===
(Binary files differ)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] SVN commit: bf-blender [62835] trunk/lib/tests/io_tests/obj/all_objects.mtl: New all_objects.mtl for obj exporter roughness fix

2022-02-06 Thread Howard Trickey
Revision: 62835
  https://developer.blender.org/rBL62835
Author:   howardt
Date: 2022-02-06 21:08:35 +0100 (Sun, 06 Feb 2022)
Log Message:
---
New all_objects.mtl for obj exporter roughness fix

Modified Paths:
--
trunk/lib/tests/io_tests/obj/all_objects.mtl

Modified: trunk/lib/tests/io_tests/obj/all_objects.mtl
===
--- trunk/lib/tests/io_tests/obj/all_objects.mtl2022-02-06 19:55:48 UTC 
(rev 62834)
+++ trunk/lib/tests/io_tests/obj/all_objects.mtl2022-02-06 20:08:35 UTC 
(rev 62835)
@@ -1,8 +1,8 @@
-# Blender 3.1.0 Alpha MTL File: 'all_objects.blend'
+# Blender 3.2.0 Alpha MTL File: 'all_objects.blend'
 # www.blender.org
 
 newmtl Blue
-Ns 225.00
+Ns 250.00
 Ka 1.00 1.00 1.00
 Kd 0.00 0.00 1.00
 Ks 0.50 0.50 0.50
@@ -12,7 +12,7 @@
 illum 2
 
 newmtl BlueDark
-Ns 225.00
+Ns 250.00
 Ka 1.00 1.00 1.00
 Kd 0.00 0.00 0.50
 Ks 0.50 0.50 0.50
@@ -22,7 +22,7 @@
 illum 2
 
 newmtl Green
-Ns 225.00
+Ns 250.00
 Ka 1.00 1.00 1.00
 Kd 0.00 1.00 0.00
 Ks 0.50 0.50 0.50
@@ -32,7 +32,7 @@
 illum 2
 
 newmtl GreenDark
-Ns 225.00
+Ns 250.00
 Ka 1.00 1.00 1.00
 Kd 0.00 0.50 0.00
 Ks 0.50 0.50 0.50
@@ -42,7 +42,7 @@
 illum 2
 
 newmtl Material
-Ns 225.00
+Ns 250.00
 Ka 1.00 1.00 1.00
 Kd 0.80 0.80 0.80
 Ks 0.50 0.50 0.50
@@ -52,7 +52,7 @@
 illum 2
 
 newmtl Red
-Ns 225.00
+Ns 250.00
 Ka 1.00 1.00 1.00
 Kd 1.00 0.00 0.00
 Ks 0.50 0.50 0.50
@@ -62,7 +62,7 @@
 illum 2
 
 newmtl RedDark
-Ns 225.00
+Ns 250.00
 Ka 1.00 1.00 1.00
 Kd 0.50 0.00 0.00
 Ks 0.50 0.50 0.50

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [f199f039947] master: Merge branch 'blender-v3.1-release'

2022-02-06 Thread Howard Trickey
Commit: f199f03994748e7d4b9421cbfd65fdd468ebbdfd
Author: Howard Trickey
Date:   Sun Feb 6 15:00:21 2022 -0500
Branches: master
https://developer.blender.org/rBf199f03994748e7d4b9421cbfd65fdd468ebbdfd

Merge branch 'blender-v3.1-release'

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] SVN commit: bf-blender [62834] tags/blender-3.1-release/lib/tests/io_tests/obj/all_objects.mtl: New all_objects.mtl needed for roughness fix to obj exporter

2022-02-06 Thread Howard Trickey
Revision: 62834
  https://developer.blender.org/rBL62834
Author:   howardt
Date: 2022-02-06 20:55:48 +0100 (Sun, 06 Feb 2022)
Log Message:
---
New all_objects.mtl needed for roughness fix to obj exporter

Modified Paths:
--
tags/blender-3.1-release/lib/tests/io_tests/obj/all_objects.mtl

Modified: tags/blender-3.1-release/lib/tests/io_tests/obj/all_objects.mtl
===
--- tags/blender-3.1-release/lib/tests/io_tests/obj/all_objects.mtl 
2022-02-05 23:06:46 UTC (rev 62833)
+++ tags/blender-3.1-release/lib/tests/io_tests/obj/all_objects.mtl 
2022-02-06 19:55:48 UTC (rev 62834)
@@ -1,8 +1,8 @@
-# Blender 3.1.0 Alpha MTL File: 'all_objects.blend'
+# Blender 3.2.0 Alpha MTL File: 'all_objects.blend'
 # www.blender.org
 
 newmtl Blue
-Ns 225.00
+Ns 250.00
 Ka 1.00 1.00 1.00
 Kd 0.00 0.00 1.00
 Ks 0.50 0.50 0.50
@@ -12,7 +12,7 @@
 illum 2
 
 newmtl BlueDark
-Ns 225.00
+Ns 250.00
 Ka 1.00 1.00 1.00
 Kd 0.00 0.00 0.50
 Ks 0.50 0.50 0.50
@@ -22,7 +22,7 @@
 illum 2
 
 newmtl Green
-Ns 225.00
+Ns 250.00
 Ka 1.00 1.00 1.00
 Kd 0.00 1.00 0.00
 Ks 0.50 0.50 0.50
@@ -32,7 +32,7 @@
 illum 2
 
 newmtl GreenDark
-Ns 225.00
+Ns 250.00
 Ka 1.00 1.00 1.00
 Kd 0.00 0.50 0.00
 Ks 0.50 0.50 0.50
@@ -42,7 +42,7 @@
 illum 2
 
 newmtl Material
-Ns 225.00
+Ns 250.00
 Ka 1.00 1.00 1.00
 Kd 0.80 0.80 0.80
 Ks 0.50 0.50 0.50
@@ -52,7 +52,7 @@
 illum 2
 
 newmtl Red
-Ns 225.00
+Ns 250.00
 Ka 1.00 1.00 1.00
 Kd 1.00 0.00 0.00
 Ks 0.50 0.50 0.50
@@ -62,7 +62,7 @@
 illum 2
 
 newmtl RedDark
-Ns 225.00
+Ns 250.00
 Ka 1.00 1.00 1.00
 Kd 0.50 0.00 0.00
 Ks 0.50 0.50 0.50

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] SVN commit: bf-blender [62833] trunk/lib/tests/io_tests: Fix files for obj exporter nurbs fix (master)

2022-02-05 Thread Howard Trickey
Revision: 62833
  https://developer.blender.org/rBL62833
Author:   howardt
Date: 2022-02-06 00:06:46 +0100 (Sun, 06 Feb 2022)
Log Message:
---
Fix files for obj exporter nurbs fix (master)

Modified Paths:
--
trunk/lib/tests/io_tests/obj/nurbs.obj

Added Paths:
---
trunk/lib/tests/io_tests/blend_geometry/nurbs_curves.blend
trunk/lib/tests/io_tests/obj/nurbs_curves.obj

Added: trunk/lib/tests/io_tests/blend_geometry/nurbs_curves.blend
===
(Binary files differ)

Index: trunk/lib/tests/io_tests/blend_geometry/nurbs_curves.blend
===
--- trunk/lib/tests/io_tests/blend_geometry/nurbs_curves.blend  2022-02-05 
22:53:04 UTC (rev 62832)
+++ trunk/lib/tests/io_tests/blend_geometry/nurbs_curves.blend  2022-02-05 
23:06:46 UTC (rev 62833)

Property changes on: trunk/lib/tests/io_tests/blend_geometry/nurbs_curves.blend
___
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Modified: trunk/lib/tests/io_tests/obj/nurbs.obj
===
--- trunk/lib/tests/io_tests/obj/nurbs.obj  2022-02-05 22:53:04 UTC (rev 
62832)
+++ trunk/lib/tests/io_tests/obj/nurbs.obj  2022-02-05 23:06:46 UTC (rev 
62833)
@@ -1,4 +1,4 @@
-# Blender 3.0.0 Alpha
+# Blender 3.2.0 Alpha
 # www.blender.org
 v 3.00 0.00 0.00
 v 0.260472 1.477212 0.866025
@@ -13,5 +13,5 @@
 cstype bspline
 deg 3
 curv 0.0 1.0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -1 -2 -3
-parm 0.0 0.07 0.13 0.20 0.27 0.33 0.40 0.47 
0.53 0.60 0.67 0.73 0.80 0.87 0.93 1.0
+parm u 0.0 0.07 0.13 0.20 0.27 0.33 0.40 0.47 
0.53 0.60 0.67 0.73 0.80 0.87 0.93 1.0
 end

Added: trunk/lib/tests/io_tests/obj/nurbs_curves.obj
===
--- trunk/lib/tests/io_tests/obj/nurbs_curves.obj   
(rev 0)
+++ trunk/lib/tests/io_tests/obj/nurbs_curves.obj   2022-02-05 23:06:46 UTC 
(rev 62833)
@@ -0,0 +1,52 @@
+# Blender 3.2.0 Alpha
+# www.blender.org
+v -2.00 -2.00 -0.00
+v -2.00 2.00 0.00
+v 2.00 2.00 0.00
+v 2.00 -2.00 -0.00
+g NurbsCurve
+cstype bspline
+deg 3
+curv 0.0 1.0 -1 -2 -3 -4
+parm u 0.0 0.142857 0.285714 0.428571 0.571429 0.714286 0.857143 1.0
+end
+v 2.00 -2.00 -0.00
+v 2.00 2.00 0.00
+v 6.00 2.00 0.00
+v 6.00 -2.00 -0.00
+g NurbsCurveDiffWeights
+cstype bspline
+deg 3
+curv 0.0 1.0 -1 -2 -3 -4
+parm u 0.0 0.142857 0.285714 0.428571 0.571429 0.714286 0.857143 1.0
+end
+v -6.00 -2.00 -0.00
+v -6.00 2.00 0.00
+v -2.00 2.00 0.00
+v -2.00 -2.00 -0.00
+g NurbsCurveCyclic
+cstype bspline
+deg 3
+curv 0.0 1.0 -1 -2 -3 -4 -1 -2 -3
+parm u 0.0 0.10 0.20 0.30 0.40 0.50 0.60 0.70 
0.80 0.90 1.0
+end
+v -10.00 -2.00 -0.00
+v -10.00 2.00 0.00
+v -6.00 2.00 0.00
+v -6.00 -2.00 -0.00
+g NurbsCurveEndpoint
+cstype bspline
+deg 3
+curv 0.0 1.0 -1 -2 -3 -4
+parm u 0.0 0.00 0.00 0.00 1.00 1.00 1.00 1.0
+end
+v 6.00 -2.00 -0.00
+v 6.00 2.00 0.00
+v 10.00 2.00 0.00
+v 10.00 -2.00 -0.00
+g CurveDeg3
+cstype bspline
+deg 2
+curv 0.0 1.0 -1 -2 -3 -4
+parm u 0.0 0.142857 0.285714 0.428571 0.571429 0.714286 0.857143 1.0
+end

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [94c0a59f959] master: Merge branch 'blender-v3.1-release'

2022-02-05 Thread Howard Trickey
Commit: 94c0a59f959f6adfea48f8105b9aa25c3c5161bb
Author: Howard Trickey
Date:   Sat Feb 5 18:04:30 2022 -0500
Branches: master
https://developer.blender.org/rB94c0a59f959f6adfea48f8105b9aa25c3c5161bb

Merge branch 'blender-v3.1-release'

Also fixed conflicts due to the change in file writing in the new obj exporter
in master, and fixed one of the tests that was added in master but not 3.1.

===



===

diff --cc source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc
index 4f5321019d5,38163af64b6..13d1a4fdde6
--- a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc
@@@ -369,15 -352,28 +369,29 @@@ void OBJWriter::write_nurbs_curve(Forma
  
  /**
   * In `parm u 0 0.1 ..` line:, (total control points + 2) equidistant 
numbers in the
-  * parameter range are inserted.
+  * parameter range are inserted. However for curves with endpoint flag,
+  * first degree+1 numbers are zeroes, and last degree+1 numbers are ones
   */
++
+ const short flagsu = obj_nurbs_data.get_nurbs_flagu(spline_idx);
+ const bool cyclic = flagsu & CU_NURB_CYCLIC;
+ const bool endpoint = !cyclic && (flagsu & CU_NURB_ENDPOINT);
 -file_handler_->write();
 +fh.write();
  for (int i = 1; i <= total_control_points + 2; i++) {
-   fh.write(1.0f * i / 
(total_control_points + 2 + 1));
+   float parm = 1.0f * i / (total_control_points + 2 + 1);
+   if (endpoint) {
+ if (i <= nurbs_degree) {
+   parm = 0;
+ }
+ else if (i > total_control_points + 2 - nurbs_degree) {
+   parm = 1;
+ }
+   }
 -  file_handler_->write(parm);
++  fh.write(parm);
  }
 -file_handler_->write();
 +fh.write();
  
 -file_handler_->write();
 +fh.write();
}
  }
  
diff --cc source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc
index ac2ee8d566b,ecae93f8f7a..01f201897cf
--- a/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc
+++ b/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc
@@@ -238,38 -238,6 +238,38 @@@ TEST(obj_exporter_writer, mtllib
BLI_delete(out_file_path.c_str(), false, false);
  }
  
 +TEST(obj_exporter_writer, format_handler_buffer_chunking)
 +{
 +  /* Use a tiny buffer chunk size, so that the test below ends up creating 
several blocks. */
 +  FormatHandler h;
 +  h.write("abc");
 +  h.write("abcd");
 +  h.write("abcde");
 +  h.write("abcdef");
 +  
h.write("012345678901234567890123456789abcd");
 +  h.write("123");
 +  h.write();
 +  h.write();
 +  h.write();
 +  h.write();
 +
 +  size_t got_blocks = h.get_block_count();
 +  ASSERT_EQ(got_blocks, 7);
 +
 +  std::string got_string = h.get_as_string();
 +  using namespace std::string_literals;
 +  const char *expected = R"(o abc
 +o abcd
 +o abcde
 +o abcdef
 +o 012345678901234567890123456789abcd
 +o 123
 +curv 0.0 1.0
- parm 0.0
++parm u 0.0
 +)";
 +  ASSERT_EQ(got_string, expected);
 +}
 +
  /* Return true if string #a and string #b are equal after their first 
newline. */
  static bool strings_equal_after_first_lines(const std::string , const 
std::string )
  {
@@@ -410,6 -378,17 +410,19 @@@ TEST_F(obj_exporter_regression_test, nu
"io_tests/blend_geometry/nurbs.blend", "io_tests/obj/nurbs.obj", "", 
_export.params);
  }
  
+ TEST_F(obj_exporter_regression_test, nurbs_curves_as_nurbs)
+ {
+   OBJExportParamsDefault _export;
+   _export.params.forward_axis = OBJ_AXIS_Y_FORWARD;
+   _export.params.up_axis = OBJ_AXIS_Z_UP;
+   _export.params.export_materials = false;
+   _export.params.export_curves_as_nurbs = true;
 -  compare_obj_export_to_golden(
 -  "io_tests/blend_geometry/nurbs_curves.blend", 
"io_tests/obj/nurbs_curves.obj", "", _export.params);
++  compare_obj_export_to_golden("io_tests/blend_geometry/nurbs_curves.blend",
++   "io_tests/obj/nurbs_curves.obj",
++   "",
++   _export.params);
+ }
+ 
  TEST_F(obj_exporter_regression_test, nurbs_as_mesh)
  {
OBJExportParamsDefault _export;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] SVN commit: bf-blender [62832] tags/blender-3.1-release/lib/tests/io_tests: Update tests for fix to io exporter nurbs

2022-02-05 Thread Howard Trickey
Revision: 62832
  https://developer.blender.org/rBL62832
Author:   howardt
Date: 2022-02-05 23:53:04 +0100 (Sat, 05 Feb 2022)
Log Message:
---
Update tests for fix to io exporter nurbs

Modified Paths:
--
tags/blender-3.1-release/lib/tests/io_tests/obj/nurbs.obj

Added Paths:
---

tags/blender-3.1-release/lib/tests/io_tests/blend_geometry/nurbs_curves.blend
tags/blender-3.1-release/lib/tests/io_tests/obj/nurbs_curves.obj

Added: 
tags/blender-3.1-release/lib/tests/io_tests/blend_geometry/nurbs_curves.blend
===
(Binary files differ)

Index: 
tags/blender-3.1-release/lib/tests/io_tests/blend_geometry/nurbs_curves.blend
===
--- 
tags/blender-3.1-release/lib/tests/io_tests/blend_geometry/nurbs_curves.blend   
2022-02-04 17:15:25 UTC (rev 62831)
+++ 
tags/blender-3.1-release/lib/tests/io_tests/blend_geometry/nurbs_curves.blend   
2022-02-05 22:53:04 UTC (rev 62832)

Property changes on: 
tags/blender-3.1-release/lib/tests/io_tests/blend_geometry/nurbs_curves.blend
___
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Modified: tags/blender-3.1-release/lib/tests/io_tests/obj/nurbs.obj
===
--- tags/blender-3.1-release/lib/tests/io_tests/obj/nurbs.obj   2022-02-04 
17:15:25 UTC (rev 62831)
+++ tags/blender-3.1-release/lib/tests/io_tests/obj/nurbs.obj   2022-02-05 
22:53:04 UTC (rev 62832)
@@ -1,4 +1,4 @@
-# Blender 3.0.0 Alpha
+# Blender 3.2.0 Alpha
 # www.blender.org
 v 3.00 0.00 0.00
 v 0.260472 1.477212 0.866025
@@ -13,5 +13,5 @@
 cstype bspline
 deg 3
 curv 0.0 1.0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -1 -2 -3
-parm 0.0 0.07 0.13 0.20 0.27 0.33 0.40 0.47 
0.53 0.60 0.67 0.73 0.80 0.87 0.93 1.0
+parm u 0.0 0.07 0.13 0.20 0.27 0.33 0.40 0.47 
0.53 0.60 0.67 0.73 0.80 0.87 0.93 1.0
 end

Added: tags/blender-3.1-release/lib/tests/io_tests/obj/nurbs_curves.obj
===
--- tags/blender-3.1-release/lib/tests/io_tests/obj/nurbs_curves.obj
(rev 0)
+++ tags/blender-3.1-release/lib/tests/io_tests/obj/nurbs_curves.obj
2022-02-05 22:53:04 UTC (rev 62832)
@@ -0,0 +1,52 @@
+# Blender 3.2.0 Alpha
+# www.blender.org
+v -2.00 -2.00 -0.00
+v -2.00 2.00 0.00
+v 2.00 2.00 0.00
+v 2.00 -2.00 -0.00
+g NurbsCurve
+cstype bspline
+deg 3
+curv 0.0 1.0 -1 -2 -3 -4
+parm u 0.0 0.142857 0.285714 0.428571 0.571429 0.714286 0.857143 1.0
+end
+v 2.00 -2.00 -0.00
+v 2.00 2.00 0.00
+v 6.00 2.00 0.00
+v 6.00 -2.00 -0.00
+g NurbsCurveDiffWeights
+cstype bspline
+deg 3
+curv 0.0 1.0 -1 -2 -3 -4
+parm u 0.0 0.142857 0.285714 0.428571 0.571429 0.714286 0.857143 1.0
+end
+v -6.00 -2.00 -0.00
+v -6.00 2.00 0.00
+v -2.00 2.00 0.00
+v -2.00 -2.00 -0.00
+g NurbsCurveCyclic
+cstype bspline
+deg 3
+curv 0.0 1.0 -1 -2 -3 -4 -1 -2 -3
+parm u 0.0 0.10 0.20 0.30 0.40 0.50 0.60 0.70 
0.80 0.90 1.0
+end
+v -10.00 -2.00 -0.00
+v -10.00 2.00 0.00
+v -6.00 2.00 0.00
+v -6.00 -2.00 -0.00
+g NurbsCurveEndpoint
+cstype bspline
+deg 3
+curv 0.0 1.0 -1 -2 -3 -4
+parm u 0.0 0.00 0.00 0.00 1.00 1.00 1.00 1.0
+end
+v 6.00 -2.00 -0.00
+v 6.00 2.00 0.00
+v 10.00 2.00 0.00
+v 10.00 -2.00 -0.00
+g CurveDeg3
+cstype bspline
+deg 2
+curv 0.0 1.0 -1 -2 -3 -4
+parm u 0.0 0.142857 0.285714 0.428571 0.571429 0.714286 0.857143 1.0
+end

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [3bcbbf8992b] blender-v3.1-release: Split Python OBJ importer and exporter, enabling only the importer.

2022-02-03 Thread Howard Trickey
Commit: 3bcbbf8992b0f41f19bef466129ce5b88984ac2b
Author: Howard Trickey
Date:   Thu Feb 3 09:30:55 2022 -0500
Branches: blender-v3.1-release
https://developer.blender.org/rB3bcbbf8992b0f41f19bef466129ce5b88984ac2b

Split Python OBJ importer and exporter, enabling only the importer.

This is from patch D13988. It removes the "- New" from the menu of the
new obj exporter, changes the default addon to just io_import_obj,
and does the right versioning thing.
Also disables the python tests for the old python exporter.

===

M   release/scripts/startup/bl_ui/space_topbar.py
M   source/blender/blenkernel/intern/blendfile.c
M   source/blender/blenloader/intern/versioning_userdef.c
M   tests/python/CMakeLists.txt

===

diff --git a/release/scripts/startup/bl_ui/space_topbar.py 
b/release/scripts/startup/bl_ui/space_topbar.py
index 99abc60db6f..513c1c2ae2e 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -481,7 +481,7 @@ class TOPBAR_MT_file_export(Menu):
 bl_owner_use_filter = False
 
 def draw(self, _context):
-self.layout.operator("wm.obj_export", text="Wavefront OBJ (.obj) - 
New")
+self.layout.operator("wm.obj_export", text="Wavefront OBJ (.obj)")
 if bpy.app.build_options.collada:
 self.layout.operator("wm.collada_export",
  text="Collada (Default) (.dae)")
diff --git a/source/blender/blenkernel/intern/blendfile.c 
b/source/blender/blenkernel/intern/blendfile.c
index 6ae19c8036f..53c9fe49fb7 100644
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@ -603,12 +603,12 @@ UserDef *BKE_blendfile_userdef_from_defaults(void)
 const char *addons[] = {
 "io_anim_bvh",
 "io_curve_svg",
+"io_import_obj",
 "io_mesh_ply",
 "io_mesh_stl",
 "io_mesh_uv_layout",
 "io_scene_fbx",
 "io_scene_gltf2",
-"io_scene_obj",
 "io_scene_x3d",
 "cycles",
 "pose_library",
diff --git a/source/blender/blenloader/intern/versioning_userdef.c 
b/source/blender/blenloader/intern/versioning_userdef.c
index 064d7977c68..520059649e6 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -973,6 +973,13 @@ void blo_do_versions_userdef(UserDef *userdef)
*/
   {
 /* Keep this block, even when empty. */
+if (!USER_VERSION_ATLEAST(301, 7)) {
+  /* io_scene_obj directory is gone, split into io_import_obj and 
io_export_obj,
+   * with io_import_obj enabled by default and io_export_obj replaced by 
the C++ version.
+   */
+  BKE_addon_remove_safe(>addons, "io_scene_obj");
+  BKE_addon_ensure(>addons, "io_import_obj");
+}
   }
 
   LISTBASE_FOREACH (bTheme *, btheme, >themes) {
diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt
index d6575436bd6..63dcdc0f925 100644
--- a/tests/python/CMakeLists.txt
+++ b/tests/python/CMakeLists.txt
@@ -324,7 +324,10 @@ add_blender_test(
 )
 endif()
 
+if(FALSE)
 # OBJ Export tests
+# Disabled because new C++ Obj exporter has C++ tests.
+
 add_blender_test(
   export_obj_cube
   ${TEST_SRC_DIR}/io_tests/blend_geometry/all_quads.blend
@@ -345,8 +348,6 @@ add_blender_test(
   --md5=a733ae4fa4a591ea9b0912da3af042de --md5_method=FILE
 )
 
-# disabled until updated & working
-if(FALSE)
 add_blender_test(
   export_obj_all_objects
   ${TEST_SRC_DIR}/io_tests/blend_scene/all_objects.blend

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [ff9dc1986e6] master: Split Python OBJ importer and exporter, enabling only the importer.

2022-02-03 Thread Howard Trickey
Commit: ff9dc1986e6c9a54fd0bb228e8813551e6baa042
Author: Howard Trickey
Date:   Thu Feb 3 07:56:55 2022 -0500
Branches: master
https://developer.blender.org/rBff9dc1986e6c9a54fd0bb228e8813551e6baa042

Split Python OBJ importer and exporter, enabling only the importer.

This is from patch D13988. It removes the "- New" from the menu of the
new obj exporter, changes the default addon to just io_import_obj,
and does the right versioning thing.
Also disables the python tests for the old python exporter.

===

M   release/scripts/startup/bl_ui/space_topbar.py
M   source/blender/blenkernel/intern/blendfile.c
M   source/blender/blenloader/intern/versioning_userdef.c
M   tests/python/CMakeLists.txt

===

diff --git a/release/scripts/startup/bl_ui/space_topbar.py 
b/release/scripts/startup/bl_ui/space_topbar.py
index 99abc60db6f..513c1c2ae2e 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -481,7 +481,7 @@ class TOPBAR_MT_file_export(Menu):
 bl_owner_use_filter = False
 
 def draw(self, _context):
-self.layout.operator("wm.obj_export", text="Wavefront OBJ (.obj) - 
New")
+self.layout.operator("wm.obj_export", text="Wavefront OBJ (.obj)")
 if bpy.app.build_options.collada:
 self.layout.operator("wm.collada_export",
  text="Collada (Default) (.dae)")
diff --git a/source/blender/blenkernel/intern/blendfile.c 
b/source/blender/blenkernel/intern/blendfile.c
index 819f786a2d0..86c2593e2e6 100644
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@ -621,12 +621,12 @@ UserDef *BKE_blendfile_userdef_from_defaults(void)
 const char *addons[] = {
 "io_anim_bvh",
 "io_curve_svg",
+"io_import_obj",
 "io_mesh_ply",
 "io_mesh_stl",
 "io_mesh_uv_layout",
 "io_scene_fbx",
 "io_scene_gltf2",
-"io_scene_obj",
 "io_scene_x3d",
 "cycles",
 "pose_library",
diff --git a/source/blender/blenloader/intern/versioning_userdef.c 
b/source/blender/blenloader/intern/versioning_userdef.c
index 064d7977c68..520059649e6 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -973,6 +973,13 @@ void blo_do_versions_userdef(UserDef *userdef)
*/
   {
 /* Keep this block, even when empty. */
+if (!USER_VERSION_ATLEAST(301, 7)) {
+  /* io_scene_obj directory is gone, split into io_import_obj and 
io_export_obj,
+   * with io_import_obj enabled by default and io_export_obj replaced by 
the C++ version.
+   */
+  BKE_addon_remove_safe(>addons, "io_scene_obj");
+  BKE_addon_ensure(>addons, "io_import_obj");
+}
   }
 
   LISTBASE_FOREACH (bTheme *, btheme, >themes) {
diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt
index d6575436bd6..63dcdc0f925 100644
--- a/tests/python/CMakeLists.txt
+++ b/tests/python/CMakeLists.txt
@@ -324,7 +324,10 @@ add_blender_test(
 )
 endif()
 
+if(FALSE)
 # OBJ Export tests
+# Disabled because new C++ Obj exporter has C++ tests.
+
 add_blender_test(
   export_obj_cube
   ${TEST_SRC_DIR}/io_tests/blend_geometry/all_quads.blend
@@ -345,8 +348,6 @@ add_blender_test(
   --md5=a733ae4fa4a591ea9b0912da3af042de --md5_method=FILE
 )
 
-# disabled until updated & working
-if(FALSE)
 add_blender_test(
   export_obj_all_objects
   ${TEST_SRC_DIR}/io_tests/blend_scene/all_objects.blend

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] SVN commit: bf-blender [62822] trunk/lib/tests/io_tests: Master commit of test changes for obj exporter fix T95328

2022-01-30 Thread Howard Trickey
Revision: 62822
  https://developer.blender.org/rBL62822
Author:   howardt
Date: 2022-01-30 20:07:55 +0100 (Sun, 30 Jan 2022)
Log Message:
---
Master commit of test changes for obj exporter fix T95328

Modified Paths:
--
trunk/lib/tests/io_tests/obj/all_objects.obj

Added Paths:
---
trunk/lib/tests/io_tests/blend_geometry/cube_normal_edit.blend
trunk/lib/tests/io_tests/obj/cube_normal_edit.obj

Added: trunk/lib/tests/io_tests/blend_geometry/cube_normal_edit.blend
===
(Binary files differ)

Index: trunk/lib/tests/io_tests/blend_geometry/cube_normal_edit.blend
===
--- trunk/lib/tests/io_tests/blend_geometry/cube_normal_edit.blend  
2022-01-30 18:54:06 UTC (rev 62821)
+++ trunk/lib/tests/io_tests/blend_geometry/cube_normal_edit.blend  
2022-01-30 19:07:55 UTC (rev 62822)

Property changes on: 
trunk/lib/tests/io_tests/blend_geometry/cube_normal_edit.blend
___
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Modified: trunk/lib/tests/io_tests/obj/all_objects.obj
===
--- trunk/lib/tests/io_tests/obj/all_objects.obj2022-01-30 18:54:06 UTC 
(rev 62821)
+++ trunk/lib/tests/io_tests/obj/all_objects.obj2022-01-30 19:07:55 UTC 
(rev 62822)
@@ -1,4 +1,4 @@
-# Blender 3.1.0 Alpha
+# Blender 3.2.0 Alpha
 # www.blender.org
 mtllib all_objects.mtl
 o EmptyText
@@ -5037,7 +5037,6 @@
 v 0.351000 -9.406000 0.00
 v 0.587000 -9.406000 0.00
 vn -0. -0. 1.
-vn -0. -0. -0.
 vt 0.00 0.00
 vt 0.017544 0.00
 vt 0.035088 0.00
@@ -5220,9 +5219,9 @@
 f 1324/1198/1083 1379/1253/1083 1380/1254/1083
 f 1324/1198/1083 1378/1252/1083 1379/1253/1083
 f 1325/1199/1083 1378/1252/1083 1324/1198/1083
-f 1326/1200/1084 1378/1252/1084 1325/1199/1084
+f 1326/1200/1083 1378/1252/1083 1325/1199/1083
 f 1327/1201/1083 1377/1251/1083 1326/1200/1083
-f 1377/1251/1084 1378/1252/1084 1326/1200/1084
+f 1377/1251/1083 1378/1252/1083 1326/1200/1083
 f 1327/1201/1083 1376/1250/1083 1377/1251/1083
 f 1327/1201/1083 1375/1249/1083 1376/1250/1083
 f 1328/1202/1083 1375/1249/1083 1327/1201/1083
@@ -5383,9 +5382,9 @@
 f 1454/1328/1083 1455/1329/1083 1456/1330/1083
 f 1494/1368/1083 1492/1366/1083 1493/1367/1083
 f 1494/1368/1083 1499/1373/1083 1492/1366/1083
-f 1495/1369/1084 1499/1373/1084 1494/1368/1084
+f 1495/1369/1083 1499/1373/1083 1494/1368/1083
 f 1496/1370/1083 1498/1372/1083 1495/1369/1083
-f 1498/1372/1084 1499/1373/1084 1495/1369/1084
+f 1498/1372/1083 1499/1373/1083 1495/1369/1083
 f 1496/1370/1083 1497/1371/1083 1498/1372/1083
 o SurfTorus.001
 v 5.344670 -2.655330 -0.176777
@@ -8510,1030 +8509,1030 @@
 vt 0.968750 0.937500
 vt 0.968750 0.968750
 s 1
-f 1500/1374/1085 1532/1440/1086 1563/1472/1087 1531/1438/1088
-f 1501/1378/1089 1533/1442/1090 1532/1441/1086 1500/1375/1085
-f 1502/1380/1091 1534/1443/1092 1533/1442/1090 1501/1378/1089
-f 1503/1382/1093 1535/1444/1094 1534/1443/1092 1502/1380/1091
-f 1504/1384/1095 1536/1445/1096 1535/1444/1094 1503/1382/1093
-f 1505/1386/1097 1537/1446/1098 1536/1445/1096 1504/1384/1095
-f 1506/1388/1099 1538/1447/1100 1537/1446/1098 1505/1386/1097
-f 1507/1390/1101 1539/1448/1102 1538/1447/1100 1506/1388/1099
-f 1508/1392/1103 1540/1449/1104 1539/1448/1102 1507/1390/1101
-f 1509/1394/1105 1541/1450/1106 1540/1449/1104 1508/1392/1103
-f 1510/1396/1107 1542/1451/1108 1541/1450/1106 1509/1394/1105
-f 1511/1398/1109 1543/1452/1110 1542/1451/1108 1510/1396/1107
-f 1512/1400/ 1544/1453/1112 1543/1452/1110 1511/1398/1109
-f 1513/1402/1113 1545/1454/1114 1544/1453/1112 1512/1400/
-f 1514/1404/1115 1546/1455/1116 1545/1454/1114 1513/1402/1113
-f 1515/1406/1117 1547/1456/1118 1546/1455/1116 1514/1404/1115
-f 1516/1408/1119 1548/1457/1120 1547/1456/1118 1515/1406/1117
-f 1517/1410/1121 1549/1458/1122 1548/1457/1120 1516/1408/1119
-f 1518/1412/1123 1550/1459/1124 1549/1458/1122 1517/1410/1121
-f 1519/1414/1125 1551/1460/1126 1550/1459/1124 1518/1412/1123
-f 1520/1416/1127 1552/1461/1128 1551/1460/1126 1519/1414/1125
-f 1521/1418/1129 1553/1462/1130 1552/1461/1128 1520/1416/1127
-f 1522/1420/1131 1554/1463/1132 1553/1462/1130 1521/1418/1129
-f 1523/1422/1133 1555/1464/1134 1554/1463/1132 1522/1420/1131
-f 1524/1424/1135 1556/1465/1136 1555/1464/1134 1523/1422/1133
-f 1525/1426/1137 1557/1466/1138 1556/1465/1136 1524/1424/1135
-f 1526/1428/1139 1558/1467/1140 1557/1466/1138 1525/1426/1137
-f 1527/1430/1141 1559/1468/1142 1558/1467/1140 1526/1428/1139
-f 1528/1432/1143 1560/1469/1144 1559/1468/1142 1527/1430/1141
-f 1529/1434/1145 1561/1470/1146 1560/1469/1144 1528/1432/1143
-f 1530/1436/1147 1562/1471/1148 1561/1470/1146 1529/1434/1145
-f 1531/1438/1088 1563/1472/1087 1562/1471/1148 1530/1436/1147
-f 

[Bf-blender-cvs] [b315678feaf] master: Merge branch 'blender-v3.1-release'

2022-01-30 Thread Howard Trickey
Commit: b315678feafa0372365e38394fc1a37812debfa2
Author: Howard Trickey
Date:   Sun Jan 30 13:57:45 2022 -0500
Branches: master
https://developer.blender.org/rBb315678feafa0372365e38394fc1a37812debfa2

Merge branch 'blender-v3.1-release'

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] SVN commit: bf-blender [62821] tags/blender-3.1-release/lib/tests/io_tests: New and fixed tests for new OBJ exporter from T95328, exporting custom normals

2022-01-30 Thread Howard Trickey
Revision: 62821
  https://developer.blender.org/rBL62821
Author:   howardt
Date: 2022-01-30 19:54:06 +0100 (Sun, 30 Jan 2022)
Log Message:
---
New and fixed tests for new OBJ exporter from T95328, exporting custom normals

Modified Paths:
--
tags/blender-3.1-release/lib/tests/io_tests/obj/all_objects.obj

Added Paths:
---

tags/blender-3.1-release/lib/tests/io_tests/blend_geometry/cube_normal_edit.blend
tags/blender-3.1-release/lib/tests/io_tests/obj/cube_normal_edit.obj

Added: 
tags/blender-3.1-release/lib/tests/io_tests/blend_geometry/cube_normal_edit.blend
===
(Binary files differ)

Index: 
tags/blender-3.1-release/lib/tests/io_tests/blend_geometry/cube_normal_edit.blend
===
--- 
tags/blender-3.1-release/lib/tests/io_tests/blend_geometry/cube_normal_edit.blend
   2022-01-28 12:07:35 UTC (rev 62820)
+++ 
tags/blender-3.1-release/lib/tests/io_tests/blend_geometry/cube_normal_edit.blend
   2022-01-30 18:54:06 UTC (rev 62821)

Property changes on: 
tags/blender-3.1-release/lib/tests/io_tests/blend_geometry/cube_normal_edit.blend
___
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Modified: tags/blender-3.1-release/lib/tests/io_tests/obj/all_objects.obj
===
--- tags/blender-3.1-release/lib/tests/io_tests/obj/all_objects.obj 
2022-01-28 12:07:35 UTC (rev 62820)
+++ tags/blender-3.1-release/lib/tests/io_tests/obj/all_objects.obj 
2022-01-30 18:54:06 UTC (rev 62821)
@@ -1,4 +1,4 @@
-# Blender 3.1.0 Alpha
+# Blender 3.2.0 Alpha
 # www.blender.org
 mtllib all_objects.mtl
 o EmptyText
@@ -5037,7 +5037,6 @@
 v 0.351000 -9.406000 0.00
 v 0.587000 -9.406000 0.00
 vn -0. -0. 1.
-vn -0. -0. -0.
 vt 0.00 0.00
 vt 0.017544 0.00
 vt 0.035088 0.00
@@ -5220,9 +5219,9 @@
 f 1324/1198/1083 1379/1253/1083 1380/1254/1083
 f 1324/1198/1083 1378/1252/1083 1379/1253/1083
 f 1325/1199/1083 1378/1252/1083 1324/1198/1083
-f 1326/1200/1084 1378/1252/1084 1325/1199/1084
+f 1326/1200/1083 1378/1252/1083 1325/1199/1083
 f 1327/1201/1083 1377/1251/1083 1326/1200/1083
-f 1377/1251/1084 1378/1252/1084 1326/1200/1084
+f 1377/1251/1083 1378/1252/1083 1326/1200/1083
 f 1327/1201/1083 1376/1250/1083 1377/1251/1083
 f 1327/1201/1083 1375/1249/1083 1376/1250/1083
 f 1328/1202/1083 1375/1249/1083 1327/1201/1083
@@ -5383,9 +5382,9 @@
 f 1454/1328/1083 1455/1329/1083 1456/1330/1083
 f 1494/1368/1083 1492/1366/1083 1493/1367/1083
 f 1494/1368/1083 1499/1373/1083 1492/1366/1083
-f 1495/1369/1084 1499/1373/1084 1494/1368/1084
+f 1495/1369/1083 1499/1373/1083 1494/1368/1083
 f 1496/1370/1083 1498/1372/1083 1495/1369/1083
-f 1498/1372/1084 1499/1373/1084 1495/1369/1084
+f 1498/1372/1083 1499/1373/1083 1495/1369/1083
 f 1496/1370/1083 1497/1371/1083 1498/1372/1083
 o SurfTorus.001
 v 5.344670 -2.655330 -0.176777
@@ -8510,1030 +8509,1030 @@
 vt 0.968750 0.937500
 vt 0.968750 0.968750
 s 1
-f 1500/1374/1085 1532/1440/1086 1563/1472/1087 1531/1438/1088
-f 1501/1378/1089 1533/1442/1090 1532/1441/1086 1500/1375/1085
-f 1502/1380/1091 1534/1443/1092 1533/1442/1090 1501/1378/1089
-f 1503/1382/1093 1535/1444/1094 1534/1443/1092 1502/1380/1091
-f 1504/1384/1095 1536/1445/1096 1535/1444/1094 1503/1382/1093
-f 1505/1386/1097 1537/1446/1098 1536/1445/1096 1504/1384/1095
-f 1506/1388/1099 1538/1447/1100 1537/1446/1098 1505/1386/1097
-f 1507/1390/1101 1539/1448/1102 1538/1447/1100 1506/1388/1099
-f 1508/1392/1103 1540/1449/1104 1539/1448/1102 1507/1390/1101
-f 1509/1394/1105 1541/1450/1106 1540/1449/1104 1508/1392/1103
-f 1510/1396/1107 1542/1451/1108 1541/1450/1106 1509/1394/1105
-f 1511/1398/1109 1543/1452/1110 1542/1451/1108 1510/1396/1107
-f 1512/1400/ 1544/1453/1112 1543/1452/1110 1511/1398/1109
-f 1513/1402/1113 1545/1454/1114 1544/1453/1112 1512/1400/
-f 1514/1404/1115 1546/1455/1116 1545/1454/1114 1513/1402/1113
-f 1515/1406/1117 1547/1456/1118 1546/1455/1116 1514/1404/1115
-f 1516/1408/1119 1548/1457/1120 1547/1456/1118 1515/1406/1117
-f 1517/1410/1121 1549/1458/1122 1548/1457/1120 1516/1408/1119
-f 1518/1412/1123 1550/1459/1124 1549/1458/1122 1517/1410/1121
-f 1519/1414/1125 1551/1460/1126 1550/1459/1124 1518/1412/1123
-f 1520/1416/1127 1552/1461/1128 1551/1460/1126 1519/1414/1125
-f 1521/1418/1129 1553/1462/1130 1552/1461/1128 1520/1416/1127
-f 1522/1420/1131 1554/1463/1132 1553/1462/1130 1521/1418/1129
-f 1523/1422/1133 1555/1464/1134 1554/1463/1132 1522/1420/1131
-f 1524/1424/1135 1556/1465/1136 1555/1464/1134 1523/1422/1133
-f 1525/1426/1137 1557/1466/1138 1556/1465/1136 1524/1424/1135
-f 1526/1428/1139 1558/1467/1140 1557/1466/1138 1525/1426/1137
-f 1527/1430/1141 1559/1468/1142 1558/1467/1140 1526/1428/1139
-f 1528/1432/1143 1560/1469/1144 

[Bf-blender-cvs] SVN commit: bf-blender [62797] trunk/lib/tests/io_tests/obj/all_objects.obj: Update OBJ exporter tests for instancing fix

2022-01-21 Thread Howard Trickey
Revision: 62797
  https://developer.blender.org/rBL62797
Author:   howardt
Date: 2022-01-21 20:43:11 +0100 (Fri, 21 Jan 2022)
Log Message:
---
Update OBJ exporter tests for instancing fix

Modified Paths:
--
trunk/lib/tests/io_tests/obj/all_objects.obj

Modified: trunk/lib/tests/io_tests/obj/all_objects.obj
===
--- trunk/lib/tests/io_tests/obj/all_objects.obj2022-01-21 18:45:21 UTC 
(rev 62796)
+++ trunk/lib/tests/io_tests/obj/all_objects.obj2022-01-21 19:43:11 UTC 
(rev 62797)
@@ -1,6 +1,7 @@
 # Blender 3.1.0 Alpha
 # www.blender.org
 mtllib all_objects.mtl
+o EmptyText
 o EmptyMesh
 o SurfPatch
 v 12.50 -2.50 0.69
@@ -772,231 +773,231 @@
 vt 1.00 0.93
 vt 1.00 1.00
 s 1
-f 2/2/-9 18/18/-8 17/17/-7 1/1/-6
-f 3/3/-5 19/19/-4 18/18/-8 2/2/-9
-f 4/4/-3 20/20/-2 19/19/-4 3/3/-5
-f 5/5/-1 21/21/0 20/20/-2 4/4/-3
-f 6/6/1 22/22/2 21/21/0 5/5/-1
-f 7/7/3 23/23/4 22/22/2 6/6/1
-f 8/8/5 24/24/6 23/23/4 7/7/3
-f 9/9/7 25/25/8 24/24/6 8/8/5
-f 10/10/9 26/26/10 25/25/8 9/9/7
-f 11/11/11 27/27/12 26/26/10 10/10/9
-f 12/12/13 28/28/14 27/27/12 11/11/11
-f 13/13/15 29/29/16 28/28/14 12/12/13
-f 14/14/17 30/30/18 29/29/16 13/13/15
-f 15/15/19 31/31/20 30/30/18 14/14/17
-f 16/16/21 32/32/22 31/31/20 15/15/19
-f 18/18/-8 34/34/23 33/33/24 17/17/-7
-f 19/19/-4 35/35/25 34/34/23 18/18/-8
-f 20/20/-2 36/36/26 35/35/25 19/19/-4
-f 21/21/0 37/37/27 36/36/26 20/20/-2
-f 22/22/2 38/38/28 37/37/27 21/21/0
-f 23/23/4 39/39/29 38/38/28 22/22/2
-f 24/24/6 40/40/30 39/39/29 23/23/4
-f 25/25/8 41/41/31 40/40/30 24/24/6
-f 26/26/10 42/42/32 41/41/31 25/25/8
-f 27/27/12 43/43/33 42/42/32 26/26/10
-f 28/28/14 44/44/34 43/43/33 27/27/12
-f 29/29/16 45/45/35 44/44/34 28/28/14
-f 30/30/18 46/46/36 45/45/35 29/29/16
-f 31/31/20 47/47/37 46/46/36 30/30/18
-f 32/32/22 48/48/38 47/47/37 31/31/20
-f 34/34/23 50/50/39 49/49/40 33/33/24
-f 35/35/25 51/51/41 50/50/39 34/34/23
-f 36/36/26 52/52/42 51/51/41 35/35/25
-f 37/37/27 53/53/43 52/52/42 36/36/26
-f 38/38/28 54/54/44 53/53/43 37/37/27
-f 39/39/29 55/55/45 54/54/44 38/38/28
-f 40/40/30 56/56/46 55/55/45 39/39/29
-f 41/41/31 57/57/47 56/56/46 40/40/30
-f 42/42/32 58/58/48 57/57/47 41/41/31
-f 43/43/33 59/59/49 58/58/48 42/42/32
-f 44/44/34 60/60/50 59/59/49 43/43/33
-f 45/45/35 61/61/51 60/60/50 44/44/34
-f 46/46/36 62/62/52 61/61/51 45/45/35
-f 47/47/37 63/63/53 62/62/52 46/46/36
-f 48/48/38 64/64/54 63/63/53 47/47/37
-f 50/50/39 66/66/55 65/65/56 49/49/40
-f 51/51/41 67/67/57 66/66/55 50/50/39
-f 52/52/42 68/68/58 67/67/57 51/51/41
-f 53/53/43 69/69/59 68/68/58 52/52/42
-f 54/54/44 70/70/60 69/69/59 53/53/43
-f 55/55/45 71/71/61 70/70/60 54/54/44
-f 56/56/46 72/72/62 71/71/61 55/55/45
-f 57/57/47 73/73/63 72/72/62 56/56/46
-f 58/58/48 74/74/64 73/73/63 57/57/47
-f 59/59/49 75/75/65 74/74/64 58/58/48
-f 60/60/50 76/76/66 75/75/65 59/59/49
-f 61/61/51 77/77/67 76/76/66 60/60/50
-f 62/62/52 78/78/68 77/77/67 61/61/51
-f 63/63/53 79/79/69 78/78/68 62/62/52
-f 64/64/54 80/80/70 79/79/69 63/63/53
-f 66/66/55 82/82/71 81/81/72 65/65/56
-f 67/67/57 83/83/73 82/82/71 66/66/55
-f 68/68/58 84/84/74 83/83/73 67/67/57
-f 69/69/59 85/85/75 84/84/74 68/68/58
-f 70/70/60 86/86/76 85/85/75 69/69/59
-f 71/71/61 87/87/77 86/86/76 70/70/60
-f 72/72/62 88/88/78 87/87/77 71/71/61
-f 73/73/63 89/89/79 88/88/78 72/72/62
-f 74/74/64 90/90/80 89/89/79 73/73/63
-f 75/75/65 91/91/81 90/90/80 74/74/64
-f 76/76/66 92/92/82 91/91/81 75/75/65
-f 77/77/67 93/93/83 92/92/82 76/76/66
-f 78/78/68 94/94/84 93/93/83 77/77/67
-f 79/79/69 95/95/85 94/94/84 78/78/68
-f 80/80/70 96/96/86 95/95/85 79/79/69
-f 82/82/71 98/98/87 97/97/88 81/81/72
-f 83/83/73 99/99/89 98/98/87 82/82/71
-f 84/84/74 100/100/90 99/99/89 83/83/73
-f 85/85/75 101/101/91 100/100/90 84/84/74
-f 86/86/76 102/102/92 101/101/91 85/85/75
-f 87/87/77 103/103/93 102/102/92 86/86/76
-f 88/88/78 104/104/94 103/103/93 87/87/77
-f 89/89/79 105/105/95 104/104/94 88/88/78
-f 90/90/80 106/106/96 105/105/95 89/89/79
-f 91/91/81 107/107/97 106/106/96 90/90/80
-f 92/92/82 108/108/98 107/107/97 91/91/81
-f 93/93/83 109/109/99 108/108/98 92/92/82
-f 94/94/84 110/110/100 109/109/99 93/93/83
-f 95/95/85 111/111/101 110/110/100 94/94/84
-f 96/96/86 112/112/102 111/111/101 95/95/85
-f 98/98/87 114/114/103 113/113/104 97/97/88
-f 99/99/89 115/115/105 114/114/103 98/98/87
-f 100/100/90 116/116/106 115/115/105 99/99/89
-f 101/101/91 117/117/107 116/116/106 100/100/90
-f 102/102/92 118/118/108 117/117/107 101/101/91
-f 103/103/93 119/119/109 118/118/108 102/102/92
-f 104/104/94 120/120/110 119/119/109 103/103/93
-f 105/105/95 121/121/111 120/120/110 104/104/94
-f 106/106/96 122/122/112 121/121/111 105/105/95
-f 107/107/97 123/123/113 122/122/112 106/106/96
-f 108/108/98 124/124/114 123/123/113 107/107/97
-f 109/109/99 125/125/115 124/124/114 108/108/98
-f 110/110/100 126/126/116 125/125/115 109/109/99
-f 111/111/101 127/127/117 126/126/116 

[Bf-blender-cvs] [54d69a2fd1b] master: Fix new OBJ exporter to handle instancing.

2022-01-21 Thread Howard Trickey
Commit: 54d69a2fd1be60aaba62f92cd0db5b5ba71495aa
Author: Howard Trickey
Date:   Fri Jan 21 14:37:33 2022 -0500
Branches: master
https://developer.blender.org/rB54d69a2fd1be60aaba62f92cd0db5b5ba71495aa

Fix new OBJ exporter to handle instancing.

The new OBJ exporter did not handle object instances.
The fix is to use a dependency graph iterator, asking for instances.
Unfortunately that iterator makes a temporary copy of instance objects
that does not persist past the iteration, but we need to save all the
objects and meshes to write later, so the Object has to be copied now.

This changed some unit tests. Even though the tests don't have instancing,
the iterator also picks up some Text objects as Mesh ones (which is a good
thing), resulting in two more objects in the all_objects.obj file output.

===

M   source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
M   source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh
M   source/blender/io/wavefront_obj/exporter/obj_exporter.cc
M   source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc

===

diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc 
b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
index d6e1d8a7ea5..b77b5735784 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
@@ -17,6 +17,8 @@
 /** \file
  * \ingroup obj
  */
+/* Silence warnings from copying deprecated fields. Needed for an Object copy 
constructor use. */
+#define DNA_DEPRECATED_ALLOW
 
 #include "BKE_customdata.h"
 #include "BKE_deform.h"
@@ -42,20 +44,21 @@
 namespace blender::io::obj {
 OBJMesh::OBJMesh(Depsgraph *depsgraph, const OBJExportParams _params, 
Object *mesh_object)
 {
-  export_object_eval_ = DEG_get_evaluated_object(depsgraph, mesh_object);
-  export_mesh_eval_ = BKE_object_get_evaluated_mesh(export_object_eval_);
+  /* We need to copy the object because it may be in temporary space. */
+  Object *obj_eval = DEG_get_evaluated_object(depsgraph, mesh_object);
+  export_object_eval_ = *obj_eval;
+  export_mesh_eval_ = BKE_object_get_evaluated_mesh(_object_eval_);
   mesh_eval_needs_free_ = false;
 
   if (!export_mesh_eval_) {
 /* Curves and NURBS surfaces need a new mesh when they're
  * exported in the form of vertices and edges.
  */
-export_mesh_eval_ = BKE_mesh_new_from_object(depsgraph, 
export_object_eval_, true, true);
+export_mesh_eval_ = BKE_mesh_new_from_object(depsgraph, 
_object_eval_, true, true);
 /* Since a new mesh been allocated, it needs to be freed in the 
destructor. */
 mesh_eval_needs_free_ = true;
   }
-  if (export_params.export_triangulated_mesh &&
-  ELEM(export_object_eval_->type, OB_MESH, OB_SURF)) {
+  if (export_params.export_triangulated_mesh && ELEM(export_object_eval_.type, 
OB_MESH, OB_SURF)) {
 std::tie(export_mesh_eval_, mesh_eval_needs_free_) = 
triangulate_mesh_eval();
   }
   set_world_axes_transform(export_params.forward_axis, export_params.up_axis);
@@ -116,10 +119,10 @@ void OBJMesh::set_world_axes_transform(const 
eTransformAxisForward forward,
   mat3_from_axis_conversion(OBJ_AXIS_Y_FORWARD, OBJ_AXIS_Z_UP, forward, up, 
axes_transform);
   /* mat3_from_axis_conversion returns a transposed matrix! */
   transpose_m3(axes_transform);
-  mul_m4_m3m4(world_and_axes_transform_, axes_transform, 
export_object_eval_->obmat);
+  mul_m4_m3m4(world_and_axes_transform_, axes_transform, 
export_object_eval_.obmat);
   /* mul_m4_m3m4 does not transform last row of obmat, i.e. location data. */
-  mul_v3_m3v3(world_and_axes_transform_[3], axes_transform, 
export_object_eval_->obmat[3]);
-  world_and_axes_transform_[3][3] = export_object_eval_->obmat[3][3];
+  mul_v3_m3v3(world_and_axes_transform_[3], axes_transform, 
export_object_eval_.obmat[3]);
+  world_and_axes_transform_[3][3] = export_object_eval_.obmat[3][3];
 }
 
 int OBJMesh::tot_vertices() const
@@ -185,8 +188,14 @@ void OBJMesh::calc_smooth_groups(const bool use_bitflags)
 
 const Material *OBJMesh::get_object_material(const int16_t mat_nr) const
 {
-  /* "+ 1" as material getter needs one-based indices.  */
-  const Material *r_mat = BKE_object_material_get(export_object_eval_, mat_nr 
+ 1);
+  /**
+   * The const_cast is safe here because BKE_object_material_get won't change 
the object
+   * but it is a big can of worms to fix the declaration of that function 
right now.
+   *
+   * The call uses "+ 1" as material getter needs one-based indices.
+   */
+  Object *obj = const_cast(_object_eval_);
+  const Material *r_mat = BKE_object_material_get(obj, mat_nr + 1);
 #ifdef DEBUG
   if (!r_mat) {
 std::cerr << "Material not found for mat_nr = " << mat_nr << std::endl;
@@ -20

[Bf-blender-cvs] SVN commit: bf-blender [62792] trunk/lib/tests/io_tests/obj: Update obj golden files for changes to dedup normals in obj exporter

2022-01-17 Thread Howard Trickey
Revision: 62792
  https://developer.blender.org/rBL62792
Author:   howardt
Date: 2022-01-18 05:29:37 +0100 (Tue, 18 Jan 2022)
Log Message:
---
Update obj golden files for changes to dedup normals in obj exporter

Modified Paths:
--
trunk/lib/tests/io_tests/obj/all_objects.obj
trunk/lib/tests/io_tests/obj/all_quads.obj
trunk/lib/tests/io_tests/obj/all_tris.obj
trunk/lib/tests/io_tests/obj/cube_all_data_triangulated.obj
trunk/lib/tests/io_tests/obj/fgons.obj
trunk/lib/tests/io_tests/obj/suzanne_all_data.obj

Modified: trunk/lib/tests/io_tests/obj/all_objects.obj
===
--- trunk/lib/tests/io_tests/obj/all_objects.obj2022-01-17 18:39:57 UTC 
(rev 62791)
+++ trunk/lib/tests/io_tests/obj/all_objects.obj2022-01-18 04:29:37 UTC 
(rev 62792)
@@ -259,906 +259,262 @@
 v 13.36 -1.51 0.742593
 v 13.42 -1.51 0.720371
 v 13.49 -1.51 0.694445
-vn -0.324632 -0.353080 0.877467
-vn -0.330530 -0.330530 0.884025
-vn -0.353078 -0.324633 0.877467
-vn -0.345605 -0.345607 0.872418
-vn -0.277831 -0.368180 0.887273
-vn -0.283136 -0.344867 0.894931
-vn -0.330530 -0.330530 0.884025
-vn -0.324632 -0.353080 0.877467
-vn -0.229505 -0.381036 0.895622
-vn -0.234077 -0.357095 0.904263
-vn -0.283136 -0.344867 0.894931
-vn -0.277831 -0.368180 0.887273
-vn -0.179891 -0.391504 0.902421
-vn -0.183599 -0.367069 0.911894
-vn -0.234077 -0.357095 0.904263
-vn -0.229505 -0.381036 0.895622
-vn -0.129248 -0.399465 0.907592
-vn -0.131982 -0.374664 0.917719
-vn -0.183599 -0.367069 0.911894
-vn -0.179891 -0.391504 0.902421
-vn -0.077853 -0.404826 0.911074
-vn -0.079529 -0.379783 0.921651
-vn -0.131982 -0.374664 0.917719
-vn -0.129248 -0.399465 0.907592
-vn -0.026003 -0.407523 0.912825
-vn -0.026567 -0.382360 0.923631
-vn -0.079529 -0.379783 0.921651
-vn -0.077853 -0.404826 0.911074
-vn 0.026000 -0.407523 0.912825
-vn 0.026566 -0.382360 0.923632
-vn -0.026567 -0.382360 0.923631
-vn -0.026003 -0.407523 0.912825
-vn 0.077853 -0.404826 0.911074
-vn 0.079529 -0.379783 0.921651
-vn 0.026566 -0.382360 0.923632
-vn 0.026000 -0.407523 0.912825
-vn 0.129248 -0.399465 0.907592
-vn 0.131982 -0.374664 0.917719
-vn 0.079529 -0.379783 0.921651
-vn 0.077853 -0.404826 0.911074
-vn 0.179890 -0.391504 0.902421
-vn 0.183599 -0.367069 0.911895
-vn 0.131982 -0.374664 0.917719
-vn 0.129248 -0.399465 0.907592
-vn 0.229505 -0.381035 0.895622
-vn 0.234076 -0.357095 0.904263
-vn 0.183599 -0.367069 0.911895
-vn 0.179890 -0.391504 0.902421
-vn 0.277830 -0.368180 0.887274
-vn 0.283135 -0.344867 0.894931
-vn 0.234076 -0.357095 0.904263
-vn 0.229505 -0.381035 0.895622
-vn 0.324631 -0.353080 0.877467
-vn 0.330529 -0.330530 0.884025
-vn 0.283135 -0.344867 0.894931
-vn 0.277830 -0.368180 0.887274
-vn 0.345605 -0.345606 0.872418
-vn 0.353079 -0.324633 0.877467
-vn 0.330529 -0.330530 0.884025
-vn 0.324631 -0.353080 0.877467
-vn -0.330530 -0.330530 0.884025
-vn -0.344867 -0.283135 0.894931
-vn -0.368180 -0.277830 0.887273
-vn -0.353078 -0.324633 0.877467
-vn -0.283136 -0.344867 0.894931
-vn -0.296104 -0.296104 0.908099
-vn -0.344867 -0.283135 0.894931
-vn -0.330530 -0.330530 0.884025
-vn -0.234077 -0.357095 0.904263
-vn -0.245303 -0.307235 0.919474
-vn -0.296104 -0.296104 0.908099
-vn -0.283136 -0.344867 0.894931
-vn -0.183599 -0.367069 0.911894
-vn -0.192738 -0.316361 0.928853
-vn -0.245303 -0.307235 0.919474
-vn -0.234077 -0.357095 0.904263
-vn -0.131982 -0.374664 0.917719
-vn -0.138738 -0.323342 0.936057
-vn -0.192738 -0.316361 0.928853
-vn -0.183599 -0.367069 0.911894
-vn -0.079529 -0.379783 0.921651
-vn -0.083678 -0.328062 0.940943
-vn -0.138738 -0.323342 0.936057
-vn -0.131982 -0.374664 0.917719
-vn -0.026567 -0.382360 0.923631
-vn -0.027966 -0.330442 0.943412
-vn -0.083678 -0.328062 0.940943
-vn -0.079529 -0.379783 0.921651
-vn 0.026566 -0.382360 0.923632
-vn 0.027965 -0.330442 0.943412
-vn -0.027966 -0.330442 0.943412
-vn -0.026567 -0.382360 0.923631
-vn 0.079529 -0.379783 0.921651
-vn 0.083677 -0.328062 0.940943
-vn 0.027965 -0.330442 0.943412
-vn 0.026566 -0.382360 0.923632
-vn 0.131982 -0.374664 0.917719
-vn 0.138737 -0.323342 0.936057
-vn 0.083677 -0.328062 0.940943
-vn 0.079529 -0.379783 0.921651
-vn 0.183599 -0.367069 0.911895
-vn 0.192737 -0.316361 0.928853
-vn 0.138737 -0.323342 0.936057
-vn 0.131982 -0.374664 0.917719
-vn 0.234076 -0.357095 0.904263
-vn 0.245302 -0.307235 0.919475
-vn 0.192737 -0.316361 0.928853
-vn 0.183599 -0.367069 0.911895
-vn 0.283135 -0.344867 0.894931
-vn 0.296104 -0.296105 0.908099
-vn 0.245302 -0.307235 0.919475
-vn 0.234076 -0.357095 0.904263
-vn 0.330529 -0.330530 0.884025
-vn 0.344866 -0.283136 0.894931
-vn 0.296104 -0.296105 0.908099
-vn 0.283135 -0.344867 0.894931
-vn 0.353079 -0.324633 0.877467
-vn 0.368179 -0.277830 0.887274
-vn 0.344866 -0.283136 0.894931
-vn 0.330529 -0.330530 0.884025
-vn -0.344867 -0.283135 0.894931
-vn -0.357095 -0.234077 0.904263
-vn -0.381035 -0.229505 0.895622

[Bf-blender-cvs] [6dd89afa966] master: Fix obj exporter tests by deduping normals and printing with less precision.

2022-01-17 Thread Howard Trickey
Commit: 6dd89afa966042f8ae402c848655ac0dc0d795fe
Author: Howard Trickey
Date:   Mon Jan 17 23:22:40 2022 -0500
Branches: master
https://developer.blender.org/rB6dd89afa966042f8ae402c848655ac0dc0d795fe

Fix obj exporter tests by deduping normals and printing with less precision.

Some new obj exporter tests were disabled because the normals were different
in the last decimal place on different platforms.
The old python exporter deduped normals with their coordinates rounded to
four decimal places. This change does the same in the new exporter.
On one test, this produced a file 25% smaller and even ran 10% faster.

===

M   source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc
M   source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh
M   source/blender/io/wavefront_obj/exporter/obj_export_io.hh
M   source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
M   source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh
M   source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc

===

diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc 
b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc
index 45fa75c65b3..8c845c34db2 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc
@@ -175,23 +175,13 @@ void OBJWriter::write_uv_coords(OBJMesh _obj_mesh_data) 
const
   }
 }
 
-void OBJWriter::write_poly_normals(const OBJMesh _mesh_data) const
+void OBJWriter::write_poly_normals(OBJMesh _mesh_data)
 {
   obj_mesh_data.ensure_mesh_normals();
-  Vector lnormals;
-  const int tot_polygons = obj_mesh_data.tot_polygons();
-  for (int i = 0; i < tot_polygons; i++) {
-if (obj_mesh_data.is_ith_poly_smooth(i)) {
-  obj_mesh_data.calc_loop_normals(i, lnormals);
-  for (const float3  : lnormals) {
-file_handler_->write(lnormal[0], 
lnormal[1], lnormal[2]);
-  }
-}
-else {
-  float3 poly_normal = obj_mesh_data.calc_poly_normal(i);
-  file_handler_->write(
-  poly_normal[0], poly_normal[1], poly_normal[2]);
-}
+  Vector normals;
+  obj_mesh_data.store_normal_coords_and_indices(normals);
+  for (const float3  : normals) {
+file_handler_->write(normal[0], normal[1], 
normal[2]);
   }
 }
 
@@ -298,28 +288,17 @@ void OBJWriter::write_poly_elements(const OBJMesh 
_mesh_data,
   const func_vert_uv_normal_indices poly_element_writer = 
get_poly_element_writer(
   obj_mesh_data.tot_uv_vertices());
 
-  /* Number of normals may not be equal to number of polygons due to smooth 
shading. */
-  int per_object_tot_normals = 0;
   const int tot_polygons = obj_mesh_data.tot_polygons();
   for (int i = 0; i < tot_polygons; i++) {
 Vector poly_vertex_indices = 
obj_mesh_data.calc_poly_vertex_indices(i);
 Span poly_uv_indices = obj_mesh_data.calc_poly_uv_indices(i);
-/* For an Object, a normal index depends on how many of its normals have 
been written before
- * it. This is unknown because of smooth shading. So pass "per object 
total normals"
- * and update it after each call. */
-int new_normals = 0;
-Vector poly_normal_indices;
-std::tie(new_normals, poly_normal_indices) = 
obj_mesh_data.calc_poly_normal_indices(
-i, per_object_tot_normals);
-per_object_tot_normals += new_normals;
+Vector poly_normal_indices = 
obj_mesh_data.calc_poly_normal_indices(i);
 
 last_poly_smooth_group = write_smooth_group(obj_mesh_data, i, 
last_poly_smooth_group);
 last_poly_vertex_group = write_vertex_group(obj_mesh_data, i, 
last_poly_vertex_group);
 last_poly_mat_nr = write_poly_material(obj_mesh_data, i, last_poly_mat_nr, 
matname_fn);
 (this->*poly_element_writer)(poly_vertex_indices, poly_uv_indices, 
poly_normal_indices);
   }
-  /* Unusual: Other indices are updated in #OBJWriter::update_index_offsets. */
-  index_offsets_.normal_offset += per_object_tot_normals;
 }
 
 void OBJWriter::write_edges_indices(const OBJMesh _mesh_data) const
@@ -390,7 +369,7 @@ void OBJWriter::update_index_offsets(const OBJMesh 
_mesh_data)
 {
   index_offsets_.vertex_offset += obj_mesh_data.tot_vertices();
   index_offsets_.uv_vertex_offset += obj_mesh_data.tot_uv_vertices();
-  /* Normal index is updated right after writing the normals. */
+  index_offsets_.normal_offset += obj_mesh_data.tot_normal_indices();
 }
 
 /*  */
diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh 
b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh
index 3403d059068..1cad179a70c 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_fil

[Bf-blender-cvs] [9109ea0b969] master: Disable some failing new obj exporter tests.

2022-01-14 Thread Howard Trickey
Commit: 9109ea0b969f94e614e7a52807b00f3cd9e9383f
Author: Howard Trickey
Date:   Fri Jan 14 12:34:07 2022 -0500
Branches: master
https://developer.blender.org/rB9109ea0b969f94e614e7a52807b00f3cd9e9383f

Disable some failing new obj exporter tests.

The switch to how normals are kept has led to tiny differences in
the normal output values on different platforms. Disabling the failing
tests while working on a solution to this problem.

===

M   source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc

===

diff --git a/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc 
b/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc
index e7db1c36203..3b44a72ca0c 100644
--- a/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc
+++ b/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc
@@ -390,6 +390,7 @@ TEST_F(obj_exporter_regression_test, 
cube_all_data_triangulated)
_export.params);
 }
 
+#if 0
 TEST_F(obj_exporter_regression_test, suzanne_all_data)
 {
   OBJExportParamsDefault _export;
@@ -414,5 +415,6 @@ TEST_F(obj_exporter_regression_test, all_objects)
"io_tests/obj/all_objects.mtl",
_export.params);
 }
+#endif
 
 }  // namespace blender::io::obj

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [0e1da8dd120] master: In obj exporter test, fix a strncpy length and a stray test file left behind.

2022-01-05 Thread Howard Trickey
Commit: 0e1da8dd120d1d2b4f699087b102ce0573ed90be
Author: Howard Trickey
Date:   Wed Jan 5 17:04:47 2022 -0500
Branches: master
https://developer.blender.org/rB0e1da8dd120d1d2b4f699087b102ce0573ed90be

In obj exporter test, fix a strncpy length and a stray test file left behind.

===

M   source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc

===

diff --git a/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc 
b/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc
index f12bfd0cea5..0feca806f35 100644
--- a/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc
+++ b/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc
@@ -229,6 +229,7 @@ TEST(obj_exporter_writer, mtllib)
   }
   const std::string result = read_temp_file_in_string(out_file_path);
   ASSERT_EQ(result, "mtllib blah.mtl\nmtllib blah.mtl\n");
+  BLI_delete(out_file_path.c_str(), false, false);
 }
 
 /* Return true if string #a and string #b are equal after their first newline. 
*/
@@ -286,7 +287,7 @@ class obj_exporter_regression_test : public 
obj_exporter_test {
 BKE_tempdir_init(NULL);
 std::string tempdir = std::string(BKE_tempdir_base());
 std::string out_file_path = tempdir + 
BLI_path_basename(golden_obj.c_str());
-strncpy(params.filepath, out_file_path.c_str(), FILE_MAX);
+strncpy(params.filepath, out_file_path.c_str(), FILE_MAX - 1);
 params.blen_filepath = blendfile.c_str();
 export_frame(depsgraph, params, out_file_path.c_str());
 std::string output_str = read_temp_file_in_string(out_file_path);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [4e44cfa3d99] master: Add a new C++ version of an exporter for the Wavefront .obj format.

2022-01-03 Thread Howard Trickey
Commit: 4e44cfa3d9969f0f3e175b53f116f377278a3245
Author: Howard Trickey
Date:   Mon Jan 3 14:49:31 2022 -0500
Branches: master
https://developer.blender.org/rB4e44cfa3d9969f0f3e175b53f116f377278a3245

Add a new C++ version of an exporter for the Wavefront .obj format.

This was originally written by Ankit Meel as a GSoC 2020 project.
Howard Trickey added some tests and made some corrections/modifications.
See D13046 for more details.

This commit inserts a new menu item into the export menu called
"Wavefront OBJ (.obj) - New".
For now the old Python exporter remains in the menu, along with
the Python importer, but we plan to remove it soon (leaving the
old addon bundled with Blender but not enabled by default).

===

M   release/scripts/startup/bl_ui/space_topbar.py
M   source/blender/blenloader/CMakeLists.txt
M   source/blender/blenloader/tests/blendfile_loading_base_test.cc
M   source/blender/editors/io/CMakeLists.txt
A   source/blender/editors/io/io_obj.c
A   source/blender/editors/io/io_obj.h
M   source/blender/editors/io/io_ops.c
M   source/blender/editors/space_file/filesel.c
M   source/blender/io/CMakeLists.txt
A   source/blender/io/wavefront_obj/CMakeLists.txt
A   source/blender/io/wavefront_obj/IO_wavefront_obj.cc
A   source/blender/io/wavefront_obj/IO_wavefront_obj.h
A   source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc
A   source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh
A   source/blender/io/wavefront_obj/exporter/obj_export_io.hh
A   source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
A   source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh
A   source/blender/io/wavefront_obj/exporter/obj_export_mtl.cc
A   source/blender/io/wavefront_obj/exporter/obj_export_mtl.hh
A   source/blender/io/wavefront_obj/exporter/obj_export_nurbs.cc
A   source/blender/io/wavefront_obj/exporter/obj_export_nurbs.hh
A   source/blender/io/wavefront_obj/exporter/obj_exporter.cc
A   source/blender/io/wavefront_obj/exporter/obj_exporter.hh
A   source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc
A   source/blender/io/wavefront_obj/tests/obj_exporter_tests.hh
M   source/blender/windowmanager/intern/wm_operator_props.c

===

diff --git a/release/scripts/startup/bl_ui/space_topbar.py 
b/release/scripts/startup/bl_ui/space_topbar.py
index 3137ac43549..99abc60db6f 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -481,6 +481,7 @@ class TOPBAR_MT_file_export(Menu):
 bl_owner_use_filter = False
 
 def draw(self, _context):
+self.layout.operator("wm.obj_export", text="Wavefront OBJ (.obj) - 
New")
 if bpy.app.build_options.collada:
 self.layout.operator("wm.collada_export",
  text="Collada (Default) (.dae)")
diff --git a/source/blender/blenloader/CMakeLists.txt 
b/source/blender/blenloader/CMakeLists.txt
index 05f74bfa834..245514d4977 100644
--- a/source/blender/blenloader/CMakeLists.txt
+++ b/source/blender/blenloader/CMakeLists.txt
@@ -26,6 +26,7 @@ set(INC
   ../blentranslation
   ../depsgraph
   ../draw
+  ../editors/include
   ../imbuf
   ../makesdna
   ../makesrna
diff --git a/source/blender/blenloader/tests/blendfile_loading_base_test.cc 
b/source/blender/blenloader/tests/blendfile_loading_base_test.cc
index 32d288f35e1..7a8afbcb227 100644
--- a/source/blender/blenloader/tests/blendfile_loading_base_test.cc
+++ b/source/blender/blenloader/tests/blendfile_loading_base_test.cc
@@ -27,9 +27,11 @@
 #include "BKE_idtype.h"
 #include "BKE_image.h"
 #include "BKE_main.h"
+#include "BKE_mball_tessellate.h"
 #include "BKE_modifier.h"
 #include "BKE_node.h"
 #include "BKE_scene.h"
+#include "BKE_vfont.h"
 
 #include "BLI_path_util.h"
 #include "BLI_threads.h"
@@ -44,6 +46,8 @@
 
 #include "IMB_imbuf.h"
 
+#include "ED_datafiles.h"
+
 #include "RNA_define.h"
 
 #include "WM_api.h"
@@ -73,6 +77,7 @@ void BlendfileLoadingBaseTest::SetUpTestCase()
   RNA_init();
   BKE_node_system_init();
   BKE_callback_global_init();
+  BKE_vfont_builtin_register(datatoc_bfont_pfb, datatoc_bfont_pfb_size);
 
   G.background = true;
   G.factory_startup = true;
@@ -111,6 +116,7 @@ void BlendfileLoadingBaseTest::TearDownTestCase()
 
 void BlendfileLoadingBaseTest::TearDown()
 {
+  BKE_mball_cubeTable_free();
   depsgraph_free();
   blendfile_free();
 
diff --git a/source/blender/editors/io/CMakeLists.txt 
b/source/blender/editors/io/CMakeLists.txt
index 44b5f85050f..f4da114159f 100644
--- a/source/blender/editors/io/CMakeLists.txt
+++ b/source/blender/

[Bf-blender-cvs] [c26011efcbe] master: Fix T92962 Boolean output indices unstable.

2021-11-24 Thread Howard Trickey
Commit: c26011efcbe1d888962bb9a696723db228dac3cf
Author: Howard Trickey
Date:   Wed Nov 24 15:25:32 2021 -0500
Branches: master
https://developer.blender.org/rBc26011efcbe1d888962bb9a696723db228dac3cf

Fix T92962 Boolean output indices unstable.

A parallel loop to create the interesection meshes for each triangle
meant that with parallelism, the output order of the created meshes
could vary with each execution. Keep the parallelism for doing the CDTs
for interesection, but move the extraction of the new faces into a
serial loop afterwards, for repeatability.

===

M   source/blender/blenlib/intern/mesh_intersect.cc

===

diff --git a/source/blender/blenlib/intern/mesh_intersect.cc 
b/source/blender/blenlib/intern/mesh_intersect.cc
index feb7b64f766..a09276a1abb 100644
--- a/source/blender/blenlib/intern/mesh_intersect.cc
+++ b/source/blender/blenlib/intern/mesh_intersect.cc
@@ -2567,79 +2567,6 @@ static void calc_overlap_itts(Map, 
ITT_value> _map,
   BLI_task_parallel_range(0, tot_intersect_pairs, , 
calc_overlap_itts_range_func, );
 }
 
-/**
- * Data needed for parallelization of calc_subdivided_non_cluster_tris.
- */
-struct OverlapTriRange {
-  int tri_index;
-  int overlap_start;
-  int len;
-};
-struct SubdivideTrisData {
-  Array _tri_subdivided;
-  const IMesh 
-  const Map, ITT_value> _map;
-  Span overlap;
-  IMeshArena *arena;
-
-  /* This vector gives, for each triangle in tm that has an intersection
-   * we want to calculate: what the index of that triangle in tm is,
-   * where it starts in the ov structure as indexA, and how many
-   * overlap pairs have that same indexA (they will be continuous). */
-  Vector overlap_tri_range;
-
-  SubdivideTrisData(Array _tri_subdivided,
-const IMesh ,
-const Map, ITT_value> _map,
-Span overlap,
-IMeshArena *arena)
-  : r_tri_subdivided(r_tri_subdivided),
-tm(tm),
-itt_map(itt_map),
-overlap(overlap),
-arena(arena)
-  {
-  }
-};
-
-static void calc_subdivided_tri_range_func(void *__restrict userdata,
-   const int iter,
-   const TaskParallelTLS *__restrict 
UNUSED(tls))
-{
-  constexpr int dbg_level = 0;
-  SubdivideTrisData *data = static_cast(userdata);
-  OverlapTriRange  = data->overlap_tri_range[iter];
-  int t = otr.tri_index;
-  if (dbg_level > 0) {
-std::cout << "calc_subdivided_tri_range_func\nt=" << t << " start=" << 
otr.overlap_start
-  << " len=" << otr.len << "\n";
-  }
-  constexpr int inline_capacity = 100;
-  Vector itts(otr.len);
-  for (int j = otr.overlap_start; j < otr.overlap_start + otr.len; ++j) {
-int t_other = data->overlap[j].indexB;
-std::pair key = canon_int_pair(t, t_other);
-ITT_value itt;
-if (data->itt_map.contains(key)) {
-  itt = data->itt_map.lookup(key);
-}
-if (itt.kind != INONE) {
-  itts.append(itt);
-}
-if (dbg_level > 0) {
-  std::cout << "  tri t" << t_other << "; result = " << itt << "\n";
-}
-  }
-  if (itts.size() > 0) {
-CDT_data cd_data = prepare_cdt_input(data->tm, t, itts);
-do_cdt(cd_data);
-data->r_tri_subdivided[t] = extract_subdivided_tri(cd_data, data->tm, t, 
data->arena);
-if (dbg_level > 0) {
-  std::cout << "subdivide output\n" << data->r_tri_subdivided[t];
-}
-  }
-}
-
 /**
  * For each triangle in tm, fill in the corresponding slot in
  * r_tri_subdivided with the result of intersecting it with
@@ -2658,10 +2585,14 @@ static void 
calc_subdivided_non_cluster_tris(Array _tri_subdivided,
 std::cout << "\nCALC_SUBDIVIDED_TRIS\n\n";
   }
   Span overlap = ov.overlap();
-  SubdivideTrisData data(r_tri_subdivided, tm, itt_map, overlap, arena);
+  struct OverlapTriRange {
+int tri_index;
+int overlap_start;
+int len;
+  };
+  Vector overlap_tri_range;
   int overlap_tot = overlap.size();
-  data.overlap_tri_range = Vector();
-  data.overlap_tri_range.reserve(overlap_tot);
+  overlap_tri_range.reserve(overlap_tot);
   int overlap_index = 0;
   while (overlap_index < overlap_tot) {
 int t = overlap[overlap_index].indexA;
@@ -2676,7 +2607,7 @@ static void calc_subdivided_non_cluster_tris(Array 
_tri_subdivided,
   int len = i - overlap_index + 1;
   if (!(len == 1 && overlap[overlap_index].indexB == t)) {
 OverlapTriRange range = {t, overlap_index, len};
-data.overlap_tri_range.append(range);
+overlap_tri_range.append(range);
 #  ifdef PERFDEBUG
 bumpperfcount(0, len); /* Non-cluster overlaps

[Bf-blender-cvs] [55c82d8380e] master: Fix T84493 issue with selection after boolean.

2021-11-22 Thread Howard Trickey
Commit: 55c82d8380ea3fd37a9d966fad10f42cc5b365d5
Author: Howard Trickey
Date:   Mon Nov 22 11:47:46 2021 -0500
Branches: master
https://developer.blender.org/rB55c82d8380ea3fd37a9d966fad10f42cc5b365d5

Fix T84493 issue with selection after boolean.

According to Blender selection rules, selections should be flushed
to containing elements. Added an EDMB_select_flush() after edit
mode booleans or intersects are done. Hopefully this doesn't break
any scripts that might have been depending on the old (broken) behavior.

===

M   source/blender/editors/mesh/editmesh_intersect.c

===

diff --git a/source/blender/editors/mesh/editmesh_intersect.c 
b/source/blender/editors/mesh/editmesh_intersect.c
index ee227c58fe7..18fe9cf7ad3 100644
--- a/source/blender/editors/mesh/editmesh_intersect.c
+++ b/source/blender/editors/mesh/editmesh_intersect.c
@@ -114,6 +114,7 @@ static void edbm_intersect_select(BMEditMesh *em, struct 
Mesh *me, bool do_selec
 }
   }
 }
+EDBM_select_flush(em);
   }
 
   EDBM_update(me,

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e9bbfd0c8c7] soc-2020-io-performance: Merge branch 'master' into soc-2020-io-performance

2021-10-30 Thread Howard Trickey
Commit: e9bbfd0c8c7a508d220bf355722ff03f91e93183
Author: Howard Trickey
Date:   Sat Oct 30 15:37:05 2021 -0400
Branches: soc-2020-io-performance
https://developer.blender.org/rBe9bbfd0c8c7a508d220bf355722ff03f91e93183

Merge branch 'master' into soc-2020-io-performance

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [1aa953bd191] soc-2020-io-performance: Merge branch 'master' into soc-2020-io-performance

2021-10-24 Thread Howard Trickey
Commit: 1aa953bd1913c81b22c80a00edbf4ad88a32c52f
Author: Howard Trickey
Date:   Sun Oct 24 08:31:22 2021 -0400
Branches: soc-2020-io-performance
https://developer.blender.org/rB1aa953bd1913c81b22c80a00edbf4ad88a32c52f

Merge branch 'master' into soc-2020-io-performance

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] SVN commit: bf-blender [62723] trunk/lib/tests/io_tests: Added new regression file outputs for new obj exporter.

2021-10-17 Thread Howard Trickey
Revision: 62723
  https://developer.blender.org/rBL62723
Author:   howardt
Date: 2021-10-17 22:27:02 +0200 (Sun, 17 Oct 2021)
Log Message:
---
Added new regression file outputs for new obj exporter.
Rewrote all_objects.blend so that it can be read by
the BlendfileLoadingBaseTest class (needs a later Blender
version file). Also selected an object in that file
to be able to test selected-only export.

Modified Paths:
--
trunk/lib/tests/io_tests/blend_scene/all_objects.blend

Added Paths:
---
trunk/lib/tests/io_tests/obj/all_objects.mtl
trunk/lib/tests/io_tests/obj/all_objects.obj
trunk/lib/tests/io_tests/obj/all_quads.obj
trunk/lib/tests/io_tests/obj/cube_all_data_triangulated.obj
trunk/lib/tests/io_tests/obj/edges.obj
trunk/lib/tests/io_tests/obj/fgons.obj
trunk/lib/tests/io_tests/obj/nurbs.obj
trunk/lib/tests/io_tests/obj/nurbs_mesh.obj
trunk/lib/tests/io_tests/obj/suzanne_all_data.obj
trunk/lib/tests/io_tests/obj/vertices.obj

Modified: trunk/lib/tests/io_tests/blend_scene/all_objects.blend
===
(Binary files differ)

Added: trunk/lib/tests/io_tests/obj/all_objects.mtl
===
--- trunk/lib/tests/io_tests/obj/all_objects.mtl
(rev 0)
+++ trunk/lib/tests/io_tests/obj/all_objects.mtl2021-10-17 20:27:02 UTC 
(rev 62723)
@@ -0,0 +1,72 @@
+# Blender 3.0.0 Alpha MTL File: 'all_objects.blend'
+# www.blender.org
+
+newmtl Blue
+Ns 225.00
+Ka 1.00 1.00 1.00
+Kd 0.00 0.00 1.00
+Ks 0.50 0.50 0.50
+Ke 0.00 0.00 0.00
+Ni 1.00
+d 1.00
+illum 2
+
+newmtl BlueDark
+Ns 225.00
+Ka 1.00 1.00 1.00
+Kd 0.00 0.00 0.50
+Ks 0.50 0.50 0.50
+Ke 0.00 0.00 0.00
+Ni 1.00
+d 1.00
+illum 2
+
+newmtl Green
+Ns 225.00
+Ka 1.00 1.00 1.00
+Kd 0.00 1.00 0.00
+Ks 0.50 0.50 0.50
+Ke 0.00 0.00 0.00
+Ni 1.00
+d 1.00
+illum 2
+
+newmtl GreenDark
+Ns 225.00
+Ka 1.00 1.00 1.00
+Kd 0.00 0.50 0.00
+Ks 0.50 0.50 0.50
+Ke 0.00 0.00 0.00
+Ni 1.00
+d 1.00
+illum 2
+
+newmtl Material
+Ns 225.00
+Ka 1.00 1.00 1.00
+Kd 0.80 0.80 0.80
+Ks 0.50 0.50 0.50
+Ke 0.00 0.00 0.00
+Ni 1.00
+d 1.00
+illum 2
+
+newmtl Red
+Ns 225.00
+Ka 1.00 1.00 1.00
+Kd 1.00 0.00 0.00
+Ks 0.50 0.50 0.50
+Ke 0.00 0.00 0.00
+Ni 1.00
+d 1.00
+illum 2
+
+newmtl RedDark
+Ns 225.00
+Ka 1.00 1.00 1.00
+Kd 0.50 0.00 0.00
+Ks 0.50 0.50 0.50
+Ke 0.00 0.00 0.00
+Ni 1.00
+d 1.00
+illum 2

Added: trunk/lib/tests/io_tests/obj/all_objects.obj
===
--- trunk/lib/tests/io_tests/obj/all_objects.obj
(rev 0)
+++ trunk/lib/tests/io_tests/obj/all_objects.obj2021-10-17 20:27:02 UTC 
(rev 62723)
@@ -0,0 +1,15663 @@
+# Blender 3.0.0 Alpha
+# www.blender.org
+mtllib all_objects.mtl
+o EmptyMesh
+o SurfPatch
+v 12.50 -2.50 0.69
+v 12.57 -2.50 0.720370
+v 12.63 -2.50 0.742593
+v 12.70 -2.50 0.76
+v 12.76 -2.50 0.775926
+v 12.83 -2.50 0.787037
+v 12.90 -2.50 0.79
+v 12.96 -2.50 0.798148
+v 13.03 -2.50 0.798148
+v 13.09 -2.50 0.794445
+v 13.16 -2.50 0.787037
+v 13.23 -2.50 0.775926
+v 13.29 -2.50 0.76
+v 13.36 -2.50 0.742593
+v 13.42 -2.50 0.720371
+v 13.49 -2.50 0.694445
+v 12.50 -2.43 0.720370
+v 12.57 -2.43 0.747264
+v 12.63 -2.43 0.770316
+v 12.70 -2.43 0.789526
+v 12.76 -2.43 0.804894
+v 12.83 -2.43 0.816420
+v 12.90 -2.43 0.824104
+v 12.96 -2.43 0.827946
+v 13.03 -2.43 0.827946
+v 13.09 -2.43 0.824104
+v 13.16 -2.43 0.816420
+v 13.23 -2.43 0.804894
+v 13.29 -2.43 0.789526
+v 13.36 -2.43 0.770316
+v 13.42 -2.43 0.747265
+v 13.49 -2.43 0.720371
+v 12.50 -2.37 0.742593
+v 12.57 -2.37 0.770316
+v 12.63 -2.37 0.794079
+v 12.70 -2.37 0.813881
+v 12.76 -2.37 0.829723
+v 12.83 -2.37 0.841605
+v 12.90 -2.37 0.849526
+v 12.96 -2.37 0.853486
+v 13.03 -2.37 0.853486
+v 13.09 -2.37 0.849526
+v 13.16 -2.37 0.841605
+v 13.23 -2.37 0.829724
+v 13.29 -2.37 0.813882
+v 13.36 -2.37 0.794079
+v 13.42 -2.37 0.770316
+v 13.49 -2.37 0.742593
+v 12.50 -2.30 0.76
+v 12.57 -2.30 0.789526
+v 12.63 -2.30 0.813881
+v 12.70 -2.30 0.834178
+v 12.76 

[Bf-blender-cvs] [fc171c1be9d] soc-2020-io-performance: Add more regression tests for new obj exporter.

2021-10-17 Thread Howard Trickey
Commit: fc171c1be9da36485e892339b86dc8d4251914af
Author: Howard Trickey
Date:   Sun Oct 17 16:17:45 2021 -0400
Branches: soc-2020-io-performance
https://developer.blender.org/rBfc171c1be9da36485e892339b86dc8d4251914af

Add more regression tests for new obj exporter.

This adds regression tests for exporting most of the blend files
in the io_tests/blend_geometry and io_tests/blend_scene tests.
A fix was necessary in the BlendfileLoadingBaseTest class to prevent
leakage of some global data generated when a loaded file has metaballs.
Also, had to fix the exporter to deal with empty curves.

===

M   source/blender/blenloader/CMakeLists.txt
M   source/blender/blenloader/tests/blendfile_loading_base_test.cc
M   source/blender/io/wavefront_obj/exporter/obj_exporter.cc
M   source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc

===

diff --git a/source/blender/blenloader/CMakeLists.txt 
b/source/blender/blenloader/CMakeLists.txt
index 89631588ed0..ca4b7cc2a32 100644
--- a/source/blender/blenloader/CMakeLists.txt
+++ b/source/blender/blenloader/CMakeLists.txt
@@ -26,6 +26,7 @@ set(INC
   ../blentranslation
   ../depsgraph
   ../draw
+  ../editors/include
   ../imbuf
   ../makesdna
   ../makesrna
diff --git a/source/blender/blenloader/tests/blendfile_loading_base_test.cc 
b/source/blender/blenloader/tests/blendfile_loading_base_test.cc
index 8afa631ffc5..ebafab9cd93 100644
--- a/source/blender/blenloader/tests/blendfile_loading_base_test.cc
+++ b/source/blender/blenloader/tests/blendfile_loading_base_test.cc
@@ -26,9 +26,11 @@
 #include "BKE_idtype.h"
 #include "BKE_image.h"
 #include "BKE_main.h"
+#include "BKE_mball_tessellate.h"
 #include "BKE_modifier.h"
 #include "BKE_node.h"
 #include "BKE_scene.h"
+#include "BKE_vfont.h"
 
 #include "BLI_path_util.h"
 #include "BLI_threads.h"
@@ -43,6 +45,8 @@
 
 #include "IMB_imbuf.h"
 
+#include "ED_datafiles.h"
+
 #include "RNA_define.h"
 
 #include "WM_api.h"
@@ -70,6 +74,7 @@ void BlendfileLoadingBaseTest::SetUpTestCase()
   DEG_register_node_types();
   RNA_init();
   BKE_node_system_init();
+  BKE_vfont_builtin_register(datatoc_bfont_pfb, datatoc_bfont_pfb_size);
 
   G.background = true;
   G.factory_startup = true;
@@ -107,6 +112,7 @@ void BlendfileLoadingBaseTest::TearDownTestCase()
 
 void BlendfileLoadingBaseTest::TearDown()
 {
+  BKE_mball_cubeTable_free();
   depsgraph_free();
   blendfile_free();
 
diff --git a/source/blender/io/wavefront_obj/exporter/obj_exporter.cc 
b/source/blender/io/wavefront_obj/exporter/obj_exporter.cc
index 9bf75105d78..1c59bd43aab 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_exporter.cc
+++ b/source/blender/io/wavefront_obj/exporter/obj_exporter.cc
@@ -112,6 +112,14 @@ filter_supported_objects(Depsgraph *depsgraph, const 
OBJExportParams _par
   case OB_CURVE: {
 Curve *curve = static_cast(object_in_layer->data);
 Nurb *nurb{static_cast(curve->nurb.first)};
+if (!nurb) {
+  /* An empty curve. Not yet supported to export these as meshes. */
+  if (export_params.export_curves_as_nurbs) {
+r_exportable_nurbs.append(
+std::make_unique(depsgraph, export_params, 
object_in_layer));
+  }
+  break;
+}
 switch (nurb->type) {
   case CU_NURBS: {
 if (export_params.export_curves_as_nurbs) {
@@ -137,6 +145,7 @@ filter_supported_objects(Depsgraph *depsgraph, const 
OBJExportParams _par
 break;
   }
 }
+break;
   }
   default: {
 /* Other object types are not supported. */
diff --git a/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc 
b/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc
index 2b6efe8da3f..cec8fc6006f 100644
--- a/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc
+++ b/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc
@@ -47,10 +47,8 @@ class obj_exporter_test : public BlendfileLoadingBaseTest {
   }
 };
 
-// https://developer.blender.org/F9260238
-const std::string all_objects_file = 
"io_tests/blend_scene/all_objects_2_92.blend";
-// https://developer.blender.org/F9278970
-const std::string all_curve_objects_file = 
"io_tests/blend_scene/all_curves_2_92.blend";
+const std::string all_objects_file = "io_tests/blend_scene/all_objects.blend";
+const std::string all_curve_objects_file = 
"io_tests/blend_scene/all_curves.blend";
 
 TEST_F(obj_exporter_test, filter_objects_curves_as_mesh)
 {
@@ -59,9 +57,8 @@ TEST_F(obj_exporter_test, filter_objects_curves_as_mesh)
 ADD_FAILURE();
 return;
   }
-
   auto [objmeshes, objcurves]{filter_supported_obj

[Bf-blender-cvs] [6e9eebe286b] soc-2020-io-performance: Merge branch 'master' into soc-2020-io-performance

2021-10-14 Thread Howard Trickey
Commit: 6e9eebe286b58c59f63499e0dc56618e799ad6d3
Author: Howard Trickey
Date:   Sun Sep 19 16:49:59 2021 -0400
Branches: soc-2020-io-performance
https://developer.blender.org/rB6e9eebe286b58c59f63499e0dc56618e799ad6d3

Merge branch 'master' into soc-2020-io-performance

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [96c80950a1d] soc-2020-io-performance: Merge branch 'master' into soc-2020-io-performance

2021-10-14 Thread Howard Trickey
Commit: 96c80950a1d6d4458dd0769306d59dcee836abcc
Author: Howard Trickey
Date:   Thu Oct 14 13:25:59 2021 -0400
Branches: soc-2020-io-performance
https://developer.blender.org/rB96c80950a1d6d4458dd0769306d59dcee836abcc

Merge branch 'master' into soc-2020-io-performance

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [1bfa9539d3b] master: Fix T91889 Exact boolean sometimes drops triangles.

2021-10-10 Thread Howard Trickey
Commit: 1bfa9539d3b50da2530c6273d2f692fb57f9c267
Author: Howard Trickey
Date:   Sun Oct 10 19:54:02 2021 -0400
Branches: master
https://developer.blender.org/rB1bfa9539d3b50da2530c6273d2f692fb57f9c267

Fix T91889 Exact boolean sometimes drops triangles.

The problem is that the fast triangulator (based on polyfill)
sometimes makes degenerate triangles. Commit 8115f0c5bd91f had
a check for degenerate triangles but it wasn't thorough enough.
This commit uses a more thorough (and pessimistic) test for
degenerate triangles, using the exact triangulator in those cases.

===

M   source/blender/blenlib/intern/mesh_intersect.cc

===

diff --git a/source/blender/blenlib/intern/mesh_intersect.cc 
b/source/blender/blenlib/intern/mesh_intersect.cc
index 526871c7b1f..8276890eec1 100644
--- a/source/blender/blenlib/intern/mesh_intersect.cc
+++ b/source/blender/blenlib/intern/mesh_intersect.cc
@@ -2225,8 +2225,7 @@ static bool face_is_degenerate(const Face *f)
   return false;
 }
 
-/** Fast check for degenerate tris. Only tests for when verts are identical,
- * not cases where there are zero-length edges. */
+/** Fast check for degenerate tris. It is OK if it returns true for nearly 
degenerate triangles. */
 static bool any_degenerate_tris_fast(const Array triangulation)
 {
   for (const Face *f : triangulation) {
@@ -2236,6 +2235,23 @@ static bool any_degenerate_tris_fast(const Array 
triangulation)
 if (v0 == v1 || v0 == v2 || v1 == v2) {
   return true;
 }
+double3 da = v2->co - v0->co;
+double3 db = v2->co - v1->co;
+double da_length_squared = da.length_squared();
+double db_length_squared = db.length_squared();
+if (da_length_squared == 0.0 || db_length_squared == 0.0) {
+  return true;
+}
+/* |da x db| = |da| |db| sin t, where t is angle between them.
+ * The triangle is almost degenerate if sin t is almost 0.
+ * sin^2 t = |da x db|^2 / (|da|^2 |db|^2)
+ */
+double3 dab = double3::cross_high_precision(da, db);
+double dab_length_squared = dab.length_squared();
+double sin_squared_t = dab_length_squared / (da_length_squared * 
db_length_squared);
+if (sin_squared_t < 1e-8) {
+  return true;
+}
   }
   return false;
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [98fe05fb5b9] master: Fix T91810 Bevel not working well with certain unbeveled edge positions.

2021-10-03 Thread Howard Trickey
Commit: 98fe05fb5b9e1e2ee18ff56806fa66de2615
Author: Howard Trickey
Date:   Sun Oct 3 11:26:48 2021 -0400
Branches: master
https://developer.blender.org/rB98fe05fb5b9e1e2ee18ff56806fa66de2615

Fix T91810 Bevel not working well with certain unbeveled edge positions.

A previous commit, c56526d8b68ab, which sometimes didn't drop offsets
into 'in plane' faces, as a fix to T71329, was overly aggressive.
If all the intermediate edges are in the same plane then it is fine
to just put the meeting point on the plane of the start and end edges.

===

M   source/blender/bmesh/tools/bmesh_bevel.c

===

diff --git a/source/blender/bmesh/tools/bmesh_bevel.c 
b/source/blender/bmesh/tools/bmesh_bevel.c
index 1f759e9ef43..8bd498a08bd 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -3048,7 +3048,9 @@ static void build_boundary(BevelParams *bp, BevVert *bv, 
bool construct)
 }
   }
   else {
-offset_meet(bp, e, e2, bv->v, e->fnext, true, co, eip);
+/* Since all edges between e and e2 are in the same plane, it is OK
+ * to treat this like the case where there are no edges between. */
+offset_meet(bp, e, e2, bv->v, e->fnext, false, co, NULL);
   }
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [53e7a2cb075] soc-2020-io-performance: Merge branch 'master' into soc-2020-io-performance

2021-09-18 Thread Howard Trickey
Commit: 53e7a2cb0753137555bd581a1538a173060c469e
Author: Howard Trickey
Date:   Sat Sep 18 10:03:45 2021 -0400
Branches: soc-2020-io-performance
https://developer.blender.org/rB53e7a2cb0753137555bd581a1538a173060c469e

Merge branch 'master' into soc-2020-io-performance

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e3edf862a92] soc-2020-io-performance: Fix mistake with last commit - it didn't compile.

2021-09-18 Thread Howard Trickey
Commit: e3edf862a92b95c75eaf3bb0d57bf298abe198e8
Author: Howard Trickey
Date:   Sat Sep 18 10:03:16 2021 -0400
Branches: soc-2020-io-performance
https://developer.blender.org/rBe3edf862a92b95c75eaf3bb0d57bf298abe198e8

Fix mistake with last commit - it didn't compile.

===

M   source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc

===

diff --git a/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc 
b/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc
index 53c4aa974d3..2b6efe8da3f 100644
--- a/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc
+++ b/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc
@@ -201,6 +201,7 @@ TEST(obj_exporter_writer, header)
 {
   /* Because testing doesn't fully initialize Blender, we need the following. 
*/
   BKE_tempdir_init(NULL);
+  std::string out_file_path = blender::tests::flags_test_release_dir() + "/" + 
temp_file_path;
   {
 OBJExportParamsDefault _export;
 std::unique_ptr writer = init_writer(_export.params, 
out_file_path);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] SVN commit: bf-blender [62694] trunk/lib/tests/io_tests: Updating .blend files for io tests to later version.

2021-09-11 Thread Howard Trickey
Revision: 62694
  https://developer.blender.org/rBL62694
Author:   howardt
Date: 2021-09-11 19:40:56 +0200 (Sat, 11 Sep 2021)
Log Message:
---
Updating .blend files for io tests to later version.

A later version of blender allows the use of C unit
tests that read them. Getting ready for merging
fast obj i/o and its new unit tests.

Modified Paths:
--
trunk/lib/tests/io_tests/blend_geometry/all_quads.blend
trunk/lib/tests/io_tests/blend_geometry/all_tris.blend
trunk/lib/tests/io_tests/blend_geometry/cube_all_data.blend
trunk/lib/tests/io_tests/blend_geometry/edges.blend
trunk/lib/tests/io_tests/blend_geometry/fgons.blend
trunk/lib/tests/io_tests/blend_geometry/mixed_quads_and_tris.blend
trunk/lib/tests/io_tests/blend_geometry/nurbs.blend
trunk/lib/tests/io_tests/blend_geometry/suzanne_all_data.blend
trunk/lib/tests/io_tests/blend_geometry/vertices.blend

Added Paths:
---
trunk/lib/tests/io_tests/blend_scene/all_curves.blend
trunk/lib/tests/io_tests/obj/all_tris.mtl
trunk/lib/tests/io_tests/obj/all_tris.obj

Modified: trunk/lib/tests/io_tests/blend_geometry/all_quads.blend
===
(Binary files differ)

Modified: trunk/lib/tests/io_tests/blend_geometry/all_tris.blend
===
(Binary files differ)

Modified: trunk/lib/tests/io_tests/blend_geometry/cube_all_data.blend
===
(Binary files differ)

Modified: trunk/lib/tests/io_tests/blend_geometry/edges.blend
===
(Binary files differ)

Modified: trunk/lib/tests/io_tests/blend_geometry/fgons.blend
===
(Binary files differ)

Modified: trunk/lib/tests/io_tests/blend_geometry/mixed_quads_and_tris.blend
===
(Binary files differ)

Modified: trunk/lib/tests/io_tests/blend_geometry/nurbs.blend
===
(Binary files differ)

Modified: trunk/lib/tests/io_tests/blend_geometry/suzanne_all_data.blend
===
(Binary files differ)

Modified: trunk/lib/tests/io_tests/blend_geometry/vertices.blend
===
(Binary files differ)

Added: trunk/lib/tests/io_tests/blend_scene/all_curves.blend
===
(Binary files differ)

Index: trunk/lib/tests/io_tests/blend_scene/all_curves.blend
===
--- trunk/lib/tests/io_tests/blend_scene/all_curves.blend   2021-09-06 
08:07:16 UTC (rev 62693)
+++ trunk/lib/tests/io_tests/blend_scene/all_curves.blend   2021-09-11 
17:40:56 UTC (rev 62694)

Property changes on: trunk/lib/tests/io_tests/blend_scene/all_curves.blend
___
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/lib/tests/io_tests/obj/all_tris.mtl
===
--- trunk/lib/tests/io_tests/obj/all_tris.mtl   (rev 0)
+++ trunk/lib/tests/io_tests/obj/all_tris.mtl   2021-09-11 17:40:56 UTC (rev 
62694)
@@ -0,0 +1,2 @@
+# Blender 3.0.0 Alpha MTL File: 'all_tris.blend'
+# www.blender.org

Added: trunk/lib/tests/io_tests/obj/all_tris.obj
===
--- trunk/lib/tests/io_tests/obj/all_tris.obj   (rev 0)
+++ trunk/lib/tests/io_tests/obj/all_tris.obj   2021-09-11 17:40:56 UTC (rev 
62694)
@@ -0,0 +1,58 @@
+# Blender 3.0.0 Alpha
+# www.blender.org
+mtllib all_tris.mtl
+o Cube
+v 1.00 -1.00 -1.00
+v 1.00 -1.00 1.00
+v -1.00 -1.00 1.00
+v -1.00 -1.00 -1.00
+v 1.00 1.00 -0.99
+v 0.99 1.00 1.01
+v -1.00 1.00 1.00
+v -1.00 1.00 -1.00
+vn 0.00 0.00 -1.00
+vn 0.00 0.00 -1.00
+vn -1.00 -0.00 -0.00
+vn -1.00 -0.00 -0.00
+vn -0.00 -0.00 1.00
+vn -0.00 0.00 1.00
+vn 1.00 -0.00 0.00
+vn 1.00 0.00 0.01
+vn 0.00 1.00 0.00
+vn 0.00 1.00 0.00
+vn 0.00 -1.00 0.00
+vn 0.00 -1.00 0.00
+vt 1.00 0.00
+vt 0.00 0.00
+vt 0.00 0.00
+vt 0.00 1.00
+vt 1.00 0.00
+vt 0.00 0.00
+vt 0.00 1.00
+vt 1.00 1.00
+vt 1.00 1.00
+vt 0.00 1.00
+vt 1.00 0.00
+vt 0.00 0.00
+vt 1.00 0.00
+vt 1.00 1.00
+vt 0.00 1.00
+vt 1.00 0.00
+vt 1.00 

  1   2   3   4   5   6   7   8   >