Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-10-19 16:39:10 +0300
committerHans Goudey <h.goudey@me.com>2021-10-19 16:39:10 +0300
commit219058c213d5c9efce3f44216f6513edc93b5536 (patch)
tree26b76ae133b36d41c9a90d43eaa29ebf2b943c5a /source/blender/blenkernel/intern/DerivedMesh.cc
parentcd36f59027042ff0f2ad53e98088428a4c0c5e38 (diff)
Geometry Nodes: Remove implicit realizing and conversion
This commit removes the implicit conversion from points to a mesh that used to happen before the next modifier. It also removes the implicit realizing of instances that happened before another modifier. Now we have specific nodes for both of these operations, the implicit conversions make less sense, and implicit instance realizing has already been removed in other nodes. This adds another geometry nodes modifier before modifiers that would have realized instances implicitly before. Currently adding another data-block during versioning after linking means that an assert needs to be changed. That should be made unnecessary by T92333. Differential Revision: https://developer.blender.org/D12722
Diffstat (limited to 'source/blender/blenkernel/intern/DerivedMesh.cc')
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.cc44
1 files changed, 1 insertions, 43 deletions
diff --git a/source/blender/blenkernel/intern/DerivedMesh.cc b/source/blender/blenkernel/intern/DerivedMesh.cc
index 59e81938e79..3ec0ab9c512 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.cc
+++ b/source/blender/blenkernel/intern/DerivedMesh.cc
@@ -886,33 +886,6 @@ void BKE_mesh_wrapper_deferred_finalize(Mesh *me_eval,
}
/**
- * 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
- * modifiers can work on it as well.
- */
-static Mesh *prepare_geometry_set_for_mesh_modifier(Mesh *mesh, GeometrySet &r_geometry_set)
-{
- if (!r_geometry_set.has_instances() && !r_geometry_set.has_pointcloud()) {
- return mesh;
- }
-
- {
- /* Add the mesh to the geometry set. */
- MeshComponent &mesh_component = r_geometry_set.get_component_for_write<MeshComponent>();
- mesh_component.replace(mesh, GeometryOwnershipType::Editable);
- }
- {
- /* 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_mesh_for_modifier(
- r_geometry_set);
- MeshComponent &mesh_component = new_geometry_set.get_component_for_write<MeshComponent>();
- Mesh *new_mesh = mesh_component.release();
- r_geometry_set = new_geometry_set;
- return new_mesh;
- }
-}
-
-/**
* Modifies the given mesh and geometry set. The mesh is not passed as part of the mesh component
* in the \a geometry_set input, it is only passed in \a input_mesh and returned in the return
* value.
@@ -928,14 +901,7 @@ static Mesh *modifier_modify_mesh_and_geometry_set(ModifierData *md,
Mesh *mesh_output = nullptr;
const ModifierTypeInfo *mti = BKE_modifier_get_info((ModifierType)md->type);
if (mti->modifyGeometrySet == nullptr) {
- Mesh *new_input_mesh = prepare_geometry_set_for_mesh_modifier(input_mesh, geometry_set);
- mesh_output = BKE_modifier_modify_mesh(md, &mectx, new_input_mesh);
-
- /* The caller is responsible for freeing `input_mesh` and `mesh_output`. The intermediate
- * `new_input_mesh` has to be freed here. */
- if (!ELEM(new_input_mesh, input_mesh, mesh_output)) {
- BKE_id_free(nullptr, new_input_mesh);
- }
+ mesh_output = BKE_modifier_modify_mesh(md, &mectx, input_mesh);
}
else {
/* For performance reasons, this should be called by the modifier and/or nodes themselves at
@@ -1177,14 +1143,6 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
/* No existing verts to deform, need to build them. */
if (!deformed_verts) {
if (mesh_final) {
- Mesh *mesh_final_new = prepare_geometry_set_for_mesh_modifier(mesh_final,
- geometry_set_final);
- if (mesh_final_new != mesh_final) {
- BLI_assert(mesh_final != mesh_input);
- BKE_id_free(nullptr, mesh_final);
- mesh_final = mesh_final_new;
- }
-
/* Deforming a mesh, read the vertex locations
* out of the mesh and deform them. Once done with this
* run of deformers verts will be written back. */