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>2022-03-22 13:09:37 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2022-03-23 19:54:04 +0300
commit52bc4206588b85c24473bc5ad12ebf9b8451c114 (patch)
treefcbf25afebb8c0e1ac5d84279cf7f6bbbb6f1cc3
parent07dc383f4b19e5a30dd5dced3cda7cd6160cb962 (diff)
Fix T96420: Set ID node not working for instances
Previously, instances used the point domain, but now there is a special domain for instance attributes that the node has to use.
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_set_id.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_id.cc b/source/blender/nodes/geometry/nodes/node_geo_set_id.cc
index 110b8206944..92433059c97 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_set_id.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_set_id.cc
@@ -30,8 +30,11 @@ static void set_id_in_component(GeometryComponent &component,
const Field<bool> &selection_field,
const Field<int> &id_field)
{
- GeometryComponentFieldContext field_context{component, ATTR_DOMAIN_POINT};
- const int domain_size = component.attribute_domain_size(ATTR_DOMAIN_POINT);
+ const AttributeDomain domain = (component.type() == GEO_COMPONENT_TYPE_INSTANCES) ?
+ ATTR_DOMAIN_INSTANCE :
+ ATTR_DOMAIN_POINT;
+ GeometryComponentFieldContext field_context{component, domain};
+ const int domain_size = component.attribute_domain_size(domain);
if (domain_size == 0) {
return;
}
@@ -44,7 +47,7 @@ static void set_id_in_component(GeometryComponent &component,
* the field. However, as an optimization, use a faster code path when it already exists. */
if (component.attribute_exists("id")) {
OutputAttribute_Typed<int> id_attribute = component.attribute_try_get_for_output_only<int>(
- "id", ATTR_DOMAIN_POINT);
+ "id", domain);
evaluator.add_with_destination(id_field, id_attribute.varray());
evaluator.evaluate();
id_attribute.save();
@@ -55,7 +58,7 @@ static void set_id_in_component(GeometryComponent &component,
const IndexMask selection = evaluator.get_evaluated_selection_as_mask();
const VArray<int> &result_ids = evaluator.get_evaluated<int>(0);
OutputAttribute_Typed<int> id_attribute = component.attribute_try_get_for_output_only<int>(
- "id", ATTR_DOMAIN_POINT);
+ "id", domain);
result_ids.materialize(selection, id_attribute.as_span());
id_attribute.save();
}