Cleanup: Use const arguments in curve code
This commit is contained in:
parent
1a100d2d78
commit
a641e08227
|
@ -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(
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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(co, bp->vec);
|
||||
co += 3;
|
||||
|
@ -4691,7 +4691,7 @@ void BKE_curve_nurbs_vert_coords_get(ListBase *lb, float (*vert_coords)[3], int
|
|||
UNUSED_VARS_NDEBUG(vert_len);
|
||||
}
|
||||
|
||||
float (*BKE_curve_nurbs_vert_coords_alloc(ListBase *lb, int *r_vert_len))[3]
|
||||
float (*BKE_curve_nurbs_vert_coords_alloc(const ListBase *lb, int *r_vert_len))[3]
|
||||
{
|
||||
const int vert_len = BKE_nurbList_verts_count(lb);
|
||||
float(*vert_coords)[3] = MEM_malloc_arrayN(vert_len, sizeof(*vert_coords), __func__);
|
||||
|
@ -4777,15 +4777,15 @@ void BKE_curve_nurbs_vert_coords_apply(ListBase *lb,
|
|||
}
|
||||
}
|
||||
|
||||
float (*BKE_curve_nurbs_key_vert_coords_alloc(ListBase *lb, float *key, int *r_vert_len))[3]
|
||||
float (*BKE_curve_nurbs_key_vert_coords_alloc(const ListBase *lb, float *key, int *r_vert_len))[3]
|
||||
{
|
||||
int vert_len = BKE_nurbList_verts_count(lb);
|
||||
float(*cos)[3] = MEM_malloc_arrayN(vert_len, sizeof(*cos), __func__);
|
||||
|
||||
float *co = cos[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, &key[0]);
|
||||
|
@ -4798,7 +4798,7 @@ float (*BKE_curve_nurbs_key_vert_coords_alloc(ListBase *lb, float *key, int *r_v
|
|||
}
|
||||
}
|
||||
else {
|
||||
BPoint *bp = nu->bp;
|
||||
const BPoint *bp = nu->bp;
|
||||
|
||||
for (int i = 0; i < nu->pntsu * nu->pntsv; i++, bp++) {
|
||||
copy_v3_v3(co, key);
|
||||
|
@ -5216,7 +5216,7 @@ bool BKE_curve_minmax(Curve *cu, bool use_radius, float min[3], float max[3])
|
|||
use_radius = false;
|
||||
}
|
||||
/* Do bounding box based on splines. */
|
||||
LISTBASE_FOREACH (Nurb *, nu, nurb_lb) {
|
||||
LISTBASE_FOREACH (const Nurb *, nu, nurb_lb) {
|
||||
BKE_nurb_minmax(nu, use_radius, min, max);
|
||||
}
|
||||
const bool result = (BLI_listbase_is_empty(nurb_lb) == false);
|
||||
|
@ -5412,12 +5412,12 @@ void BKE_curve_material_index_remove(Curve *cu, int index)
|
|||
}
|
||||
}
|
||||
|
||||
bool BKE_curve_material_index_used(Curve *cu, int index)
|
||||
bool BKE_curve_material_index_used(const Curve *cu, int index)
|
||||
{
|
||||
const int curvetype = BKE_curve_type_get(cu);
|
||||
|
||||
if (curvetype == OB_FONT) {
|
||||
struct CharInfo *info = cu->strinfo;
|
||||
const struct CharInfo *info = cu->strinfo;
|
||||
for (int i = cu->len_char32 - 1; i >= 0; i--, info++) {
|
||||
if (info->mat_nr == index) {
|
||||
return true;
|
||||
|
@ -5425,7 +5425,7 @@ bool BKE_curve_material_index_used(Curve *cu, int index)
|
|||
}
|
||||
}
|
||||
else {
|
||||
LISTBASE_FOREACH (Nurb *, nu, &cu->nurb) {
|
||||
LISTBASE_FOREACH (const Nurb *, nu, &cu->nurb) {
|
||||
if (nu->mat_nr == index) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -113,9 +113,9 @@ DispList *BKE_displist_find(ListBase *lb, int type)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
bool BKE_displist_has_faces(ListBase *lb)
|
||||
bool BKE_displist_has_faces(const ListBase *lb)
|
||||
{
|
||||
LISTBASE_FOREACH (DispList *, dl, lb) {
|
||||
LISTBASE_FOREACH (const DispList *, dl, lb) {
|
||||
if (ELEM(dl->type, DL_INDEX3, DL_INDEX4, DL_SURF)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ bool BKE_displist_has_faces(ListBase *lb)
|
|||
return false;
|
||||
}
|
||||
|
||||
void BKE_displist_copy(ListBase *lbn, ListBase *lb)
|
||||
void BKE_displist_copy(ListBase *lbn, const ListBase *lb)
|
||||
{
|
||||
BKE_displist_free(lbn);
|
||||
|
||||
|
@ -208,9 +208,9 @@ void BKE_displist_normals_add(ListBase *lb)
|
|||
}
|
||||
}
|
||||
|
||||
void BKE_displist_count(ListBase *lb, int *totvert, int *totface, int *tottri)
|
||||
void BKE_displist_count(const ListBase *lb, int *totvert, int *totface, int *tottri)
|
||||
{
|
||||
LISTBASE_FOREACH (DispList *, dl, lb) {
|
||||
LISTBASE_FOREACH (const DispList *, dl, lb) {
|
||||
int vert_tot = 0;
|
||||
int face_tot = 0;
|
||||
int tri_tot = 0;
|
||||
|
@ -251,7 +251,8 @@ void BKE_displist_count(ListBase *lb, int *totvert, int *totface, int *tottri)
|
|||
}
|
||||
}
|
||||
|
||||
bool BKE_displist_surfindex_get(DispList *dl, int a, int *b, int *p1, int *p2, int *p3, int *p4)
|
||||
bool BKE_displist_surfindex_get(
|
||||
const DispList *dl, int a, int *b, int *p1, int *p2, int *p3, int *p4)
|
||||
{
|
||||
if ((dl->flag & DL_CYCL_V) == 0 && a == (dl->parts) - 1) {
|
||||
return false;
|
||||
|
@ -608,7 +609,7 @@ static void bevels_to_filledpoly(const Curve *cu, ListBase *dispbase)
|
|||
BKE_displist_fill(dispbase, dispbase, z_up, false);
|
||||
}
|
||||
|
||||
static void curve_to_filledpoly(Curve *cu, ListBase *UNUSED(nurb), ListBase *dispbase)
|
||||
static void curve_to_filledpoly(const Curve *cu, ListBase *dispbase)
|
||||
{
|
||||
if (!CU_DO_2DFILL(cu)) {
|
||||
return;
|
||||
|
@ -628,7 +629,10 @@ static void curve_to_filledpoly(Curve *cu, ListBase *UNUSED(nurb), ListBase *dis
|
|||
* - first point left, last point right
|
||||
* - based on subdivided points in original curve, not on points in taper curve (still)
|
||||
*/
|
||||
static float displist_calc_taper(Depsgraph *depsgraph, Scene *scene, Object *taperobj, float fac)
|
||||
static float displist_calc_taper(Depsgraph *depsgraph,
|
||||
const Scene *scene,
|
||||
Object *taperobj,
|
||||
float fac)
|
||||
{
|
||||
DispList *dl;
|
||||
|
||||
|
@ -671,7 +675,7 @@ static float displist_calc_taper(Depsgraph *depsgraph, Scene *scene, Object *tap
|
|||
}
|
||||
|
||||
float BKE_displist_calc_taper(
|
||||
Depsgraph *depsgraph, Scene *scene, Object *taperobj, int cur, int tot)
|
||||
Depsgraph *depsgraph, const Scene *scene, Object *taperobj, int cur, int tot)
|
||||
{
|
||||
float fac = ((float)cur) / (float)(tot - 1);
|
||||
|
||||
|
@ -713,8 +717,8 @@ void BKE_displist_make_mball_forRender(Depsgraph *depsgraph,
|
|||
object_deform_mball(ob, dispbase);
|
||||
}
|
||||
|
||||
static ModifierData *curve_get_tessellate_point(Scene *scene,
|
||||
Object *ob,
|
||||
static ModifierData *curve_get_tessellate_point(const Scene *scene,
|
||||
const Object *ob,
|
||||
const bool for_render,
|
||||
const bool editmode)
|
||||
{
|
||||
|
@ -764,7 +768,7 @@ static ModifierData *curve_get_tessellate_point(Scene *scene,
|
|||
|
||||
/* Return true if any modifier was applied. */
|
||||
bool BKE_curve_calc_modifiers_pre(Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
const Scene *scene,
|
||||
Object *ob,
|
||||
ListBase *source_nurb,
|
||||
ListBase *target_nurb,
|
||||
|
@ -876,7 +880,7 @@ static float (*displist_vert_coords_alloc(ListBase *dispbase, int *r_vert_len))[
|
|||
return allverts;
|
||||
}
|
||||
|
||||
static void displist_vert_coords_apply(ListBase *dispbase, float (*allverts)[3])
|
||||
static void displist_vert_coords_apply(ListBase *dispbase, const float (*allverts)[3])
|
||||
{
|
||||
const float *fp;
|
||||
|
||||
|
@ -889,9 +893,8 @@ static void displist_vert_coords_apply(ListBase *dispbase, float (*allverts)[3])
|
|||
}
|
||||
|
||||
static void curve_calc_modifiers_post(Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
const Scene *scene,
|
||||
Object *ob,
|
||||
ListBase *nurb,
|
||||
ListBase *dispbase,
|
||||
Mesh **r_final,
|
||||
const bool for_render,
|
||||
|
@ -900,7 +903,7 @@ static void curve_calc_modifiers_post(Depsgraph *depsgraph,
|
|||
VirtualModifierData virtualModifierData;
|
||||
ModifierData *md = BKE_modifiers_get_virtual_modifierlist(ob, &virtualModifierData);
|
||||
ModifierData *pretessellatePoint;
|
||||
Curve *cu = ob->data;
|
||||
const Curve *cu = ob->data;
|
||||
int required_mode = 0, totvert = 0;
|
||||
const bool editmode = (!for_render && (cu->editnurb || cu->editfont));
|
||||
Mesh *modified = NULL, *mesh_applied;
|
||||
|
@ -952,7 +955,7 @@ static void curve_calc_modifiers_post(Depsgraph *depsgraph,
|
|||
}
|
||||
|
||||
if (ELEM(ob->type, OB_CURVE, OB_FONT) && (cu->flag & CU_DEFORM_FILL)) {
|
||||
curve_to_filledpoly(cu, nurb, dispbase);
|
||||
curve_to_filledpoly(cu, dispbase);
|
||||
}
|
||||
|
||||
modified = BKE_mesh_new_nomain_from_curve_displist(ob, dispbase);
|
||||
|
@ -1001,7 +1004,7 @@ static void curve_calc_modifiers_post(Depsgraph *depsgraph,
|
|||
}
|
||||
|
||||
if (ELEM(ob->type, OB_CURVE, OB_FONT) && (cu->flag & CU_DEFORM_FILL)) {
|
||||
curve_to_filledpoly(cu, nurb, dispbase);
|
||||
curve_to_filledpoly(cu, dispbase);
|
||||
}
|
||||
|
||||
modified = BKE_mesh_new_nomain_from_curve_displist(ob, dispbase);
|
||||
|
@ -1126,7 +1129,7 @@ static void displist_surf_indices(DispList *dl)
|
|||
}
|
||||
|
||||
void BKE_displist_make_surf(Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
const Scene *scene,
|
||||
Object *ob,
|
||||
ListBase *dispbase,
|
||||
Mesh **r_final,
|
||||
|
@ -1230,7 +1233,7 @@ void BKE_displist_make_surf(Depsgraph *depsgraph,
|
|||
if (!for_orco) {
|
||||
BKE_nurbList_duplicate(&ob->runtime.curve_cache->deformed_nurbs, &nubase);
|
||||
curve_calc_modifiers_post(
|
||||
depsgraph, scene, ob, &nubase, dispbase, r_final, for_render, force_mesh_conversion);
|
||||
depsgraph, scene, ob, dispbase, r_final, for_render, force_mesh_conversion);
|
||||
}
|
||||
|
||||
BKE_nurbList_free(&nubase);
|
||||
|
@ -1297,7 +1300,10 @@ static void rotateBevelPiece(const Curve *cu,
|
|||
*r_data = data;
|
||||
}
|
||||
|
||||
static void fillBevelCap(Nurb *nu, DispList *dlb, float *prev_fp, ListBase *dispbase)
|
||||
static void fillBevelCap(const Nurb *nu,
|
||||
const DispList *dlb,
|
||||
const float *prev_fp,
|
||||
ListBase *dispbase)
|
||||
{
|
||||
DispList *dl;
|
||||
|
||||
|
@ -1320,7 +1326,7 @@ static void fillBevelCap(Nurb *nu, DispList *dlb, float *prev_fp, ListBase *disp
|
|||
}
|
||||
|
||||
static void calc_bevfac_segment_mapping(
|
||||
BevList *bl, float bevfac, float spline_length, int *r_bev, float *r_blend)
|
||||
const BevList *bl, float bevfac, float spline_length, int *r_bev, float *r_blend)
|
||||
{
|
||||
float normlen, normsum = 0.0f;
|
||||
float *seglen = bl->seglen;
|
||||
|
@ -1346,7 +1352,7 @@ static void calc_bevfac_segment_mapping(
|
|||
}
|
||||
|
||||
static void calc_bevfac_spline_mapping(
|
||||
BevList *bl, float bevfac, float spline_length, int *r_bev, float *r_blend)
|
||||
const BevList *bl, float bevfac, float spline_length, int *r_bev, float *r_blend)
|
||||
{
|
||||
const float len_target = bevfac * spline_length;
|
||||
BevPoint *bevp = bl->bevpoints;
|
||||
|
@ -1368,7 +1374,7 @@ static void calc_bevfac_spline_mapping(
|
|||
}
|
||||
|
||||
static void calc_bevfac_mapping_default(
|
||||
BevList *bl, int *r_start, float *r_firstblend, int *r_steps, float *r_lastblend)
|
||||
const BevList *bl, int *r_start, float *r_firstblend, int *r_steps, float *r_lastblend)
|
||||
{
|
||||
*r_start = 0;
|
||||
*r_steps = bl->nr;
|
||||
|
@ -1376,9 +1382,9 @@ static void calc_bevfac_mapping_default(
|
|||
*r_lastblend = 1.0f;
|
||||
}
|
||||
|
||||
static void calc_bevfac_mapping(Curve *cu,
|
||||
BevList *bl,
|
||||
Nurb *nu,
|
||||
static void calc_bevfac_mapping(const Curve *cu,
|
||||
const BevList *bl,
|
||||
const Nurb *nu,
|
||||
int *r_start,
|
||||
float *r_firstblend,
|
||||
int *r_steps,
|
||||
|
@ -1456,7 +1462,7 @@ static void calc_bevfac_mapping(Curve *cu,
|
|||
}
|
||||
|
||||
static void do_makeDispListCurveTypes(Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
const Scene *scene,
|
||||
Object *ob,
|
||||
ListBase *dispbase,
|
||||
const bool for_render,
|
||||
|
@ -1691,7 +1697,7 @@ static void do_makeDispListCurveTypes(Depsgraph *depsgraph,
|
|||
}
|
||||
|
||||
if (!(cu->flag & CU_DEFORM_FILL)) {
|
||||
curve_to_filledpoly(cu, &nubase, dispbase);
|
||||
curve_to_filledpoly(cu, dispbase);
|
||||
}
|
||||
|
||||
if (!for_orco) {
|
||||
|
@ -1702,19 +1708,22 @@ static void do_makeDispListCurveTypes(Depsgraph *depsgraph,
|
|||
|
||||
BKE_nurbList_duplicate(&ob->runtime.curve_cache->deformed_nurbs, &nubase);
|
||||
curve_calc_modifiers_post(
|
||||
depsgraph, scene, ob, &nubase, dispbase, r_final, for_render, force_mesh_conversion);
|
||||
depsgraph, scene, ob, dispbase, r_final, for_render, force_mesh_conversion);
|
||||
}
|
||||
|
||||
if (cu->flag & CU_DEFORM_FILL && !ob->runtime.data_eval) {
|
||||
curve_to_filledpoly(cu, &nubase, dispbase);
|
||||
curve_to_filledpoly(cu, dispbase);
|
||||
}
|
||||
|
||||
BKE_nurbList_free(&nubase);
|
||||
}
|
||||
}
|
||||
|
||||
void BKE_displist_make_curveTypes(
|
||||
Depsgraph *depsgraph, Scene *scene, Object *ob, const bool for_render, const bool for_orco)
|
||||
void BKE_displist_make_curveTypes(Depsgraph *depsgraph,
|
||||
const Scene *scene,
|
||||
Object *ob,
|
||||
const bool for_render,
|
||||
const bool for_orco)
|
||||
{
|
||||
ListBase *dispbase;
|
||||
|
||||
|
@ -1744,7 +1753,7 @@ void BKE_displist_make_curveTypes(
|
|||
}
|
||||
|
||||
void BKE_displist_make_curveTypes_forRender(Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
const Scene *scene,
|
||||
Object *ob,
|
||||
ListBase *dispbase,
|
||||
Mesh **r_final,
|
||||
|
@ -1757,13 +1766,13 @@ void BKE_displist_make_curveTypes_forRender(Depsgraph *depsgraph,
|
|||
do_makeDispListCurveTypes(depsgraph, scene, ob, dispbase, true, for_orco, r_final);
|
||||
}
|
||||
|
||||
void BKE_displist_minmax(ListBase *dispbase, float min[3], float max[3])
|
||||
void BKE_displist_minmax(const ListBase *dispbase, float min[3], float max[3])
|
||||
{
|
||||
const float *vert;
|
||||
int a, tot = 0;
|
||||
int doit = 0;
|
||||
|
||||
LISTBASE_FOREACH (DispList *, dl, dispbase) {
|
||||
LISTBASE_FOREACH (const DispList *, dl, dispbase) {
|
||||
tot = (dl->type == DL_INDEX3) ? dl->nr : dl->nr * dl->parts;
|
||||
vert = dl->verts;
|
||||
for (a = 0; a < tot; a++, vert += 3) {
|
||||
|
|
Loading…
Reference in New Issue