Fix: error displaying 3D text for v1.70 blend files

Regression from [0] which used Curve::type for file reading
which doesn't exist in old files [1] then raised an assertion
when the curve was evaluated.

This error was only found when back-porting to 4.5 since it was
triggered by big-endian tests which have since been removed.

[0]: 8fea423e00
[1]: e17677ce73
This commit is contained in:
Campbell Barton
2025-08-28 14:36:10 +10:00
parent ee000da266
commit 3a39f9575e

View File

@@ -223,7 +223,12 @@ static void curve_blend_read_data(BlendDataReader *reader, ID *id)
BLO_read_struct_array(reader, CharInfo, cu->len_char32 + 1, &cu->strinfo);
BLO_read_struct_array(reader, TextBox, cu->totbox, &cu->tb);
if (cu->ob_type != OB_FONT) {
/* WARNING: for old files `cu->ob_type` won't be initialized,
* versioning detects fonts based on `cu->vfont` (which won't have run yet)
* so do the same here. */
const bool is_font = cu->ob_type ? (cu->ob_type == OB_FONT) : (cu->vfont != nullptr);
if (is_font == false) {
BLO_read_struct_list(reader, Nurb, &(cu->nurb));
}
else {
@@ -263,7 +268,7 @@ static void curve_blend_read_data(BlendDataReader *reader, ID *id)
BLO_read_struct_array(reader, BPoint, nu->pntsu * nu->pntsv, &nu->bp);
BLO_read_float_array(reader, KNOTSU(nu), &nu->knotsu);
BLO_read_float_array(reader, KNOTSV(nu), &nu->knotsv);
if (cu->ob_type != OB_FONT) {
if (is_font == false) {
nu->charidx = 0;
}
}