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:
authorCampbell Barton <ideasman42@gmail.com>2019-08-22 06:20:05 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-08-22 06:23:27 +0300
commit0356c8f25b96bf9d8c677e51ad5106b5295cb37f (patch)
tree8971ebe7dc35e3ef7a80e765e52dc7a2da5815ed /source/blender/blenkernel/intern/lattice.c
parentc2442541a62e48bd10499438c84d20bf21cac2c0 (diff)
Cleanup: remove edit-mode check in vertex coordinate access
This makes the function more predictable since other object types don't access edit-mode data.
Diffstat (limited to 'source/blender/blenkernel/intern/lattice.c')
-rw-r--r--source/blender/blenkernel/intern/lattice.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index 64ba02db30d..0ceca1206f6 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -1057,22 +1057,19 @@ void outside_lattice(Lattice *lt)
}
}
-float (*BKE_lattice_vert_coords_alloc(const Lattice *lt, int *r_vert_len))[3]
+void BKE_lattice_vert_coords_get(const Lattice *lt, float (*vert_coords)[3])
{
- int vert_len;
- float(*vert_coords)[3];
-
- if (lt->editlatt) {
- lt = lt->editlatt->latt;
- }
- vert_len = *r_vert_len = lt->pntsu * lt->pntsv * lt->pntsw;
-
- vert_coords = MEM_mallocN(sizeof(*vert_coords) * vert_len, __func__);
-
+ const int vert_len = lt->pntsu * lt->pntsv * lt->pntsw;
for (int i = 0; i < vert_len; i++) {
copy_v3_v3(vert_coords[i], lt->def[i].vec);
}
+}
+float (*BKE_lattice_vert_coords_alloc(const Lattice *lt, int *r_vert_len))[3]
+{
+ const int vert_len = *r_vert_len = lt->pntsu * lt->pntsv * lt->pntsw;
+ float(*vert_coords)[3] = MEM_mallocN(sizeof(*vert_coords) * vert_len, __func__);
+ BKE_lattice_vert_coords_get(lt, vert_coords);
return vert_coords;
}
@@ -1123,7 +1120,11 @@ void BKE_lattice_modifiers_calc(struct Depsgraph *depsgraph, Scene *scene, Objec
}
if (!vert_coords) {
- vert_coords = BKE_lattice_vert_coords_alloc(ob_orig->data, &numVerts);
+ Lattice *lt_orig = ob_orig->data;
+ if (lt_orig->editlatt) {
+ lt_orig = lt_orig->editlatt->latt;
+ }
+ vert_coords = BKE_lattice_vert_coords_alloc(lt_orig, &numVerts);
}
mti->deformVerts(md, &mectx, NULL, vert_coords, numVerts);
}
@@ -1137,7 +1138,11 @@ void BKE_lattice_modifiers_calc(struct Depsgraph *depsgraph, Scene *scene, Objec
else {
/* Displist won't do anything; this is just for posterity's sake until we remove it. */
if (!vert_coords) {
- vert_coords = BKE_lattice_vert_coords_alloc(ob_orig->data, &numVerts);
+ Lattice *lt_orig = ob_orig->data;
+ if (lt_orig->editlatt) {
+ lt_orig = lt_orig->editlatt->latt;
+ }
+ vert_coords = BKE_lattice_vert_coords_alloc(lt_orig, &numVerts);
}
DispList *dl = MEM_callocN(sizeof(*dl), "lt_dl");