diff options
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 12 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/displist.cc | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/effect.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/gpencil_geom.c | 17 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object_dupli.cc | 14 |
6 files changed, 28 insertions, 25 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index ca03c9c3de4..193b6d82d03 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -470,7 +470,7 @@ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[ /* when not in EditMode, use the 'final' evaluated mesh, depsgraph * ensures we build with CD_MDEFORMVERT layer */ - Mesh *me_eval = BKE_object_get_evaluated_mesh(ob); + const Mesh *me_eval = BKE_object_get_evaluated_mesh(ob); BMEditMesh *em = BKE_editmesh_from_object(ob); float plane[3]; float imat[3][3], tmat[3][3]; @@ -488,17 +488,17 @@ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[ float normal[3] = {0.0f, 0.0f, 0.0f}; float weightsum = 0.0f; if (me_eval) { - MDeformVert *dvert = CustomData_get_layer(&me_eval->vdata, CD_MDEFORMVERT); + const MDeformVert *dvert = CustomData_get_layer(&me_eval->vdata, CD_MDEFORMVERT); int numVerts = me_eval->totvert; /* check that dvert is a valid pointers (just in case) */ if (dvert) { - MDeformVert *dv = dvert; - MVert *mv = me_eval->mvert; /* get the average of all verts with that are in the vertex-group */ - for (int i = 0; i < numVerts; i++, dv++, mv++) { - MDeformWeight *dw = BKE_defvert_find_index(dv, defgroup); + for (int i = 0; i < numVerts; i++) { + const MDeformVert *dv = &dvert[i]; + const MVert *mv = &me_eval->mvert[i]; + const MDeformWeight *dw = BKE_defvert_find_index(dv, defgroup); if (dw && dw->weight > 0.0f) { float nor[3]; diff --git a/source/blender/blenkernel/intern/displist.cc b/source/blender/blenkernel/intern/displist.cc index cfe4701fb69..a4ffaa8b10b 100644 --- a/source/blender/blenkernel/intern/displist.cc +++ b/source/blender/blenkernel/intern/displist.cc @@ -1694,7 +1694,7 @@ static void boundbox_displist_object(Object *ob) ob->runtime.bb = (BoundBox *)MEM_callocN(sizeof(BoundBox), __func__); } - Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); + const Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); if (mesh_eval) { BKE_object_boundbox_calc_from_mesh(ob, mesh_eval); } diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 97aba5e787d..1b628b16802 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -716,7 +716,7 @@ int get_effector_data(EffectorCache *eff, } else if (eff->pd && eff->pd->shape == PFIELD_SHAPE_POINTS) { /* TODO: hair and points object support */ - Mesh *me_eval = BKE_object_get_evaluated_mesh(eff->ob); + const Mesh *me_eval = BKE_object_get_evaluated_mesh(eff->ob); if (me_eval != NULL) { copy_v3_v3(efd->loc, me_eval->mvert[*efd->index].co); normal_short_to_float_v3(efd->nor, me_eval->mvert[*efd->index].no); @@ -830,7 +830,7 @@ static void get_effector_tot( if (eff->pd->shape == PFIELD_SHAPE_POINTS) { /* TODO: hair and points object support */ - Mesh *me_eval = BKE_object_get_evaluated_mesh(eff->ob); + const Mesh *me_eval = BKE_object_get_evaluated_mesh(eff->ob); *tot = me_eval != NULL ? me_eval->totvert : 1; if (*tot && eff->pd->forcefield == PFIELD_HARMONIC && point->index >= 0) { diff --git a/source/blender/blenkernel/intern/gpencil_geom.c b/source/blender/blenkernel/intern/gpencil_geom.c index 53939da08e2..077c1a65243 100644 --- a/source/blender/blenkernel/intern/gpencil_geom.c +++ b/source/blender/blenkernel/intern/gpencil_geom.c @@ -2480,9 +2480,9 @@ bool BKE_gpencil_convert_mesh(Main *bmain, /* Use evaluated data to get mesh with all modifiers on top. */ Object *ob_eval = (Object *)DEG_get_evaluated_object(depsgraph, ob_mesh); - Mesh *me_eval = BKE_object_get_evaluated_mesh(ob_eval); - MPoly *mp, *mpoly = me_eval->mpoly; - MLoop *mloop = me_eval->mloop; + const Mesh *me_eval = BKE_object_get_evaluated_mesh(ob_eval); + const MPoly *mpoly = me_eval->mpoly; + const MLoop *mloop = me_eval->mloop; int mpoly_len = me_eval->totpoly; char element_name[200]; @@ -2515,8 +2515,9 @@ bool BKE_gpencil_convert_mesh(Main *bmain, bGPDframe *gpf_fill = BKE_gpencil_layer_frame_get( gpl_fill, CFRA + frame_offset, GP_GETFRAME_ADD_NEW); int i; - for (i = 0, mp = mpoly; i < mpoly_len; i++, mp++) { - MLoop *ml = &mloop[mp->loopstart]; + for (i = 0; i < mpoly_len; i++) { + const MPoly *mp = &mpoly[i]; + /* Find material. */ int mat_idx = 0; Material *ma = BKE_object_material_get(ob_mesh, mp->mat_nr + 1); @@ -2539,8 +2540,10 @@ bool BKE_gpencil_convert_mesh(Main *bmain, gps_fill->flag |= GP_STROKE_CYCLIC; /* Add points to strokes. */ - for (int j = 0; j < mp->totloop; j++, ml++) { - MVert *mv = &me_eval->mvert[ml->v]; + for (int j = 0; j < mp->totloop; j++) { + const MLoop *ml = &mloop[mp->loopstart + j]; + const MVert *mv = &me_eval->mvert[ml->v]; + bGPDspoint *pt = &gps_fill->points[j]; copy_v3_v3(&pt->x, mv->co); mul_m4_v3(matrix, &pt->x); diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index a5e16172e75..ff5d94d20b7 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -3860,7 +3860,7 @@ void BKE_object_boundbox_flag(Object *ob, int flag, const bool set) } } -void BKE_object_boundbox_calc_from_mesh(struct Object *ob, struct Mesh *me_eval) +void BKE_object_boundbox_calc_from_mesh(struct Object *ob, const struct Mesh *me_eval) { float min[3], max[3]; @@ -4169,7 +4169,7 @@ void BKE_object_foreach_display_point(Object *ob, void *user_data) { /* TODO: pointcloud and hair objects support */ - Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); + const Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob); float co[3]; if (mesh_eval != NULL) { diff --git a/source/blender/blenkernel/intern/object_dupli.cc b/source/blender/blenkernel/intern/object_dupli.cc index 768fa9373c1..77969328365 100644 --- a/source/blender/blenkernel/intern/object_dupli.cc +++ b/source/blender/blenkernel/intern/object_dupli.cc @@ -335,14 +335,14 @@ static void make_child_duplis(const DupliContext *ctx, /** \name Internal Data Access Utilities * \{ */ -static Mesh *mesh_data_from_duplicator_object(Object *ob, - BMEditMesh **r_em, - const float (**r_vert_coords)[3], - const float (**r_vert_normals)[3]) +static const Mesh *mesh_data_from_duplicator_object(Object *ob, + BMEditMesh **r_em, + const float (**r_vert_coords)[3], + const float (**r_vert_normals)[3]) { /* Gather mesh info. */ BMEditMesh *em = BKE_editmesh_from_object(ob); - Mesh *me_eval; + const Mesh *me_eval; *r_em = nullptr; *r_vert_coords = nullptr; @@ -603,7 +603,7 @@ static void make_duplis_verts(const DupliContext *ctx) BMEditMesh *em = nullptr; const float(*vert_coords)[3] = nullptr; const float(*vert_normals)[3] = nullptr; - Mesh *me_eval = mesh_data_from_duplicator_object( + const Mesh *me_eval = mesh_data_from_duplicator_object( parent, &em, &vert_coords, use_rotation ? &vert_normals : nullptr); if (em == nullptr && me_eval == nullptr) { return; @@ -1151,7 +1151,7 @@ static void make_duplis_faces(const DupliContext *ctx) /* Gather mesh info. */ BMEditMesh *em = nullptr; const float(*vert_coords)[3] = nullptr; - Mesh *me_eval = mesh_data_from_duplicator_object(parent, &em, &vert_coords, nullptr); + const Mesh *me_eval = mesh_data_from_duplicator_object(parent, &em, &vert_coords, nullptr); if (em == nullptr && me_eval == nullptr) { return; } |