Mesh: Replace MLoop struct with generic attributes #104424
|
@ -189,7 +189,6 @@ void MeshesToIMeshInfo::input_mvert_for_orig_index(int orig_index,
|
||||||
int orig_mesh_index = input_mesh_for_imesh_vert(orig_index);
|
int orig_mesh_index = input_mesh_for_imesh_vert(orig_index);
|
||||||
BLI_assert(0 <= orig_mesh_index && orig_mesh_index < meshes.size());
|
BLI_assert(0 <= orig_mesh_index && orig_mesh_index < meshes.size());
|
||||||
const Mesh *me = meshes[orig_mesh_index];
|
const Mesh *me = meshes[orig_mesh_index];
|
||||||
const Span<float3> positions = me->positions();
|
|
||||||
int index_in_mesh = orig_index - mesh_vert_offset[orig_mesh_index];
|
int index_in_mesh = orig_index - mesh_vert_offset[orig_mesh_index];
|
||||||
BLI_assert(0 <= index_in_mesh && index_in_mesh < me->totvert);
|
BLI_assert(0 <= index_in_mesh && index_in_mesh < me->totvert);
|
||||||
if (r_orig_mesh) {
|
if (r_orig_mesh) {
|
||||||
|
|
|
@ -1597,7 +1597,7 @@ int mdisp_rot_face_to_crn( struct MPoly *mpoly,
|
||||||
float mindist = FLT_MAX;
|
float mindist = FLT_MAX;
|
||||||
|
|
||||||
for (i = 0; i < mpoly->totloop; i++) {
|
for (i = 0; i < mpoly->totloop; i++) {
|
||||||
float len = len_v3v3(NULL, mvert[mloop[mpoly->loopstart + i].v].co);
|
float len = len_v3v3(NULL, positions[mloop[mpoly->loopstart + i].v].co);
|
||||||
if (len < mindist) {
|
if (len < mindist) {
|
||||||
mindist = len;
|
mindist = len;
|
||||||
minS = i;
|
minS = i;
|
||||||
|
|
|
@ -97,7 +97,7 @@ static void distribute_grid(Mesh *mesh, ParticleSystem *psys)
|
||||||
{
|
{
|
||||||
ParticleData *pa = NULL;
|
ParticleData *pa = NULL;
|
||||||
float min[3], max[3], delta[3], d;
|
float min[3], max[3], delta[3], d;
|
||||||
float(*positions)[3] = BKE_mesh_positions_for_write(mesh);
|
const float(*positions)[3] = BKE_mesh_positions(mesh);
|
||||||
int totvert = mesh->totvert, from = psys->part->from;
|
int totvert = mesh->totvert, from = psys->part->from;
|
||||||
int i, j, k, p, res = psys->part->grid_res, size[3], axis;
|
int i, j, k, p, res = psys->part->grid_res, size[3], axis;
|
||||||
|
|
||||||
|
|
|
@ -654,9 +654,9 @@ static int bm_to_mesh_shape_layer_index_from_kb(BMesh *bm, KeyBlock *currkey)
|
||||||
*
|
*
|
||||||
* \param bm: The source BMesh.
|
* \param bm: The source BMesh.
|
||||||
* \param key: The destination key.
|
* \param key: The destination key.
|
||||||
* \param mvert: The destination vertex array (in some situations it's coordinates are updated).
|
* \param positions: The destination vertex array (in some situations its coordinates are updated).
|
||||||
* \param active_shapekey_to_mvert: When editing a non-basis shape key, the coordinates for the
|
* \param active_shapekey_to_mvert: When editing a non-basis shape key, the coordinates for the
|
||||||
* basis are typically copied into the `mvert` array since it makes sense for the meshes
|
* basis are typically copied into the `positions` array since it makes sense for the meshes
|
||||||
* vertex coordinates to match the "Basis" key.
|
* vertex coordinates to match the "Basis" key.
|
||||||
* When enabled, skip this step and copy #BMVert.co directly to the mesh position.
|
* When enabled, skip this step and copy #BMVert.co directly to the mesh position.
|
||||||
* See #BMeshToMeshParams.active_shapekey_to_mvert doc-string.
|
* See #BMeshToMeshParams.active_shapekey_to_mvert doc-string.
|
||||||
|
@ -743,7 +743,7 @@ static void bm_to_mesh_shape(BMesh *bm,
|
||||||
* while users might not notice since the shape-key is applied in the viewport,
|
* while users might not notice since the shape-key is applied in the viewport,
|
||||||
* exporters for example may still use the underlying coordinates, see: T30771 & T96135.
|
* exporters for example may still use the underlying coordinates, see: T30771 & T96135.
|
||||||
*
|
*
|
||||||
* Needed when editing any shape that isn't the (`key->refkey`), the vertices in `me->mvert`
|
* Needed when editing any shape that isn't the (`key->refkey`), the vertices in mesh positions
|
||||||
* currently have vertex coordinates set from the current-shape (initialized from #BMVert.co).
|
* currently have vertex coordinates set from the current-shape (initialized from #BMVert.co).
|
||||||
* In this case it's important to overwrite these coordinates with the basis-keys coordinates. */
|
* In this case it's important to overwrite these coordinates with the basis-keys coordinates. */
|
||||||
bool update_vertex_coords_from_refkey = false;
|
bool update_vertex_coords_from_refkey = false;
|
||||||
|
|
|
@ -310,7 +310,7 @@ static bool sculpt_undo_restore_coords(bContext *C, Depsgraph *depsgraph, Sculpt
|
||||||
/* Propagate new coords to keyblock. */
|
/* Propagate new coords to keyblock. */
|
||||||
SCULPT_vertcos_to_key(ob, ss->shapekey_active, vertCos);
|
SCULPT_vertcos_to_key(ob, ss->shapekey_active, vertCos);
|
||||||
|
|
||||||
/* PBVH uses its own mvert array, so coords should be */
|
/* PBVH uses its own vertex array, so coords should be */
|
||||||
/* propagated to PBVH here. */
|
/* propagated to PBVH here. */
|
||||||
BKE_pbvh_vert_coords_apply(ss->pbvh, vertCos, ss->shapekey_active->totelem);
|
BKE_pbvh_vert_coords_apply(ss->pbvh, vertCos, ss->shapekey_active->totelem);
|
||||||
|
|
||||||
|
|
|
@ -384,7 +384,7 @@ typedef struct TFace {
|
||||||
|
|
||||||
/** #Mesh_Runtime.wrapper_type */
|
/** #Mesh_Runtime.wrapper_type */
|
||||||
typedef enum eMeshWrapperType {
|
typedef enum eMeshWrapperType {
|
||||||
/** Use mesh data (#Mesh.mvert, #Mesh.medge, #Mesh.mloop, #Mesh.mpoly). */
|
/** Use mesh data (#positions, #Mesh.medge, #Mesh.mloop, #Mesh.mpoly). */
|
||||||
ME_WRAPPER_TYPE_MDATA = 0,
|
ME_WRAPPER_TYPE_MDATA = 0,
|
||||||
/** Use edit-mesh data (#Mesh.edit_mesh, #Mesh_Runtime.edit_data). */
|
/** Use edit-mesh data (#Mesh.edit_mesh, #Mesh_Runtime.edit_data). */
|
||||||
ME_WRAPPER_TYPE_BMESH = 1,
|
ME_WRAPPER_TYPE_BMESH = 1,
|
||||||
|
|
|
@ -19,9 +19,7 @@ extern "C" {
|
||||||
* \{ */
|
* \{ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mesh Vertices.
|
* Deprecated mesh vertex data structure. Now stored with generic attributes.
|
||||||
*
|
|
||||||
* Typically accessed from #Mesh.mvert
|
|
||||||
*/
|
*/
|
||||||
#ifdef DNA_DEPRECATED_ALLOW
|
#ifdef DNA_DEPRECATED_ALLOW
|
||||||
typedef struct MVert {
|
typedef struct MVert {
|
||||||
|
@ -178,9 +176,9 @@ enum {
|
||||||
*
|
*
|
||||||
* // access vertex locations.
|
* // access vertex locations.
|
||||||
* float *vtri_co[3] = {
|
* float *vtri_co[3] = {
|
||||||
* mvert[mloop[lt->tri[0]].v].co,
|
* positions[mloop[lt->tri[0]].v],
|
||||||
* mvert[mloop[lt->tri[1]].v].co,
|
* positions[mloop[lt->tri[1]].v],
|
||||||
* mvert[mloop[lt->tri[2]].v].co,
|
* positions[mloop[lt->tri[2]].v],
|
||||||
* };
|
* };
|
||||||
*
|
*
|
||||||
* // access UV coordinates (works for all loop data, vertex colors... etc).
|
* // access UV coordinates (works for all loop data, vertex colors... etc).
|
||||||
|
|
Loading…
Reference in New Issue