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:
authorJacques Lucke <jacques@blender.org>2020-04-09 13:02:02 +0300
committerJacques Lucke <jacques@blender.org>2020-04-09 13:02:02 +0300
commit55ee66be4d2eaf1bd4556a938c618c77985b4008 (patch)
tree85b445409637fa021c72e096d0d2133fdcf2992a /source/blender/blenkernel/intern/mesh_convert.c
parent726cf93f8ad09b49cd6481af2c6ad7d5e51b0c20 (diff)
parentdabd59ba23f877f68aaf73e79f0d58118723d9b7 (diff)
Merge branch 'functions' into builtin-simulation-nodesbuiltin-simulation-nodes
Diffstat (limited to 'source/blender/blenkernel/intern/mesh_convert.c')
-rw-r--r--source/blender/blenkernel/intern/mesh_convert.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/mesh_convert.c b/source/blender/blenkernel/intern/mesh_convert.c
index 74b79490d67..28a32e1573b 100644
--- a/source/blender/blenkernel/intern/mesh_convert.c
+++ b/source/blender/blenkernel/intern/mesh_convert.c
@@ -1155,9 +1155,21 @@ Mesh *BKE_mesh_new_from_object(Depsgraph *depsgraph, Object *object, bool preser
/* Happens in special cases like request of mesh for non-mother meta ball. */
return NULL;
}
+
/* The result must have 0 users, since it's just a mesh which is free-dangling data-block.
* All the conversion functions are supposed to ensure mesh is not counted. */
BLI_assert(new_mesh->id.us == 0);
+
+ /* It is possible that mesh came from modifier stack evaluation, which preserves edit_mesh
+ * pointer (which allows draw manager to access edit mesh when drawing). Normally this does
+ * not cause ownership problems because evaluated object runtime is keeping track of the real
+ * ownership.
+ *
+ * Here we are constructing a mesh which is supposed to be independent, which means no shared
+ * ownership is allowed, so we make sure edit mesh is reset to NULL (which is similar to as if
+ * one duplicates the objects and applies all the modifiers). */
+ new_mesh->edit_mesh = NULL;
+
return new_mesh;
}