Geometry Nodes: fix getting mutable geometry component

The previous code did not take into account that they geometry
component may not be mutable because it is shared between
multiple geometry sets.
This commit is contained in:
Jacques Lucke 2021-10-15 13:39:11 +02:00
parent da3946b710
commit f834939ceb
Notes: blender-bot 2023-02-14 07:25:51 +01:00
Referenced by issue #92248, Curves disappear( remove) when using join geometry.
Referenced by issue #92225, Geometry nodes: Mesh Boolean gives empty geometry for difference between self and transformed self
1 changed files with 4 additions and 2 deletions

View File

@ -145,8 +145,10 @@ GeometryComponent &GeometrySet::get_component_for_write(GeometryComponentType co
*/
GeometryComponent *GeometrySet::get_component_ptr(GeometryComponentType type)
{
GeometryComponentPtr *component_ptr = components_.lookup_ptr(type);
return component_ptr == nullptr ? nullptr : component_ptr->get();
if (this->has(type)) {
return &this->get_component_for_write(type);
}
return nullptr;
}
/* Get the component of the given type. Might return null if the component does not exist yet. */