Page MenuHome

Fix T99873: Store named attribute node cannot write to vertex groups
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on Jul 21 2022, 11:25 PM.

Details

Summary

Since fd5e5dac8946b13599, the node would remove the attribute before
adding it again, which lost the vertex group status of an attribute,
meaning they were written as arbitrary attributes.

Now, the node first tries to write to attributes with the same domain
and data-type, which covers the vertex group case. Then it falls back
to removing the attribute and adding it again. Even that can fail
though, so I added an error message to make that a bit clearer.

Diff Detail

Repository
rB Blender

Event Timeline

Alexander Gavrilov (angavrilov) added inline comments.
source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc
117

The previous code seems to check domain and type after lookup_for_write, and also checks write_attribute for null. So I wonder if it is really necessary to do separate lookup_meta_data, and whether something might crash if lookup_for_write somehow failed. But I have no clue about this code, this is just observations from this diff alone.

Simplify: Avoid extra call to retrieve metadata

source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc
117

Thanks, good point!

Jacques Lucke (JacquesLucke) added inline comments.
source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc
93

Use r_ for output parameters.

This revision is now accepted and ready to land.Jul 22 2022, 3:45 PM