Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-07-14 12:16:43 +0300
committerJacques Lucke <jacques@blender.org>2021-07-14 12:21:10 +0300
commit271f34f77e056611e5e227b60823dd94f76340df (patch)
tree86e69d7decb3cb51e76725b06d30b5833621f86a /source/blender/nodes
parent3e125d12af625920d677ede0d24214b33f81b6ba (diff)
Geometry Nodes: initial socket inspection
Socket inspection helps with debugging a geometry node group. Now, when hovering over a socket, a tooltip will appear that provides information about the data in the socket. Note, socket inspection only works for sockets that have been computed already. Nodes that are not connected to an output are not computed. Future improvements can include ui changes to make the tooltip look more like in the original design (T85251). Furthermore, additional information could be shown if necessary. Differential Revision: https://developer.blender.org/D11842
Diffstat (limited to 'source/blender/nodes')
-rw-r--r--source/blender/nodes/NOD_geometry_nodes_eval_log.hh18
-rw-r--r--source/blender/nodes/intern/geometry_nodes_eval_log.cc31
2 files changed, 49 insertions, 0 deletions
diff --git a/source/blender/nodes/NOD_geometry_nodes_eval_log.hh b/source/blender/nodes/NOD_geometry_nodes_eval_log.hh
index 1c4590f96ac..b85862a0176 100644
--- a/source/blender/nodes/NOD_geometry_nodes_eval_log.hh
+++ b/source/blender/nodes/NOD_geometry_nodes_eval_log.hh
@@ -90,6 +90,24 @@ class GeometryValueLog : public ValueLog {
std::unique_ptr<GeometrySet> full_geometry_;
public:
+ struct MeshInfo {
+ int tot_verts, tot_edges, tot_faces;
+ };
+ struct CurveInfo {
+ int tot_splines;
+ };
+ struct PointCloudInfo {
+ int tot_points;
+ };
+ struct InstancesInfo {
+ int tot_instances;
+ };
+
+ std::optional<MeshInfo> mesh_info;
+ std::optional<CurveInfo> curve_info;
+ std::optional<PointCloudInfo> pointcloud_info;
+ std::optional<InstancesInfo> instances_info;
+
GeometryValueLog(const GeometrySet &geometry_set, bool log_full_geometry);
Span<GeometryAttributeInfo> attributes() const
diff --git a/source/blender/nodes/intern/geometry_nodes_eval_log.cc b/source/blender/nodes/intern/geometry_nodes_eval_log.cc
index 85182b67c8a..3024cc51cad 100644
--- a/source/blender/nodes/intern/geometry_nodes_eval_log.cc
+++ b/source/blender/nodes/intern/geometry_nodes_eval_log.cc
@@ -150,6 +150,37 @@ GeometryValueLog::GeometryValueLog(const GeometrySet &geometry_set, bool log_ful
8);
for (const GeometryComponent *component : geometry_set.get_components_for_read()) {
component_types_.append(component->type());
+ switch (component->type()) {
+ case GEO_COMPONENT_TYPE_MESH: {
+ const MeshComponent &mesh_component = *(const MeshComponent *)component;
+ MeshInfo &info = this->mesh_info.emplace();
+ info.tot_verts = mesh_component.attribute_domain_size(ATTR_DOMAIN_POINT);
+ info.tot_edges = mesh_component.attribute_domain_size(ATTR_DOMAIN_EDGE);
+ info.tot_faces = mesh_component.attribute_domain_size(ATTR_DOMAIN_FACE);
+ break;
+ }
+ case GEO_COMPONENT_TYPE_CURVE: {
+ const CurveComponent &curve_component = *(const CurveComponent *)component;
+ CurveInfo &info = this->curve_info.emplace();
+ info.tot_splines = curve_component.attribute_domain_size(ATTR_DOMAIN_CURVE);
+ break;
+ }
+ case GEO_COMPONENT_TYPE_POINT_CLOUD: {
+ const PointCloudComponent &pointcloud_component = *(const PointCloudComponent *)component;
+ PointCloudInfo &info = this->pointcloud_info.emplace();
+ info.tot_points = pointcloud_component.attribute_domain_size(ATTR_DOMAIN_POINT);
+ break;
+ }
+ case GEO_COMPONENT_TYPE_INSTANCES: {
+ const InstancesComponent &instances_component = *(const InstancesComponent *)component;
+ InstancesInfo &info = this->instances_info.emplace();
+ info.tot_instances = instances_component.instances_amount();
+ break;
+ }
+ case GEO_COMPONENT_TYPE_VOLUME: {
+ break;
+ }
+ }
}
if (log_full_geometry) {
full_geometry_ = std::make_unique<GeometrySet>(geometry_set);