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-12-02 06:01:35 +0300
committerHans Goudey <h.goudey@me.com>2021-12-02 06:01:35 +0300
commit218360a89217f4e8321319035bf4d9ff97fb2658 (patch)
treeebea2a1c90847a62315d81bf4f427b287c7e6e7f /source/blender/blenkernel/intern
parentca9cdba2df8231e88575c0d56df1f72efc819950 (diff)
Cleanup: Rename curve struct fields
These existing names were unhelpful at best, actively confusing at worst. This patch renames them to be consistent with the terms used to refer to the values in the UI. - `width` -> `offset` - `ext1` -> `extrude` - `ext2` -> `bevel_radius` Differential Revision: https://developer.blender.org/D9627
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/curve_bevel.c44
-rw-r--r--source/blender/blenkernel/intern/displist.cc6
2 files changed, 25 insertions, 25 deletions
diff --git a/source/blender/blenkernel/intern/curve_bevel.c b/source/blender/blenkernel/intern/curve_bevel.c
index d205d8cca46..18e4ab3ade1 100644
--- a/source/blender/blenkernel/intern/curve_bevel.c
+++ b/source/blender/blenkernel/intern/curve_bevel.c
@@ -64,8 +64,8 @@ static void bevel_quarter_fill(const Curve *curve,
float angle = 0.0f;
const float dangle = (float)M_PI_2 / (curve->bevresol + 1);
for (int i = 0; i < curve->bevresol + 1; i++) {
- quarter_coords_x[i] = (float)(cosf(angle) * (curve->ext2));
- quarter_coords_y[i] = (float)(sinf(angle) * (curve->ext2));
+ quarter_coords_x[i] = (float)(cosf(angle) * (curve->bevel_radius));
+ quarter_coords_y[i] = (float)(sinf(angle) * (curve->bevel_radius));
angle += dangle;
}
}
@@ -76,11 +76,11 @@ static void bevel_quarter_fill(const Curve *curve,
/* If there aren't enough samples, the curveprofile won't
* sample the start vertex, so set it manually instead. */
- quarter_coords_x[0] = curve->ext2;
+ quarter_coords_x[0] = curve->bevel_radius;
quarter_coords_y[0] = 0.0f;
for (int i = 1; i < curve->bevresol + 1; i++) {
- quarter_coords_x[i] = (float)(curve->bevel_profile->segments[i].x * (curve->ext2));
- quarter_coords_y[i] = (float)(curve->bevel_profile->segments[i].y * (curve->ext2));
+ quarter_coords_x[i] = (float)(curve->bevel_profile->segments[i].x * (curve->bevel_radius));
+ quarter_coords_y[i] = (float)(curve->bevel_profile->segments[i].y * (curve->bevel_radius));
}
}
}
@@ -133,13 +133,13 @@ static void curve_bevel_make_extrude_and_fill(const Curve *cu,
/* Add the bottom vertex. */
fp[0] = 0.0f;
fp[1] = 0.0f;
- fp[2] = -cu->ext1 - cu->ext2;
+ fp[2] = -cu->extrude - cu->bevel_radius;
fp += 3;
for (int i = cu->bevresol; i >= 0; i--) {
fp[0] = 0.0f;
fp[1] = quarter_coords_x[i];
- fp[2] = -quarter_coords_y[i] - cu->ext1;
+ fp[2] = -quarter_coords_y[i] - cu->extrude;
fp += 3;
}
}
@@ -147,8 +147,8 @@ static void curve_bevel_make_extrude_and_fill(const Curve *cu,
/* Add the extrusion if we're only building either the back or the front. */
if (use_extrude && ELEM(fill_type, FRONT, BACK)) {
fp[0] = 0.0f;
- fp[1] = cu->ext2;
- fp[2] = (fill_type == FRONT) ? -cu->ext1 : cu->ext1;
+ fp[1] = cu->bevel_radius;
+ fp[2] = (fill_type == FRONT) ? -cu->extrude : cu->extrude;
fp += 3;
}
@@ -159,13 +159,13 @@ static void curve_bevel_make_extrude_and_fill(const Curve *cu,
for (int i = front_start; i < cu->bevresol + 1; i++) {
fp[0] = 0.0f;
fp[1] = quarter_coords_x[i];
- fp[2] = quarter_coords_y[i] + cu->ext1;
+ fp[2] = quarter_coords_y[i] + cu->extrude;
fp += 3;
}
/* Add the top vertex. */
fp[0] = 0.0f;
fp[1] = 0.0f;
- fp[2] = cu->ext1 + cu->ext2;
+ fp[2] = cu->extrude + cu->bevel_radius;
fp += 3;
}
@@ -174,22 +174,22 @@ static void curve_bevel_make_extrude_and_fill(const Curve *cu,
for (int i = cu->bevresol; i > 0; i--) {
fp[0] = 0.0f;
fp[1] = -quarter_coords_x[i];
- fp[2] = quarter_coords_y[i] + cu->ext1;
+ fp[2] = quarter_coords_y[i] + cu->extrude;
fp += 3;
}
if (use_extrude) {
/* Add the extrusion. */
fp[0] = 0.0f;
- fp[1] = -cu->ext2;
- fp[2] = cu->ext1;
+ fp[1] = -cu->bevel_radius;
+ fp[2] = cu->extrude;
fp += 3;
}
for (int i = 0; i < cu->bevresol + 1; i++) {
fp[0] = 0.0f;
fp[1] = -quarter_coords_x[i];
- fp[2] = -quarter_coords_y[i] - cu->ext1;
+ fp[2] = -quarter_coords_y[i] - cu->extrude;
fp += 3;
}
}
@@ -213,8 +213,8 @@ static void curve_bevel_make_full_circle(const Curve *cu, ListBase *disp)
for (int i = 0; i < nr; i++) {
fp[0] = 0.0;
- fp[1] = (cosf(angle) * (cu->ext2));
- fp[2] = (sinf(angle) * (cu->ext2)) - cu->ext1;
+ fp[1] = (cosf(angle) * (cu->bevel_radius));
+ fp[2] = (sinf(angle) * (cu->bevel_radius)) - cu->extrude;
angle += dangle;
fp += 3;
}
@@ -232,9 +232,9 @@ static void curve_bevel_make_only_extrude(const Curve *cu, ListBase *disp)
float *fp = dl->verts;
fp[0] = fp[1] = 0.0;
- fp[2] = -cu->ext1;
+ fp[2] = -cu->extrude;
fp[3] = fp[4] = 0.0;
- fp[5] = cu->ext1;
+ fp[5] = cu->extrude;
}
static void curve_bevel_make_from_object(const Curve *cu, ListBase *disp)
@@ -247,7 +247,7 @@ static void curve_bevel_make_from_object(const Curve *cu, ListBase *disp)
}
Curve *bevcu = cu->bevobj->data;
- if (bevcu->ext1 == 0.0f && bevcu->ext2 == 0.0f) {
+ if (bevcu->extrude == 0.0f && bevcu->bevel_radius == 0.0f) {
ListBase bevdisp = {NULL, NULL};
float facx = cu->bevobj->scale[0];
float facy = cu->bevobj->scale[1];
@@ -299,8 +299,8 @@ ListBase BKE_curve_bevel_make(const Curve *curve)
}
}
else {
- const bool use_extrude = curve->ext1 != 0.0f;
- const bool use_bevel = curve->ext2 != 0.0f;
+ const bool use_extrude = curve->extrude != 0.0f;
+ const bool use_bevel = curve->bevel_radius != 0.0f;
/* Pass. */
if (use_extrude && !use_bevel) {
curve_bevel_make_only_extrude(curve, &bevel_shape);
diff --git a/source/blender/blenkernel/intern/displist.cc b/source/blender/blenkernel/intern/displist.cc
index 73aea944665..cae7a5fa65c 100644
--- a/source/blender/blenkernel/intern/displist.cc
+++ b/source/blender/blenkernel/intern/displist.cc
@@ -830,7 +830,7 @@ static bool do_curve_implicit_mesh_conversion(const Curve *curve,
}
/* Curve objects with implicit "tube" meshes should convert implicitly to a mesh. */
- if (curve->ext1 != 0.0f || curve->ext2 != 0.0f) {
+ if (curve->extrude != 0.0f || curve->bevel_radius != 0.0f) {
return true;
}
@@ -1310,11 +1310,11 @@ static GeometrySet evaluate_curve_type_object(Depsgraph *depsgraph,
ListBase dlbev = BKE_curve_bevel_make(cu);
/* no bevel or extrude, and no width correction? */
- if (BLI_listbase_is_empty(&dlbev) && cu->width == 1.0f) {
+ if (BLI_listbase_is_empty(&dlbev) && cu->offset == 1.0f) {
curve_to_displist(cu, deformed_nurbs, for_render, r_dispbase);
}
else {
- const float widfac = cu->width - 1.0f;
+ const float widfac = cu->offset - 1.0f;
const BevList *bl = (BevList *)ob->runtime.curve_cache->bev.first;
const Nurb *nu = (Nurb *)deformed_nurbs->first;