Cleanup: Geometry Nodes: rename GeoModifierLog to GeoNodesLog
Nowadays, Geometry Nodes is not only evaluated by a modifier, but also by an operator and in the future potentially by brushes. Therefore, the old name was misleading because it sounded like it was specific to the modifier. Pull Request: https://projects.blender.org/blender/blender/pulls/139378
This commit is contained in:
@@ -1847,7 +1847,7 @@ ListBase *object_duplilist_preview(Depsgraph *depsgraph,
|
||||
continue;
|
||||
}
|
||||
if (const geo_log::ViewerNodeLog *viewer_log =
|
||||
geo_log::GeoModifierLog::find_viewer_node_log_for_path(*viewer_path))
|
||||
geo_log::GeoNodesLog::find_viewer_node_log_for_path(*viewer_path))
|
||||
{
|
||||
ctx.preview_base_geometry = &viewer_log->geometry;
|
||||
make_duplis_geometry_set_impl(&ctx,
|
||||
|
||||
@@ -165,8 +165,8 @@ static void find_socket_log_contexts(const Main &bmain,
|
||||
}
|
||||
bke::ComputeContextCache compute_context_cache;
|
||||
const Map<const bke::bNodeTreeZone *, ComputeContextHash> hash_by_zone =
|
||||
geo_log::GeoModifierLog::get_context_hash_by_zone_for_node_editor(
|
||||
snode, compute_context_cache);
|
||||
geo_log::GeoNodesLog::get_context_hash_by_zone_for_node_editor(snode,
|
||||
compute_context_cache);
|
||||
for (const ComputeContextHash &hash : hash_by_zone.values()) {
|
||||
r_socket_log_contexts.add(hash);
|
||||
}
|
||||
@@ -675,7 +675,7 @@ static wmOperatorStatus run_node_group_exec(bContext *C, wmOperator *op)
|
||||
bke::OperatorComputeContext compute_context;
|
||||
Set<ComputeContextHash> socket_log_contexts;
|
||||
GeoOperatorLog &eval_log = get_static_eval_log();
|
||||
eval_log.log = std::make_unique<geo_log::GeoModifierLog>();
|
||||
eval_log.log = std::make_unique<geo_log::GeoNodesLog>();
|
||||
eval_log.node_group_name = node_tree->id.name + 2;
|
||||
find_socket_log_contexts(*bmain, socket_log_contexts);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ enum class AttrDomain : int8_t;
|
||||
class MutableAttributeAccessor;
|
||||
} // namespace blender::bke
|
||||
namespace blender::nodes::geo_eval_log {
|
||||
class GeoModifierLog;
|
||||
class GeoNodesLog;
|
||||
}
|
||||
|
||||
namespace blender::ed::geometry {
|
||||
@@ -66,7 +66,7 @@ bool convert_attribute(AttributeOwner &owner,
|
||||
|
||||
struct GeoOperatorLog {
|
||||
std::string node_group_name;
|
||||
std::unique_ptr<nodes::geo_eval_log::GeoModifierLog> log;
|
||||
std::unique_ptr<nodes::geo_eval_log::GeoNodesLog> log;
|
||||
|
||||
GeoOperatorLog() = default;
|
||||
~GeoOperatorLog();
|
||||
|
||||
@@ -2137,7 +2137,7 @@ static std::string node_socket_get_tooltip(const SpaceNode *snode,
|
||||
TreeDrawContext tree_draw_ctx;
|
||||
if (snode != nullptr) {
|
||||
if (ntree.type == NTREE_GEOMETRY) {
|
||||
tree_draw_ctx.tree_logs = geo_log::GeoModifierLog::get_contextual_tree_logs(*snode);
|
||||
tree_draw_ctx.tree_logs = geo_log::GeoNodesLog::get_contextual_tree_logs(*snode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5246,7 +5246,7 @@ static void draw_nodetree(const bContext &C,
|
||||
|
||||
BLI_SCOPED_DEFER([&]() { ntree.runtime->sockets_on_active_gizmo_paths.clear(); });
|
||||
if (ntree.type == NTREE_GEOMETRY) {
|
||||
tree_draw_ctx.tree_logs = geo_log::GeoModifierLog::get_contextual_tree_logs(*snode);
|
||||
tree_draw_ctx.tree_logs = geo_log::GeoNodesLog::get_contextual_tree_logs(*snode);
|
||||
tree_draw_ctx.tree_logs.foreach_tree_log([&](geo_log::GeoTreeLog &log) {
|
||||
log.ensure_node_warnings(*tree_draw_ctx.bmain);
|
||||
log.ensure_execution_times();
|
||||
|
||||
@@ -68,7 +68,7 @@ static Vector<const GeometryAttributeInfo *> get_attribute_info_from_context(
|
||||
if (!tree_zones) {
|
||||
return {};
|
||||
}
|
||||
const ContextualGeoTreeLogs tree_logs = GeoModifierLog::get_contextual_tree_logs(*snode);
|
||||
const ContextualGeoTreeLogs tree_logs = GeoNodesLog::get_contextual_tree_logs(*snode);
|
||||
|
||||
Set<StringRef> names;
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ static Vector<const std::string *> get_layer_names_from_context(const bContext &
|
||||
if (!tree_zones) {
|
||||
return {};
|
||||
}
|
||||
const ContextualGeoTreeLogs tree_logs = GeoModifierLog::get_contextual_tree_logs(*snode);
|
||||
const ContextualGeoTreeLogs tree_logs = GeoNodesLog::get_contextual_tree_logs(*snode);
|
||||
|
||||
Set<StringRef> names;
|
||||
|
||||
|
||||
@@ -684,7 +684,7 @@ bke::GeometrySet spreadsheet_get_display_geometry_set(const SpaceSpreadsheet *ss
|
||||
}
|
||||
else {
|
||||
if (const ViewerNodeLog *viewer_log =
|
||||
nodes::geo_eval_log::GeoModifierLog::find_viewer_node_log_for_path(
|
||||
nodes::geo_eval_log::GeoNodesLog::find_viewer_node_log_for_path(
|
||||
sspreadsheet->geometry_id.viewer_path))
|
||||
{
|
||||
geometry_set = viewer_log->geometry;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace blender::bke::bake {
|
||||
struct ModifierCache;
|
||||
}
|
||||
namespace blender::nodes::geo_eval_log {
|
||||
class GeoModifierLog;
|
||||
class GeoNodesLog;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -35,7 +35,7 @@ struct NodesModifierRuntime {
|
||||
* This is a shared pointer because we might want to keep it around in some cases after the
|
||||
* evaluation (e.g. for gizmo backpropagation).
|
||||
*/
|
||||
std::shared_ptr<nodes::geo_eval_log::GeoModifierLog> eval_log;
|
||||
std::shared_ptr<nodes::geo_eval_log::GeoNodesLog> eval_log;
|
||||
/**
|
||||
* Simulation cache that is shared between original and evaluated modifiers. This allows the
|
||||
* original modifier to be removed, without also removing the simulation state which may still be
|
||||
|
||||
@@ -886,8 +886,8 @@ static void find_socket_log_contexts(const NodesModifierData &nmd,
|
||||
continue;
|
||||
}
|
||||
const Map<const bke::bNodeTreeZone *, ComputeContextHash> hash_by_zone =
|
||||
geo_log::GeoModifierLog::get_context_hash_by_zone_for_node_editor(
|
||||
snode, compute_context_cache);
|
||||
geo_log::GeoNodesLog::get_context_hash_by_zone_for_node_editor(snode,
|
||||
compute_context_cache);
|
||||
for (const ComputeContextHash &hash : hash_by_zone.values()) {
|
||||
r_socket_log_contexts.add(hash);
|
||||
}
|
||||
@@ -1865,7 +1865,7 @@ static void modifyGeometry(ModifierData *md,
|
||||
nodes::GeoNodesModifierData modifier_eval_data{};
|
||||
modifier_eval_data.depsgraph = ctx->depsgraph;
|
||||
modifier_eval_data.self_object = ctx->object;
|
||||
auto eval_log = std::make_unique<geo_log::GeoModifierLog>();
|
||||
auto eval_log = std::make_unique<geo_log::GeoNodesLog>();
|
||||
call_data.modifier_data = &modifier_eval_data;
|
||||
|
||||
NodesModifierSimulationParams simulation_params(*nmd, *ctx);
|
||||
|
||||
@@ -22,7 +22,7 @@ struct IDProperty;
|
||||
namespace blender::nodes {
|
||||
struct GeoNodesCallData;
|
||||
namespace geo_eval_log {
|
||||
class GeoModifierLog;
|
||||
class GeoNodesLog;
|
||||
} // namespace geo_eval_log
|
||||
} // namespace blender::nodes
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ ie::ElemVariant get_editable_gizmo_elem(const ComputeContext &gizmo_context,
|
||||
void apply_gizmo_change(bContext &C,
|
||||
Object &object,
|
||||
NodesModifierData &nmd,
|
||||
geo_eval_log::GeoModifierLog &eval_log,
|
||||
geo_eval_log::GeoNodesLog &eval_log,
|
||||
const ComputeContext &gizmo_context,
|
||||
const bNodeSocket &gizmo_socket,
|
||||
FunctionRef<void(bke::SocketValueVariant &value)> apply_on_gizmo_value_fn);
|
||||
|
||||
@@ -219,7 +219,7 @@ struct GeoNodesCallData {
|
||||
* Optional logger that keeps track of data generated during evaluation to allow for better
|
||||
* debugging afterwards.
|
||||
*/
|
||||
geo_eval_log::GeoModifierLog *eval_log = nullptr;
|
||||
geo_eval_log::GeoNodesLog *eval_log = nullptr;
|
||||
/**
|
||||
* Optional injected behavior for simulations.
|
||||
*/
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
* search, node warnings, socket inspection and the viewer node.
|
||||
*
|
||||
* This file provides the system for logging data during evaluation and accessing the data after
|
||||
* evaluation. Geometry nodes is executed by a modifier, therefore the "root" of logging is
|
||||
* #GeoModifierLog which will contain all data generated in a modifier.
|
||||
* evaluation. At the root of the logging data is a #GeoNodesLog which is created by the code that
|
||||
* invokes Geometry Nodes (e.g. the Geometry Nodes modifier).
|
||||
*
|
||||
* The system makes a distinction between "loggers" and the "log":
|
||||
* - Logger (#GeoTreeLogger): Is used during geometry nodes evaluation. Each thread logs data
|
||||
@@ -339,7 +339,7 @@ class GeoNodeLog {
|
||||
~GeoNodeLog();
|
||||
};
|
||||
|
||||
class GeoModifierLog;
|
||||
class GeoNodesLog;
|
||||
|
||||
/**
|
||||
* Contains data that has been logged for a specific node group in a context. If the same node
|
||||
@@ -350,7 +350,7 @@ class GeoModifierLog;
|
||||
*/
|
||||
class GeoTreeLog {
|
||||
private:
|
||||
GeoModifierLog *modifier_log_;
|
||||
GeoNodesLog *root_log_;
|
||||
Vector<GeoTreeLogger *> tree_loggers_;
|
||||
VectorSet<ComputeContextHash> children_hashes_;
|
||||
bool reduced_node_warnings_ = false;
|
||||
@@ -373,7 +373,7 @@ class GeoTreeLog {
|
||||
Set<int> evaluated_gizmo_nodes;
|
||||
Vector<std::string> all_layer_names;
|
||||
|
||||
GeoTreeLog(GeoModifierLog *modifier_log, Vector<GeoTreeLogger *> tree_loggers);
|
||||
GeoTreeLog(GeoNodesLog *root_log, Vector<GeoTreeLogger *> tree_loggers);
|
||||
~GeoTreeLog();
|
||||
|
||||
/**
|
||||
@@ -435,11 +435,11 @@ class ContextualGeoTreeLogs {
|
||||
};
|
||||
|
||||
/**
|
||||
* There is one #GeoModifierLog for every modifier that evaluates geometry nodes. It contains all
|
||||
* There is one #GeoNodesLog for every modifier that evaluates geometry nodes. It contains all
|
||||
* the loggers that are used during evaluation as well as the preprocessed logs that are used by UI
|
||||
* code.
|
||||
*/
|
||||
class GeoModifierLog {
|
||||
class GeoNodesLog {
|
||||
private:
|
||||
/** Data that is stored for each thread. */
|
||||
struct LocalData {
|
||||
@@ -460,8 +460,8 @@ class GeoModifierLog {
|
||||
Map<ComputeContextHash, std::unique_ptr<GeoTreeLog>> tree_logs_;
|
||||
|
||||
public:
|
||||
GeoModifierLog();
|
||||
~GeoModifierLog();
|
||||
GeoNodesLog();
|
||||
~GeoNodesLog();
|
||||
|
||||
/**
|
||||
* Get a thread-local logger for the current node tree.
|
||||
|
||||
@@ -35,7 +35,7 @@ struct SocketToUpdate {
|
||||
bool backpropagate_socket_values(bContext &C,
|
||||
Object &object,
|
||||
NodesModifierData &nmd,
|
||||
geo_eval_log::GeoModifierLog &eval_log,
|
||||
geo_eval_log::GeoNodesLog &eval_log,
|
||||
Span<SocketToUpdate> sockets_to_update);
|
||||
|
||||
/**
|
||||
|
||||
@@ -504,7 +504,7 @@ void apply_gizmo_change(
|
||||
bContext &C,
|
||||
Object &object,
|
||||
NodesModifierData &nmd,
|
||||
geo_eval_log::GeoModifierLog &eval_log,
|
||||
geo_eval_log::GeoNodesLog &eval_log,
|
||||
const ComputeContext &gizmo_context,
|
||||
const bNodeSocket &gizmo_socket,
|
||||
const FunctionRef<void(bke::SocketValueVariant &value)> apply_on_gizmo_value_fn)
|
||||
|
||||
@@ -1740,7 +1740,7 @@ std::string zone_wrapper_output_name(const ZoneBuildInfo &zone_info,
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs intermediate values from the lazy-function graph evaluation into #GeoModifierLog based on
|
||||
* Logs intermediate values from the lazy-function graph evaluation into #GeoNodesLog based on
|
||||
* the mapping between the lazy-function graph and the corresponding #bNodeTree.
|
||||
*/
|
||||
class GeometryNodesLazyFunctionLogger : public lf::GraphExecutor::Logger {
|
||||
@@ -4243,7 +4243,7 @@ destruct_ptr<fn::LocalUserData> GeoNodesUserData::get_local(LinearAllocator<> &a
|
||||
|
||||
void GeoNodesLocalUserData::ensure_tree_logger(const GeoNodesUserData &user_data) const
|
||||
{
|
||||
if (geo_eval_log::GeoModifierLog *log = user_data.call_data->eval_log) {
|
||||
if (geo_eval_log::GeoNodesLog *log = user_data.call_data->eval_log) {
|
||||
tree_logger_.emplace(&log->get_local_tree_logger(*user_data.compute_context));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -261,8 +261,8 @@ NodeWarning::NodeWarning(const Report &report)
|
||||
}
|
||||
|
||||
/* Avoid generating these in every translation unit. */
|
||||
GeoModifierLog::GeoModifierLog() = default;
|
||||
GeoModifierLog::~GeoModifierLog() = default;
|
||||
GeoNodesLog::GeoNodesLog() = default;
|
||||
GeoNodesLog::~GeoNodesLog() = default;
|
||||
|
||||
GeoTreeLogger::GeoTreeLogger() = default;
|
||||
GeoTreeLogger::~GeoTreeLogger() = default;
|
||||
@@ -270,8 +270,8 @@ GeoTreeLogger::~GeoTreeLogger() = default;
|
||||
GeoNodeLog::GeoNodeLog() = default;
|
||||
GeoNodeLog::~GeoNodeLog() = default;
|
||||
|
||||
GeoTreeLog::GeoTreeLog(GeoModifierLog *modifier_log, Vector<GeoTreeLogger *> tree_loggers)
|
||||
: modifier_log_(modifier_log), tree_loggers_(std::move(tree_loggers))
|
||||
GeoTreeLog::GeoTreeLog(GeoNodesLog *root_log, Vector<GeoTreeLogger *> tree_loggers)
|
||||
: root_log_(root_log), tree_loggers_(std::move(tree_loggers))
|
||||
{
|
||||
for (GeoTreeLogger *tree_logger : tree_loggers_) {
|
||||
for (const ComputeContextHash &hash : tree_logger->children_hashes) {
|
||||
@@ -453,7 +453,7 @@ void GeoTreeLog::ensure_node_warnings(
|
||||
}
|
||||
}
|
||||
for (const ComputeContextHash &child_hash : children_hashes_) {
|
||||
GeoTreeLog &child_log = modifier_log_->get_tree_log(child_hash);
|
||||
GeoTreeLog &child_log = root_log_->get_tree_log(child_hash);
|
||||
if (child_log.tree_loggers_.is_empty()) {
|
||||
continue;
|
||||
}
|
||||
@@ -574,7 +574,7 @@ void GeoTreeLog::ensure_used_named_attributes()
|
||||
}
|
||||
}
|
||||
for (const ComputeContextHash &child_hash : children_hashes_) {
|
||||
GeoTreeLog &child_log = modifier_log_->get_tree_log(child_hash);
|
||||
GeoTreeLog &child_log = root_log_->get_tree_log(child_hash);
|
||||
if (child_log.tree_loggers_.is_empty()) {
|
||||
continue;
|
||||
}
|
||||
@@ -755,7 +755,7 @@ static std::optional<uint32_t> get_original_session_uid(const ID *id)
|
||||
return {};
|
||||
}
|
||||
|
||||
GeoTreeLogger &GeoModifierLog::get_local_tree_logger(const ComputeContext &compute_context)
|
||||
GeoTreeLogger &GeoNodesLog::get_local_tree_logger(const ComputeContext &compute_context)
|
||||
{
|
||||
LocalData &local_data = data_per_thread_.local();
|
||||
Map<ComputeContextHash, destruct_ptr<GeoTreeLogger>> &local_tree_loggers =
|
||||
@@ -830,7 +830,7 @@ GeoTreeLogger &GeoModifierLog::get_local_tree_logger(const ComputeContext &compu
|
||||
return tree_logger;
|
||||
}
|
||||
|
||||
GeoTreeLog &GeoModifierLog::get_tree_log(const ComputeContextHash &compute_context_hash)
|
||||
GeoTreeLog &GeoNodesLog::get_tree_log(const ComputeContextHash &compute_context_hash)
|
||||
{
|
||||
GeoTreeLog &reduced_tree_log = *tree_logs_.lookup_or_add_cb(compute_context_hash, [&]() {
|
||||
Vector<GeoTreeLogger *> tree_logs;
|
||||
@@ -862,7 +862,7 @@ static void find_tree_zone_hash_recursive(
|
||||
}
|
||||
}
|
||||
|
||||
Map<const bNodeTreeZone *, ComputeContextHash> GeoModifierLog::
|
||||
Map<const bNodeTreeZone *, ComputeContextHash> GeoNodesLog::
|
||||
get_context_hash_by_zone_for_node_editor(const SpaceNode &snode,
|
||||
bke::ComputeContextCache &compute_context_cache)
|
||||
{
|
||||
@@ -884,7 +884,7 @@ Map<const bNodeTreeZone *, ComputeContextHash> GeoModifierLog::
|
||||
return hash_by_zone;
|
||||
}
|
||||
|
||||
static GeoModifierLog *get_root_log(const SpaceNode &snode)
|
||||
static GeoNodesLog *get_root_log(const SpaceNode &snode)
|
||||
{
|
||||
switch (SpaceNodeGeometryNodesType(snode.geometry_nodes_type)) {
|
||||
case SNODE_GEOMETRY_MODIFIER: {
|
||||
@@ -907,15 +907,15 @@ static GeoModifierLog *get_root_log(const SpaceNode &snode)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ContextualGeoTreeLogs GeoModifierLog::get_contextual_tree_logs(const SpaceNode &snode)
|
||||
ContextualGeoTreeLogs GeoNodesLog::get_contextual_tree_logs(const SpaceNode &snode)
|
||||
{
|
||||
GeoModifierLog *log = get_root_log(snode);
|
||||
GeoNodesLog *log = get_root_log(snode);
|
||||
if (!log) {
|
||||
return {};
|
||||
}
|
||||
bke::ComputeContextCache compute_context_cache;
|
||||
const Map<const bNodeTreeZone *, ComputeContextHash> hash_by_zone =
|
||||
GeoModifierLog::get_context_hash_by_zone_for_node_editor(snode, compute_context_cache);
|
||||
GeoNodesLog::get_context_hash_by_zone_for_node_editor(snode, compute_context_cache);
|
||||
Map<const bke::bNodeTreeZone *, GeoTreeLog *> tree_logs_by_zone;
|
||||
for (const auto item : hash_by_zone.items()) {
|
||||
GeoTreeLog &tree_log = log->get_tree_log(item.value);
|
||||
@@ -924,7 +924,7 @@ ContextualGeoTreeLogs GeoModifierLog::get_contextual_tree_logs(const SpaceNode &
|
||||
return {tree_logs_by_zone};
|
||||
}
|
||||
|
||||
const ViewerNodeLog *GeoModifierLog::find_viewer_node_log_for_path(const ViewerPath &viewer_path)
|
||||
const ViewerNodeLog *GeoNodesLog::find_viewer_node_log_for_path(const ViewerPath &viewer_path)
|
||||
{
|
||||
const std::optional<ed::viewer_path::ViewerPathForGeometryNodesViewer> parsed_path =
|
||||
ed::viewer_path::parse_geometry_nodes_viewer(viewer_path);
|
||||
@@ -946,7 +946,7 @@ const ViewerNodeLog *GeoModifierLog::find_viewer_node_log_for_path(const ViewerP
|
||||
if (!nmd->runtime->eval_log) {
|
||||
return nullptr;
|
||||
}
|
||||
nodes::geo_eval_log::GeoModifierLog *modifier_log = nmd->runtime->eval_log.get();
|
||||
nodes::geo_eval_log::GeoNodesLog *root_log = nmd->runtime->eval_log.get();
|
||||
|
||||
bke::ComputeContextCache compute_context_cache;
|
||||
const ComputeContext *compute_context = &compute_context_cache.for_modifier(nullptr, *nmd);
|
||||
@@ -958,7 +958,7 @@ const ViewerNodeLog *GeoModifierLog::find_viewer_node_log_for_path(const ViewerP
|
||||
}
|
||||
}
|
||||
const ComputeContextHash context_hash = compute_context->hash();
|
||||
nodes::geo_eval_log::GeoTreeLog &tree_log = modifier_log->get_tree_log(context_hash);
|
||||
nodes::geo_eval_log::GeoTreeLog &tree_log = root_log->get_tree_log(context_hash);
|
||||
tree_log.ensure_viewer_node_logs();
|
||||
|
||||
const ViewerNodeLog *viewer_log = tree_log.viewer_node_logs.lookup_default(
|
||||
|
||||
@@ -628,7 +628,7 @@ std::optional<SocketValueVariant> get_logged_socket_value(geo_eval_log::GeoTreeL
|
||||
|
||||
static void backpropagate_socket_values_through_node(
|
||||
const NodeInContext &ctx_node,
|
||||
geo_eval_log::GeoModifierLog &eval_log,
|
||||
geo_eval_log::GeoNodesLog &eval_log,
|
||||
Map<SocketInContext, SocketValueVariant> &value_by_socket,
|
||||
Vector<const bNodeSocket *> &r_modified_inputs)
|
||||
{
|
||||
@@ -688,7 +688,7 @@ static void backpropagate_socket_values_through_node(
|
||||
bool backpropagate_socket_values(bContext &C,
|
||||
Object &object,
|
||||
NodesModifierData &nmd,
|
||||
geo_eval_log::GeoModifierLog &eval_log,
|
||||
geo_eval_log::GeoNodesLog &eval_log,
|
||||
const Span<SocketToUpdate> sockets_to_update)
|
||||
{
|
||||
nmd.node_group->ensure_topology_cache();
|
||||
|
||||
Reference in New Issue
Block a user