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
This commit is contained in:
committed by
Philipp Oeser
parent
2e81f2c01a
commit
c13754e647
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user