[Bf-blender-cvs] [47f5a635daa] geometry-nodes: Geometry Nodes: add utility method to check if a geometry has a mesh

Jacques Lucke noreply at git.blender.org
Mon Oct 26 12:28:02 CET 2020


Commit: 47f5a635daade324b4ca4bd720380a16e1cf2c9c
Author: Jacques Lucke
Date:   Mon Oct 26 12:25:46 2020 +0100
Branches: geometry-nodes
https://developer.blender.org/rB47f5a635daade324b4ca4bd720380a16e1cf2c9c

Geometry Nodes: add utility method to check if a geometry has a mesh

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

M	source/blender/blenkernel/BKE_geometry.hh
M	source/blender/blenkernel/intern/geometry.cc

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

diff --git a/source/blender/blenkernel/BKE_geometry.hh b/source/blender/blenkernel/BKE_geometry.hh
index e2532d639c4..a90a1f433f2 100644
--- a/source/blender/blenkernel/BKE_geometry.hh
+++ b/source/blender/blenkernel/BKE_geometry.hh
@@ -62,6 +62,7 @@ class Geometry {
   void user_remove();
   bool is_mutable() const;
 
+  bool mesh_available() const;
   void mesh_set_and_keep_ownership(Mesh *mesh);
   void mesh_set_and_transfer_ownership(Mesh *mesh);
   void mesh_reset();
diff --git a/source/blender/blenkernel/intern/geometry.cc b/source/blender/blenkernel/intern/geometry.cc
index 014197ed423..58ec71108da 100644
--- a/source/blender/blenkernel/intern/geometry.cc
+++ b/source/blender/blenkernel/intern/geometry.cc
@@ -57,6 +57,14 @@ bool Geometry::is_mutable() const
   return users_ <= 1;
 }
 
+/**
+ * Returns true when this geometry has a mesh component.
+ */
+bool Geometry::mesh_available() const
+{
+  return mesh_ != nullptr;
+}
+
 /**
  * Replace the mesh in the geometry. The caller remains the owner of the given mesh and is
  * responsible for freeing it eventually.



More information about the Bf-blender-cvs mailing list