Fix #125758: deduplicate warnings shown in geometry nodes
This commit is contained in:
@@ -61,6 +61,13 @@ enum class NodeWarningType {
|
||||
struct NodeWarning {
|
||||
NodeWarningType type;
|
||||
std::string message;
|
||||
|
||||
uint64_t hash() const
|
||||
{
|
||||
return get_default_hash(this->type, this->message);
|
||||
}
|
||||
|
||||
BLI_STRUCT_EQUALITY_OPERATORS_2(NodeWarning, type, message)
|
||||
};
|
||||
|
||||
enum class NamedAttributeUsage {
|
||||
@@ -252,7 +259,7 @@ class GeoTreeLogger {
|
||||
class GeoNodeLog {
|
||||
public:
|
||||
/** Warnings generated for that node. */
|
||||
Vector<NodeWarning> warnings;
|
||||
VectorSet<NodeWarning> warnings;
|
||||
/**
|
||||
* Time spent in this node. For node groups this is the sum of the run times of the nodes
|
||||
* inside.
|
||||
@@ -296,7 +303,7 @@ class GeoTreeLog {
|
||||
public:
|
||||
Map<int32_t, GeoNodeLog> nodes;
|
||||
Map<int32_t, ViewerNodeLog *, 0> viewer_node_logs;
|
||||
Vector<NodeWarning> all_warnings;
|
||||
VectorSet<NodeWarning> all_warnings;
|
||||
std::chrono::nanoseconds run_time_sum{0};
|
||||
Vector<const GeometryAttributeInfo *> existing_attributes;
|
||||
Map<StringRefNull, NamedAttributeUsage> used_named_attributes;
|
||||
|
||||
@@ -273,8 +273,8 @@ void GeoTreeLog::ensure_node_warnings()
|
||||
}
|
||||
for (GeoTreeLogger *tree_logger : tree_loggers_) {
|
||||
for (const GeoTreeLogger::WarningWithNode &warnings : tree_logger->node_warnings) {
|
||||
this->nodes.lookup_or_add_default(warnings.node_id).warnings.append(warnings.warning);
|
||||
this->all_warnings.append(warnings.warning);
|
||||
this->nodes.lookup_or_add_default(warnings.node_id).warnings.add(warnings.warning);
|
||||
this->all_warnings.add(warnings.warning);
|
||||
}
|
||||
}
|
||||
for (const ComputeContextHash &child_hash : children_hashes_) {
|
||||
@@ -285,9 +285,10 @@ void GeoTreeLog::ensure_node_warnings()
|
||||
child_log.ensure_node_warnings();
|
||||
const std::optional<int32_t> &parent_node_id = child_log.tree_loggers_[0]->parent_node_id;
|
||||
if (parent_node_id.has_value()) {
|
||||
this->nodes.lookup_or_add_default(*parent_node_id).warnings.extend(child_log.all_warnings);
|
||||
this->nodes.lookup_or_add_default(*parent_node_id)
|
||||
.warnings.add_multiple(child_log.all_warnings);
|
||||
}
|
||||
this->all_warnings.extend(child_log.all_warnings);
|
||||
this->all_warnings.add_multiple(child_log.all_warnings);
|
||||
}
|
||||
reduced_node_warnings_ = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user