Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/intern/geometry_nodes_eval_log.cc
| Context not available. | |||||
| */ | */ | ||||
| #include "NOD_geometry_nodes_eval_log.hh" | #include "NOD_geometry_nodes_eval_log.hh" | ||||
| #include "NOD_node_declaration.hh" | |||||
| #include "BKE_geometry_set_instances.hh" | #include "BKE_geometry_set_instances.hh" | ||||
| Context not available. | |||||
| return this->lookup_socket_log((eNodeSocketInOut)socket.in_out, index); | return this->lookup_socket_log((eNodeSocketInOut)socket.in_out, index); | ||||
| } | } | ||||
| GeometryValueLog::GeometryValueLog(const GeometrySet &geometry_set, bool log_full_geometry) | GeometryValueLog::GeometryValueLog(const GeometrySet &geometry_set, | ||||
| bool log_full_geometry, | |||||
| bool log_attributes = false) | |||||
HooglyBoogly: If this was used a lot, the `= false` might be helfpul, but since it's just called once, I… | |||||
| { | { | ||||
| static std::array all_component_types = {GEO_COMPONENT_TYPE_CURVE, | static std::array all_component_types = {GEO_COMPONENT_TYPE_CURVE, | ||||
| GEO_COMPONENT_TYPE_INSTANCES, | GEO_COMPONENT_TYPE_INSTANCES, | ||||
| GEO_COMPONENT_TYPE_MESH, | GEO_COMPONENT_TYPE_MESH, | ||||
| GEO_COMPONENT_TYPE_POINT_CLOUD, | GEO_COMPONENT_TYPE_POINT_CLOUD, | ||||
| GEO_COMPONENT_TYPE_VOLUME}; | GEO_COMPONENT_TYPE_VOLUME}; | ||||
| geometry_set.attribute_foreach( | if (log_attributes) { | ||||
| all_component_types, | geometry_set.attribute_foreach( | ||||
| true, | all_component_types, | ||||
| [&](const bke::AttributeIDRef &attribute_id, | true, | ||||
| const AttributeMetaData &meta_data, | [&](const bke::AttributeIDRef &attribute_id, | ||||
| const GeometryComponent &UNUSED(component)) { | const AttributeMetaData &meta_data, | ||||
| if (attribute_id.is_named()) { | const GeometryComponent &UNUSED(component)) { | ||||
| this->attributes_.append({attribute_id.name(), meta_data.domain, meta_data.data_type}); | if (attribute_id.is_named()) { | ||||
| } | this->attributes_.append({attribute_id.name(), meta_data.domain, meta_data.data_type}); | ||||
| }); | } | ||||
| }); | |||||
| } | |||||
| for (const GeometryComponent *component : geometry_set.get_components_for_read()) { | for (const GeometryComponent *component : geometry_set.get_components_for_read()) { | ||||
| component_types_.append(component->type()); | component_types_.append(component->type()); | ||||
| Context not available. | |||||
| Span<DSocket> copied_sockets = allocator_->construct_array_copy(sockets); | Span<DSocket> copied_sockets = allocator_->construct_array_copy(sockets); | ||||
| if (type.is<GeometrySet>()) { | if (type.is<GeometrySet>()) { | ||||
| bool log_full_geometry = false; | bool log_full_geometry = false; | ||||
| bool needs_attribute_search = false; | |||||
HooglyBooglyUnsubmitted Done Inline ActionsMaybe it would be more correct to call this "log_attributes" HooglyBoogly: Maybe it would be more correct to call this "log_attributes" | |||||
| if (sockets.size() > 0) { | |||||
Not Done Inline ActionsThis should check if any of the passed in sockets needs attribute search. Only checking sockets[0] is not enough. FYI, multiple sockets are passed in for the same geometry when they have the same value, e.g. when a geometry is passed through reroute nodes, group inputs/outputs, ... JacquesLucke: This should check if any of the passed in sockets needs attribute search. Only checking… | |||||
| const NodeDeclaration *decl = sockets[0]->node().declaration(); | |||||
| if (decl != nullptr) { | |||||
| needs_attribute_search = decl->needs_attribute_search(); | |||||
| } | |||||
| } | |||||
| for (const DSocket &socket : sockets) { | for (const DSocket &socket : sockets) { | ||||
| if (main_logger_->log_full_geometry_sockets_.contains(socket)) { | if (main_logger_->log_full_geometry_sockets_.contains(socket)) { | ||||
| log_full_geometry = true; | log_full_geometry = true; | ||||
| Context not available. | |||||
| const GeometrySet &geometry_set = *value.get<GeometrySet>(); | const GeometrySet &geometry_set = *value.get<GeometrySet>(); | ||||
| destruct_ptr<GeometryValueLog> value_log = allocator_->construct<GeometryValueLog>( | destruct_ptr<GeometryValueLog> value_log = allocator_->construct<GeometryValueLog>( | ||||
| geometry_set, log_full_geometry); | geometry_set, log_full_geometry, needs_attribute_search); | ||||
| values_.append({copied_sockets, std::move(value_log)}); | values_.append({copied_sockets, std::move(value_log)}); | ||||
| } | } | ||||
| else { | else { | ||||
| Context not available. | |||||
If this was used a lot, the = false might be helfpul, but since it's just called once, I would suggest leaving the default out for now.