diff options
author | Hans Goudey <h.goudey@me.com> | 2021-03-06 00:16:25 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-03-06 00:16:25 +0300 |
commit | f117ea26246355f423fd78785a3b00a2490bd9a4 (patch) | |
tree | 7eece56e3299c2e2f90691c10f3699d1d05a93c9 /source/blender/nodes | |
parent | becc36cce5248417fe4f626dedb50804c0e0eb1d (diff) |
Geometry Nodes: Expose vertex normals as an attribute
This attribute exposes mesh vertex normals as a `vertex_normal`
attribute for use with nodes. Since the normal vector stored in
vertices is only a cache of data computable from the surrounding faces,
the attribute is read-only. A proper error message for attempting to
write this attribute is part of T85749. A write-only normal attribute
will likely come later, most likely called `corner_normal`.
The normals are recomputed before reading if they are marked dirty.
This involves const write-access to the mesh, protected by the mutex
stored in `Mesh_Runtime`. This is essential for correct behavior after
nodes like "Edge Split" or nodes that adjust the position attribute.
Ref T84297, T85880, T86206
Differential Revision: https://developer.blender.org/D10541
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc b/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc index 4e15f232934..9dce52c072d 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc @@ -222,8 +222,9 @@ static void join_components(Span<const MeshComponent *> src_components, Geometry dst_component.replace(new_mesh); /* Don't copy attributes that are stored directly in the mesh data structs. */ - join_attributes( - to_base_components(src_components), dst_component, {"position", "material_index"}); + join_attributes(to_base_components(src_components), + dst_component, + {"position", "material_index", "vertex_normal"}); } static void join_components(Span<const PointCloudComponent *> src_components, GeometrySet &result) |