1
1

Curves: change default font offset from 1.0 to 0.0

Currently, curves have a default offset of 1.0, while the initial (and
expected) value is 0.0. When resetting this value to its default, the
curve is now modified unexpectedly. This is most noticeable with text
objects: when resetting the offset of a new text, it will look very
broken.

Internally the value is stored with an offset of 1.0, with custom
setter and getter adding and subtracting 1.0 respectively. To give
this property a default of 0.0, we also need to add 1.0 to the initial
value upon curve creation.

Pull Request #105182
This commit is contained in:
2023-03-06 14:28:40 +01:00
committed by Hans Goudey
parent 4dc59c7311
commit 4fb6e45b37
2 changed files with 4 additions and 1 deletions

View File

@@ -409,6 +409,9 @@ void BKE_curve_init(Curve *cu, const short curve_type)
cu->resolv = 4;
}
cu->bevel_profile = nullptr;
/* Initialize the offset to 1.0, to compensate for it being set to -1.0
in the property getter. */
cu->offset = 1.0f;
}
Curve *BKE_curve_add(Main *bmain, const char *name, int type)

View File

@@ -20,7 +20,7 @@
.pathlen = 100, \
.resolu = 12, \
.resolv = 12, \
.offset = 1.0, \
.offset = 0.0, \
.wordspace = 1.0, \
.spacing = 1.0f, \
.linedist = 1.0, \