Commit: 3d5efb4335fe3879455099d3866469ac4c0f4c79
Author: Jacques Lucke
Date:   Mon Nov 9 13:08:17 2020 +0100
Branches: geometry-nodes
https://developer.blender.org/rB3d5efb4335fe3879455099d3866469ac4c0f4c79

Geometry Nodes: rename Geometry type to GeometrySet

This should not change any functionality.

After talking to Brecht, we agreed that it might be good
not to have a class called Geometry for now. In the future
we might want to use a Geometry class as base class for
meshes, curves, etc.

This commit renames the Geometry class to GeometrySet,
because it is essentially a container that can contain
multiple geometries of different types.

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

R085    source/blender/blenkernel/BKE_geometry.hh       
source/blender/blenkernel/BKE_geometry_set.hh
M       source/blender/blenkernel/CMakeLists.txt
R080    source/blender/blenkernel/intern/geometry.cc    
source/blender/blenkernel/intern/geometry_set.cc
M       source/blender/modifiers/intern/MOD_nodes.cc
M       source/blender/nodes/NOD_geometry_exec.hh
M       source/blender/nodes/geometry/node_geometry_exec.cc
M       source/blender/nodes/geometry/nodes/node_geo_boolean.cc
M       source/blender/nodes/geometry/nodes/node_geo_edge_split.cc
M       source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
M       source/blender/nodes/geometry/nodes/node_geo_point_instance.cc
M       source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc
M       source/blender/nodes/geometry/nodes/node_geo_transform.cc
M       source/blender/nodes/geometry/nodes/node_geo_triangulate.cc
M       source/blender/nodes/intern/node_socket.cc

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

diff --git a/source/blender/blenkernel/BKE_geometry.hh 
b/source/blender/blenkernel/BKE_geometry_set.hh
similarity index 85%
rename from source/blender/blenkernel/BKE_geometry.hh
rename to source/blender/blenkernel/BKE_geometry_set.hh
index fd03b110749..36c77619139 100644
--- a/source/blender/blenkernel/BKE_geometry.hh
+++ b/source/blender/blenkernel/BKE_geometry_set.hh
@@ -32,8 +32,8 @@ struct PointCloud;
 
 namespace blender::bke {
 
-/* An automatically reference counted geometry. */
-using GeometryPtr = UserCounter<class Geometry>;
+/* An automatically reference counted geometry set. */
+using GeometrySetPtr = UserCounter<class GeometrySet>;
 
 /* Each geometry component has a specific type. The type determines what kind 
of data the component
  * stores. Functions modifying a geometry will usually just modify a subset of 
the component types.
@@ -82,31 +82,31 @@ template<typename T>
 inline constexpr bool is_geometry_component_v = 
std::is_base_of_v<GeometryComponent, T>;
 
 /**
- * A geometry contains zero or more geometry components. There is at most one 
component of each
+ * A geometry set contains zero or more geometry components. There is at most 
one component of each
  * type. Individual components might be shared between multiple geometries.
  *
  * Geometries are reference counted. This allows them to be shared without 
making unnecessary
  * copies. A geometry that is shared is immutable. If some code wants to 
change it,
- * #make_geometry_mutable should be called first.
+ * #make_geometry_set_mutable should be called first.
  */
-class Geometry {
+class GeometrySet {
  private:
-  /* Number of users of this geometry. If this number goes to zero, the 
geometry is freed. If it
-   * is above 1, the geometry is immutable. */
+  /* Number of users of this geometry set. If this number goes to zero, the 
set is freed. If
+   * it is above 1, the geometry set is immutable. */
   std::atomic<int> users_ = 1;
 
   using GeometryComponentPtr = UserCounter<class GeometryComponent>;
   Map<GeometryComponentType, GeometryComponentPtr> components_;
 
  public:
-  Geometry() = default;
-  Geometry(const Geometry &other);
-  Geometry(Geometry &&other) = delete;
-  ~Geometry() = default;
+  GeometrySet() = default;
+  GeometrySet(const GeometrySet &other);
+  GeometrySet(GeometrySet &&other) = delete;
+  ~GeometrySet() = default;
 
   /* Disable copy and move assignment operators. */
-  Geometry &operator=(const Geometry &other) = delete;
-  Geometry &operator=(Geometry &&other) = delete;
+  GeometrySet &operator=(const GeometrySet &other) = delete;
+  GeometrySet &operator=(GeometrySet &&other) = delete;
 
   void user_add();
   void user_remove();
@@ -127,7 +127,7 @@ class Geometry {
   }
 
   /* Utility methods for creation. */
-  static GeometryPtr create_with_mesh(Mesh *mesh, bool transfer_ownership = 
true);
+  static GeometrySetPtr create_with_mesh(Mesh *mesh, bool transfer_ownership = 
true);
 
   /* Utility methods for access. */
   bool has_mesh() const;
@@ -142,7 +142,7 @@ class Geometry {
   void replace_pointcloud(PointCloud *pointcloud, bool transfer_ownership = 
true);
 };
 
-void make_geometry_mutable(GeometryPtr &geometry);
+void make_geometry_set_mutable(GeometrySetPtr &geometry);
 
 /** A geometry component that can store a mesh. */
 class MeshComponent : public GeometryComponent {
diff --git a/source/blender/blenkernel/CMakeLists.txt 
b/source/blender/blenkernel/CMakeLists.txt
index d6185ae3f5a..7361a750992 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -124,7 +124,7 @@ set(SRC
   intern/fmodifier.c
   intern/font.c
   intern/freestyle.c
-  intern/geometry.cc
+  intern/geometry_set.cc
   intern/gpencil.c
   intern/gpencil_curve.c
   intern/gpencil_geom.c
@@ -312,7 +312,7 @@ set(SRC
   BKE_fluid.h
   BKE_font.h
   BKE_freestyle.h
-  BKE_geometry.hh
+  BKE_geometry_set.hh
   BKE_global.h
   BKE_gpencil.h
   BKE_gpencil_curve.h
diff --git a/source/blender/blenkernel/intern/geometry.cc 
b/source/blender/blenkernel/intern/geometry_set.cc
similarity index 80%
rename from source/blender/blenkernel/intern/geometry.cc
rename to source/blender/blenkernel/intern/geometry_set.cc
index aa58ce17f5b..568e581fd85 100644
--- a/source/blender/blenkernel/intern/geometry.cc
+++ b/source/blender/blenkernel/intern/geometry_set.cc
@@ -14,7 +14,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#include "BKE_geometry.hh"
+#include "BKE_geometry_set.hh"
 #include "BKE_lib_id.h"
 #include "BKE_mesh.h"
 #include "BKE_pointcloud.h"
@@ -66,22 +66,22 @@ bool GeometryComponent::is_mutable() const
 /** \} */
 
 /* -------------------------------------------------------------------- */
-/** \name Geometry
+/** \name Geometry Set
  * \{ */
 
-/* Makes a copy of the geometry. The individual components are shared with the 
original geometry.
- * Therefore, this is a relatively cheap operation.
+/* Makes a copy of the geometry set. The individual components are shared with 
the original
+ * geometry set. Therefore, this is a relatively cheap operation.
  */
-Geometry::Geometry(const Geometry &other) : components_(other.components_)
+GeometrySet::GeometrySet(const GeometrySet &other) : 
components_(other.components_)
 {
 }
 
-void Geometry::user_add()
+void GeometrySet::user_add()
 {
   users_.fetch_add(1);
 }
 
-void Geometry::user_remove()
+void GeometrySet::user_remove()
 {
   const int new_users = users_.fetch_sub(1) - 1;
   if (new_users == 0) {
@@ -89,17 +89,17 @@ void Geometry::user_remove()
   }
 }
 
-bool Geometry::is_mutable() const
+bool GeometrySet::is_mutable() const
 {
-  /* If the geometry is shared, it is read-only. */
+  /* If the geometry set is shared, it is read-only. */
   /* The user count can be 0, when this is called from the destructor. */
   return users_ <= 1;
 }
 
-/* This method can only be used when the geometry is mutable. It returns a 
mutable geometry
+/* This method can only be used when the geometry set is mutable. It returns a 
mutable geometry
  * component of the given type.
  */
-GeometryComponent &Geometry::get_component_for_write(GeometryComponentType 
component_type)
+GeometryComponent &GeometrySet::get_component_for_write(GeometryComponentType 
component_type)
 {
   BLI_assert(this->is_mutable());
   return components_.add_or_modify(
@@ -124,7 +124,7 @@ GeometryComponent 
&Geometry::get_component_for_write(GeometryComponentType compo
 }
 
 /* Get the component of the given type. Might return null if the component 
does not exist yet. */
-const GeometryComponent *Geometry::get_component_for_read(
+const GeometryComponent *GeometrySet::get_component_for_read(
     GeometryComponentType component_type) const
 {
   const GeometryComponentPtr *component = 
components_.lookup_ptr(component_type);
@@ -135,90 +135,90 @@ const GeometryComponent *Geometry::get_component_for_read(
 }
 
 /* Returns a read-only mesh or null. */
-const Mesh *Geometry::get_mesh_for_read() const
+const Mesh *GeometrySet::get_mesh_for_read() const
 {
   const MeshComponent *component = 
this->get_component_for_read<MeshComponent>();
   return (component == nullptr) ? nullptr : component->get_for_read();
 }
 
-/* Returns true when the geometry has a mesh component that has a mesh. */
-bool Geometry::has_mesh() const
+/* Returns true when the geometry set has a mesh component that has a mesh. */
+bool GeometrySet::has_mesh() const
 {
   const MeshComponent *component = 
this->get_component_for_read<MeshComponent>();
   return component != nullptr && component->has_mesh();
 }
 
 /* Returns a read-only point cloud of null. */
-const PointCloud *Geometry::get_pointcloud_for_read() const
+const PointCloud *GeometrySet::get_pointcloud_for_read() const
 {
   const PointCloudComponent *component = 
this->get_component_for_read<PointCloudComponent>();
   return (component == nullptr) ? nullptr : component->get_for_read();
 }
 
-/* Returns true when the geometry has a point cloud component that has a point 
cloud. */
-bool Geometry::has_pointcloud() const
+/* Returns true when the geometry set has a point cloud component that has a 
point cloud. */
+bool GeometrySet::has_pointcloud() const
 {
   const PointCloudComponent *component = 
this->get_component_for_read<PointCloudComponent>();
   return component != nullptr && component->has_pointcloud();
 }
 
-/* Create a new geometry that only contains the given mesh. Ownership of the 
mesh is transferred to
- * the new geometry. */
-GeometryPtr Geometry::create_with_mesh(Mesh *mesh, bool transfer_ownership)
+/* Create a new geometry set that only contains the given mesh. Ownership of 
the mesh is
+ * transferred to the new geometry. */
+GeometrySetPtr GeometrySet::create_with_mesh(Mesh *mesh, bool 
transfer_ownership)
 {
-  Geometry *geometry = new Geometry();
-  MeshComponent &component = 
geometry->get_component_for_write<MeshComponent>();
+  GeometrySet *geometry_set = new GeometrySet();
+  MeshComponent &component = 
geometry_set->get_component_for_write<MeshComponent>();
   component.replace(mesh, transfer_ownership);
-  return geometry;
+  return geometry_set;
 }
 
 /* Clear the existing mesh and replace it with the given one. */
-void Geometry::replace_mesh(Mesh *mesh, bool transfer_ownership)
+void GeometrySet::replace_mesh(Mesh *mesh, bool transfer_ownership)
 {
   MeshComponent &component = this->get_component_for_write<MeshComponent>();
   component.replace(mesh, transfer_ownership);
 }
 
 /* Clear the existing point cloud and replace with the given one. */
-void Geometry::replace_pointcloud(PointCloud *pointcloud, bool 
transfer_ownership)
+void GeometrySet::replace_pointcloud(PointCloud *pointcloud, bool 
transfer_ownership)
 {
   PointCloudComponent &pointcloud_component = 
this->get_component_for_write<PointCloudComponent>();
   pointcloud_component.replace(pointcloud, transfer_ownership);
 }
 
 /* Returns a mutable mesh or null. No ownership is transferred. */
-Mesh *Geometry::get_mesh_for_write()
+Mesh *GeometrySet::get_mesh_for_write()
 {
   MeshComponent &component = this->get_component_for_write<MeshComponent>();
   return component.get_for_write();
 }
 
 /* Returns a mutable point cloud or null. No ownership is transferred. */
-PointCloud *Geomet

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to