Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/DerivedMesh.cc
| Show First 20 Lines • Show All 884 Lines • ▼ Show 20 Lines | |||||
| /** | /** | ||||
| * Some modifiers don't work on geometry sets directly, but expect a single mesh as input. | * Some modifiers don't work on geometry sets directly, but expect a single mesh as input. | ||||
| * Therefore, we convert data from the geometry set into a single mesh, so that those | * Therefore, we convert data from the geometry set into a single mesh, so that those | ||||
| * modifiers can work on it as well. | * modifiers can work on it as well. | ||||
| */ | */ | ||||
| static Mesh *prepare_geometry_set_for_mesh_modifier(Mesh *mesh, GeometrySet &r_geometry_set) | static Mesh *prepare_geometry_set_for_mesh_modifier(Mesh *mesh, GeometrySet &r_geometry_set) | ||||
| { | { | ||||
| if (!r_geometry_set.has_instances()) { | if (!r_geometry_set.has_instances() && !r_geometry_set.has_pointcloud()) { | ||||
| return mesh; | return mesh; | ||||
| } | } | ||||
| { | { | ||||
| /* Add the mesh to the geometry set. */ | /* Add the mesh to the geometry set. */ | ||||
| MeshComponent &mesh_component = r_geometry_set.get_component_for_write<MeshComponent>(); | MeshComponent &mesh_component = r_geometry_set.get_component_for_write<MeshComponent>(); | ||||
| mesh_component.replace_mesh_but_keep_vertex_group_names(mesh, GeometryOwnershipType::Editable); | mesh_component.replace_mesh_but_keep_vertex_group_names(mesh, GeometryOwnershipType::Editable); | ||||
| } | } | ||||
| { | { | ||||
| /* Combine mesh and all instances into a single mesh that can be passed to the modifier. */ | /* Combine mesh and all instances into a single mesh that can be passed to the modifier. */ | ||||
| GeometrySet new_geometry_set = blender::bke::geometry_set_realize_instances(r_geometry_set); | GeometrySet new_geometry_set = blender::bke::geometry_set_realize_mesh_for_modifier( | ||||
| r_geometry_set); | |||||
| MeshComponent &mesh_component = new_geometry_set.get_component_for_write<MeshComponent>(); | MeshComponent &mesh_component = new_geometry_set.get_component_for_write<MeshComponent>(); | ||||
| Mesh *new_mesh = mesh_component.release(); | Mesh *new_mesh = mesh_component.release(); | ||||
| r_geometry_set = new_geometry_set; | r_geometry_set = new_geometry_set; | ||||
| return new_mesh; | return new_mesh; | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| ▲ Show 20 Lines • Show All 1,626 Lines • Show Last 20 Lines | |||||