Cleanup: redundant initialization

These were limited to obvious cases. Some less obvious cases
were kept as refactoring might make them necessary in future.
This commit is contained in:
2021-06-13 14:47:22 +10:00
parent f731bce6cd
commit ab38223047
26 changed files with 38 additions and 53 deletions

View File

@@ -1521,12 +1521,12 @@ void BKE_mesh_transform(Mesh *me, const float mat[4][4], bool do_keys)
void BKE_mesh_translate(Mesh *me, const float offset[3], const bool do_keys)
{
MVert *mvert = CustomData_duplicate_referenced_layer(&me->vdata, CD_MVERT, me->totvert);
CustomData_duplicate_referenced_layer(&me->vdata, CD_MVERT, me->totvert);
/* If the referenced layer has been re-allocated need to update pointers stored in the mesh. */
BKE_mesh_update_customdata_pointers(me, false);
int i = me->totvert;
for (mvert = me->mvert; i--; mvert++) {
for (MVert *mvert = me->mvert; i--; mvert++) {
add_v3_v3(mvert->co, offset);
}

View File

@@ -2567,7 +2567,7 @@ bool BKE_mesh_center_median_from_polys(const Mesh *me, float r_cent[3])
const MLoop *mloop = me->mloop;
const MVert *mvert = me->mvert;
zero_v3(r_cent);
for (mpoly = me->mpoly; i--; mpoly++) {
for (; i--; mpoly++) {
int loopend = mpoly->loopstart + mpoly->totloop;
for (int j = mpoly->loopstart; j < loopend; j++) {
add_v3_v3(r_cent, mvert[mloop[j].v].co);

View File

@@ -1879,12 +1879,11 @@ static const MeshElemMap *ccgDM_getPolyMap(Object *ob, DerivedMesh *dm)
/* WARNING! *MUST* be called in an 'loops_cache_rwlock' protected thread context! */
static void ccgDM_recalcLoopTri(DerivedMesh *dm)
{
MLoopTri *mlooptri = dm->looptris.array;
const int tottri = dm->numPolyData * 2;
int i, poly_index;
DM_ensure_looptri_data(dm);
mlooptri = dm->looptris.array_wip;
MLoopTri *mlooptri = dm->looptris.array_wip;
BLI_assert(tottri == 0 || mlooptri != NULL);
BLI_assert(poly_to_tri_count(dm->numPolyData, dm->numLoopData) == dm->looptris.num);