Curve: Validation message split from nurb_check_valid

Split retrieval of translated text for the "invalid" messages for NURBS
curves from the actual calculation, which is a lower-level function.
Also fixes an issue where "At least two points required" would always
display in the "Active Spline" panel.

Differential Revision: https://developer.blender.org/D14315
This commit is contained in:
Laurynas Duburas
2022-03-22 09:54:13 -05:00
committed by Hans Goudey
parent b0aaf6ff4a
commit 6bbc3b5610
3 changed files with 71 additions and 28 deletions

View File

@@ -43,22 +43,19 @@ static void rna_Nurb_valid_message(Nurb *nu, int direction, int *result_len, con
int pnts;
short order, flag;
const char *dir;
if (direction == 0) {
pnts = nu->pntsu;
order = nu->orderu;
flag = nu->flagu;
dir = "U";
}
else {
pnts = nu->pntsv;
order = nu->orderv;
flag = nu->flagv;
dir = "V";
}
char buf[64];
if (BKE_nurb_valid_message(pnts, order, flag, type, is_surf, dir, buf, sizeof(buf))) {
if (BKE_nurb_valid_message(pnts, order, flag, type, is_surf, direction, buf, sizeof(buf))) {
const int buf_len = strlen(buf);
*r_result = BLI_strdupn(buf, buf_len);
*result_len = buf_len;