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:
-rw-r--r--source/blender/editors/space_node/node_draw.cc4
-rw-r--r--source/blender/modifiers/intern/MOD_nodes.cc2
-rw-r--r--source/blender/nodes/NOD_geometry_exec.hh4
-rw-r--r--source/blender/nodes/NOD_geometry_nodes_log.hh34
-rw-r--r--source/blender/nodes/intern/geometry_nodes_lazy_function.cc3
-rw-r--r--source/blender/nodes/intern/geometry_nodes_log.cc14
-rw-r--r--source/blender/nodes/intern/node_geometry_exec.cc12
7 files changed, 40 insertions, 33 deletions
diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc
index 3a8e5d0aed6..937db9951b4 100644
--- a/source/blender/editors/space_node/node_draw.cc
+++ b/source/blender/editors/space_node/node_draw.cc
@@ -1770,7 +1770,7 @@ struct NodeExtraInfoRow {
};
struct NamedAttributeTooltipArg {
- Map<std::string, geo_log::NamedAttributeUsage> usage_by_attribute;
+ Map<StringRefNull, geo_log::NamedAttributeUsage> usage_by_attribute;
};
static char *named_attribute_tooltip(bContext *UNUSED(C), void *argN, const char *UNUSED(tip))
@@ -1824,7 +1824,7 @@ static char *named_attribute_tooltip(bContext *UNUSED(C), void *argN, const char
}
static NodeExtraInfoRow row_from_used_named_attribute(
- const Map<std::string, geo_log::NamedAttributeUsage> &usage_by_attribute_name)
+ const Map<StringRefNull, geo_log::NamedAttributeUsage> &usage_by_attribute_name)
{
const int attributes_num = usage_by_attribute_name.size();
diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc
index d4384c988e3..ff8f851c1e8 100644
--- a/source/blender/modifiers/intern/MOD_nodes.cc
+++ b/source/blender/modifiers/intern/MOD_nodes.cc
@@ -1760,7 +1760,7 @@ static void internal_dependencies_panel_draw(const bContext *UNUSED(C), Panel *p
}
tree_log->ensure_used_named_attributes();
- const Map<std::string, NamedAttributeUsage> &usage_by_attribute =
+ const Map<StringRefNull, NamedAttributeUsage> &usage_by_attribute =
tree_log->used_named_attributes;
if (usage_by_attribute.is_empty()) {
diff --git a/source/blender/nodes/NOD_geometry_exec.hh b/source/blender/nodes/NOD_geometry_exec.hh
index 16669f7cfce..73e82f741ab 100644
--- a/source/blender/nodes/NOD_geometry_exec.hh
+++ b/source/blender/nodes/NOD_geometry_exec.hh
@@ -237,13 +237,13 @@ class GeoNodeExecParams {
* Add an error message displayed at the top of the node when displaying the node tree,
* and potentially elsewhere in Blender.
*/
- void error_message_add(const NodeWarningType type, std::string message) const;
+ void error_message_add(const NodeWarningType type, StringRef message) const;
std::string attribute_producer_name() const;
void set_default_remaining_outputs();
- void used_named_attribute(std::string attribute_name, NamedAttributeUsage usage);
+ void used_named_attribute(StringRef attribute_name, NamedAttributeUsage usage);
private:
/* Utilities for detecting common errors at when using this class. */
diff --git a/source/blender/nodes/NOD_geometry_nodes_log.hh b/source/blender/nodes/NOD_geometry_nodes_log.hh
index dd4868b6ba0..cf59c99bc79 100644
--- a/source/blender/nodes/NOD_geometry_nodes_log.hh
+++ b/source/blender/nodes/NOD_geometry_nodes_log.hh
@@ -169,37 +169,37 @@ using TimePoint = Clock::time_point;
class GeoTreeLogger {
public:
std::optional<ComputeContextHash> parent_hash;
- std::optional<std::string> group_node_name;
+ std::optional<StringRefNull> group_node_name;
Vector<ComputeContextHash> children_hashes;
LinearAllocator<> *allocator = nullptr;
struct WarningWithNode {
- std::string node_name;
+ StringRefNull node_name;
NodeWarning warning;
};
struct SocketValueLog {
- std::string node_name;
- std::string socket_identifier;
+ StringRefNull node_name;
+ StringRefNull socket_identifier;
destruct_ptr<ValueLog> value;
};
struct NodeExecutionTime {
- std::string node_name;
+ StringRefNull node_name;
TimePoint start;
TimePoint end;
};
struct ViewerNodeLogWithNode {
- std::string node_name;
+ StringRefNull node_name;
destruct_ptr<ViewerNodeLog> viewer_log;
};
struct AttributeUsageWithNode {
- std::string node_name;
- std::string attribute_name;
+ StringRefNull node_name;
+ StringRefNull attribute_name;
NamedAttributeUsage usage;
};
struct DebugMessage {
- std::string node_name;
- std::string message;
+ StringRefNull node_name;
+ StringRefNull message;
};
Vector<WarningWithNode> node_warnings;
@@ -235,12 +235,12 @@ class GeoNodeLog {
*/
std::chrono::nanoseconds run_time{0};
/** Maps from socket identifiers to their values. */
- Map<std::string, ValueLog *> input_values_;
- Map<std::string, ValueLog *> output_values_;
+ Map<StringRefNull, ValueLog *> input_values_;
+ Map<StringRefNull, ValueLog *> output_values_;
/** Maps from attribute name to their usage flags. */
- Map<std::string, NamedAttributeUsage> used_named_attributes;
+ Map<StringRefNull, NamedAttributeUsage> used_named_attributes;
/** Messages that are used for debugging purposes during development. */
- Vector<std::string> debug_messages;
+ Vector<StringRefNull> debug_messages;
GeoNodeLog();
~GeoNodeLog();
@@ -269,12 +269,12 @@ class GeoTreeLog {
bool reduced_debug_messages_ = false;
public:
- Map<std::string, GeoNodeLog> nodes;
- Map<std::string, ViewerNodeLog *, 0> viewer_node_logs;
+ Map<StringRefNull, GeoNodeLog> nodes;
+ Map<StringRefNull, ViewerNodeLog *, 0> viewer_node_logs;
Vector<NodeWarning> all_warnings;
std::chrono::nanoseconds run_time_sum{0};
Vector<const GeometryAttributeInfo *> existing_attributes;
- Map<std::string, NamedAttributeUsage> used_named_attributes;
+ Map<StringRefNull, NamedAttributeUsage> used_named_attributes;
GeoTreeLog(GeoModifierLog *modifier_log, Vector<GeoTreeLogger *> tree_loggers);
~GeoTreeLog();
diff --git a/source/blender/nodes/intern/geometry_nodes_lazy_function.cc b/source/blender/nodes/intern/geometry_nodes_lazy_function.cc
index 137057414d4..996cea26718 100644
--- a/source/blender/nodes/intern/geometry_nodes_lazy_function.cc
+++ b/source/blender/nodes/intern/geometry_nodes_lazy_function.cc
@@ -134,7 +134,8 @@ class LazyFunctionForGeometryNode : public LazyFunction {
if (geo_eval_log::GeoModifierLog *modifier_log = user_data->modifier_data->eval_log) {
geo_eval_log::GeoTreeLogger &tree_logger = modifier_log->get_local_tree_logger(
*user_data->compute_context);
- tree_logger.node_execution_times.append({node_.name, start_time, end_time});
+ tree_logger.node_execution_times.append(
+ {tree_logger.allocator->copy_string(node_.name), start_time, end_time});
}
}
};
diff --git a/source/blender/nodes/intern/geometry_nodes_log.cc b/source/blender/nodes/intern/geometry_nodes_log.cc
index 350b199cd60..110573c9119 100644
--- a/source/blender/nodes/intern/geometry_nodes_log.cc
+++ b/source/blender/nodes/intern/geometry_nodes_log.cc
@@ -148,7 +148,9 @@ void GeoTreeLogger::log_value(const bNode &node, const bNodeSocket &socket, cons
auto store_logged_value = [&](destruct_ptr<ValueLog> value_log) {
auto &socket_values = socket.in_out == SOCK_IN ? this->input_socket_values :
this->output_socket_values;
- socket_values.append({node.name, socket.identifier, std::move(value_log)});
+ socket_values.append({this->allocator->copy_string(node.name),
+ this->allocator->copy_string(socket.identifier),
+ std::move(value_log)});
};
auto log_generic_value = [&](const CPPType &type, const void *value) {
@@ -194,7 +196,7 @@ void GeoTreeLogger::log_viewer_node(const bNode &viewer_node,
log->geometry = geometry;
log->field = field;
log->geometry.ensure_owns_direct_data();
- this->viewer_node_logs.append({viewer_node.name, std::move(log)});
+ this->viewer_node_logs.append({this->allocator->copy_string(viewer_node.name), std::move(log)});
}
void GeoTreeLog::ensure_node_warnings()
@@ -315,11 +317,11 @@ void GeoTreeLog::ensure_used_named_attributes()
return;
}
- auto add_attribute = [&](const StringRef node_name,
- const StringRef attribute_name,
+ auto add_attribute = [&](const StringRefNull node_name,
+ const StringRefNull attribute_name,
const NamedAttributeUsage &usage) {
- this->nodes.lookup_or_add_as(node_name).used_named_attributes.lookup_or_add_as(attribute_name,
- usage) |= usage;
+ this->nodes.lookup_or_add_default(node_name).used_named_attributes.lookup_or_add(
+ attribute_name, usage) |= usage;
this->used_named_attributes.lookup_or_add_as(attribute_name, usage) |= usage;
};
diff --git a/source/blender/nodes/intern/node_geometry_exec.cc b/source/blender/nodes/intern/node_geometry_exec.cc
index 1833774fe33..1de92fa8409 100644
--- a/source/blender/nodes/intern/node_geometry_exec.cc
+++ b/source/blender/nodes/intern/node_geometry_exec.cc
@@ -13,18 +13,22 @@
namespace blender::nodes {
-void GeoNodeExecParams::error_message_add(const NodeWarningType type, std::string message) const
+void GeoNodeExecParams::error_message_add(const NodeWarningType type,
+ const StringRef message) const
{
if (geo_eval_log::GeoTreeLogger *tree_logger = this->get_local_tree_logger()) {
- tree_logger->node_warnings.append({node_.name, {type, std::move(message)}});
+ tree_logger->node_warnings.append({tree_logger->allocator->copy_string(node_.name),
+ {type, tree_logger->allocator->copy_string(message)}});
}
}
-void GeoNodeExecParams::used_named_attribute(std::string attribute_name,
+void GeoNodeExecParams::used_named_attribute(const StringRef attribute_name,
const NamedAttributeUsage usage)
{
if (geo_eval_log::GeoTreeLogger *tree_logger = this->get_local_tree_logger()) {
- tree_logger->used_named_attributes.append({node_.name, std::move(attribute_name), usage});
+ tree_logger->used_named_attributes.append({tree_logger->allocator->copy_string(node_.name),
+ tree_logger->allocator->copy_string(attribute_name),
+ usage});
}
}