Various small cleanups
This commit is contained in:
parent
8dff7bb4eb
commit
8cd9317b67
|
@ -1596,7 +1596,7 @@ int mdisp_rot_face_to_crn(
|
|||
float mindist = FLT_MAX;
|
||||
|
||||
for (i = 0; i < mpoly->totloop; i++) {
|
||||
float len = len_v3v3(nullptr, positions[mloop[mpoly->loopstart + i].v].co);
|
||||
float len = len_v3v3(nullptr, positions[mloop[mpoly->loopstart + i].v]);
|
||||
if (len < mindist) {
|
||||
mindist = len;
|
||||
minS = i;
|
||||
|
|
|
@ -4806,9 +4806,9 @@ bool BKE_object_shapekey_remove(Main *bmain, Object *ob, KeyBlock *kb)
|
|||
switch (ob->type) {
|
||||
case OB_MESH: {
|
||||
Mesh *mesh = (Mesh *)ob->data;
|
||||
MutableSpan<float3> verts = mesh->positions_for_write();
|
||||
MutableSpan<float3> positions = mesh->positions_for_write();
|
||||
BKE_keyblock_convert_to_mesh(
|
||||
key->refkey, reinterpret_cast<float(*)[3]>(verts.data()), mesh->totvert);
|
||||
key->refkey, reinterpret_cast<float(*)[3]>(positions.data()), mesh->totvert);
|
||||
break;
|
||||
}
|
||||
case OB_CURVES_LEGACY:
|
||||
|
|
|
@ -81,8 +81,7 @@ static void set_coarse_positions(Subdiv *subdiv,
|
|||
const Mesh *mesh,
|
||||
const float (*coarse_vertex_cos)[3])
|
||||
{
|
||||
const float (*positions)[3]
|
||||
= BKE_mesh_positions(mesh);
|
||||
const float(*positions)[3] = BKE_mesh_positions(mesh);
|
||||
const MPoly *mpoly = BKE_mesh_polys(mesh);
|
||||
const MLoop *mloop = BKE_mesh_loops(mesh);
|
||||
/* Mark vertices which needs new coordinates. */
|
||||
|
|
|
@ -1411,7 +1411,7 @@ struct LineartEdgeNeighbor {
|
|||
int v1, v2;
|
||||
};
|
||||
|
||||
typedef struct VertData {
|
||||
struct VertData {
|
||||
const float (*positions)[3];
|
||||
LineartVert *v_arr;
|
||||
double (*model_view)[4];
|
||||
|
|
|
@ -695,9 +695,9 @@ void USDMeshReader::read_mesh_sample(ImportSettings *settings,
|
|||
* in code that expect this data to be there. */
|
||||
|
||||
if (new_mesh || (settings->read_flag & MOD_MESHSEQ_READ_VERT) != 0) {
|
||||
MutableSpan<float3> verts = mesh->positions_for_write();
|
||||
MutableSpan<float3> mesh_positions = mesh->positions_for_write();
|
||||
for (int i = 0; i < positions_.size(); i++) {
|
||||
verts[i] = {positions_[i][0], positions_[i][1], positions_[i][2]};
|
||||
mesh_positions[i] = {positions_[i][0], positions_[i][1], positions_[i][2]};
|
||||
}
|
||||
BKE_mesh_tag_coords_changed(mesh);
|
||||
|
||||
|
|
|
@ -13,10 +13,6 @@
|
|||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_session_uuid_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
# include "BLI_math_vec_types.hh"
|
||||
#endif
|
||||
|
||||
/** Workaround to forward-declare C++ type in C header. */
|
||||
#ifdef __cplusplus
|
||||
|
||||
|
|
|
@ -18,33 +18,6 @@ extern "C" {
|
|||
/** \name Geometry Elements
|
||||
* \{ */
|
||||
|
||||
/**
|
||||
* Deprecated mesh vertex data structure. Now stored with generic attributes.
|
||||
*/
|
||||
#ifdef DNA_DEPRECATED_ALLOW
|
||||
typedef struct MVert {
|
||||
float co_legacy[3];
|
||||
/**
|
||||
* Deprecated flag for storing hide status and selection, which are now stored in separate
|
||||
* generic attributes. Kept for file read and write.
|
||||
*/
|
||||
char flag_legacy;
|
||||
/**
|
||||
* Deprecated bevel weight storage, now located in #CD_BWEIGHT, except for file read and write.
|
||||
*/
|
||||
char bweight_legacy;
|
||||
char _pad[2];
|
||||
} MVert;
|
||||
|
||||
/** #MVert.flag */
|
||||
enum {
|
||||
/** Deprecated selection status. Now stored in ".select_vert" attribute. */
|
||||
/* SELECT = (1 << 0), */
|
||||
/** Deprecated hide status. Now stored in ".hide_vert" attribute. */
|
||||
ME_HIDE = (1 << 4),
|
||||
};
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Mesh Edges.
|
||||
*
|
||||
|
@ -474,6 +447,33 @@ enum {
|
|||
/** \name Deprecated Structs
|
||||
* \{ */
|
||||
|
||||
/**
|
||||
* Deprecated mesh vertex data structure. Now stored with generic attributes.
|
||||
*/
|
||||
#ifdef DNA_DEPRECATED_ALLOW
|
||||
typedef struct MVert {
|
||||
float co_legacy[3];
|
||||
/**
|
||||
* Deprecated flag for storing hide status and selection, which are now stored in separate
|
||||
* generic attributes. Kept for file read and write.
|
||||
*/
|
||||
char flag_legacy;
|
||||
/**
|
||||
* Deprecated bevel weight storage, now located in #CD_BWEIGHT, except for file read and write.
|
||||
*/
|
||||
char bweight_legacy;
|
||||
char _pad[2];
|
||||
} MVert;
|
||||
|
||||
/** #MVert.flag */
|
||||
enum {
|
||||
/** Deprecated selection status. Now stored in ".select_vert" attribute. */
|
||||
/* SELECT = (1 << 0), */
|
||||
/** Deprecated hide status. Now stored in ".hide_vert" attribute. */
|
||||
ME_HIDE = (1 << 4),
|
||||
};
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Used in Blender pre 2.63, See #MLoop, #MPoly for face data stored in the blend file.
|
||||
* Use for reading old files and in a handful of cases which should be removed eventually.
|
||||
|
|
|
@ -368,7 +368,6 @@ static void add_interp_verts_copy_edges_to_new_mesh(const Mesh &src_mesh,
|
|||
uint verts_add_num,
|
||||
MutableSpan<int> r_edge_map)
|
||||
{
|
||||
using namespace blender;
|
||||
BLI_assert(src_mesh.totvert == vertex_mask.size());
|
||||
BLI_assert(src_mesh.totedge == r_edge_map.size());
|
||||
const Span<MEdge> src_edges = src_mesh.edges();
|
||||
|
|
|
@ -57,7 +57,7 @@ static void generate_vert_coordinates(Mesh *mesh,
|
|||
const Span<float3> positions = mesh->positions();
|
||||
for (int i = 0; i < mesh->totvert; i++) {
|
||||
copy_v3_v3(r_cos[i], positions[i]);
|
||||
if (r_size != NULL && ob_center == NULL) {
|
||||
if (r_size != nullptr && ob_center == nullptr) {
|
||||
minmax_v3v3_v3(min_co, max_co, r_cos[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -781,22 +781,22 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
|||
|
||||
/* set location */
|
||||
for (j = 0; j < totvert; j++) {
|
||||
const int vert_index_new = int(varray_stride) + int(j);
|
||||
const int vert_new = int(varray_stride) + int(j);
|
||||
|
||||
copy_v3_v3(positions_new[vert_index_new], positions_new[j]);
|
||||
copy_v3_v3(positions_new[vert_new], positions_new[j]);
|
||||
|
||||
/* only need to set these if using non cleared memory */
|
||||
// mv_new->mat_nr = mv_new->flag = 0;
|
||||
|
||||
if (ob_axis != nullptr) {
|
||||
sub_v3_v3(positions_new[vert_index_new], mtx_tx[3]);
|
||||
sub_v3_v3(positions_new[vert_new], mtx_tx[3]);
|
||||
|
||||
mul_m4_v3(mat, positions_new[vert_index_new]);
|
||||
mul_m4_v3(mat, positions_new[vert_new]);
|
||||
|
||||
add_v3_v3(positions_new[vert_index_new], mtx_tx[3]);
|
||||
add_v3_v3(positions_new[vert_new], mtx_tx[3]);
|
||||
}
|
||||
else {
|
||||
mul_m4_v3(mat, positions_new[vert_index_new]);
|
||||
mul_m4_v3(mat, positions_new[vert_new]);
|
||||
}
|
||||
|
||||
/* add the new edge */
|
||||
|
@ -875,8 +875,8 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
|||
/* Polygon */
|
||||
if (has_mpoly_orig) {
|
||||
CustomData_copy_data(
|
||||
&mesh->pdata, &result->pdata, (int)mpoly_index_orig, (int)mpoly_index, 1);
|
||||
origindex[mpoly_index] = (int)mpoly_index_orig;
|
||||
&mesh->pdata, &result->pdata, int(mpoly_index_orig), int(mpoly_index), 1);
|
||||
origindex[mpoly_index] = int(mpoly_index_orig);
|
||||
}
|
||||
else {
|
||||
origindex[mpoly_index] = ORIGINDEX_NONE;
|
||||
|
|
|
@ -486,7 +486,7 @@ static void do_multires_bake(MultiresBakeRender *bkr,
|
|||
Mesh *temp_mesh = BKE_mesh_new_nomain(
|
||||
dm->getNumVerts(dm), dm->getNumEdges(dm), 0, dm->getNumLoops(dm), dm->getNumPolys(dm));
|
||||
memcpy(
|
||||
BKE_mesh_positions_for_write(temp_mesh), positions, temp_mesh->totvert * sizeof(float[3]));
|
||||
temp_mesh->positions_for_write().data(), positions, temp_mesh->totvert * sizeof(float[3]));
|
||||
memcpy(BKE_mesh_edges_for_write(temp_mesh),
|
||||
dm->getEdgeArray(dm),
|
||||
temp_mesh->totedge * sizeof(MEdge));
|
||||
|
|
Loading…
Reference in New Issue