Cleanup: Remove unnecessary Mesh C API functions
This commit is contained in:
@@ -23,8 +23,6 @@ struct Scene;
|
||||
/** Return the number of derived triangles (looptris). */
|
||||
int BKE_mesh_runtime_looptri_len(const Mesh *mesh);
|
||||
|
||||
const int *BKE_mesh_runtime_looptri_faces_ensure(const Mesh *mesh);
|
||||
|
||||
bool BKE_mesh_runtime_ensure_edit_data(Mesh *mesh);
|
||||
|
||||
/**
|
||||
@@ -56,11 +54,6 @@ void BKE_mesh_runtime_verttri_from_looptri(MVertTri *r_verttri,
|
||||
const MLoopTri *looptri,
|
||||
int looptri_num);
|
||||
|
||||
/** \note Only used for access in C. */
|
||||
bool BKE_mesh_is_deformed_only(const Mesh *mesh);
|
||||
/** \note Only used for access in C. */
|
||||
eMeshWrapperType BKE_mesh_wrapper_type(const Mesh *mesh);
|
||||
|
||||
/* NOTE: the functions below are defined in DerivedMesh.cc, and are intended to be moved
|
||||
* to a more suitable location when that file is removed.
|
||||
* They should also be renamed to use conventions from BKE, not old DerivedMesh.cc.
|
||||
|
||||
@@ -213,11 +213,6 @@ int BKE_mesh_runtime_looptri_len(const Mesh *mesh)
|
||||
return poly_to_tri_count(mesh->faces_num, mesh->totloop);
|
||||
}
|
||||
|
||||
const int *BKE_mesh_runtime_looptri_faces_ensure(const Mesh *mesh)
|
||||
{
|
||||
return mesh->looptri_faces().data();
|
||||
}
|
||||
|
||||
void BKE_mesh_runtime_verttri_from_looptri(MVertTri *r_verttri,
|
||||
const int *corner_verts,
|
||||
const MLoopTri *looptri,
|
||||
@@ -331,16 +326,6 @@ void BKE_mesh_tag_topology_changed(Mesh *mesh)
|
||||
BKE_mesh_runtime_clear_geometry(mesh);
|
||||
}
|
||||
|
||||
bool BKE_mesh_is_deformed_only(const Mesh *mesh)
|
||||
{
|
||||
return mesh->runtime->deformed_only;
|
||||
}
|
||||
|
||||
eMeshWrapperType BKE_mesh_wrapper_type(const Mesh *mesh)
|
||||
{
|
||||
return mesh->runtime->wrapper_type;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
@@ -1857,7 +1857,7 @@ int psys_particle_dm_face_lookup(Mesh *mesh_final,
|
||||
CustomData_get_layer(&mesh_original->fdata_legacy, CD_ORIGINDEX));
|
||||
}
|
||||
else {
|
||||
BLI_assert(BKE_mesh_is_deformed_only(mesh_final));
|
||||
BLI_assert(mesh_final->runtime->deformed_only);
|
||||
index_mf_to_mpoly_deformed = index_mf_to_mpoly;
|
||||
}
|
||||
BLI_assert(index_mf_to_mpoly_deformed);
|
||||
@@ -1949,7 +1949,7 @@ static int psys_map_index_on_dm(Mesh *mesh,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (BKE_mesh_is_deformed_only(mesh) || index_dmcache == DMCACHE_ISCHILD) {
|
||||
if (mesh->runtime->deformed_only || index_dmcache == DMCACHE_ISCHILD) {
|
||||
/* for meshes that are either only deformed or for child particles, the
|
||||
* index and fw do not require any mapping, so we can directly use it */
|
||||
if (from == PART_FROM_VERT) {
|
||||
|
||||
@@ -916,7 +916,7 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!BKE_mesh_is_deformed_only(final_mesh) &&
|
||||
if (!final_mesh->runtime->deformed_only &&
|
||||
!CustomData_get_layer(&final_mesh->fdata_legacy, CD_ORIGINDEX))
|
||||
{
|
||||
printf(
|
||||
|
||||
@@ -324,7 +324,7 @@ void psys_calc_dmcache(Object *ob, Mesh *mesh_final, Mesh *mesh_original, Partic
|
||||
PARTICLE_P;
|
||||
|
||||
/* CACHE LOCATIONS */
|
||||
if (!BKE_mesh_is_deformed_only(mesh_final)) {
|
||||
if (!mesh_final->runtime->deformed_only) {
|
||||
/* Will use later to speed up subsurf/evaluated mesh. */
|
||||
LinkNode *node, *nodedmelem, **nodearray;
|
||||
int totdmelem, totelem, i;
|
||||
|
||||
@@ -3,11 +3,10 @@
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "BLI_map.hh"
|
||||
#include "BLI_math_matrix.hh"
|
||||
#include "BLI_ordered_edge.hh"
|
||||
#include "BLI_math_geom.h"
|
||||
#include "BLI_math_matrix.hh"
|
||||
#include "BLI_math_vector.h"
|
||||
#include "BLI_ordered_edge.hh"
|
||||
|
||||
#include "pbvh_uv_islands.hh"
|
||||
|
||||
|
||||
@@ -244,7 +244,7 @@ static void workbench_cache_hair_populate(WORKBENCH_PrivateData *wpd,
|
||||
|
||||
static const CustomData *workbench_mesh_get_loop_custom_data(const Mesh *mesh)
|
||||
{
|
||||
if (BKE_mesh_wrapper_type(mesh) == ME_WRAPPER_TYPE_BMESH) {
|
||||
if (mesh->runtime->wrapper_type == ME_WRAPPER_TYPE_BMESH) {
|
||||
BLI_assert(mesh->edit_mesh != nullptr);
|
||||
BLI_assert(mesh->edit_mesh->bm != nullptr);
|
||||
return &mesh->edit_mesh->bm->ldata;
|
||||
@@ -254,7 +254,7 @@ static const CustomData *workbench_mesh_get_loop_custom_data(const Mesh *mesh)
|
||||
|
||||
static const CustomData *workbench_mesh_get_vert_custom_data(const Mesh *mesh)
|
||||
{
|
||||
if (BKE_mesh_wrapper_type(mesh) == ME_WRAPPER_TYPE_BMESH) {
|
||||
if (mesh->runtime->wrapper_type == ME_WRAPPER_TYPE_BMESH) {
|
||||
BLI_assert(mesh->edit_mesh != nullptr);
|
||||
BLI_assert(mesh->edit_mesh->bm != nullptr);
|
||||
return &mesh->edit_mesh->bm->vdata;
|
||||
|
||||
@@ -3540,7 +3540,7 @@ static void PE_mirror_x(Depsgraph *depsgraph, Scene *scene, Object *ob, int tagg
|
||||
}
|
||||
|
||||
const bool use_dm_final_indices = (psys->part->use_modifier_stack &&
|
||||
!BKE_mesh_is_deformed_only(psmd_eval->mesh_final));
|
||||
!psmd_eval->mesh_final->runtime->deformed_only);
|
||||
|
||||
/* NOTE: this is not nice to use tessfaces but hard to avoid since pa->num uses tessfaces */
|
||||
BKE_mesh_tessface_ensure(me);
|
||||
@@ -4363,7 +4363,7 @@ static void brush_add_count_iter(void *__restrict iter_data_v,
|
||||
0,
|
||||
nullptr))
|
||||
{
|
||||
if (psys->part->use_modifier_stack && !BKE_mesh_is_deformed_only(psmd_eval->mesh_final)) {
|
||||
if (psys->part->use_modifier_stack && !psmd_eval->mesh_final->runtime->deformed_only) {
|
||||
add_pars[iter].num = add_pars[iter].num_dmcache;
|
||||
add_pars[iter].num_dmcache = DMCACHE_ISCHILD;
|
||||
}
|
||||
@@ -4441,7 +4441,7 @@ static int brush_add(const bContext *C, PEData *data, short number)
|
||||
|
||||
timestep = psys_get_timestep(&sim);
|
||||
|
||||
if (psys->part->use_modifier_stack || BKE_mesh_is_deformed_only(psmd_eval->mesh_final)) {
|
||||
if (psys->part->use_modifier_stack || psmd_eval->mesh_final->runtime->deformed_only) {
|
||||
mesh = psmd_eval->mesh_final;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -731,7 +731,7 @@ static bool remap_hair_emitter(Depsgraph *depsgraph,
|
||||
invert_m4_m4(to_imat, to_mat);
|
||||
|
||||
const bool use_dm_final_indices = (target_psys->part->use_modifier_stack &&
|
||||
!BKE_mesh_is_deformed_only(target_psmd->mesh_final));
|
||||
!target_psmd->mesh_final->runtime->deformed_only);
|
||||
|
||||
if (use_dm_final_indices || !target_psmd->mesh_original) {
|
||||
mesh = target_psmd->mesh_final;
|
||||
|
||||
@@ -277,8 +277,7 @@ static void imapaint_pick_uv(const Mesh *me_eval,
|
||||
const ePaintCanvasSource mode = ePaintCanvasSource(scene->toolsettings->imapaint.mode);
|
||||
|
||||
const blender::Span<MLoopTri> tris = me_eval->looptris();
|
||||
const int tottri = BKE_mesh_runtime_looptri_len(me_eval);
|
||||
const int *looptri_faces = BKE_mesh_runtime_looptri_faces_ensure(me_eval);
|
||||
const blender::Span<int> looptri_faces = me_eval->looptri_faces();
|
||||
|
||||
const blender::Span<blender::float3> positions = me_eval->vert_positions();
|
||||
const blender::Span<int> corner_verts = me_eval->corner_verts();
|
||||
@@ -301,7 +300,7 @@ static void imapaint_pick_uv(const Mesh *me_eval,
|
||||
|
||||
/* test all faces in the derivedmesh with the original index of the picked face */
|
||||
/* face means poly here, not triangle, indeed */
|
||||
for (i = 0; i < tottri; i++) {
|
||||
for (const int i : tris.index_range()) {
|
||||
const int face_i = looptri_faces[i];
|
||||
findex = index_mp_to_orig ? index_mp_to_orig[face_i] : face_i;
|
||||
|
||||
|
||||
@@ -555,7 +555,7 @@ static void rna_Mesh_assign_verts_to_group(
|
||||
/* don't call inside a loop */
|
||||
static int mesh_looptri_to_face_index(Mesh *me_eval, const int tri_index)
|
||||
{
|
||||
const int *looptri_faces = BKE_mesh_runtime_looptri_faces_ensure(me_eval);
|
||||
const blender::Span<int> looptri_faces = me_eval->looptri_faces();
|
||||
const int face_i = looptri_faces[tri_index];
|
||||
const int *index_mp_to_orig = static_cast<const int *>(
|
||||
CustomData_get_layer(&me_eval->face_data, CD_ORIGINDEX));
|
||||
|
||||
Reference in New Issue
Block a user