Code cleanup: use 'const' for arrays (blenkernel)
This commit is contained in:
parent
11310b554a
commit
a2c107aef1
|
@ -2791,9 +2791,9 @@ void DM_calc_auto_bump_scale(DerivedMesh *dm)
|
|||
int t;
|
||||
for (t = 0; t < nr_tris_to_pile; t++) {
|
||||
float f2x_area_uv;
|
||||
float *p0 = verts[indices[t * 3 + 0]];
|
||||
float *p1 = verts[indices[t * 3 + 1]];
|
||||
float *p2 = verts[indices[t * 3 + 2]];
|
||||
const float *p0 = verts[indices[t * 3 + 0]];
|
||||
const float *p1 = verts[indices[t * 3 + 1]];
|
||||
const float *p2 = verts[indices[t * 3 + 2]];
|
||||
|
||||
float edge_t0[2], edge_t1[2];
|
||||
sub_v2_v2v2(edge_t0, tex_coords[indices[t * 3 + 1]], tex_coords[indices[t * 3 + 0]]);
|
||||
|
|
|
@ -1127,7 +1127,7 @@ short action_get_item_transforms(bAction *act, Object *ob, bPoseChannel *pchan,
|
|||
* - we cannot use the groups, since they may not be grouped in that way...
|
||||
*/
|
||||
for (fcu = act->curves.first; fcu; fcu = fcu->next) {
|
||||
char *bPtr = NULL, *pPtr = NULL;
|
||||
const char *bPtr = NULL, *pPtr = NULL;
|
||||
|
||||
/* if enough flags have been found, we can stop checking unless we're also getting the curves */
|
||||
if ((flags == ACT_TRANS_ALL) && (curves == NULL))
|
||||
|
|
|
@ -581,7 +581,7 @@ static char *rna_path_rename_fix(ID *owner_id, const char *prefix, const char *o
|
|||
/* if we haven't aren't able to resolve the path now, try again after fixing it */
|
||||
if (!verify_paths || check_rna_path_is_valid(owner_id, oldpath) == 0) {
|
||||
DynStr *ds = BLI_dynstr_new();
|
||||
char *postfixPtr = oldNamePtr + oldNameLen;
|
||||
const char *postfixPtr = oldNamePtr + oldNameLen;
|
||||
char *newPath = NULL;
|
||||
char oldChar;
|
||||
|
||||
|
@ -633,7 +633,7 @@ static void fcurves_path_rename_fix(ID *owner_id, const char *prefix, const char
|
|||
/* we need to check every curve... */
|
||||
for (fcu = curves->first; fcu; fcu = fcu->next) {
|
||||
if (fcu->rna_path) {
|
||||
char *old_path = fcu->rna_path;
|
||||
const char *old_path = fcu->rna_path;
|
||||
|
||||
/* firstly, handle the F-Curve's own path */
|
||||
fcu->rna_path = rna_path_rename_fix(owner_id, prefix, oldKey, newKey, fcu->rna_path, verify_paths);
|
||||
|
|
|
@ -371,7 +371,7 @@ static void mesh_faces_nearest_point(void *userdata, int index, const float co[3
|
|||
MVert *vert = data->vert;
|
||||
MFace *face = data->face + index;
|
||||
|
||||
float *t0, *t1, *t2, *t3;
|
||||
const float *t0, *t1, *t2, *t3;
|
||||
t0 = vert[face->v1].co;
|
||||
t1 = vert[face->v2].co;
|
||||
t2 = vert[face->v3].co;
|
||||
|
@ -406,7 +406,7 @@ static void editmesh_faces_nearest_point(void *userdata, int index, const float
|
|||
BMEditMesh *em = data->em_evil;
|
||||
const BMLoop **ltri = (const BMLoop **)em->looptris[index];
|
||||
|
||||
float *t0, *t1, *t2;
|
||||
const float *t0, *t1, *t2;
|
||||
t0 = ltri[0]->v->co;
|
||||
t1 = ltri[1]->v->co;
|
||||
t2 = ltri[2]->v->co;
|
||||
|
@ -433,7 +433,7 @@ static void mesh_faces_spherecast(void *userdata, int index, const BVHTreeRay *r
|
|||
MVert *vert = data->vert;
|
||||
MFace *face = data->face + index;
|
||||
|
||||
float *t0, *t1, *t2, *t3;
|
||||
const float *t0, *t1, *t2, *t3;
|
||||
t0 = vert[face->v1].co;
|
||||
t1 = vert[face->v2].co;
|
||||
t2 = vert[face->v3].co;
|
||||
|
@ -471,7 +471,7 @@ static void editmesh_faces_spherecast(void *userdata, int index, const BVHTreeRa
|
|||
BMEditMesh *em = data->em_evil;
|
||||
const BMLoop **ltri = (const BMLoop **)em->looptris[index];
|
||||
|
||||
float *t0, *t1, *t2;
|
||||
const float *t0, *t1, *t2;
|
||||
t0 = ltri[0]->v->co;
|
||||
t1 = ltri[1]->v->co;
|
||||
t2 = ltri[2]->v->co;
|
||||
|
@ -503,7 +503,7 @@ static void mesh_edges_nearest_point(void *userdata, int index, const float co[3
|
|||
MEdge *edge = data->edge + index;
|
||||
float nearest_tmp[3], dist_sq;
|
||||
|
||||
float *t0, *t1;
|
||||
const float *t0, *t1;
|
||||
t0 = vert[edge->v1].co;
|
||||
t1 = vert[edge->v2].co;
|
||||
|
||||
|
|
|
@ -537,7 +537,7 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm,
|
|||
CDDerivedMesh *cddm = (CDDerivedMesh *) dm;
|
||||
MVert *mvert = cddm->mvert;
|
||||
MFace *mface = cddm->mface;
|
||||
float *nors = dm->getTessFaceDataArray(dm, CD_NORMAL);
|
||||
const float *nors = dm->getTessFaceDataArray(dm, CD_NORMAL);
|
||||
short (*lnors)[4][3] = dm->getTessFaceDataArray(dm, CD_TESSLOOPNORMAL);
|
||||
int a, glmode = -1, shademodel = -1, matnr = -1, drawCurrentMat = 1;
|
||||
|
||||
|
@ -653,7 +653,7 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
|
|||
CDDerivedMesh *cddm = (CDDerivedMesh *) dm;
|
||||
MVert *mv = cddm->mvert;
|
||||
MFace *mf = DM_get_tessface_data_layer(dm, CD_MFACE);
|
||||
float *nors = dm->getTessFaceDataArray(dm, CD_NORMAL);
|
||||
const float *nors = dm->getTessFaceDataArray(dm, CD_NORMAL);
|
||||
short (*lnors)[4][3] = dm->getTessFaceDataArray(dm, CD_TESSLOOPNORMAL);
|
||||
MTFace *tf = DM_get_tessface_data_layer(dm, CD_MTFACE);
|
||||
MCol *mcol;
|
||||
|
@ -887,7 +887,7 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm,
|
|||
MVert *mv = cddm->mvert;
|
||||
MFace *mf = cddm->mface;
|
||||
MCol *mcol;
|
||||
float *nors = DM_get_tessface_data_layer(dm, CD_NORMAL);
|
||||
const float *nors = DM_get_tessface_data_layer(dm, CD_NORMAL);
|
||||
short (*lnors)[4][3] = dm->getTessFaceDataArray(dm, CD_TESSLOOPNORMAL);
|
||||
int colType, useColors = flag & DM_DRAW_USE_COLORS;
|
||||
int i, orig;
|
||||
|
@ -1291,7 +1291,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
|
|||
}
|
||||
else {
|
||||
GPUBuffer *buffer = NULL;
|
||||
char *varray = NULL;
|
||||
const char *varray = NULL;
|
||||
int numdata = 0, elementsize = 0, offset;
|
||||
int start = 0, numfaces = 0 /* , prevdraw = 0 */ /* UNUSED */, curface = 0;
|
||||
int i;
|
||||
|
@ -1429,7 +1429,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
|
|||
}
|
||||
}
|
||||
if (attribs.tottang && attribs.tang.array) {
|
||||
float *tang = attribs.tang.array[a * 4 + 0];
|
||||
const float *tang = attribs.tang.array[a * 4 + 0];
|
||||
copy_v4_v4((float *)&varray[elementsize * curface * 3 + offset], tang);
|
||||
tang = attribs.tang.array[a * 4 + 1];
|
||||
copy_v4_v4((float *)&varray[elementsize * curface * 3 + offset + elementsize], tang);
|
||||
|
@ -1474,7 +1474,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
|
|||
}
|
||||
}
|
||||
if (attribs.tottang && attribs.tang.array) {
|
||||
float *tang = attribs.tang.array[a * 4 + 2];
|
||||
const float *tang = attribs.tang.array[a * 4 + 2];
|
||||
copy_v4_v4((float *)&varray[elementsize * curface * 3 + offset], tang);
|
||||
tang = attribs.tang.array[a * 4 + 3];
|
||||
copy_v4_v4((float *)&varray[elementsize * curface * 3 + offset + elementsize], tang);
|
||||
|
@ -1651,7 +1651,7 @@ static void cdDM_foreachMappedVert(
|
|||
DMForeachFlag flag)
|
||||
{
|
||||
MVert *mv = CDDM_get_verts(dm);
|
||||
int *index = DM_get_vert_data_layer(dm, CD_ORIGINDEX);
|
||||
const int *index = DM_get_vert_data_layer(dm, CD_ORIGINDEX);
|
||||
int i;
|
||||
|
||||
if (index) {
|
||||
|
@ -2836,7 +2836,7 @@ void CDDM_calc_edges(DerivedMesh *dm)
|
|||
EdgeHash *eh;
|
||||
unsigned int eh_reserve;
|
||||
int v1, v2;
|
||||
int *eindex;
|
||||
const int *eindex;
|
||||
int i, j, *index;
|
||||
const int numFaces = dm->numPolyData;
|
||||
const int numLoops = dm->numLoopData;
|
||||
|
|
|
@ -961,7 +961,7 @@ void BKE_histogram_update_sample_line(Histogram *hist, ImBuf *ibuf, const ColorM
|
|||
const ColorManagedDisplaySettings *display_settings)
|
||||
{
|
||||
int i, x, y;
|
||||
float *fp;
|
||||
const float *fp;
|
||||
float rgb[3];
|
||||
unsigned char *cp;
|
||||
|
||||
|
@ -1024,7 +1024,7 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings *
|
|||
int x, y, c;
|
||||
unsigned int nl, na, nr, ng, nb;
|
||||
double divl, diva, divr, divg, divb;
|
||||
float *rf = NULL;
|
||||
const float *rf = NULL;
|
||||
unsigned char *rc = NULL;
|
||||
unsigned int *bin_lum, *bin_r, *bin_g, *bin_b, *bin_a;
|
||||
int savedlines, saveline;
|
||||
|
|
|
@ -460,7 +460,7 @@ static void contarget_get_lattice_mat(Object *ob, const char *substring, float m
|
|||
Lattice *lt = (Lattice *)ob->data;
|
||||
|
||||
DispList *dl = ob->curve_cache ? BKE_displist_find(&ob->curve_cache->disp, DL_VERTS) : NULL;
|
||||
float *co = dl ? dl->verts : NULL;
|
||||
const float *co = dl ? dl->verts : NULL;
|
||||
BPoint *bp = lt->def;
|
||||
|
||||
MDeformVert *dv = lt->dvert;
|
||||
|
|
|
@ -1598,7 +1598,7 @@ float *BKE_curve_make_orco(Scene *scene, Object *ob, int *r_numVerts)
|
|||
fp[2] = 0.0;
|
||||
}
|
||||
else {
|
||||
float *vert;
|
||||
const float *vert;
|
||||
int realv = v % dl->nr;
|
||||
int realu = u % dl->parts;
|
||||
|
||||
|
@ -3673,7 +3673,7 @@ float (*BKE_curve_nurbs_vertexCos_get(ListBase *lb, int *r_numVerts))[3]
|
|||
|
||||
void BK_curve_nurbs_vertexCos_apply(ListBase *lb, float (*vertexCos)[3])
|
||||
{
|
||||
float *co = vertexCos[0];
|
||||
const float *co = vertexCos[0];
|
||||
Nurb *nu;
|
||||
int i;
|
||||
|
||||
|
@ -3897,7 +3897,7 @@ bool BKE_nurb_type_convert(Nurb *nu, const short type, const bool use_handles)
|
|||
bp++;
|
||||
}
|
||||
else {
|
||||
char *f = &bezt->f1;
|
||||
const char *f = &bezt->f1;
|
||||
for (c = 0; c < 3; c++, f++) {
|
||||
copy_v3_v3(bp->vec, bezt->vec[c]);
|
||||
bp->vec[3] = 1.0;
|
||||
|
|
|
@ -1987,7 +1987,7 @@ static void CustomData_copy_data_layer(const CustomData *source, CustomData *des
|
|||
int src_offset;
|
||||
int dest_offset;
|
||||
|
||||
char *src_data = source->layers[src_i].data;
|
||||
const char *src_data = source->layers[src_i].data;
|
||||
char *dest_data = dest->layers[dest_i].data;
|
||||
|
||||
typeInfo = layerType_getInfo(source->layers[src_i].type);
|
||||
|
@ -2612,7 +2612,7 @@ void CustomData_bmesh_copy_data(const CustomData *source, CustomData *dest,
|
|||
if (dest->layers[dest_i].type == source->layers[src_i].type &&
|
||||
strcmp(dest->layers[dest_i].name, source->layers[src_i].name) == 0)
|
||||
{
|
||||
char *src_data = (char *)src_block + source->layers[src_i].offset;
|
||||
const char *src_data = (char *)src_block + source->layers[src_i].offset;
|
||||
char *dest_data = (char *)*dest_block + dest->layers[dest_i].offset;
|
||||
|
||||
typeInfo = layerType_getInfo(source->layers[src_i].type);
|
||||
|
@ -2931,7 +2931,7 @@ void CustomData_to_bmesh_block(const CustomData *source, CustomData *dest,
|
|||
/* if we found a matching layer, copy the data */
|
||||
if (dest->layers[dest_i].type == source->layers[src_i].type) {
|
||||
int offset = dest->layers[dest_i].offset;
|
||||
char *src_data = source->layers[src_i].data;
|
||||
const char *src_data = source->layers[src_i].data;
|
||||
char *dest_data = (char *)*dest_block + offset;
|
||||
|
||||
typeInfo = layerType_getInfo(dest->layers[dest_i].type);
|
||||
|
@ -2981,7 +2981,7 @@ void CustomData_from_bmesh_block(const CustomData *source, CustomData *dest,
|
|||
/* if we found a matching layer, copy the data */
|
||||
if (dest->layers[dest_i].type == source->layers[src_i].type) {
|
||||
int offset = source->layers[src_i].offset;
|
||||
char *src_data = (char *)src_block + offset;
|
||||
const char *src_data = (char *)src_block + offset;
|
||||
char *dest_data = dest->layers[dest_i].data;
|
||||
|
||||
typeInfo = layerType_getInfo(dest->layers[dest_i].type);
|
||||
|
|
|
@ -891,7 +891,7 @@ static float (*displist_get_allverts(ListBase *dispbase, int *totvert))[3]
|
|||
static void displist_apply_allverts(ListBase *dispbase, float (*allverts)[3])
|
||||
{
|
||||
DispList *dl;
|
||||
float *fp;
|
||||
const float *fp;
|
||||
|
||||
fp = (float *)allverts;
|
||||
for (dl = dispbase->first; dl; dl = dl->next) {
|
||||
|
@ -1794,7 +1794,7 @@ float *BKE_displist_make_orco(Scene *scene, Object *ob, DerivedMesh *dm_final,
|
|||
void BKE_displist_minmax(ListBase *dispbase, float min[3], float max[3])
|
||||
{
|
||||
DispList *dl;
|
||||
float *vert;
|
||||
const float *vert;
|
||||
int a, tot = 0;
|
||||
int doit = 0;
|
||||
|
||||
|
|
|
@ -323,7 +323,7 @@ static void dynamicPaint_setPreview(DynamicPaintSurface *t_surface)
|
|||
|
||||
bool dynamicPaint_outputLayerExists(struct DynamicPaintSurface *surface, Object *ob, int output)
|
||||
{
|
||||
char *name;
|
||||
const char *name;
|
||||
|
||||
if (output == 0)
|
||||
name = surface->output_name;
|
||||
|
@ -1678,7 +1678,7 @@ static void dynamicPaint_applySurfaceDisplace(DynamicPaintSurface *surface, Deri
|
|||
if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE) {
|
||||
MVert *mvert = result->getVertArray(result);
|
||||
int i;
|
||||
float *value = (float *)sData->type_data;
|
||||
const float *value = (float *)sData->type_data;
|
||||
|
||||
#pragma omp parallel for schedule(static)
|
||||
for (i = 0; i < sData->total_points; i++) {
|
||||
|
@ -2103,7 +2103,7 @@ static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh
|
|||
float closest_point[2], lambda, dir_vec[2];
|
||||
int target_uv1, target_uv2, final_pixel[2], final_index;
|
||||
|
||||
float *s_uv1, *s_uv2, *t_uv1, *t_uv2;
|
||||
const float *s_uv1, *s_uv2, *t_uv1, *t_uv2;
|
||||
|
||||
pixel[0] = ((float)(px + neighX[n_index]) + 0.5f) / (float)w;
|
||||
pixel[1] = ((float)(py + neighY[n_index]) + 0.5f) / (float)h;
|
||||
|
@ -2901,7 +2901,7 @@ static void mesh_faces_spherecast_dp(void *userdata, int index, const BVHTreeRay
|
|||
MFace *face = data->face + index;
|
||||
short quad = 0;
|
||||
|
||||
float *t0, *t1, *t2, *t3;
|
||||
const float *t0, *t1, *t2, *t3;
|
||||
t0 = vert[face->v1].co;
|
||||
t1 = vert[face->v2].co;
|
||||
t2 = vert[face->v3].co;
|
||||
|
@ -2937,7 +2937,7 @@ static void mesh_faces_nearest_point_dp(void *userdata, int index, const float c
|
|||
MFace *face = data->face + index;
|
||||
short quad = 0;
|
||||
|
||||
float *t0, *t1, *t2, *t3;
|
||||
const float *t0, *t1, *t2, *t3;
|
||||
t0 = vert[face->v1].co;
|
||||
t1 = vert[face->v2].co;
|
||||
t2 = vert[face->v3].co;
|
||||
|
|
|
@ -1256,7 +1256,7 @@ static int emDM_getNumPolys(DerivedMesh *dm)
|
|||
|
||||
static void bmvert_to_mvert(BMesh *bm, BMVert *ev, MVert *r_vert)
|
||||
{
|
||||
float *f;
|
||||
const float *f;
|
||||
|
||||
copy_v3_v3(r_vert->co, ev->co);
|
||||
|
||||
|
@ -1366,7 +1366,7 @@ static void emDM_getEdge(DerivedMesh *dm, int index, MEdge *r_edge)
|
|||
EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm;
|
||||
BMesh *bm = bmdm->em->bm;
|
||||
BMEdge *e;
|
||||
float *f;
|
||||
const float *f;
|
||||
|
||||
if (UNLIKELY(index < 0 || index >= bm->totedge)) {
|
||||
BLI_assert(!"error in emDM_getEdge");
|
||||
|
@ -1557,7 +1557,7 @@ static void *emDM_getTessFaceDataArray(DerivedMesh *dm, int type)
|
|||
if (type == CD_MTFACE || type == CD_MCOL) {
|
||||
const int type_from = (type == CD_MTFACE) ? CD_MTEXPOLY : CD_MLOOPCOL;
|
||||
int index;
|
||||
char *data, *bmdata;
|
||||
const char *data, *bmdata;
|
||||
index = CustomData_get_layer_index(&bm->pdata, type_from);
|
||||
|
||||
if (index != -1) {
|
||||
|
|
|
@ -1580,7 +1580,7 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
|
|||
}
|
||||
|
||||
if (scene->r.stamp & R_STAMP_MARKER) {
|
||||
char *name = BKE_scene_find_last_marker_name(scene, CFRA);
|
||||
const char *name = BKE_scene_find_last_marker_name(scene, CFRA);
|
||||
|
||||
if (name) BLI_strncpy(text, name, sizeof(text));
|
||||
else BLI_strncpy(text, "<none>", sizeof(text));
|
||||
|
@ -1902,7 +1902,7 @@ bool BKE_imbuf_alpha_test(ImBuf *ibuf)
|
|||
{
|
||||
int tot;
|
||||
if (ibuf->rect_float) {
|
||||
float *buf = ibuf->rect_float;
|
||||
const float *buf = ibuf->rect_float;
|
||||
for (tot = ibuf->x * ibuf->y; tot--; buf += 4) {
|
||||
if (buf[3] < 1.0f) {
|
||||
return true;
|
||||
|
|
|
@ -1681,7 +1681,7 @@ void BKE_key_convert_from_lattice(Lattice *lt, KeyBlock *kb)
|
|||
void BKE_key_convert_to_lattice(KeyBlock *kb, Lattice *lt)
|
||||
{
|
||||
BPoint *bp;
|
||||
float *fp;
|
||||
const float *fp;
|
||||
int a, tot;
|
||||
|
||||
bp = lt->def;
|
||||
|
@ -1752,7 +1752,7 @@ void BKE_key_convert_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb)
|
|||
Nurb *nu;
|
||||
BezTriple *bezt;
|
||||
BPoint *bp;
|
||||
float *fp;
|
||||
const float *fp;
|
||||
int a, tot;
|
||||
|
||||
nu = nurb->first;
|
||||
|
@ -1822,7 +1822,7 @@ void BKE_key_convert_from_mesh(Mesh *me, KeyBlock *kb)
|
|||
void BKE_key_convert_to_mesh(KeyBlock *kb, Mesh *me)
|
||||
{
|
||||
MVert *mvert;
|
||||
float *fp;
|
||||
const float *fp;
|
||||
int a, tot;
|
||||
|
||||
mvert = me->mvert;
|
||||
|
@ -1839,7 +1839,7 @@ void BKE_key_convert_to_mesh(KeyBlock *kb, Mesh *me)
|
|||
float (*BKE_key_convert_to_vertcos(Object *ob, KeyBlock *kb))[3]
|
||||
{
|
||||
float (*vertCos)[3], *co;
|
||||
float *fp = kb->data;
|
||||
const float *fp = kb->data;
|
||||
int tot = 0, a;
|
||||
|
||||
/* Count of vertex coords in array */
|
||||
|
|
|
@ -368,7 +368,7 @@ LatticeDeformData *init_latt_deform(Object *oblatt, Object *ob)
|
|||
Lattice *lt = oblatt->data;
|
||||
BPoint *bp;
|
||||
DispList *dl = oblatt->curve_cache ? BKE_displist_find(&oblatt->curve_cache->disp, DL_VERTS) : NULL;
|
||||
float *co = dl ? dl->verts : NULL;
|
||||
const float *co = dl ? dl->verts : NULL;
|
||||
float *fp, imat[4][4];
|
||||
float fu, fv, fw;
|
||||
int u, v, w;
|
||||
|
|
|
@ -134,7 +134,7 @@
|
|||
* also note that the id _must_ have a library - campbell */
|
||||
void BKE_id_lib_local_paths(Main *bmain, Library *lib, ID *id)
|
||||
{
|
||||
char *bpath_user_data[2] = {bmain->name, lib->filepath};
|
||||
const char *bpath_user_data[2] = {bmain->name, lib->filepath};
|
||||
|
||||
BKE_bpath_traverse_id(bmain, id,
|
||||
BKE_bpath_relocate_visitor,
|
||||
|
|
|
@ -1687,8 +1687,8 @@ void BKE_mask_layer_shape_to_mask_interp(MaskLayer *masklay,
|
|||
{
|
||||
int tot = BKE_mask_layer_shape_totvert(masklay);
|
||||
if (masklay_shape_a->tot_vert == tot && masklay_shape_b->tot_vert == tot) {
|
||||
float *fp_a = masklay_shape_a->data;
|
||||
float *fp_b = masklay_shape_b->data;
|
||||
const float *fp_a = masklay_shape_a->data;
|
||||
const float *fp_b = masklay_shape_b->data;
|
||||
const float ifac = 1.0f - fac;
|
||||
|
||||
MaskSpline *spline;
|
||||
|
@ -2105,7 +2105,7 @@ void BKE_mask_clipboard_paste_to_layer(Main *bmain, MaskLayer *mask_layer)
|
|||
for (i = 0; i < spline_new->tot_point; i++) {
|
||||
MaskSplinePoint *point = &spline_new->points[i];
|
||||
if (point->parent.id) {
|
||||
char *id_name = BLI_ghash_lookup(mask_clipboard.id_hash, point->parent.id);
|
||||
const char *id_name = BLI_ghash_lookup(mask_clipboard.id_hash, point->parent.id);
|
||||
ListBase *listbase;
|
||||
|
||||
BLI_assert(id_name != NULL);
|
||||
|
|
|
@ -258,15 +258,15 @@ static void feather_bucket_check_intersect(
|
|||
{
|
||||
int i;
|
||||
|
||||
float *v1 = (float *) feather_points[cur_a];
|
||||
float *v2 = (float *) feather_points[cur_b];
|
||||
const float *v1 = (float *) feather_points[cur_a];
|
||||
const float *v2 = (float *) feather_points[cur_b];
|
||||
|
||||
for (i = 0; i < bucket->tot_segment; i++) {
|
||||
int check_a = bucket->segments[i][0];
|
||||
int check_b = bucket->segments[i][1];
|
||||
|
||||
float *v3 = (float *) feather_points[check_a];
|
||||
float *v4 = (float *) feather_points[check_b];
|
||||
const float *v3 = (float *) feather_points[check_a];
|
||||
const float *v4 = (float *) feather_points[check_b];
|
||||
|
||||
if (check_a >= cur_a - 1 || cur_b == check_a)
|
||||
continue;
|
||||
|
|
|
@ -841,8 +841,8 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas
|
|||
open_spline_ranges[open_spline_index].vertex_total_cap_tail = 0;
|
||||
|
||||
if (!is_cyclic) {
|
||||
float *fp_cent;
|
||||
float *fp_turn;
|
||||
const float *fp_cent;
|
||||
const float *fp_turn;
|
||||
|
||||
unsigned int k;
|
||||
|
||||
|
|
|
@ -669,7 +669,7 @@ void BKE_material_clear_id(struct ID *id, bool update_data)
|
|||
Material *give_current_material(Object *ob, short act)
|
||||
{
|
||||
Material ***matarar, *ma;
|
||||
short *totcolp;
|
||||
const short *totcolp;
|
||||
|
||||
if (ob == NULL) return NULL;
|
||||
|
||||
|
@ -774,7 +774,7 @@ void test_object_materials(Main *bmain, ID *id)
|
|||
{
|
||||
/* make the ob mat-array same size as 'ob->data' mat-array */
|
||||
Object *ob;
|
||||
short *totcol;
|
||||
const short *totcol;
|
||||
|
||||
if (id == NULL || (totcol = give_totcolp_id(id)) == NULL) {
|
||||
return;
|
||||
|
|
|
@ -1023,7 +1023,7 @@ void BKE_mesh_from_metaball(ListBase *lb, Mesh *me)
|
|||
MVert *mvert;
|
||||
MLoop *mloop, *allloop;
|
||||
MPoly *mpoly;
|
||||
float *nors, *verts;
|
||||
const float *nors, *verts;
|
||||
int a, *index;
|
||||
|
||||
dl = lb->first;
|
||||
|
@ -1194,7 +1194,7 @@ int BKE_mesh_nurbs_displist_to_mdata(Object *ob, ListBase *dispbase,
|
|||
MLoop *mloop;
|
||||
MLoopUV *mloopuv = NULL;
|
||||
MEdge *medge;
|
||||
float *data;
|
||||
const float *data;
|
||||
int a, b, ofs, vertcount, startvert, totvert = 0, totedge = 0, totloop = 0, totvlak = 0;
|
||||
int p1, p2, p3, p4, *index;
|
||||
const bool conv_polys = ((CU_DO_2DFILL(cu) == false) || /* 2d polys are filled with DL_INDEX3 displists */
|
||||
|
|
|
@ -172,8 +172,8 @@ static void mesh_calc_normals_poly_accum(MPoly *mp, MLoop *ml,
|
|||
/* inline version of #BKE_mesh_calc_poly_normal, also does edge-vectors */
|
||||
{
|
||||
int i_prev = nverts - 1;
|
||||
float const *v_prev = mvert[ml[i_prev].v].co;
|
||||
float const *v_curr;
|
||||
const float const *v_prev = mvert[ml[i_prev].v].co;
|
||||
const float const *v_curr;
|
||||
|
||||
zero_v3(polyno);
|
||||
/* Newell's Method */
|
||||
|
@ -287,7 +287,7 @@ void BKE_mesh_calc_normals_tessface(MVert *mverts, int numVerts, MFace *mfaces,
|
|||
MFace *mf = &mfaces[i];
|
||||
float *f_no = fnors[i];
|
||||
float *n4 = (mf->v4) ? tnorms[mf->v4] : NULL;
|
||||
float *c4 = (mf->v4) ? mverts[mf->v4].co : NULL;
|
||||
const float *c4 = (mf->v4) ? mverts[mf->v4].co : NULL;
|
||||
|
||||
if (mf->v4)
|
||||
normal_quad_v3(f_no, mverts[mf->v1].co, mverts[mf->v2].co, mverts[mf->v3].co, mverts[mf->v4].co);
|
||||
|
@ -738,8 +738,8 @@ static void mesh_calc_ngon_normal(MPoly *mpoly, MLoop *loopstart,
|
|||
MVert *mvert, float normal[3])
|
||||
{
|
||||
const int nverts = mpoly->totloop;
|
||||
float const *v_prev = mvert[loopstart[nverts - 1].v].co;
|
||||
float const *v_curr;
|
||||
const float const *v_prev = mvert[loopstart[nverts - 1].v].co;
|
||||
const float const *v_curr;
|
||||
int i;
|
||||
|
||||
zero_v3(normal);
|
||||
|
@ -788,8 +788,8 @@ static void mesh_calc_ngon_normal_coords(MPoly *mpoly, MLoop *loopstart,
|
|||
const float (*vertex_coords)[3], float normal[3])
|
||||
{
|
||||
const int nverts = mpoly->totloop;
|
||||
float const *v_prev = vertex_coords[loopstart[nverts - 1].v];
|
||||
float const *v_curr;
|
||||
const float const *v_prev = vertex_coords[loopstart[nverts - 1].v];
|
||||
const float const *v_curr;
|
||||
int i;
|
||||
|
||||
zero_v3(normal);
|
||||
|
@ -1178,7 +1178,7 @@ void BKE_mesh_loops_to_tessdata(CustomData *fdata, CustomData *ldata, CustomData
|
|||
const bool hasOrigSpace = CustomData_has_layer(ldata, CD_ORIGSPACE_MLOOP);
|
||||
const bool hasLoopNormal = CustomData_has_layer(ldata, CD_NORMAL);
|
||||
int findex, i, j;
|
||||
int *pidx;
|
||||
const int *pidx;
|
||||
unsigned int (*lidx)[4];
|
||||
|
||||
for (i = 0; i < numTex; i++) {
|
||||
|
|
|
@ -426,7 +426,7 @@ int *BKE_mesh_calc_smoothgroups(const MEdge *medge, const int totedge,
|
|||
for (ml = &mloop[mp->loopstart], j = mp->totloop; j--; ml++) {
|
||||
/* loop over poly users */
|
||||
const MeshElemMap *map_ele = &edge_poly_map[ml->e];
|
||||
int *p = map_ele->indices;
|
||||
const int *p = map_ele->indices;
|
||||
int i = map_ele->count;
|
||||
if (!(medge[ml->e].flag & ME_SHARP)) {
|
||||
for (; i--; p++) {
|
||||
|
|
|
@ -565,7 +565,7 @@ bool BKE_mesh_validate_arrays(Mesh *mesh,
|
|||
|
||||
/* Now check that that poly does not use a same vertex more than once! */
|
||||
if (!sp->invalid) {
|
||||
int *prev_v = v = sp->verts;
|
||||
const int *prev_v = v = sp->verts;
|
||||
j = sp->numverts;
|
||||
|
||||
qsort(sp->verts, j, sizeof(int), int_cmp);
|
||||
|
@ -598,7 +598,7 @@ bool BKE_mesh_validate_arrays(Mesh *mesh,
|
|||
|
||||
for (i = 1; i < totpoly; i++, sp++) {
|
||||
int p1_nv = sp->numverts, p2_nv = prev_sp->numverts;
|
||||
int *p1_v = sp->verts, *p2_v = prev_sp->verts;
|
||||
const int *p1_v = sp->verts, *p2_v = prev_sp->verts;
|
||||
short p1_sub = true, p2_sub = true;
|
||||
if (sp->invalid)
|
||||
break;
|
||||
|
|
|
@ -2724,7 +2724,7 @@ void BKE_object_foreach_display_point(
|
|||
DispList *dl;
|
||||
|
||||
for (dl = ob->curve_cache->disp.first; dl; dl = dl->next) {
|
||||
float *v3 = dl->verts;
|
||||
const float *v3 = dl->verts;
|
||||
int totvert = dl->nr;
|
||||
int i;
|
||||
|
||||
|
@ -3656,7 +3656,7 @@ KDTree *BKE_object_as_kdtree(Object *ob, int *r_tot)
|
|||
unsigned int i;
|
||||
|
||||
DerivedMesh *dm = ob->derivedDeform ? ob->derivedDeform : ob->derivedFinal;
|
||||
int *index;
|
||||
const int *index;
|
||||
|
||||
if (dm && (index = CustomData_get_layer(&dm->vertData, CD_ORIGINDEX))) {
|
||||
MVert *mvert = dm->getVertArray(dm);
|
||||
|
|
|
@ -684,7 +684,7 @@ static void get_dupliface_transform(MPoly *mpoly, MLoop *mloop, MVert *mvert,
|
|||
BKE_mesh_calc_poly_center(mpoly, mloop, mvert, loc);
|
||||
/* rotation */
|
||||
{
|
||||
float *v1, *v2, *v3;
|
||||
const float *v1, *v2, *v3;
|
||||
BKE_mesh_calc_poly_normal(mpoly, mloop, mvert, f_no);
|
||||
v1 = mvert[mloop[0].v].co;
|
||||
v2 = mvert[mloop[1].v].co;
|
||||
|
|
|
@ -214,7 +214,7 @@ static void curves_apply_threaded(int width, int height, unsigned char *rect, fl
|
|||
curvemapping_evaluate_premulRGBF(curve_mapping, result, pixel);
|
||||
|
||||
if (mask_rect_float) {
|
||||
float *m = mask_rect_float + pixel_index;
|
||||
const float *m = mask_rect_float + pixel_index;
|
||||
|
||||
pixel[0] = pixel[0] * (1.0f - m[0]) + result[0] * m[0];
|
||||
pixel[1] = pixel[1] * (1.0f - m[1]) + result[1] * m[1];
|
||||
|
@ -454,7 +454,7 @@ static void brightcontrast_apply_threaded(int width, int height, unsigned char *
|
|||
v = a * i + b;
|
||||
|
||||
if (mask_rect_float) {
|
||||
float *m = mask_rect_float + pixel_index;
|
||||
const float *m = mask_rect_float + pixel_index;
|
||||
|
||||
pixel[c] = pixel[c] * (1.0f - m[c]) + v * m[c];
|
||||
}
|
||||
|
@ -518,7 +518,7 @@ static void maskmodifier_apply_threaded(int width, int height, unsigned char *re
|
|||
else if (rect_float) {
|
||||
int c;
|
||||
float *pixel = rect_float + pixel_index;
|
||||
float *mask_pixel = mask_rect_float + pixel_index;
|
||||
const float *mask_pixel = mask_rect_float + pixel_index;
|
||||
float mask = min_fff(mask_pixel[0], mask_pixel[1], mask_pixel[2]);
|
||||
|
||||
/* float buffers are premultiplied, so need to premul color
|
||||
|
|
|
@ -1767,8 +1767,8 @@ static void color_balance_byte_float(StripColorBalance *cb_, unsigned char *rect
|
|||
static void color_balance_float_float(StripColorBalance *cb_, float *rect_float, float *mask_rect_float, int width, int height, float mul)
|
||||
{
|
||||
float *p = rect_float;
|
||||
float *e = rect_float + width * 4 * height;
|
||||
float *m = mask_rect_float;
|
||||
const float *e = rect_float + width * 4 * height;
|
||||
const float *m = mask_rect_float;
|
||||
StripColorBalance cb = calc_cb(cb_);
|
||||
|
||||
while (p < e) {
|
||||
|
@ -2415,7 +2415,7 @@ static ImBuf *seq_render_mask(const SeqRenderData *context, Mask *mask, float nr
|
|||
|
||||
if (make_float) {
|
||||
/* pixels */
|
||||
float *fp_src;
|
||||
const float *fp_src;
|
||||
float *fp_dst;
|
||||
|
||||
ibuf = IMB_allocImBuf(context->rectx, context->recty, 32, IB_rectfloat);
|
||||
|
@ -2433,7 +2433,7 @@ static ImBuf *seq_render_mask(const SeqRenderData *context, Mask *mask, float nr
|
|||
}
|
||||
else {
|
||||
/* pixels */
|
||||
float *fp_src;
|
||||
const float *fp_src;
|
||||
unsigned char *ub_dst;
|
||||
|
||||
ibuf = IMB_allocImBuf(context->rectx, context->recty, 32, IB_rect);
|
||||
|
|
|
@ -70,7 +70,7 @@ bSound *sound_new_file(struct Main *bmain, const char *filename)
|
|||
bSound *sound = NULL;
|
||||
|
||||
char str[FILE_MAX];
|
||||
char *path;
|
||||
const char *path;
|
||||
|
||||
size_t len;
|
||||
|
||||
|
|
|
@ -1367,7 +1367,7 @@ char *txt_to_buf(Text *text)
|
|||
int txt_find_string(Text *text, const char *findstr, int wrap, int match_case)
|
||||
{
|
||||
TextLine *tl, *startl;
|
||||
char *s = NULL;
|
||||
const char *s = NULL;
|
||||
|
||||
if (!text || !text->curl || !text->sell) return 0;
|
||||
|
||||
|
@ -2537,7 +2537,7 @@ void txt_backspace_char(Text *text)
|
|||
}
|
||||
else { /* Just backspacing a char */
|
||||
size_t c_len = 0;
|
||||
char *prev = BLI_str_prev_char_utf8(text->curl->line + text->curc);
|
||||
const char *prev = BLI_str_prev_char_utf8(text->curl->line + text->curc);
|
||||
c = BLI_str_utf8_as_unicode_and_size(prev, &c_len);
|
||||
|
||||
/* source and destination overlap, don't use memcpy() */
|
||||
|
@ -2574,7 +2574,7 @@ static void txt_convert_tab_to_spaces(Text *text)
|
|||
* is added so that the indention of the line is the right width (i.e. aligned
|
||||
* to multiples of TXT_TABSIZE)
|
||||
*/
|
||||
char *sb = &tab_to_spaces[text->curc % TXT_TABSIZE];
|
||||
const char *sb = &tab_to_spaces[text->curc % TXT_TABSIZE];
|
||||
txt_insert_buf(text, sb);
|
||||
}
|
||||
|
||||
|
|
|
@ -680,7 +680,7 @@ int bUnit_ReplaceString(char *str, int len_max, const char *str_prev, double sca
|
|||
* */
|
||||
{
|
||||
char *str_found = str;
|
||||
char *ch = str;
|
||||
const char *ch = str;
|
||||
|
||||
while ((str_found = strchr(str_found, SEP_CHR))) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue