[Bf-blender-cvs] [2622882d832] geometry-nodes-curve-support: Add method to create geometry set from curve

Hans Goudey noreply at git.blender.org
Fri Apr 2 20:20:07 CEST 2021


Commit: 2622882d8328683bde66809c372314d4f9233ccb
Author: Hans Goudey
Date:   Fri Apr 2 10:49:01 2021 -0500
Branches: geometry-nodes-curve-support
https://developer.blender.org/rB2622882d8328683bde66809c372314d4f9233ccb

Add method to create geometry set from curve

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

M	source/blender/blenkernel/BKE_geometry_set.hh
M	source/blender/blenkernel/intern/geometry_set.cc

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

diff --git a/source/blender/blenkernel/BKE_geometry_set.hh b/source/blender/blenkernel/BKE_geometry_set.hh
index a596a6c57b2..8e12d3afc9e 100644
--- a/source/blender/blenkernel/BKE_geometry_set.hh
+++ b/source/blender/blenkernel/BKE_geometry_set.hh
@@ -321,6 +321,8 @@ struct GeometrySet {
       Mesh *mesh, GeometryOwnershipType ownership = GeometryOwnershipType::Owned);
   static GeometrySet create_with_pointcloud(
       PointCloud *pointcloud, GeometryOwnershipType ownership = GeometryOwnershipType::Owned);
+  static GeometrySet GeometrySet::create_with_curve(
+      DCurve *curve, GeometryOwnershipType ownership = GeometryOwnershipType::Owned);
 
   /* Utility methods for access. */
   bool has_mesh() const;
diff --git a/source/blender/blenkernel/intern/geometry_set.cc b/source/blender/blenkernel/intern/geometry_set.cc
index f432cc09ec7..31582ea79ab 100644
--- a/source/blender/blenkernel/intern/geometry_set.cc
+++ b/source/blender/blenkernel/intern/geometry_set.cc
@@ -297,6 +297,15 @@ GeometrySet GeometrySet::create_with_pointcloud(PointCloud *pointcloud,
   return geometry_set;
 }
 
+/* Create a new geometry set that only contains the given curve. */
+GeometrySet GeometrySet::create_with_curve(DCurve *curve, GeometryOwnershipType ownership)
+{
+  GeometrySet geometry_set;
+  CurveComponent &component = geometry_set.get_component_for_write<CurveComponent>();
+  component.replace(curve, ownership);
+  return geometry_set;
+}
+
 /* Clear the existing mesh and replace it with the given one. */
 void GeometrySet::replace_mesh(Mesh *mesh, GeometryOwnershipType ownership)
 {



More information about the Bf-blender-cvs mailing list