Page MenuHome

Convert all data to real mesh when applying the nodes modifier
Confirmed, NormalPublicTO DO

Description

For 2.92 we didn't include a change to realize instances when you apply a nodes modifier.

This is a reasonable limitation-- it might be a very heavy operation, but it's also very confusing, especially for new users.

Currently we make instances real and convert points to mesh when a modifier is added after the nodes modifier.
With this change, we would do the same thing when applying the modifier too.

Event Timeline

Dalai Felinto (dfelinto) changed the task status from Needs Triage to Confirmed.Wed, Mar 31, 1:05 PM
Dalai Felinto (dfelinto) created this task.
Hans Goudey (HooglyBoogly) renamed this task from Applying geometry nodes modifier is not converting the data to mesh to Convert all data to real mesh when applying the nodes modifier.Tue, Apr 6, 2:55 PM
Hans Goudey (HooglyBoogly) updated the task description. (Show Details)

the change is only one line actually, quite nice!

In the chat I posted a concern that this is a dangerous thing to do, since realizing instances is a very heavy operation in some cases, and it could crash Blender.

diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc
index 843797e0f72..093722adc5f 100644
--- a/source/blender/modifiers/intern/MOD_nodes.cc
+++ b/source/blender/modifiers/intern/MOD_nodes.cc
@@ -1258,6 +1258,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
   geometry_set.get_component_for_write<MeshComponent>().copy_vertex_group_names_from_object(
       *ctx->object);
   modifyGeometry(md, ctx, geometry_set);
+  geometry_set = blender::bke::geometry_set_realize_mesh_for_modifier(geometry_set);
   Mesh *new_mesh = geometry_set.get_component_for_write<MeshComponent>().release();
   if (new_mesh == nullptr) {
     return BKE_mesh_new_nomain(0, 0, 0, 0, 0);

For me this sounds like "we shouldn't let users render a super high-poly scene" because it will break their computers.

We *could* (not sure we should since it goes against some Blender design) warn the user if the new geometry have more than 1M triangles. (arbitrary number).

For any use case where users are not instancing a whole set but instead doing procedural modeling of one object users should be able to apply the modifier.

A warning for operations that may cause crashes or freezing may be a good UX and an encourage change of thought for Blender UI design. We confirm delete dialogues and other operators, even library override application, it would also be consistent here to confirm this operator with a "⚠️* attached to the confirm dialogue. It hurts none and saves work for many.

It seems to be working well. I wonder if there is a smart way to go about materials. But it is unrelated to this since the same issue happens when using geometry nodes + another modifier after that.
Nice work Hans.