Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-05-13 19:31:29 +0300
committerHans Goudey <h.goudey@me.com>2022-05-13 19:35:22 +0300
commitcf69652618fefcd22b2cde9a2e0338b63f9a003e (patch)
tree013435f2e181f1332681bd513903c0cacf1baeda /source/blender/blenkernel/intern/particle.c
parentfa7224d8ed88fbfbf55e5d1a83cef49c309785cb (diff)
Cleanup: Use const when retrieving custom data layers
Knowing when layers are retrieved for write access will be essential when adding proper copy-on-write support. This commit makes that clearer by adding `const` where the retrieved data is not modified. Ref T95842
Diffstat (limited to 'source/blender/blenkernel/intern/particle.c')
-rw-r--r--source/blender/blenkernel/intern/particle.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 72d9f72eb14..a594453bee9 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -1667,7 +1667,7 @@ void psys_interpolate_face(Mesh *mesh,
const float (*vert_normals)[3],
MFace *mface,
MTFace *tface,
- float (*orcodata)[3],
+ const float (*orcodata)[3],
float w[4],
float vec[3],
float nor[3],
@@ -1680,7 +1680,7 @@ void psys_interpolate_face(Mesh *mesh,
float *uv1, *uv2, *uv3, *uv4;
float n1[3], n2[3], n3[3], n4[3];
float tuv[4][2];
- float *o1, *o2, *o3, *o4;
+ const float *o1, *o2, *o3, *o4;
v1 = mvert[mface->v1].co;
v2 = mvert[mface->v2].co;
@@ -1903,9 +1903,10 @@ int psys_particle_dm_face_lookup(Mesh *mesh_final,
struct LinkNode **poly_nodes)
{
MFace *mtessface_final;
- OrigSpaceFace *osface_final;
+ const OrigSpaceFace *osface_final;
int pindex_orig;
- float uv[2], (*faceuv)[2];
+ float uv[2];
+ const float(*faceuv)[2];
const int *index_mf_to_mpoly_deformed = NULL;
const int *index_mf_to_mpoly = NULL;
@@ -2048,11 +2049,7 @@ static int psys_map_index_on_dm(Mesh *mesh,
}
else { /* FROM_FACE/FROM_VOLUME */
/* find a face on the derived mesh that uses this face */
- MFace *mface;
- OrigSpaceFace *osface;
- int i;
-
- i = index_dmcache;
+ int i = index_dmcache;
if (i == DMCACHE_NOTFOUND || i >= mesh->totface) {
return 0;
@@ -2062,8 +2059,8 @@ static int psys_map_index_on_dm(Mesh *mesh,
/* modify the original weights to become
* weights for the derived mesh face */
- osface = CustomData_get_layer(&mesh->fdata, CD_ORIGSPACE);
- mface = &mesh->mface[i];
+ OrigSpaceFace *osface = CustomData_get_layer(&mesh->fdata, CD_ORIGSPACE);
+ const MFace *mface = &mesh->mface[i];
if (osface == NULL) {
mapfw[0] = mapfw[1] = mapfw[2] = mapfw[3] = 0.0f;
@@ -2090,7 +2087,7 @@ void psys_particle_on_dm(Mesh *mesh_final,
float orco[3])
{
float tmpnor[3], mapfw[4];
- float(*orcodata)[3];
+ const float(*orcodata)[3];
int mapindex;
if (!psys_map_index_on_dm(
@@ -3843,7 +3840,7 @@ static void psys_face_mat(Object *ob, Mesh *mesh, ParticleData *pa, float mat[4]
float v[3][3];
MFace *mface;
OrigSpaceFace *osface;
- float(*orcodata)[3];
+ const float(*orcodata)[3];
int i = (ELEM(pa->num_dmcache, DMCACHE_ISCHILD, DMCACHE_NOTFOUND)) ? pa->num : pa->num_dmcache;
if (i == -1 || i >= mesh->totface) {
@@ -4159,7 +4156,7 @@ static int get_particle_uv(Mesh *mesh,
bool from_vert)
{
MFace *mf;
- MTFace *tf;
+ const MTFace *tf;
int i;
tf = CustomData_get_layer_named(&mesh->fdata, CD_MTFACE, name);