Merge branch 'blender-v2.82-release'

This commit is contained in:
Philipp Oeser 2020-02-04 21:24:48 +01:00
commit 78ba097331
5 changed files with 16 additions and 6 deletions

View File

@ -220,7 +220,10 @@ bool BKE_nurb_order_clamp_u(struct Nurb *nu);
bool BKE_nurb_order_clamp_v(struct Nurb *nu);
void BKE_nurb_direction_switch(struct Nurb *nu);
bool BKE_nurb_type_convert(struct Nurb *nu, const short type, const bool use_handles);
bool BKE_nurb_type_convert(struct Nurb *nu,
const short type,
const bool use_handles,
const char **r_err_msg);
void BKE_nurb_points_add(struct Nurb *nu, int number);
void BKE_nurb_bezierPoints_add(struct Nurb *nu, int number);

View File

@ -4869,7 +4869,10 @@ bool BKE_nurb_order_clamp_v(struct Nurb *nu)
/**
* \note caller must ensure active vertex remains valid.
*/
bool BKE_nurb_type_convert(Nurb *nu, const short type, const bool use_handles)
bool BKE_nurb_type_convert(Nurb *nu,
const short type,
const bool use_handles,
const char **r_err_msg)
{
BezTriple *bezt;
BPoint *bp;
@ -4976,6 +4979,9 @@ bool BKE_nurb_type_convert(Nurb *nu, const short type, const bool use_handles)
nr = nu->pntsu / 3;
if (nr < 2) {
if (r_err_msg != NULL) {
*r_err_msg = "At least 6 points required for conversion";
}
return false; /* conversion impossible */
}
else {

View File

@ -4002,14 +4002,15 @@ static int set_spline_type_exec(bContext *C, wmOperator *op)
for (nu = editnurb->first; nu; nu = nu->next) {
if (ED_curve_nurb_select_check(v3d, nu)) {
const int pntsu_prev = nu->pntsu;
if (BKE_nurb_type_convert(nu, type, use_handles)) {
const char *err_msg = NULL;
if (BKE_nurb_type_convert(nu, type, use_handles, &err_msg)) {
changed = true;
if (pntsu_prev != nu->pntsu) {
changed_size = true;
}
}
else {
BKE_report(op->reports, RPT_ERROR, "No conversion possible");
BKE_report(op->reports, RPT_ERROR, err_msg);
}
}
}

View File

@ -1385,7 +1385,7 @@ static void gp_layer_to_curve(bContext *C,
if (mode == GP_STROKECONVERT_POLY) {
for (nu = cu->nurb.first; nu; nu = nu->next) {
BKE_nurb_type_convert(nu, CU_POLY, false);
BKE_nurb_type_convert(nu, CU_POLY, false, NULL);
}
}

View File

@ -384,7 +384,7 @@ static void rna_Nurb_type_set(PointerRNA *ptr, int value)
Nurb *nu = (Nurb *)ptr->data;
const int pntsu_prev = nu->pntsu;
if (BKE_nurb_type_convert(nu, value, true)) {
if (BKE_nurb_type_convert(nu, value, true, NULL)) {
if (nu->pntsu != pntsu_prev) {
cu->actvert = CU_ACT_NONE;
}