Geometry Nodes: Support instances in attribute search
Previously only attributes of "real" geometry were displayed in attribute search. This commit adds code to look through attributes on instances and add those to the search drop-down too. This required implementing the same sort of recursive traversal as the realize instances code. The situation is a bit different though, this can return early and doesn't need to keep track of transforms. I added a limit so that it doesn't look through the attributes of too many instanced geometry sets. I think this is important, since this isn't a trivial operation and it could potentially happen for every node in a large node tree. Currently the limit is set at 8 geometry sets, which I expect will be enough, since the set of attributes is mostly not very unique anyway. Fixes T86282 Diffrential Revision: https://developer.blender.org/D10919
This commit is contained in:
@@ -47,6 +47,7 @@
|
||||
#include "DNA_windowmanager_types.h"
|
||||
|
||||
#include "BKE_customdata.h"
|
||||
#include "BKE_geometry_set_instances.hh"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_idprop.h"
|
||||
#include "BKE_lib_query.h"
|
||||
@@ -489,20 +490,19 @@ class GeometryNodesEvaluator {
|
||||
const NodeTreeEvaluationContext context(*self_object_, *modifier_);
|
||||
|
||||
const GeometrySet &geometry_set = params.get_input<GeometrySet>(socket_ref->identifier());
|
||||
const Vector<const GeometryComponent *> components = geometry_set.get_components_for_read();
|
||||
|
||||
for (const GeometryComponent *component : components) {
|
||||
component->attribute_foreach(
|
||||
[&](StringRefNull attribute_name, const AttributeMetaData &meta_data) {
|
||||
BKE_nodetree_attribute_hint_add(*btree_original,
|
||||
context,
|
||||
*node->bnode(),
|
||||
attribute_name,
|
||||
meta_data.domain,
|
||||
meta_data.data_type);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
blender::bke::geometry_set_instances_attribute_foreach(
|
||||
geometry_set,
|
||||
[&](StringRefNull attribute_name, const AttributeMetaData &meta_data) {
|
||||
BKE_nodetree_attribute_hint_add(*btree_original,
|
||||
context,
|
||||
*node->bnode(),
|
||||
attribute_name,
|
||||
meta_data.domain,
|
||||
meta_data.data_type);
|
||||
return true;
|
||||
},
|
||||
8);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user