From ea5bfedb4925485192e40cab98f2d5f1d3fe5012 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Sat, 14 May 2022 18:57:52 +0200 Subject: Cleanup: Further use of const for retrieved custom data layers Similar to cf69652618fefcd22b2cde9a2. --- source/blender/makesrna/intern/rna_mesh.c | 14 ++++++++------ source/blender/makesrna/intern/rna_particle.c | 5 +++-- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'source/blender/makesrna/intern') diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 7a6f78d0300..2ba3cf1096c 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -626,9 +626,10 @@ static void rna_CustomDataLayer_clone_set(PointerRNA *ptr, CustomData *data, int static bool rna_MEdge_freestyle_edge_mark_get(PointerRNA *ptr) { - Mesh *me = rna_mesh(ptr); - MEdge *medge = (MEdge *)ptr->data; - FreestyleEdge *fed = CustomData_get(&me->edata, (int)(medge - me->medge), CD_FREESTYLE_EDGE); + const Mesh *me = rna_mesh(ptr); + const MEdge *medge = (MEdge *)ptr->data; + const FreestyleEdge *fed = CustomData_get( + &me->edata, (int)(medge - me->medge), CD_FREESTYLE_EDGE); return fed && (fed->flag & FREESTYLE_EDGE_MARK) != 0; } @@ -652,9 +653,10 @@ static void rna_MEdge_freestyle_edge_mark_set(PointerRNA *ptr, bool value) static bool rna_MPoly_freestyle_face_mark_get(PointerRNA *ptr) { - Mesh *me = rna_mesh(ptr); - MPoly *mpoly = (MPoly *)ptr->data; - FreestyleFace *ffa = CustomData_get(&me->pdata, (int)(mpoly - me->mpoly), CD_FREESTYLE_FACE); + const Mesh *me = rna_mesh(ptr); + const MPoly *mpoly = (MPoly *)ptr->data; + const FreestyleFace *ffa = CustomData_get( + &me->pdata, (int)(mpoly - me->mpoly), CD_FREESTYLE_FACE); return ffa && (ffa->flag & FREESTYLE_FACE_MARK) != 0; } diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 6f2264680c8..8a024fdcfc2 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -660,7 +660,7 @@ static void rna_ParticleSystem_uv_on_emitter(ParticleSystem *particlesystem, } else { MFace *mface = &modifier->mesh_final->mface[num]; - MTFace *mtface = (MTFace *)CustomData_get_layer_n( + const MTFace *mtface = (const MTFace *)CustomData_get_layer_n( &modifier->mesh_final->fdata, CD_MTFACE, uv_no); psys_interpolate_uvs(&mtface[num], mface->v4, *fuv, r_uv); @@ -694,7 +694,8 @@ static void rna_ParticleSystem_mcol_on_emitter(ParticleSystem *particlesystem, } else { MFace *mface = &modifier->mesh_final->mface[num]; - MCol *mc = (MCol *)CustomData_get_layer_n(&modifier->mesh_final->fdata, CD_MCOL, vcol_no); + const MCol *mc = (const MCol *)CustomData_get_layer_n( + &modifier->mesh_final->fdata, CD_MCOL, vcol_no); MCol mcol; psys_interpolate_mcol(&mc[num * 4], mface->v4, *fuv, &mcol); -- cgit v1.2.3