Cleanup: remove tessface loop from set-smooth function

This commit is contained in:
2019-08-25 12:00:03 +10:00
parent 6bb2912704
commit d42a23b31a
4 changed files with 10 additions and 24 deletions

View File

@@ -185,7 +185,7 @@ void BKE_mesh_material_index_remove(struct Mesh *me, short index);
bool BKE_mesh_material_index_used(struct Mesh *me, short index);
void BKE_mesh_material_index_clear(struct Mesh *me);
void BKE_mesh_material_remap(struct Mesh *me, const unsigned int *remap, unsigned int remap_len);
void BKE_mesh_smooth_flag_set(struct Object *meshOb, int enableSmooth);
void BKE_mesh_smooth_flag_set(struct Mesh *me, const bool use_smooth);
const char *BKE_mesh_cmp(struct Mesh *me1, struct Mesh *me2, float thresh);

View File

@@ -1273,30 +1273,16 @@ void BKE_mesh_material_remap(Mesh *me, const unsigned int *remap, unsigned int r
#undef MAT_NR_REMAP
}
void BKE_mesh_smooth_flag_set(Object *meshOb, int enableSmooth)
void BKE_mesh_smooth_flag_set(Mesh *me, const bool use_smooth)
{
Mesh *me = meshOb->data;
int i;
for (i = 0; i < me->totpoly; i++) {
MPoly *mp = &me->mpoly[i];
if (enableSmooth) {
mp->flag |= ME_SMOOTH;
}
else {
mp->flag &= ~ME_SMOOTH;
if (use_smooth) {
for (int i = 0; i < me->totpoly; i++) {
me->mpoly[i].flag |= ME_SMOOTH;
}
}
for (i = 0; i < me->totface; i++) {
MFace *mf = &me->mface[i];
if (enableSmooth) {
mf->flag |= ME_SMOOTH;
}
else {
mf->flag &= ~ME_SMOOTH;
else {
for (int i = 0; i < me->totpoly; i++) {
me->mpoly[i].flag &= ~ME_SMOOTH;
}
}
}

View File

@@ -1200,7 +1200,7 @@ static int shade_smooth_exec(bContext *C, wmOperator *op)
}
if (ob->type == OB_MESH) {
BKE_mesh_smooth_flag_set(ob, !clear);
BKE_mesh_smooth_flag_set(ob->data, !clear);
BKE_mesh_batch_cache_dirty_tag(ob->data, BKE_MESH_BATCH_DIRTY_ALL);
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);

View File

@@ -126,7 +126,7 @@ static int voxel_remesh_exec(bContext *C, wmOperator *op)
}
if (mesh->flag & ME_REMESH_SMOOTH_NORMALS) {
BKE_mesh_smooth_flag_set(ob, true);
BKE_mesh_smooth_flag_set(ob->data, true);
}
if (ob->mode == OB_MODE_SCULPT) {