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:
authorPratik Borhade <PratikPB2123>2021-02-16 15:21:28 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2021-02-16 15:47:12 +0300
commitc13754e6475e438ebd2fbafa2e51aa58504dc5f9 (patch)
treeef7aedae6a4c7b9c0768752cfb31c02b82960d6b /source/blender/blenkernel/intern/lattice.c
parent2e81f2c01abd21fdbc79625f3f7a0778103fa199 (diff)
Fixes T84928 : Lattice vertices at unexpected positions when changing lattice resolution from 1 to 3 or more.
Fix for T84928 . Considering the changes , issue is resolved ( Ignoring readability issues) . **Changes **: - `Change in value assignment of fu/v/w :` Observing previous code , I noticed ,value assigned to them is equivalent to -0.5 ( i.e. co-ordinate of left most vertex of lattice size =1 where centre of lattice is origin ) . - `Change in value assignment of du/v/w :` Margin ( distance ) between each division of surface along any axis is equivalent to **( (length of surface along axis ) / (no of division line - 1) )** . that's why is changed it to (default_size/unew -1) . - ` New variable declared "default_size" :` As far as I gone through the code , I noticed values 1 < du ,fu < 1 , which indicates these values were calculated with respect to default lattice of size 1 . - `removed pntsu/v/w != 1 check :` Following changes inside the if block worked properly for pntsu/v/w = 1 . Reviewed By: lichtwerk, campbellbarton Differential Revision: https://developer.blender.org/D10353
Diffstat (limited to 'source/blender/blenkernel/intern/lattice.c')
-rw-r--r--source/blender/blenkernel/intern/lattice.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index 74f78106be5..84ffd8c636b 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -319,19 +319,21 @@ void BKE_lattice_resize(Lattice *lt, int uNew, int vNew, int wNew, Object *ltOb)
* size first.
*/
if (ltOb) {
- if (uNew != 1 && lt->pntsu != 1) {
- fu = lt->fu;
- du = (lt->pntsu - 1) * lt->du / (uNew - 1);
+ const float default_size = 1.0;
+
+ if (uNew != 1) {
+ fu = -default_size / 2.0;
+ du = default_size / (uNew - 1);
}
- if (vNew != 1 && lt->pntsv != 1) {
- fv = lt->fv;
- dv = (lt->pntsv - 1) * lt->dv / (vNew - 1);
+ if (vNew != 1) {
+ fv = -default_size / 2.0;
+ dv = default_size / (vNew - 1);
}
- if (wNew != 1 && lt->pntsw != 1) {
- fw = lt->fw;
- dw = (lt->pntsw - 1) * lt->dw / (wNew - 1);
+ if (wNew != 1) {
+ fw = -default_size / 2.0;
+ dw = default_size / (wNew - 1);
}
}