Page MenuHome

Geometry Nodes: Create empty components less often
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on Oct 14 2021, 7:09 AM.

Details

Summary

Avoiding creating empty components can be a hassle for code that
interacts with a geometry set. One easy way to do that was calling
the functions that retrieved mutable access to geometry data directly,
like get_mesh_for_write. This commit makes it so that sort of direct
function does not create an empty component if there is no data.

Another way to create an empty component was calling the replace_*
methods with a null pointer. It's more convenient to have a nice API
that handles those cases without creating an empty component.

It's still convenient that the regular get_component_for_write adds
the component if it doesn't exist, because that's often a nice way to
add data to the geometry set.

Diff Detail

Repository
rB Blender

Event Timeline

Hans Goudey (HooglyBoogly) requested review of this revision.Oct 14 2021, 7:09 AM
Hans Goudey (HooglyBoogly) created this revision.

Besides the bug mentioned inline, this looks good.

source/blender/blenkernel/intern/geometry_set.cc
148

lookup_ptr can return nullptr.

This revision is now accepted and ready to land.Oct 14 2021, 1:01 PM
Hans Goudey (HooglyBoogly) marked an inline comment as done.Oct 14 2021, 7:44 PM