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
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-06-07 21:58:47 +0300
committerHans Goudey <h.goudey@me.com>2021-06-07 21:58:47 +0300
commitd2aee304e8041ab0b037a142f8bcba0ae4903c6a (patch)
treeed5896eb113761407cf975e5c701722bcbb5249f /source/blender/blenkernel/intern/curve_bevel.c
parent6e56b42faa242f3d8b935a07cbb9b5300cebf0a6 (diff)
Cleanup: Use const arguments, return by value
Also use Curve as an argument instead of Object, since the object was only used to retrieve the curve, and the calling code is already working with curve data.
Diffstat (limited to 'source/blender/blenkernel/intern/curve_bevel.c')
-rw-r--r--source/blender/blenkernel/intern/curve_bevel.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/curve_bevel.c b/source/blender/blenkernel/intern/curve_bevel.c
index 911a98cb607..51418a6485f 100644
--- a/source/blender/blenkernel/intern/curve_bevel.c
+++ b/source/blender/blenkernel/intern/curve_bevel.c
@@ -83,7 +83,7 @@ static void bevel_quarter_fill(Curve *curve, float *quarter_coords_x, float *qua
}
}
-static void curve_bevel_make_extrude_and_fill(Curve *cu,
+static void curve_bevel_make_extrude_and_fill(const Curve *cu,
ListBase *disp,
const bool use_extrude,
const CurveBevelFillType fill_type)
@@ -193,7 +193,7 @@ static void curve_bevel_make_extrude_and_fill(Curve *cu,
}
}
-static void curve_bevel_make_full_circle(Curve *cu, ListBase *disp)
+static void curve_bevel_make_full_circle(const Curve *cu, ListBase *disp)
{
const int nr = 4 + 2 * cu->bevresol;
@@ -218,7 +218,7 @@ static void curve_bevel_make_full_circle(Curve *cu, ListBase *disp)
}
}
-static void curve_bevel_make_only_extrude(Curve *cu, ListBase *disp)
+static void curve_bevel_make_only_extrude(const Curve *cu, ListBase *disp)
{
DispList *dl = MEM_callocN(sizeof(DispList), __func__);
dl->verts = MEM_malloc_arrayN(2, sizeof(float[3]), __func__);
@@ -235,7 +235,7 @@ static void curve_bevel_make_only_extrude(Curve *cu, ListBase *disp)
fp[5] = cu->ext1;
}
-static void curve_bevel_make_from_object(Curve *cu, ListBase *disp)
+static void curve_bevel_make_from_object(const Curve *cu, ListBase *disp)
{
if (cu->bevobj == NULL) {
return;
@@ -287,15 +287,13 @@ static void curve_bevel_make_from_object(Curve *cu, ListBase *disp)
}
}
-void BKE_curve_bevel_make(Object *ob, ListBase *disp)
+ListBase BKE_curve_bevel_make(const Curve *curve)
{
- Curve *curve = ob->data;
-
- BLI_listbase_clear(disp);
+ ListBase bevel_shape = {NULL, NULL};
if (curve->bevel_mode == CU_BEV_MODE_OBJECT) {
if (curve->bevobj != NULL) {
- curve_bevel_make_from_object(curve, disp);
+ curve_bevel_make_from_object(curve, &bevel_shape);
}
}
else {
@@ -303,18 +301,20 @@ void BKE_curve_bevel_make(Object *ob, ListBase *disp)
const bool use_bevel = curve->ext2 != 0.0f;
/* Pass. */
if (use_extrude && !use_bevel) {
- curve_bevel_make_only_extrude(curve, disp);
+ curve_bevel_make_only_extrude(curve, &bevel_shape);
}
else if (use_extrude || use_bevel) {
CurveBevelFillType fill_type = curve_bevel_get_fill_type(curve);
if (!use_extrude && fill_type == FULL && curve->bevel_mode == CU_BEV_MODE_ROUND) {
- curve_bevel_make_full_circle(curve, disp);
+ curve_bevel_make_full_circle(curve, &bevel_shape);
}
else {
/* The general case for nonzero extrusion or an incomplete loop. */
- curve_bevel_make_extrude_and_fill(curve, disp, use_extrude, fill_type);
+ curve_bevel_make_extrude_and_fill(curve, &bevel_shape, use_extrude, fill_type);
}
}
}
+
+ return bevel_shape;
}