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:
authorSybren A. Stüvel <sybren@blender.org>2021-03-29 11:14:53 +0300
committerSybren A. Stüvel <sybren@blender.org>2021-03-29 12:00:32 +0300
commit3681a619ded1a6b225befc31ef87259081fb61e5 (patch)
tree35f841fc7287689e25c95da5aa89842b75a9fd7b /source/blender/blenkernel/intern/object.c
parent8034b276ba6c5369a356a1b8f5e858305f8b47b9 (diff)
Fix T78650: Lattice evaluation writes to shared data
Fix the data management bug where evaluation of lattice objects would write back to the CoW copy of the Lattice ID, even when that copy was shared between objects. Each lattice object evaluation now stores its own evaluated data copy via `BKE_object_eval_assign_data()`. Reviewed By: sergey Maniphest Tasks: T78650 Differential Revision: https://developer.blender.org/D10790
Diffstat (limited to 'source/blender/blenkernel/intern/object.c')
-rw-r--r--source/blender/blenkernel/intern/object.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index b07c4b22c39..a8224094919 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -4474,6 +4474,37 @@ Mesh *BKE_object_get_original_mesh(Object *object)
return result;
}
+Lattice *BKE_object_get_lattice(const Object *object)
+{
+ ID *data = object->data;
+ if (data == NULL || GS(data->name) != ID_LT) {
+ return NULL;
+ }
+
+ Lattice *lt = (Lattice *)data;
+ if (lt->editlatt) {
+ return lt->editlatt->latt;
+ }
+
+ return lt;
+}
+
+Lattice *BKE_object_get_evaluated_lattice(const Object *object)
+{
+ ID *data_eval = object->runtime.data_eval;
+
+ if (data_eval == NULL || GS(data_eval->name) != ID_LT) {
+ return NULL;
+ }
+
+ Lattice *lt_eval = (Lattice *)data_eval;
+ if (lt_eval->editlatt) {
+ return lt_eval->editlatt->latt;
+ }
+
+ return lt_eval;
+}
+
static int pc_cmp(const void *a, const void *b)
{
const LinkData *ad = a, *bd = b;