diff options
author | Hans Goudey <h.goudey@me.com> | 2021-02-02 18:21:14 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-02-02 18:21:14 +0300 |
commit | b7865f77c358124fc93c208ba1d4756e54cbab74 (patch) | |
tree | 2e378cdef94c8e150ccbf186a30d72037902ba03 /source/blender/blenkernel/intern/geometry_set.cc | |
parent | ed00f7c65e27be5aae16c3b8dbf13e281cf94f9c (diff) | |
parent | a1c7cab06cc5473273a711200b6b5d0a96fb1c21 (diff) |
Merge branch 'blender-v2.92-release'
Diffstat (limited to 'source/blender/blenkernel/intern/geometry_set.cc')
-rw-r--r-- | source/blender/blenkernel/intern/geometry_set.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/geometry_set.cc b/source/blender/blenkernel/intern/geometry_set.cc index 833e1dd3719..dae0b757df0 100644 --- a/source/blender/blenkernel/intern/geometry_set.cc +++ b/source/blender/blenkernel/intern/geometry_set.cc @@ -339,6 +339,23 @@ void MeshComponent::replace(Mesh *mesh, GeometryOwnershipType ownership) ownership_ = ownership; } +/* This function exists for the same reason as #vertex_group_names_. Non-nodes modifiers need to + * be able to replace the mesh data without losing the vertex group names, which may have come + * from another object. */ +void MeshComponent::replace_mesh_but_keep_vertex_group_names(Mesh *mesh, + GeometryOwnershipType ownership) +{ + BLI_assert(this->is_mutable()); + if (mesh_ != nullptr) { + if (ownership_ == GeometryOwnershipType::Owned) { + BKE_id_free(nullptr, mesh_); + } + mesh_ = nullptr; + } + mesh_ = mesh; + ownership_ = ownership; +} + /* Return the mesh and clear the component. The caller takes over responsibility for freeing the * mesh (if the component was responsible before). */ Mesh *MeshComponent::release() |