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:
authorJacques Lucke <jacques@blender.org>2021-08-06 12:56:11 +0300
committerJacques Lucke <jacques@blender.org>2021-08-06 12:56:11 +0300
commitf9b948d4fec11d41e835739f02e02aea312bca68 (patch)
tree1836f237032e03d8923ff28f77cd9183603e8693
parent9eb238db2d1c2f3d0de7c65b06e5abd71f99d178 (diff)
get input attribute names from modifier
-rw-r--r--source/blender/modifiers/intern/MOD_nodes.cc12
-rw-r--r--source/blender/modifiers/intern/MOD_nodes_evaluator.cc1
-rw-r--r--source/blender/modifiers/intern/MOD_nodes_evaluator.hh1
-rw-r--r--source/blender/nodes/NOD_geometry_exec.hh5
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc2
5 files changed, 16 insertions, 5 deletions
diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc
index b67cdbb1cb0..afbddba2294 100644
--- a/source/blender/modifiers/intern/MOD_nodes.cc
+++ b/source/blender/modifiers/intern/MOD_nodes.cc
@@ -723,7 +723,8 @@ void MOD_nodes_init(Main *bmain, NodesModifierData *nmd)
static void initialize_group_input(NodesModifierData &nmd,
const bNodeSocket &socket,
const CPPType &cpp_type,
- void *r_value)
+ void *r_value,
+ Map<std::string, std::string> &r_group_input_attribute_names)
{
const SocketPropertyType *property_type = get_socket_property_type(socket);
if (property_type == nullptr) {
@@ -745,6 +746,9 @@ static void initialize_group_input(NodesModifierData &nmd,
return;
}
property_type->init_cpp_value(*property, r_value);
+ if (property->type == IDP_STRING) {
+ r_group_input_attribute_names.add(socket.identifier, IDP_String(property));
+ }
}
static Vector<SpaceSpreadsheet *> find_spreadsheet_editors(Main *bmain)
@@ -872,6 +876,8 @@ static GeometrySet compute_geometry(const DerivedNodeTree &tree,
Map<DOutputSocket, GMutablePointer> group_inputs;
+ Map<std::string, std::string> group_input_attribute_names;
+
const DTreeContext *root_context = &tree.root_context();
for (const NodeRef *group_input_node : group_input_nodes) {
Span<const OutputSocketRef *> group_input_sockets = group_input_node->outputs().drop_back(1);
@@ -895,7 +901,8 @@ static GeometrySet compute_geometry(const DerivedNodeTree &tree,
for (const OutputSocketRef *socket : remaining_input_sockets) {
const CPPType &cpp_type = *socket->typeinfo()->get_geometry_nodes_cpp_type();
void *value_in = allocator.allocate(cpp_type.size(), cpp_type.alignment());
- initialize_group_input(*nmd, *socket->bsocket(), cpp_type, value_in);
+ initialize_group_input(
+ *nmd, *socket->bsocket(), cpp_type, value_in, group_input_attribute_names);
group_inputs.add_new({root_context, socket}, {cpp_type, value_in});
}
}
@@ -924,6 +931,7 @@ static GeometrySet compute_geometry(const DerivedNodeTree &tree,
eval_params.depsgraph = ctx->depsgraph;
eval_params.self_object = ctx->object;
eval_params.geo_logger = geo_logger.has_value() ? &*geo_logger : nullptr;
+ eval_params.group_input_attribute_names = group_input_attribute_names;
blender::modifiers::geometry_nodes::evaluate_geometry_nodes(eval_params);
if (geo_logger.has_value()) {
diff --git a/source/blender/modifiers/intern/MOD_nodes_evaluator.cc b/source/blender/modifiers/intern/MOD_nodes_evaluator.cc
index 1c4811b9767..eb43cf35083 100644
--- a/source/blender/modifiers/intern/MOD_nodes_evaluator.cc
+++ b/source/blender/modifiers/intern/MOD_nodes_evaluator.cc
@@ -1514,6 +1514,7 @@ NodeParamsProvider::NodeParamsProvider(GeometryNodesEvaluator &evaluator,
this->modifier = &evaluator.params_.modifier_->modifier;
this->depsgraph = evaluator.params_.depsgraph;
this->logger = evaluator.params_.geo_logger;
+ this->group_attribute_input_names = &evaluator.params_.group_input_attribute_names;
}
bool NodeParamsProvider::can_get_input(StringRef identifier) const
diff --git a/source/blender/modifiers/intern/MOD_nodes_evaluator.hh b/source/blender/modifiers/intern/MOD_nodes_evaluator.hh
index d8c60d31986..c11556f1128 100644
--- a/source/blender/modifiers/intern/MOD_nodes_evaluator.hh
+++ b/source/blender/modifiers/intern/MOD_nodes_evaluator.hh
@@ -50,6 +50,7 @@ struct GeometryNodesEvaluationParams {
Depsgraph *depsgraph;
Object *self_object;
geo_log::GeoLogger *geo_logger;
+ Map<std::string, std::string> group_input_attribute_names;
Vector<GMutablePointer> r_output_values;
};
diff --git a/source/blender/nodes/NOD_geometry_exec.hh b/source/blender/nodes/NOD_geometry_exec.hh
index 156595a1583..c00264fdc32 100644
--- a/source/blender/nodes/NOD_geometry_exec.hh
+++ b/source/blender/nodes/NOD_geometry_exec.hh
@@ -67,6 +67,7 @@ class GeoNodeExecParamsProvider {
const ModifierData *modifier = nullptr;
Depsgraph *depsgraph = nullptr;
geometry_nodes_eval_log::GeoLogger *logger = nullptr;
+ const Map<std::string, std::string> *group_attribute_input_names = nullptr;
/**
* Returns true when the node is allowed to get/extract the input value. The identifier is
@@ -340,9 +341,9 @@ class GeoNodeExecParams {
const GeometryComponent &component,
const AttributeDomain default_domain) const;
- std::string get_group_input_attribute_name(const StringRef UNUSED(input_identifier)) const
+ std::string get_group_input_attribute_name(const StringRef input_identifier) const
{
- return "Group";
+ return provider_->group_attribute_input_names->lookup_default(input_identifier, "");
}
private:
diff --git a/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc b/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
index d63814092d9..cec1819159e 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
@@ -350,7 +350,7 @@ struct SpecialAttributeOutputs {
} // namespace
BLI_NOINLINE static void compute_special_attributes(Span<GeometryInstanceGroup> sets,
- Span<int> instance_start_offsets,
+ Span<int> UNUSED(instance_start_offsets),
Span<Vector<float3>> bary_coords_array,
Span<Vector<int>> looptri_indices_array,
SpecialAttributeOutputs &r_special_attributes)