Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKévin Dietrich <kevin.dietrich@mailoo.org>2021-06-25 13:56:01 +0300
committerKévin Dietrich <kevin.dietrich@mailoo.org>2021-06-25 15:16:07 +0300
commit5f9677fe0c533b008b815d7fee0b56509a414ab7 (patch)
tree4d8f03c278afae00a9bf72f9b49fc55cfdff52ac /source/blender/blenkernel/BKE_customdata.h
parent3558bb8eae758aa7e6483d0a6fc00dc83407d4cf (diff)
Fix T88756: crash when baking with autosmooth
When baking some data, we create a new Mesh with edits and modifiers applied. However, in some cases (e.g. when there is no modifier), the returned Mesh is actually referencing the original one and its data layers. When autosmooth is enabled we also split the Mesh. However, since the new Mesh is referencing the original one, although `BKE_mesh_split_faces` is creating new vertices and edges, the reallocation of the custom data layers is preempted because of the reference, so adding the new vertices and edges overwrites valid data To fix this we duplicate referenced layers before splitting the faces. Reviewed By: brecht Differential Revision: https://developer.blender.org/D11703
Diffstat (limited to 'source/blender/blenkernel/BKE_customdata.h')
-rw-r--r--source/blender/blenkernel/BKE_customdata.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h
index ed319948160..6d6639b1e70 100644
--- a/source/blender/blenkernel/BKE_customdata.h
+++ b/source/blender/blenkernel/BKE_customdata.h
@@ -233,6 +233,9 @@ void *CustomData_duplicate_referenced_layer_named(struct CustomData *data,
const int totelem);
bool CustomData_is_referenced_layer(struct CustomData *data, int type);
+/* Duplicate all the layers with flag NOFREE, and remove the flag from duplicated layers. */
+void CustomData_duplicate_referenced_layers(CustomData *data, int totelem);
+
/* set the CD_FLAG_NOCOPY flag in custom data layers where the mask is
* zero for the layer type, so only layer types specified by the mask
* will be copied