Cleanup: shadowing (blenkernel)

This commit is contained in:
Campbell Barton 2015-11-23 11:27:02 +11:00
parent bc8504cb4c
commit 2e348fd43e
16 changed files with 88 additions and 83 deletions

View File

@ -322,15 +322,16 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss,
}
}
static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
CCGVert **effectedV, CCGEdge **effectedE, CCGFace **effectedF,
int numEffectedV, int numEffectedE, int numEffectedF, int curLvl)
static void ccgSubSurf__calcSubdivLevel(
CCGSubSurf *ss,
CCGVert **effectedV, CCGEdge **effectedE, CCGFace **effectedF,
const int numEffectedV, const int numEffectedE, const int numEffectedF, const int curLvl)
{
int subdivLevels = ss->subdivLevels;
const int subdivLevels = ss->subdivLevels;
const int nextLvl = curLvl + 1;
int edgeSize = ccg_edgesize(curLvl);
int gridSize = ccg_gridsize(curLvl);
int nextLvl = curLvl + 1;
int ptrIdx, cornerIdx, i;
int ptrIdx, i;
int vertDataSize = ss->meshIFC.vertDataSize;
float *q = ss->q, *r = ss->r;
@ -524,7 +525,7 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
VertDataAdd(nCo, r, ss);
}
else {
int cornerIdx = (1 + (1 << (curLvl))) - 2;
const int cornerIdx = (1 + (1 << (curLvl))) - 2;
int numEdges = 0, numFaces = 0;
VertDataZero(q, ss);
@ -683,8 +684,6 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
#pragma omp parallel private(ptrIdx) if (numEffectedF * edgeSize * edgeSize * 4 >= CCG_OMP_LIMIT)
{
float *q, *r;
#pragma omp critical
{
q = MEM_mallocN(ss->meshIFC.vertDataSize, "CCGSubsurf q");
@ -792,7 +791,7 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
/* copy down */
edgeSize = ccg_edgesize(nextLvl);
gridSize = ccg_gridsize(nextLvl);
cornerIdx = gridSize - 1;
const int cornerIdx = gridSize - 1;
#pragma omp parallel for private(i) if (numEffectedF * edgeSize * edgeSize * 4 >= CCG_OMP_LIMIT)
for (i = 0; i < numEffectedE; i++) {

View File

@ -582,7 +582,6 @@ void DM_update_tessface_data(DerivedMesh *dm)
void DM_generate_tangent_tessface_data(DerivedMesh *dm, bool generate)
{
int i;
MFace *mf, *mface = dm->getTessFaceArray(dm);
MPoly *mp = dm->getPolyArray(dm);
MLoop *ml = dm->getLoopArray(dm);
@ -602,9 +601,10 @@ void DM_generate_tangent_tessface_data(DerivedMesh *dm, bool generate)
return;
if (generate) {
for (i = 0; i < ldata->totlayer; i++) {
if (ldata->layers[i].type == CD_TANGENT)
for (int i = 0; i < ldata->totlayer; i++) {
if (ldata->layers[i].type == CD_TANGENT) {
CustomData_add_layer_named(fdata, CD_TANGENT, CD_CALLOC, NULL, totface, ldata->layers[i].name);
}
}
CustomData_bmesh_update_active_layers(fdata, pdata, ldata);
}

View File

@ -2730,8 +2730,8 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
float hard = min_ff(bulge, bulge_max);
float range = bulge_max - 1.0f;
float scale = (range > 0.0f) ? 1.0f / range : 0.0f;
float soft = 1.0f + range * atanf((bulge - 1.0f) * scale) / (float)M_PI_2;
float scale_fac = (range > 0.0f) ? 1.0f / range : 0.0f;
float soft = 1.0f + range * atanf((bulge - 1.0f) * scale_fac) / (float)M_PI_2;
bulge = interpf(soft, hard, data->bulge_smooth);
}
@ -2742,8 +2742,8 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
float hard = max_ff(bulge, bulge_min);
float range = 1.0f - bulge_min;
float scale = (range > 0.0f) ? 1.0f / range : 0.0f;
float soft = 1.0f - range * atanf((1.0f - bulge) * scale) / (float)M_PI_2;
float scale_fac = (range > 0.0f) ? 1.0f / range : 0.0f;
float soft = 1.0f - range * atanf((1.0f - bulge) * scale_fac) / (float)M_PI_2;
bulge = interpf(soft, hard, data->bulge_smooth);
}

View File

@ -2632,7 +2632,7 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render)
BezTriple *bezt, *prevbezt;
BPoint *bp;
BevList *bl, *blnew, *blnext;
BevPoint *bevp, *bevp2, *bevp1 = NULL, *bevp0;
BevPoint *bevp2, *bevp1 = NULL, *bevp0;
const float treshold = 0.00001f;
float min, inp;
float *seglen = NULL;
@ -2681,6 +2681,8 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render)
bl->charidx = nu->charidx;
}
else {
BevPoint *bevp;
if (for_render && cu->resolu_ren != 0)
resolu = cu->resolu_ren;
else
@ -3012,6 +3014,7 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render)
bl = bev->first;
while (bl) {
if (bl->poly > 0) {
BevPoint *bevp;
min = 300000.0;
bevp = bl->bevpoints;

View File

@ -2536,11 +2536,11 @@ int dynamicPaint_createUVSurface(Scene *scene, DynamicPaintSurface *surface)
/* Generate surface adjacency data. */
{
int i, cursor = 0;
int cursor = 0;
/* Create a temporary array of final indexes (before unassigned
* pixels have been dropped) */
for (i = 0; i < w * h; i++) {
for (int i = 0; i < w * h; i++) {
if (tempPoints[i].tri_index != -1) {
final_index[i] = cursor;
cursor++;
@ -2556,13 +2556,13 @@ int dynamicPaint_createUVSurface(Scene *scene, DynamicPaintSurface *surface)
for (ty = 0; ty < h; ty++) {
int tx;
for (tx = 0; tx < w; tx++) {
int i, index = tx + w * ty;
int index = tx + w * ty;
if (tempPoints[index].tri_index != -1) {
ed->n_index[final_index[index]] = n_pos;
ed->n_num[final_index[index]] = 0;
for (i = 0; i < 8; i++) {
for (int i = 0; i < 8; i++) {
/* Try to find a neighboring pixel in defined direction
* If not found, -1 is returned */
@ -3628,7 +3628,6 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
float timescale)
{
ParticleSettings *part = psys->part;
ParticleData *pa = NULL;
PaintSurfaceData *sData = surface->data;
PaintBakeData *bData = sData->bData;
VolumeGrid *grid = bData->grid;
@ -3654,7 +3653,8 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
tree = BLI_kdtree_new(psys->totpart);
/* loop through particles and insert valid ones to the tree */
for (p = 0, pa = psys->particles; p < psys->totpart; p++, pa++) {
p = 0;
for (ParticleData *pa = psys->particles; p < psys->totpart; p++, pa++) {
/* Proceed only if particle is active */
if (pa->alive == PARS_UNBORN && (part->flag & PART_UNBORN) == 0) continue;

View File

@ -171,10 +171,10 @@ static int search_poly_cmp(const void *v1, const void *v2)
return sp1->invalid ? (sp2->invalid ? 0 : 1) : -1;
/* Else, sort on first non-equal verts (remember verts of valid polys are sorted). */
for (idx = 0; idx < max_idx; idx++) {
const int v1 = sp1->verts[idx];
const int v2 = sp2->verts[idx];
if (v1 != v2) {
return (v1 > v2) ? 1 : -1;
const int v1_i = sp1->verts[idx];
const int v2_i = sp2->verts[idx];
if (v1_i != v2_i) {
return (v1_i > v2_i) ? 1 : -1;
}
}
return sp1->numverts > sp2->numverts ? 1 : sp1->numverts < sp2->numverts ? -1 : 0;

View File

@ -1855,7 +1855,7 @@ static void multires_load_old_dm(DerivedMesh *dm, Mesh *me, int totlvl)
Multires *mr = me->mr;
MVert *vsrc, *vdst;
unsigned int src, dst;
int st = multires_side_tot[totlvl - 1] - 1;
int st_last = multires_side_tot[totlvl - 1] - 1;
int extedgelen = multires_side_tot[totlvl] - 2;
int *vvmap; // inorder for dst, map to src
int crossedgelen;
@ -1901,7 +1901,7 @@ static void multires_load_old_dm(DerivedMesh *dm, Mesh *me, int totlvl)
int sides = lvl1->faces[i].v[3] ? 4 : 3;
vvmap[dst] = src + lvl1->totedge + i;
dst += 1 + sides * (st - 1) * st;
dst += 1 + sides * (st_last - 1) * st_last;
}
@ -1943,7 +1943,7 @@ static void multires_load_old_dm(DerivedMesh *dm, Mesh *me, int totlvl)
lvl = lvl->next;
}
dst += sides * (st - 1) * st;
dst += sides * (st_last - 1) * st_last;
if (sides == 4) ++totquad;
else ++tottri;
@ -1967,7 +1967,7 @@ static void multires_load_old_dm(DerivedMesh *dm, Mesh *me, int totlvl)
dst = 0;
for (j = 0; j < lvl1->totface; ++j) {
int sides = lvl1->faces[j].v[3] ? 4 : 3;
int ldst = dst + 1 + sides * (st - 1);
int ldst = dst + 1 + sides * (st_last - 1);
for (s = 0; s < sides; ++s) {
int st2 = multires_side_tot[totlvl - 1] - 2;
@ -1984,7 +1984,7 @@ static void multires_load_old_dm(DerivedMesh *dm, Mesh *me, int totlvl)
find_old_edge(emap[0], lvl1->edges, cv, nv)->mid,
st2, st4);
ldst += (st - 1) * (st - 1);
ldst += (st_last - 1) * (st_last - 1);
}

View File

@ -3838,19 +3838,19 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
/* try to estimate correct velocity */
if (vel) {
ParticleKey tstate;
ParticleKey tstate_tmp;
float length = len_v3(state->vel);
if (t >= 0.001f) {
tstate.time = t - 0.001f;
psys_get_particle_on_path(sim, p, &tstate, 0);
sub_v3_v3v3(state->vel, state->co, tstate.co);
tstate_tmp.time = t - 0.001f;
psys_get_particle_on_path(sim, p, &tstate_tmp, 0);
sub_v3_v3v3(state->vel, state->co, tstate_tmp.co);
normalize_v3(state->vel);
}
else {
tstate.time = t + 0.001f;
psys_get_particle_on_path(sim, p, &tstate, 0);
sub_v3_v3v3(state->vel, tstate.co, state->co);
tstate_tmp.time = t + 0.001f;
psys_get_particle_on_path(sim, p, &tstate_tmp, 0);
sub_v3_v3v3(state->vel, tstate_tmp.co, state->co);
normalize_v3(state->vel);
}

View File

@ -1215,8 +1215,8 @@ void psys_get_pointcache_start_end(Scene *scene, ParticleSystem *psys, int *sfra
{
ParticleSettings *part = psys->part;
*sfra = MAX2(1, (int)part->sta);
*efra = MIN2((int)(part->end + part->lifetime + 1.0f), MAX2(scene->r.pefra, scene->r.efra));
*sfra = max_ii(1, (int)part->sta);
*efra = min_ii((int)(part->end + part->lifetime + 1.0f), max_ii(scene->r.pefra, scene->r.efra));
}
/************************************************/
@ -1939,7 +1939,7 @@ static void sphclassical_calc_dens(ParticleData *pa, float UNUSED(dfra), SPHData
pfr.mass = sphdata->mass;
sph_evaluate_func( NULL, psys, pa->state.co, &pfr, interaction_radius, sphclassical_density_accum_cb);
pa->sphdensity = MIN2(MAX2(data[0], fluid->rest_density * 0.9f), fluid->rest_density * 1.1f);
pa->sphdensity = min_ff(max_ff(data[0], fluid->rest_density * 0.9f), fluid->rest_density * 1.1f);
}
void psys_sph_init(ParticleSimulationData *sim, SPHData *sphdata)
@ -3489,7 +3489,6 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
case PART_PHYS_FLUID:
{
SPHData sphdata;
ParticleSettings *part = sim->psys->part;
psys_sph_init(sim, &sphdata);
if (part->fluid->solver == SPH_SOLVER_DDR) {

View File

@ -691,10 +691,10 @@ static int ptcache_smoke_read_old(PTCacheFile *pf, void *smoke_v)
SmokeDomainSettings *sds = smd->domain;
if (sds->fluid) {
size_t res = sds->res[0]*sds->res[1]*sds->res[2];
const size_t res = sds->res[0] * sds->res[1] * sds->res[2];
const unsigned int out_len = (unsigned int)res * sizeof(float);
float dt, dx, *dens, *heat, *heatold, *vx, *vy, *vz;
unsigned char *obstacles;
unsigned int out_len = (unsigned int)res * sizeof(float);
float *tmp_array = MEM_callocN(out_len, "Smoke old cache tmp");
int fluid_fields = smoke_get_data_flags(sds);
@ -733,13 +733,10 @@ static int ptcache_smoke_read_old(PTCacheFile *pf, void *smoke_v)
MEM_freeN(tmp_array);
if (pf->data_types & (1<<BPHYS_DATA_SMOKE_HIGH) && sds->wt) {
int res = sds->res[0]*sds->res[1]*sds->res[2];
int res_big, res_big_array[3];
float *dens, *tcu, *tcv, *tcw;
unsigned int out_len = sizeof(float)*(unsigned int)res;
float *tcu, *tcv, *tcw;
unsigned int out_len_big;
unsigned char *tmp_array_big;
smoke_turbulence_get_res(sds->wt, res_big_array);
res_big = res_big_array[0]*res_big_array[1]*res_big_array[2];
out_len_big = sizeof(float) * (unsigned int)res_big;

View File

@ -148,8 +148,8 @@ struct SmokeModifierData;
// timestep default value for nice appearance 0.1f
#define DT_DEFAULT 0.1f
#define ADD_IF_LOWER_POS(a, b) (MIN2((a) + (b), MAX2((a), (b))))
#define ADD_IF_LOWER_NEG(a, b) (MAX2((a) + (b), MIN2((a), (b))))
#define ADD_IF_LOWER_POS(a, b) (min_ff((a) + (b), max_ff((a), (b))))
#define ADD_IF_LOWER_NEG(a, b) (max_ff((a) + (b), min_ff((a), (b))))
#define ADD_IF_LOWER(a, b) (((b) > 0) ? ADD_IF_LOWER_POS((a), (b)) : ADD_IF_LOWER_NEG((a), (b)))
#else /* WITH_SMOKE */
@ -1238,7 +1238,7 @@ static void emit_from_particles(Object *flow_ob, SmokeDomainSettings *sds, Smoke
float solid = sfs->particle_size * 0.5f;
float smooth = 0.5f; /* add 0.5 cells of linear falloff to reduce aliasing */
int hires_multiplier = 1;
int i, z;
int z;
KDTree *tree;
sim.scene = scene;
@ -1358,7 +1358,7 @@ static void emit_from_particles(Object *flow_ob, SmokeDomainSettings *sds, Smoke
const float hr_smooth = smooth * powf(hr, 1.0f / 3.0f);
/* setup loop bounds */
for (i = 0; i < 3; i++) {
for (int i = 0; i < 3; i++) {
min[i] = em->min[i] * hires_multiplier;
max[i] = em->max[i] * hires_multiplier;
res[i] = em->res[i] * hires_multiplier;
@ -1732,10 +1732,11 @@ static void emit_from_derivedmesh(Object *flow_ob, SmokeDomainSettings *sds, Smo
static void adjustDomainResolution(SmokeDomainSettings *sds, int new_shift[3], EmissionMap *emaps, unsigned int numflowobj, float dt)
{
const int block_size = sds->amplify + 1;
int min[3] = {32767, 32767, 32767}, max[3] = {-32767, -32767, -32767}, res[3];
int total_cells = 1, res_changed = 0, shift_changed = 0;
float min_vel[3], max_vel[3];
int x, y, z, i;
int x, y, z;
float *density = smoke_get_density(sds->fluid);
float *fuel = smoke_get_fuel(sds->fluid);
float *bigdensity = smoke_turbulence_get_density(sds->wt);
@ -1743,7 +1744,6 @@ static void adjustDomainResolution(SmokeDomainSettings *sds, int new_shift[3], E
float *vx = smoke_get_velocity_x(sds->fluid);
float *vy = smoke_get_velocity_y(sds->fluid);
float *vz = smoke_get_velocity_z(sds->fluid);
int block_size = sds->amplify + 1;
int wt_res[3];
if (sds->flags & MOD_SMOKE_HIGHRES && sds->wt) {
@ -1810,8 +1810,7 @@ static void adjustDomainResolution(SmokeDomainSettings *sds, int new_shift[3], E
}
/* also apply emission maps */
for (i = 0; i < numflowobj; i++)
{
for (int i = 0; i < numflowobj; i++) {
EmissionMap *em = &emaps[i];
for (x = em->min[0]; x < em->max[0]; x++)
@ -1838,7 +1837,7 @@ static void adjustDomainResolution(SmokeDomainSettings *sds, int new_shift[3], E
mul_v3_fl(max_vel, 1.0f / sds->dx);
clampBoundsInDomain(sds, min, max, min_vel, max_vel, sds->adapt_margin + 1, dt);
for (i = 0; i < 3; i++) {
for (int i = 0; i < 3; i++) {
/* calculate new resolution */
res[i] = max[i] - min[i];
total_cells *= res[i];
@ -1938,7 +1937,6 @@ static void adjustDomainResolution(SmokeDomainSettings *sds, int new_shift[3], E
n_vz[index_new] = o_vz[index_old];
if (sds->flags & MOD_SMOKE_HIGHRES && turb_old) {
int block_size = sds->amplify + 1;
int i, j, k;
/* old grid index */
int xx_o = xo * block_size;

View File

@ -2254,7 +2254,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
float iks, ks, kd, gravity[3] = {0.0f, 0.0f, 0.0f};
float fieldfactor = -1.0f, windfactor = 0.25f;
float tune = sb->ballstiff;
int a, b, do_deflector, do_selfcollision, do_springcollision, do_aero;
int do_deflector, do_selfcollision, do_springcollision, do_aero;
if (scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY) {
copy_v3_v3(gravity, scene->physics_settings.gravity);
@ -2279,7 +2279,8 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
do_deflector = sb_detect_aabb_collisionCached(defforce, ob->lay, ob, timenow);
}
for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
bp = sb->bpoint;
for (int a = sb->totpoint; a > 0; a--, bp++) {
/* clear forces accumulator */
bp->force[0] = bp->force[1] = bp->force[2] = 0.0;
@ -2451,7 +2452,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
/* +++springs */
if (ob->softflag & OB_SB_EDGES) {
if (sb->bspring) { /* spring list exists at all ? */
for (b=bp->nofsprings;b>0;b--) {
for (int b = bp->nofsprings; b > 0; b--) {
bs = sb->bspring + bp->springs[b-1];
if (do_springcollision || do_aero) {
add_v3_v3(bp->force, bs->ext_force);

View File

@ -2729,8 +2729,8 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
CCGSubSurf *ss = ccgdm->ss;
CCGKey key;
GPUVertexAttribs gattribs;
int a, b, do_draw, new_matnr;
DMFlagMat *faceFlags = ccgdm->faceFlags;
int a, b;
const DMFlagMat *faceFlags = ccgdm->faceFlags;
unsigned char *varray;
size_t max_element_size = 0;
int tot_loops = 0;
@ -2741,8 +2741,6 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
#ifdef WITH_OPENSUBDIV
if (ccgdm->useGpuBackend) {
CCGSubSurf *ss = ccgdm->ss;
const DMFlagMat *faceFlags = ccgdm->faceFlags;
const int level = ccgSubSurf_getSubdivisionLevels(ss);
const int face_side = 1 << level;
const int grid_side = 1 << (level - 1);
@ -2763,6 +2761,7 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
: num_face_verts * grid_patches;
int new_matnr;
bool new_draw_smooth;
if (faceFlags) {
new_draw_smooth = (faceFlags[i].flag & ME_SMOOTH);
new_matnr = (faceFlags[i].mat_nr + 1);
@ -2817,7 +2816,7 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
DMVertexAttribs attribs = {{{NULL}}};
int i;
int matnr = -1;
do_draw = 0;
int do_draw = 0;
#define PASSATTRIB(dx, dy, vert) { \
if (attribs.totorco) \
@ -2836,6 +2835,7 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
int origIndex = ccgDM_getFaceMapIndex(ss, f);
int numVerts = ccgSubSurf_getFaceNumVerts(f);
int new_matnr;
if (faceFlags) {
drawSmooth = (lnors || (faceFlags[index].flag & ME_SMOOTH));
@ -2982,6 +2982,9 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
/* part one, check what attributes are needed per material */
for (a = 0; a < tot_active_mat; a++) {
int new_matnr;
int do_draw;
new_matnr = dm->drawObject->materials[a].mat_nr;
/* map from original material index to new
@ -3044,12 +3047,12 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
for (a = 0; a < totpoly; a++) {
CCGFace *f = ccgdm->faceMap[a].face;
int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
int orig_index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
int i;
if (faceFlags) {
i = mat_orig_to_new[faceFlags[index].mat_nr];
i = mat_orig_to_new[faceFlags[orig_index].mat_nr];
}
else {
i = mat_orig_to_new[0];
@ -3128,6 +3131,9 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
}
for (a = 0; a < tot_active_mat; a++) {
int new_matnr;
int do_draw;
new_matnr = dm->drawObject->materials[a].mat_nr;
do_draw = setMaterial(new_matnr + 1, &gattribs);
@ -3175,7 +3181,7 @@ static void ccgDM_drawMappedFacesMat(DerivedMesh *dm,
int edgeSize = ccgSubSurf_getEdgeSize(ss);
DMFlagMat *faceFlags = ccgdm->faceFlags;
const float (*lnors)[3] = dm->getLoopDataArray(dm, CD_NORMAL);
int a, i, numVerts, matnr, new_matnr, totface;
int a, i, numVerts, matnr, totface;
#ifdef WITH_OPENSUBDIV
if (ccgdm->useGpuBackend) {
@ -3221,6 +3227,7 @@ static void ccgDM_drawMappedFacesMat(DerivedMesh *dm,
int S, x, y, drawSmooth;
int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
int origIndex = ccgDM_getFaceMapIndex(ss, f);
int new_matnr;
numVerts = ccgSubSurf_getFaceNumVerts(f);
@ -3426,7 +3433,7 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
CCGFace *f = ccgdm->faceMap[polyindex].face;
int numVerts = ccgSubSurf_getFaceNumVerts(f);
int index = ccgDM_getFaceMapIndex(ss, f);
int origIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
int orig_index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
int mat_nr;
int facequads = numVerts * gridFaces * gridFaces;
int actualFace = ccgdm->faceMap[polyindex].startFace;
@ -3437,7 +3444,7 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
}
if (faceFlags) {
mat_nr = faceFlags[origIndex].mat_nr;
mat_nr = faceFlags[orig_index].mat_nr;
}
else {
mat_nr = 0;
@ -3554,7 +3561,6 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm,
#ifdef WITH_OPENSUBDIV
if (ccgdm->useGpuBackend) {
DMFlagMat *faceFlags = ccgdm->faceFlags;
int new_matnr;
bool draw_smooth, do_draw = true;
if (setDrawOptions == NULL) {

View File

@ -2115,7 +2115,7 @@ void txt_do_undo(Text *text)
{
int op = text->undo_buf[text->undo_pos];
int prev_flags;
unsigned int linep, i;
unsigned int linep;
unsigned int uchar;
unsigned int curln, selln;
unsigned short curc, selc;
@ -2184,6 +2184,8 @@ void txt_do_undo(Text *text)
break;
case UNDO_DBLOCK:
{
int i;
/* length of the string in the buffer */
linep = txt_undo_read_uint32(text->undo_buf, &text->undo_pos);
@ -2213,8 +2215,10 @@ void txt_do_undo(Text *text)
text->undo_pos--;
break;
}
case UNDO_IBLOCK:
{
int i;
/* length of the string in the buffer */
linep = txt_undo_read_uint32(text->undo_buf, &text->undo_pos);
@ -2252,6 +2256,7 @@ void txt_do_undo(Text *text)
text->undo_pos--;
break;
}
case UNDO_INDENT:
case UNDO_COMMENT:
case UNDO_DUPLICATE:

View File

@ -2577,7 +2577,6 @@ static void tracking_dopesheet_calc_coverage(MovieTracking *tracking)
int frames, start_frame = INT_MAX, end_frame = -INT_MAX;
int *per_frame_counter;
int prev_coverage, last_segment_frame;
int i;
/* find frame boundaries */
for (track = tracksbase->first; track; track = track->next) {
@ -2592,9 +2591,7 @@ static void tracking_dopesheet_calc_coverage(MovieTracking *tracking)
/* find per-frame markers count */
for (track = tracksbase->first; track; track = track->next) {
int i;
for (i = 0; i < track->markersnr; i++) {
for (int i = 0; i < track->markersnr; i++) {
MovieTrackingMarker *marker = &track->markers[i];
/* TODO: perhaps we need to add check for non-single-frame track here */
@ -2611,7 +2608,7 @@ static void tracking_dopesheet_calc_coverage(MovieTracking *tracking)
if (!per_frame_counter[0])
prev_coverage = TRACKING_COVERAGE_OK;
for (i = 1; i < frames; i++) {
for (int i = 1; i < frames; i++) {
int coverage = coverage_from_count(per_frame_counter[i]);
/* means only disabled tracks in the end, could be ignored */

View File

@ -447,7 +447,7 @@ bool BKE_autotrack_context_step(AutoTrackContext *context)
void BKE_autotrack_context_sync(AutoTrackContext *context)
{
int newframe, frame_delta = context->backwards ? -1 : 1;
int clip, frame;
int frame;
BLI_spin_lock(&context->spin_lock);
newframe = context->user.framenr;
@ -502,7 +502,7 @@ void BKE_autotrack_context_sync(AutoTrackContext *context)
}
BLI_spin_unlock(&context->spin_lock);
for (clip = 0; clip < context->num_clips; ++clip) {
for (int clip = 0; clip < context->num_clips; ++clip) {
MovieTracking *tracking = &context->clips[clip]->tracking;
BKE_tracking_dopesheet_tag_update(tracking);
}