[Bf-blender-cvs] [46642507ae6] master: Geometry Nodes: improve printing geometry set for debugging

Jacques Lucke noreply at git.blender.org
Wed Sep 7 10:43:54 CEST 2022


Commit: 46642507ae658a9a3704df70b5ca2028dc5a3593
Author: Jacques Lucke
Date:   Wed Sep 7 10:43:46 2022 +0200
Branches: master
https://developer.blender.org/rB46642507ae658a9a3704df70b5ca2028dc5a3593

Geometry Nodes: improve printing geometry set for debugging

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

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

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

diff --git a/source/blender/blenkernel/intern/geometry_set.cc b/source/blender/blenkernel/intern/geometry_set.cc
index 633d9ad8c49..46ff8141504 100644
--- a/source/blender/blenkernel/intern/geometry_set.cc
+++ b/source/blender/blenkernel/intern/geometry_set.cc
@@ -18,6 +18,7 @@
 
 #include "DNA_collection_types.h"
 #include "DNA_object_types.h"
+#include "DNA_pointcloud_types.h"
 
 #include "BLI_rand.hh"
 
@@ -237,8 +238,40 @@ bool GeometrySet::compute_boundbox_without_instances(float3 *r_min, float3 *r_ma
 
 std::ostream &operator<<(std::ostream &stream, const GeometrySet &geometry_set)
 {
-  stream << "<GeometrySet at " << &geometry_set << ", " << geometry_set.components_.size()
-         << " components>";
+  Vector<std::string> parts;
+  if (const Mesh *mesh = geometry_set.get_mesh_for_read()) {
+    parts.append(std::to_string(mesh->totvert) + " verts");
+    parts.append(std::to_string(mesh->totedge) + " edges");
+    parts.append(std::to_string(mesh->totpoly) + " polys");
+    parts.append(std::to_string(mesh->totloop) + " corners");
+  }
+  if (const Curves *curves = geometry_set.get_curves_for_read()) {
+    parts.append(std::to_string(curves->geometry.point_num) + " control points");
+    parts.append(std::to_string(curves->geometry.curve_num) + " curves");
+  }
+  if (const PointCloud *point_cloud = geometry_set.get_pointcloud_for_read()) {
+    parts.append(std::to_string(point_cloud->totpoint) + " points");
+  }
+  if (const Volume *volume = geometry_set.get_volume_for_read()) {
+    parts.append(std::to_string(BKE_volume_num_grids(volume)) + " volume grids");
+  }
+  if (geometry_set.has_instances()) {
+    parts.append(std::to_string(
+                     geometry_set.get_component_for_read<InstancesComponent>()->instances_num()) +
+                 " instances");
+  }
+  if (geometry_set.get_curve_edit_hints_for_read()) {
+    parts.append("curve edit hints");
+  }
+
+  stream << "<GeometrySet: ";
+  for (const int i : parts.index_range()) {
+    stream << parts[i];
+    if (i < parts.size() - 1) {
+      stream << ", ";
+    }
+  }
+  stream << ">";
   return stream;
 }



More information about the Bf-blender-cvs mailing list