Fix: Material selection node test failure

The actual selection needs to be evaluated on the right domain, not
necessarily the domain from the field context. It's interpolated as
a separate step.

Also reuse the attribute accessor already assigned to a local variable.
This commit is contained in:
Hans Goudey
2023-10-17 22:46:16 +02:00
parent 60e7e89bfa
commit e84ba67c73

View File

@@ -81,9 +81,8 @@ class MaterialSelectionFieldInput final : public bke::GeometryFieldInput {
IndexMask(mesh->faces_num);
const AttributeAccessor attributes = mesh->attributes();
VArray<bool> selection = select_by_material(
{mesh->mat, mesh->totcol}, material_, attributes, domain, domain_mask);
return mesh->attributes().adapt_domain<bool>(
std::move(selection), ATTR_DOMAIN_FACE, domain);
{mesh->mat, mesh->totcol}, material_, attributes, ATTR_DOMAIN_FACE, domain_mask);
return attributes.adapt_domain<bool>(std::move(selection), ATTR_DOMAIN_FACE, domain);
}
case GeometryComponent::Type::GreasePencil: {
const bke::CurvesGeometry *curves = context.curves_or_strokes();
@@ -102,10 +101,9 @@ class MaterialSelectionFieldInput final : public bke::GeometryFieldInput {
{grease_pencil.material_array, grease_pencil.material_array_num},
material_,
attributes,
domain,
ATTR_DOMAIN_CURVE,
domain_mask);
return curves->attributes().adapt_domain<bool>(
std::move(selection), ATTR_DOMAIN_CURVE, domain);
return attributes.adapt_domain<bool>(std::move(selection), ATTR_DOMAIN_CURVE, domain);
}
default:
return {};