Geometry Nodes: add utility to show debug messages in node editor

This is only meant to be used for development purposes for now,
not to show warnings to the user.

Differential Revision: https://developer.blender.org/D13348
This commit is contained in:
2021-11-24 13:39:09 +01:00
parent 9fc5a9c78f
commit 65f547c3fc
4 changed files with 45 additions and 0 deletions

View File

@@ -72,6 +72,11 @@ ModifierLog::ModifierLog(GeoLogger &logger)
node_with_exec_time.node);
node_log.exec_time_ = node_with_exec_time.exec_time;
}
for (NodeWithDebugMessage &debug_message : local_logger.node_debug_messages_) {
NodeLog &node_log = this->lookup_or_add_node_log(log_by_tree_context, debug_message.node);
node_log.debug_messages_.append(debug_message.message);
}
}
}
@@ -484,4 +489,13 @@ void LocalGeoLogger::log_execution_time(DNode node, std::chrono::microseconds ex
node_exec_times_.append({node, exec_time});
}
/**
* Log a message that will be displayed in the node editor next to the node. This should only be
* used for debugging purposes and not to display information to users.
*/
void LocalGeoLogger::log_debug_message(DNode node, std::string message)
{
node_debug_messages_.append({node, std::move(message)});
}
} // namespace blender::nodes::geometry_nodes_eval_log