Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorPhilipp Oeser <info@graphics-engineer.com>2019-11-19 14:05:03 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2020-02-04 23:14:05 +0300
commit559d01e12949a730f3497fdfbe79a11f532f3afe (patch)
tree854612ac452c7975c4273b35d302fb74fbf47c34 /source
parent0bedf9cf07c66f4f6ddbdcfb47001bb29cb2389e (diff)
Improve error message converting nurb to bezier
BKE_nurb_type_convert now takes r_err_msg and is more specific in the error message... ref T71672. Maniphest Tasks: T71672 Differential Revision: https://developer.blender.org/D6275
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_curve.h5
-rw-r--r--source/blender/blenkernel/intern/curve.c8
-rw-r--r--source/blender/editors/curve/editcurve.c5
-rw-r--r--source/blender/editors/gpencil/gpencil_convert.c2
-rw-r--r--source/blender/makesrna/intern/rna_curve.c2
5 files changed, 16 insertions, 6 deletions
diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h
index e03780cc027..cf516c630c5 100644
--- a/source/blender/blenkernel/BKE_curve.h
+++ b/source/blender/blenkernel/BKE_curve.h
@@ -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);
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 12bb7b573bd..8d9052c942a 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -4872,7 +4872,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;
@@ -4979,6 +4982,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 {
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index e7803fdaafb..f5920bfb258 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -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);
}
}
}
diff --git a/source/blender/editors/gpencil/gpencil_convert.c b/source/blender/editors/gpencil/gpencil_convert.c
index 1ce4ffbbd46..e1b13747ee0 100644
--- a/source/blender/editors/gpencil/gpencil_convert.c
+++ b/source/blender/editors/gpencil/gpencil_convert.c
@@ -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);
}
}
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index e900160a653..104bc3bd745 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -388,7 +388,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;
}