Fix #108977: Propagate material from first point cloud by Join Geometry node

Until point clouds support multiple materials, just copy
the material from the first point cloud. This approach is the
same as for texture coordinate of meshes, active color attribute
of custom data, etc.

Pull Request: https://projects.blender.org/blender/blender/pulls/108990
This commit is contained in:
Iliya Katueshenock
2023-06-14 22:49:37 +02:00
committed by Hans Goudey
parent 3d6a99d2aa
commit 4be143193d

View File

@@ -780,6 +780,11 @@ static void execute_realize_pointcloud_tasks(const RealizeInstancesOptions &opti
dst_component.replace(dst_pointcloud);
bke::MutableAttributeAccessor dst_attributes = dst_pointcloud->attributes_for_write();
const RealizePointCloudTask &first_task = tasks.first();
const PointCloud &first_pointcloud = *first_task.pointcloud_info->pointcloud;
dst_pointcloud->mat = static_cast<Material **>(MEM_dupallocN(first_pointcloud.mat));
dst_pointcloud->totcol = first_pointcloud.totcol;
SpanAttributeWriter<float3> positions = dst_attributes.lookup_or_add_for_write_only_span<float3>(
"position", ATTR_DOMAIN_POINT);