diff options
author | Hans Goudey <h.goudey@me.com> | 2021-02-17 17:30:15 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-02-17 17:30:15 +0300 |
commit | 53bf04f2844b64cd9f79bedd047eac9690f872e3 (patch) | |
tree | 5f66fbf888ee86ded53ebe3ff6fc4efe098080e6 /source/blender/blenkernel/intern/geometry_set_instances.cc | |
parent | 37de612104dfae77ad34e3f76e77b3aa277c78fa (diff) |
Geometry Nodes: Expose material index attribute
The `material_index` attribute can adjust which material in the list
will be applied to each face of the mesh. There are two new things
about this attribute that haven't been exposed by the attribute API yet.
Each comes with limitations:
1. Integer data type: Most attribute nodes are currently written to use
float data types. This means that they can't write to this attribute
because they can't change the type of a built-in attribute.
2. Polygon domain: This is our first attribute using the polygon domain,
meaning until some of the interpolations are implemented, some
operations may not work as expected.
Currently the two nodes that work with this attribute are Attribute Fill
and Attribute Randomize.
Differential Revision: https://developer.blender.org/D10444
Diffstat (limited to 'source/blender/blenkernel/intern/geometry_set_instances.cc')
-rw-r--r-- | source/blender/blenkernel/intern/geometry_set_instances.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/geometry_set_instances.cc b/source/blender/blenkernel/intern/geometry_set_instances.cc index 8e9edc86bca..436fc0f1d1d 100644 --- a/source/blender/blenkernel/intern/geometry_set_instances.cc +++ b/source/blender/blenkernel/intern/geometry_set_instances.cc @@ -350,9 +350,10 @@ static void join_instance_groups_mesh(Span<GeometryInstanceGroup> set_groups, Ge MeshComponent &dst_component = result.get_component_for_write<MeshComponent>(); dst_component.replace(new_mesh); - /* The position attribute is handled above already. */ + /* Don't copy attributes that are stored directly in the mesh data structs. */ Map<std::string, AttributeInfo> attributes; - gather_attribute_info(attributes, GeometryComponentType::Mesh, set_groups, {"position"}); + gather_attribute_info( + attributes, GeometryComponentType::Mesh, set_groups, {"position", "material_index"}); join_attributes(set_groups, GeometryComponentType::Mesh, attributes, |