Commit: e9197a4cbb8726181b0530073aeb0e08df99b59d Author: Hans Goudey Date: Wed Jul 20 13:08:29 2022 -0500 Branches: refactor-mesh-remove-pointers https://developer.blender.org/rBe9197a4cbb8726181b0530073aeb0e08df99b59d
Progress =================================================================== M source/blender/blenkernel/intern/fluid.c =================================================================== diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c index 609e4551bb4..478bc93ecdf 100644 --- a/source/blender/blenkernel/intern/fluid.c +++ b/source/blender/blenkernel/intern/fluid.c @@ -1008,12 +1008,8 @@ static void obstacles_from_mesh(Object *coll_ob, int min[3], max[3], res[3]; /* Duplicate vertices to modify. */ - if (me->mvert) { - me->mvert = MEM_dupallocN(me->mvert); - CustomData_set_layer(&me->vdata, CD_MVERT, me->mvert); - } + MVert *vertices = MEM_dupallocN(BKE_mesh_vertices(me)); - const MVert *mvert = BKE_mesh_vertices(me); const MLoop *mloop = BKE_mesh_loops(me); looptri = BKE_mesh_runtime_looptri_ensure(me); numverts = me->totvert; @@ -1037,14 +1033,13 @@ static void obstacles_from_mesh(Object *coll_ob, /* Transform mesh vertices to domain grid space for fast lookups. * This is valid because the mesh is copied above. */ - BKE_mesh_vertex_normals_ensure(me); - float(*vert_normals)[3] = BKE_mesh_vertex_normals_for_write(me); + float(*vert_normals)[3] = MEM_dupallocN(BKE_mesh_vertex_normals_ensure(me)); for (i = 0; i < numverts; i++) { float co[3]; /* Vertex position. */ - mul_m4_v3(coll_ob->obmat, mvert[i].co); - manta_pos_to_cell(fds, mvert[i].co); + mul_m4_v3(coll_ob->obmat, vertices[i].co); + manta_pos_to_cell(fds, vertices[i].co); /* Vertex normal. */ mul_mat3_m4_v3(coll_ob->obmat, vert_normals[i]); @@ -1052,7 +1047,7 @@ static void obstacles_from_mesh(Object *coll_ob, normalize_v3(vert_normals[i]); /* Vertex velocity. */ - add_v3fl_v3fl_v3i(co, mvert[i].co, fds->shift); + add_v3fl_v3fl_v3i(co, vertices[i].co, fds->shift); if (has_velocity) { sub_v3_v3v3(&vert_vel[i * 3], co, &fes->verts_old[i * 3]); mul_v3_fl(&vert_vel[i * 3], 1.0f / dt); @@ -1060,7 +1055,7 @@ static void obstacles_from_mesh(Object *coll_ob, copy_v3_v3(&fes->verts_old[i * 3], co); /* Calculate emission map bounds. */ - bb_boundInsert(bb, mvert[i].co); + bb_boundInsert(bb, vertices[i].co); } /* Set emission map. @@ -1082,7 +1077,7 @@ static void obstacles_from_mesh(Object *coll_ob, ObstaclesFromDMData data = { .fes = fes, - .mvert = mvert, + .mvert = vertices, .mloop = mloop, .mlooptri = looptri, .tree = &tree_data, @@ -1105,9 +1100,8 @@ static void obstacles_from_mesh(Object *coll_ob, if (vert_vel) { MEM_freeN(vert_vel); } - if (me->mvert) { - MEM_freeN(me->mvert); - } + MEM_freeN(vertices); + MEM_freeN(vert_normals); BKE_id_free(NULL, me); } } _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs