diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_mesh.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 28 | ||||
-rw-r--r-- | source/blender/editors/object/object_edit.c | 2 | ||||
-rw-r--r-- | source/blender/editors/object/object_remesh.c | 2 |
4 files changed, 10 insertions, 24 deletions
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 7986bf947e5..4233c140dad 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -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); diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 38e4527fd17..6102fec963e 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -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; } } } diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 16d21a11e2b..12f7ecb89dd 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -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); diff --git a/source/blender/editors/object/object_remesh.c b/source/blender/editors/object/object_remesh.c index bc94b3f7875..5f464084a9b 100644 --- a/source/blender/editors/object/object_remesh.c +++ b/source/blender/editors/object/object_remesh.c @@ -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) { |