Files
test/source/blender/blenkernel/BKE_mesh_runtime.hh
Brecht Van Lommel 920e709069 Refactor: Make header files more clangd and clang-tidy friendly
When using clangd or running clang-tidy on headers there are
currently many errors. These are noisy in IDEs, make auto fixes
impossible, and break features like code completion, refactoring
and navigation.

This makes source/blender headers work by themselves, which is
generally the goal anyway. But #includes and forward declarations
were often incomplete.

* Add #includes and forward declarations
* Add IWYU pragma: export in a few places
* Remove some unused #includes (but there are many more)
* Tweak ShaderCreateInfo macros to work better with clangd

Some types of headers still have errors, these could be fixed or
worked around with more investigation. Mostly preprocessor
template headers like NOD_static_types.h.

Note that that disabling WITH_UNITY_BUILD is required for clangd to
work properly, otherwise compile_commands.json does not contain
the information for the relevant source files.

For more details see the developer docs:
https://developer.blender.org/docs/handbook/tooling/clangd/

Pull Request: https://projects.blender.org/blender/blender/pulls/132608
2025-01-07 12:39:13 +01:00

94 lines
3.4 KiB
C++

/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
/** \file
* \ingroup bke
*
* This file contains access functions for the Mesh.runtime struct.
*/
#include "BLI_math_vector_types.hh"
#include "BLI_span.hh"
struct BMEditMesh;
struct CustomData_MeshMasks;
struct Depsgraph;
struct KeyBlock;
struct ModifierData;
struct Mesh;
struct Object;
struct Scene;
/** Return the number of derived triangles (corner_tris). */
int BKE_mesh_runtime_corner_tris_len(const Mesh *mesh);
void BKE_mesh_runtime_ensure_edit_data(Mesh *mesh);
/**
* Clear and free any derived caches associated with the mesh geometry data. Examples include BVH
* caches, normals, triangulation, etc. This should be called when replacing a mesh's geometry
* directly or making other large changes to topology. It does not need to be called on new meshes.
*
* For "smaller" changes to meshes like updating positions, consider calling a more specific update
* function like #Mesh::tag_positions_changed().
*
* Also note that some derived caches like #CD_TANGENT are stored directly in #CustomData.
*/
void BKE_mesh_runtime_clear_geometry(Mesh *mesh);
/**
* Similar to #BKE_mesh_runtime_clear_geometry, but subtly different in that it also clears
* data-block level features like evaluated data-blocks and edit mode data. They will be
* functionally the same in most cases, but prefer this function if unsure, since it clears
* more data.
*/
void BKE_mesh_runtime_clear_cache(Mesh *mesh);
namespace blender::bke {
void mesh_get_mapped_verts_coords(Mesh *mesh_eval, MutableSpan<float3> r_cos);
Mesh *editbmesh_get_eval_cage(Depsgraph *depsgraph,
const Scene *scene,
Object *obedit,
BMEditMesh *em,
const CustomData_MeshMasks *dataMask);
Mesh *editbmesh_get_eval_cage_from_orig(Depsgraph *depsgraph,
const Scene *scene,
Object *obedit,
const CustomData_MeshMasks *dataMask);
bool editbmesh_modifier_is_enabled(const Scene *scene,
const Object *ob,
ModifierData *md,
bool has_prev_mesh);
Mesh *mesh_get_eval_deform(Depsgraph *depsgraph,
const Scene *scene,
Object *ob,
const CustomData_MeshMasks *dataMask);
Mesh *mesh_create_eval_final(Depsgraph *depsgraph,
const Scene *scene,
Object *ob,
const CustomData_MeshMasks *dataMask);
Mesh *mesh_create_eval_no_deform(Depsgraph *depsgraph,
const Scene *scene,
Object *ob,
const CustomData_MeshMasks *dataMask);
Mesh *mesh_create_eval_no_deform_render(Depsgraph *depsgraph,
const Scene *scene,
Object *ob,
const CustomData_MeshMasks *dataMask);
void mesh_eval_to_meshkey(const Mesh *me_deformed, Mesh *mesh, KeyBlock *kb);
} // namespace blender::bke
#ifndef NDEBUG
bool BKE_mesh_runtime_is_valid(Mesh *mesh_eval);
#endif /* !NDEBUG */