[Bf-blender-cvs] [a641e08227a] master: Cleanup: Use const arguments in curve code
Hans Goudey
noreply at git.blender.org
Thu Apr 1 01:07:23 CEST 2021
Commit: a641e08227a5bd98cb67e82d5503311719236b50
Author: Hans Goudey
Date: Wed Mar 31 18:07:15 2021 -0500
Branches: master
https://developer.blender.org/rBa641e08227a5bd98cb67e82d5503311719236b50
Cleanup: Use const arguments in curve code
===================================================================
M source/blender/blenkernel/BKE_curve.h
M source/blender/blenkernel/BKE_displist.h
M source/blender/blenkernel/intern/curve.c
M source/blender/blenkernel/intern/displist.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h
index 660e7c08062..2380af6a08e 100644
--- a/source/blender/blenkernel/BKE_curve.h
+++ b/source/blender/blenkernel/BKE_curve.h
@@ -108,7 +108,7 @@ void BKE_curve_transform(struct Curve *cu,
const bool do_props);
void BKE_curve_translate(struct Curve *cu, const float offset[3], const bool do_keys);
void BKE_curve_material_index_remove(struct Curve *cu, int index);
-bool BKE_curve_material_index_used(struct Curve *cu, int index);
+bool BKE_curve_material_index_used(const struct Curve *cu, int index);
void BKE_curve_material_index_clear(struct Curve *cu);
bool BKE_curve_material_index_validate(struct Curve *cu);
void BKE_curve_material_remap(struct Curve *cu, const unsigned int *remap, unsigned int remap_len);
@@ -125,8 +125,10 @@ void BKE_curve_nurb_vert_active_set(struct Curve *cu, const struct Nurb *nu, con
bool BKE_curve_nurb_vert_active_get(struct Curve *cu, struct Nurb **r_nu, void **r_vert);
void BKE_curve_nurb_vert_active_validate(struct Curve *cu);
-float (*BKE_curve_nurbs_vert_coords_alloc(struct ListBase *lb, int *r_vert_len))[3];
-void BKE_curve_nurbs_vert_coords_get(struct ListBase *lb, float (*vert_coords)[3], int vert_len);
+float (*BKE_curve_nurbs_vert_coords_alloc(const struct ListBase *lb, int *r_vert_len))[3];
+void BKE_curve_nurbs_vert_coords_get(const struct ListBase *lb,
+ float (*vert_coords)[3],
+ int vert_len);
void BKE_curve_nurbs_vert_coords_apply_with_mat4(struct ListBase *lb,
const float (*vert_coords)[3],
@@ -137,7 +139,7 @@ void BKE_curve_nurbs_vert_coords_apply(struct ListBase *lb,
const float (*vert_coords)[3],
const bool constrain_2d);
-float (*BKE_curve_nurbs_key_vert_coords_alloc(struct ListBase *lb,
+float (*BKE_curve_nurbs_key_vert_coords_alloc(const struct ListBase *lb,
float *key,
int *r_vert_len))[3];
void BKE_curve_nurbs_key_vert_tilts_apply(struct ListBase *lb, const float *key);
@@ -166,8 +168,8 @@ void BKE_curve_correct_bezpart(const float v1[2], float v2[2], float v3[2], cons
bool BKE_nurbList_index_get_co(struct ListBase *editnurb, const int index, float r_co[3]);
-int BKE_nurbList_verts_count(struct ListBase *nurb);
-int BKE_nurbList_verts_count_without_handles(struct ListBase *nurb);
+int BKE_nurbList_verts_count(const struct ListBase *nurb);
+int BKE_nurbList_verts_count_without_handles(const struct ListBase *nurb);
void BKE_nurbList_free(struct ListBase *lb);
void BKE_nurbList_duplicate(struct ListBase *lb1, const struct ListBase *lb2);
@@ -185,7 +187,7 @@ struct Nurb *BKE_nurb_duplicate(const struct Nurb *nu);
struct Nurb *BKE_nurb_copy(struct Nurb *src, int pntsu, int pntsv);
void BKE_nurb_test_2d(struct Nurb *nu);
-void BKE_nurb_minmax(struct Nurb *nu, bool use_radius, float min[3], float max[3]);
+void BKE_nurb_minmax(const struct Nurb *nu, bool use_radius, float min[3], float max[3]);
float BKE_nurb_calc_length(const struct Nurb *nu, int resolution);
void BKE_nurb_makeFaces(
diff --git a/source/blender/blenkernel/BKE_displist.h b/source/blender/blenkernel/BKE_displist.h
index 1883cebe203..23f01bc0d02 100644
--- a/source/blender/blenkernel/BKE_displist.h
+++ b/source/blender/blenkernel/BKE_displist.h
@@ -77,29 +77,29 @@ typedef struct DispList {
int totindex; /* indexed array drawing surfaces */
} DispList;
-void BKE_displist_copy(struct ListBase *lbn, struct ListBase *lb);
+void BKE_displist_copy(struct ListBase *lbn, const struct ListBase *lb);
void BKE_displist_elem_free(DispList *dl);
DispList *BKE_displist_find_or_create(struct ListBase *lb, int type);
DispList *BKE_displist_find(struct ListBase *lb, int type);
void BKE_displist_normals_add(struct ListBase *lb);
-void BKE_displist_count(struct ListBase *lb, int *totvert, int *totface, int *tottri);
+void BKE_displist_count(const struct ListBase *lb, int *totvert, int *totface, int *tottri);
void BKE_displist_free(struct ListBase *lb);
-bool BKE_displist_has_faces(struct ListBase *lb);
+bool BKE_displist_has_faces(const struct ListBase *lb);
void BKE_displist_make_surf(struct Depsgraph *depsgraph,
- struct Scene *scene,
+ const struct Scene *scene,
struct Object *ob,
struct ListBase *dispbase,
struct Mesh **r_final,
const bool for_render,
const bool for_orco);
void BKE_displist_make_curveTypes(struct Depsgraph *depsgraph,
- struct Scene *scene,
+ const struct Scene *scene,
struct Object *ob,
const bool for_render,
const bool for_orco);
void BKE_displist_make_curveTypes_forRender(struct Depsgraph *depsgraph,
- struct Scene *scene,
+ const struct Scene *scene,
struct Object *ob,
struct ListBase *dispbase,
struct Mesh **r_final,
@@ -111,22 +111,26 @@ void BKE_displist_make_mball_forRender(struct Depsgraph *depsgraph,
struct ListBase *dispbase);
bool BKE_curve_calc_modifiers_pre(struct Depsgraph *depsgraph,
- struct Scene *scene,
+ const struct Scene *scene,
struct Object *ob,
struct ListBase *source_nurb,
struct ListBase *target_nurb,
const bool for_render);
+bool BKE_displist_surfindex_get(
+ const struct DispList *dl, int a, int *b, int *p1, int *p2, int *p3, int *p4);
-bool BKE_displist_surfindex_get(DispList *dl, int a, int *b, int *p1, int *p2, int *p3, int *p4);
void BKE_displist_fill(const struct ListBase *dispbase,
struct ListBase *to,
const float normal_proj[3],
const bool flip_normal);
-float BKE_displist_calc_taper(
- struct Depsgraph *depsgraph, struct Scene *scene, struct Object *taperobj, int cur, int tot);
+float BKE_displist_calc_taper(struct Depsgraph *depsgraph,
+ const struct Scene *scene,
+ struct Object *taperobj,
+ int cur,
+ int tot);
-void BKE_displist_minmax(struct ListBase *dispbase, float min[3], float max[3]);
+void BKE_displist_minmax(const struct ListBase *dispbase, float min[3], float max[3]);
#ifdef __cplusplus
}
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index b0ea9b0f0d3..021aea20d22 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -596,11 +596,11 @@ bool BKE_nurbList_index_get_co(ListBase *nurb, const int index, float r_co[3])
return false;
}
-int BKE_nurbList_verts_count(ListBase *nurb)
+int BKE_nurbList_verts_count(const ListBase *nurb)
{
int tot = 0;
- LISTBASE_FOREACH (Nurb *, nu, nurb) {
+ LISTBASE_FOREACH (const Nurb *, nu, nurb) {
if (nu->bezt) {
tot += 3 * nu->pntsu;
}
@@ -612,7 +612,7 @@ int BKE_nurbList_verts_count(ListBase *nurb)
return tot;
}
-int BKE_nurbList_verts_count_without_handles(ListBase *nurb)
+int BKE_nurbList_verts_count_without_handles(const ListBase *nurb)
{
int tot = 0;
@@ -779,7 +779,7 @@ void BKE_nurb_test_2d(Nurb *nu)
* if use_radius is truth, minmax will take points' radius into account,
* which will make boundbox closer to beveled curve.
*/
-void BKE_nurb_minmax(Nurb *nu, bool use_radius, float min[3], float max[3])
+void BKE_nurb_minmax(const Nurb *nu, bool use_radius, float min[3], float max[3])
{
BezTriple *bezt;
BPoint *bp;
@@ -1928,7 +1928,7 @@ static int cu_isectLL(const float v1[3],
return 0;
}
-static bool bevelinside(BevList *bl1, BevList *bl2)
+static bool bevelinside(const BevList *bl1, const BevList *bl2)
{
/* is bl2 INSIDE bl1 ? with left-right method and "lambda's" */
/* returns '1' if correct hole */
@@ -2052,8 +2052,8 @@ static void calc_bevel_sin_cos(
*r_cosa = x3 / t02;
}
-static void tilt_bezpart(BezTriple *prevbezt,
- BezTriple *bezt,
+static void tilt_bezpart(const BezTriple *prevbezt,
+ const BezTriple *bezt,
Nurb *nu,
float *tilt_array,
float *radius_array,
@@ -2061,7 +2061,7 @@ static void tilt_bezpart(BezTriple *prevbezt,
int resolu,
int stride)
{
- BezTriple *pprev, *next, *last;
+ const BezTriple *pprev, *next, *last;
float fac, dfac, t[4];
int a;
@@ -4664,12 +4664,12 @@ void BKE_nurb_direction_switch(Nurb *nu)
}
}
-void BKE_curve_nurbs_vert_coords_get(ListBase *lb, float (*vert_coords)[3], int vert_len)
+void BKE_curve_nurbs_vert_coords_get(const ListBase *lb, float (*vert_coords)[3], int vert_len)
{
float *co = vert_coords[0];
- LISTBASE_FOREACH (Nurb *, nu, lb) {
+ LISTBASE_FOREACH (const Nurb *, nu, lb) {
if (nu->type == CU_BEZIER) {
- BezTriple *bezt = nu->bezt;
+ const BezTriple *bezt = nu->bezt;
for (int i = 0; i < nu->pntsu; i++, bezt++) {
copy_v3_v3(co, bezt->vec[0]);
co += 3;
@@ -4680,7 +4680,7 @@ void BKE_curve_nurbs_vert_coords_get(ListBase *lb, float (*vert_coords)[3], int
}
}
else {
- BPoint *bp = nu->bp;
+ const BPoint *bp = nu->bp;
for (int i = 0; i < nu->pntsu * nu->pntsv; i++, bp++) {
copy_v3_v3(c
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list