[Bf-blender-cvs] [52bc4206588] blender-v3.1-release: Fix T96420: Set ID node not working for instances
Jacques Lucke
noreply at git.blender.org
Thu Mar 24 09:07:13 CET 2022
Commit: 52bc4206588b85c24473bc5ad12ebf9b8451c114
Author: Jacques Lucke
Date: Tue Mar 22 11:09:37 2022 +0100
Branches: blender-v3.1-release
https://developer.blender.org/rB52bc4206588b85c24473bc5ad12ebf9b8451c114
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.
===================================================================
M source/blender/nodes/geometry/nodes/node_geo_set_id.cc
===================================================================
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();
}
More information about the Bf-blender-cvs
mailing list