diff options
author | Hans Goudey <h.goudey@me.com> | 2022-05-15 21:27:28 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-05-15 21:27:28 +0300 |
commit | 7b091fbb94c8f5d07de1c23e2cb30165b7a285fe (patch) | |
tree | a077c33fae745842fd9f15c8d182d59b39dfbb2a /source | |
parent | 024f3ddf617f19b467b3948464fb2f9ba7e84951 (diff) |
Cleanup: Remove includes from DerivedMesh header
Headers should only include other headers when absolutely necessary,
to avoid unnecessary dependencies and increasing compile times.
To make this change simpler, three DerivedMesh functions with a single
use were removed.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_DerivedMesh.h | 16 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_subdiv_ccg.h | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.cc | 15 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/crazyspace.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/editmesh.c | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh_convert.cc | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/multires_reshape_util.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/pbvh_intern.h | 13 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/subdiv_ccg_material.c | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/subsurf_ccg.c | 13 | ||||
-rw-r--r-- | source/blender/editors/armature/armature_skinning.c | 1 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_utils.c | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/meshtools.c | 1 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 4 | ||||
-rw-r--r-- | source/blender/render/intern/multires_bake.c | 1 | ||||
-rw-r--r-- | source/blender/render/intern/texture_margin.cc | 1 |
16 files changed, 36 insertions, 45 deletions
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 3488f50a32b..59f0c86684d 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -46,14 +46,9 @@ * as it is and stick with using BMesh and CDDM. */ -#include "DNA_customdata_types.h" -#include "DNA_defs.h" -#include "DNA_meshdata_types.h" - #include "BLI_compiler_attrs.h" -#include "BKE_bvhutils.h" -#include "BKE_customdata.h" +#include "DNA_customdata_types.h" #ifdef __cplusplus extern "C" { @@ -232,15 +227,6 @@ bool DM_release(DerivedMesh *dm); */ void DM_set_only_copy(DerivedMesh *dm, const struct CustomData_MeshMasks *mask); -/* Adds a vertex/edge/face custom data layer to a DerivedMesh, optionally - * backed by an external data array - * alloctype defines how the layer is allocated or copied, and how it is - * freed, see BKE_customdata.h for the different options. */ - -void DM_add_vert_layer(struct DerivedMesh *dm, int type, eCDAllocType alloctype, void *layer); -void DM_add_edge_layer(struct DerivedMesh *dm, int type, eCDAllocType alloctype, void *layer); -void DM_add_poly_layer(struct DerivedMesh *dm, int type, eCDAllocType alloctype, void *layer); - /* -------------------------------------------------------------------- */ /** \name Custom Data Layer Access Functions * diff --git a/source/blender/blenkernel/BKE_subdiv_ccg.h b/source/blender/blenkernel/BKE_subdiv_ccg.h index 31a1912bc68..b30b707759c 100644 --- a/source/blender/blenkernel/BKE_subdiv_ccg.h +++ b/source/blender/blenkernel/BKE_subdiv_ccg.h @@ -8,7 +8,6 @@ #pragma once #include "BKE_DerivedMesh.h" -#include "BKE_customdata.h" #include "BLI_bitmap.h" #include "BLI_sys_types.h" @@ -21,6 +20,8 @@ struct CCGFace; struct CCGKey; struct DMFlagMat; struct Mesh; +struct MPoly; +struct MLoop; struct Subdiv; /* -------------------------------------------------------------------- @@ -309,8 +310,8 @@ typedef enum SubdivCCGAdjacencyType { * adjacent to a vertex, r_v1 and r_v2 will be the index of that vertex. */ SubdivCCGAdjacencyType BKE_subdiv_ccg_coarse_mesh_adjacency_info_get(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord, - const MLoop *mloop, - const MPoly *mpoly, + const struct MLoop *mloop, + const struct MPoly *mpoly, int *r_v1, int *r_v2); diff --git a/source/blender/blenkernel/intern/DerivedMesh.cc b/source/blender/blenkernel/intern/DerivedMesh.cc index 7ca76e72839..fb44fc46531 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.cc +++ b/source/blender/blenkernel/intern/DerivedMesh.cc @@ -423,21 +423,6 @@ static void mesh_set_only_copy(Mesh *mesh, const CustomData_MeshMasks *mask) #endif } -void DM_add_vert_layer(DerivedMesh *dm, int type, eCDAllocType alloctype, void *layer) -{ - CustomData_add_layer(&dm->vertData, type, alloctype, layer, dm->numVertData); -} - -void DM_add_edge_layer(DerivedMesh *dm, int type, eCDAllocType alloctype, void *layer) -{ - CustomData_add_layer(&dm->edgeData, type, alloctype, layer, dm->numEdgeData); -} - -void DM_add_poly_layer(DerivedMesh *dm, int type, eCDAllocType alloctype, void *layer) -{ - CustomData_add_layer(&dm->polyData, type, alloctype, layer, dm->numPolyData); -} - void *DM_get_vert_data_layer(DerivedMesh *dm, int type) { if (type == CD_MVERT) { diff --git a/source/blender/blenkernel/intern/crazyspace.c b/source/blender/blenkernel/intern/crazyspace.c index 96389c44839..14e862c2377 100644 --- a/source/blender/blenkernel/intern/crazyspace.c +++ b/source/blender/blenkernel/intern/crazyspace.c @@ -13,8 +13,8 @@ #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "BLI_bitmap.h" #include "BLI_linklist.h" -#include "BLI_math.h" #include "BLI_utildefines.h" #include "BKE_DerivedMesh.h" diff --git a/source/blender/blenkernel/intern/editmesh.c b/source/blender/blenkernel/intern/editmesh.c index d176bf41254..a952da6fa52 100644 --- a/source/blender/blenkernel/intern/editmesh.c +++ b/source/blender/blenkernel/intern/editmesh.c @@ -15,6 +15,7 @@ #include "BLI_math.h" #include "BKE_DerivedMesh.h" +#include "BKE_customdata.h" #include "BKE_editmesh.h" #include "BKE_editmesh_cache.h" #include "BKE_lib_id.h" diff --git a/source/blender/blenkernel/intern/mesh_convert.cc b/source/blender/blenkernel/intern/mesh_convert.cc index 42722125970..07c9bccacc3 100644 --- a/source/blender/blenkernel/intern/mesh_convert.cc +++ b/source/blender/blenkernel/intern/mesh_convert.cc @@ -12,6 +12,7 @@ #include "DNA_key_types.h" #include "DNA_material_types.h" #include "DNA_mesh_types.h" +#include "DNA_meshdata_types.h" #include "DNA_meta_types.h" #include "DNA_object_types.h" #include "DNA_pointcloud_types.h" diff --git a/source/blender/blenkernel/intern/multires_reshape_util.c b/source/blender/blenkernel/intern/multires_reshape_util.c index aed13adf56d..34aa90aa554 100644 --- a/source/blender/blenkernel/intern/multires_reshape_util.c +++ b/source/blender/blenkernel/intern/multires_reshape_util.c @@ -10,12 +10,14 @@ #include "MEM_guardedalloc.h" #include "DNA_mesh_types.h" +#include "DNA_meshdata_types.h" #include "DNA_modifier_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" #include "BLI_task.h" +#include "BKE_customdata.h" #include "BKE_mesh.h" #include "BKE_mesh_runtime.h" #include "BKE_multires.h" diff --git a/source/blender/blenkernel/intern/pbvh_intern.h b/source/blender/blenkernel/intern/pbvh_intern.h index 76db3d1245c..9506a077dc6 100644 --- a/source/blender/blenkernel/intern/pbvh_intern.h +++ b/source/blender/blenkernel/intern/pbvh_intern.h @@ -10,6 +10,11 @@ extern "C" { #endif +struct MLoop; +struct MLoopTri; +struct MPoly; +struct MVert; + /* Axis-aligned bounding box */ typedef struct { float bmin[3], bmax[3]; @@ -143,10 +148,10 @@ struct PBVH { /* NOTE: Normals are not `const` because they can be updated for drawing by sculpt code. */ float (*vert_normals)[3]; - MVert *verts; - const MPoly *mpoly; - const MLoop *mloop; - const MLoopTri *looptri; + struct MVert *verts; + const struct MPoly *mpoly; + const struct MLoop *mloop; + const struct MLoopTri *looptri; CustomData *vdata; CustomData *ldata; CustomData *pdata; diff --git a/source/blender/blenkernel/intern/subdiv_ccg_material.c b/source/blender/blenkernel/intern/subdiv_ccg_material.c index 9fbc99cb4f1..cf49db15b7b 100644 --- a/source/blender/blenkernel/intern/subdiv_ccg_material.c +++ b/source/blender/blenkernel/intern/subdiv_ccg_material.c @@ -10,6 +10,7 @@ #include "MEM_guardedalloc.h" #include "DNA_mesh_types.h" +#include "DNA_meshdata_types.h" typedef struct CCGMaterialFromMeshData { const Mesh *mesh; diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 0abececd17b..ba2df362b92 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -1247,8 +1247,9 @@ static void *ccgDM_get_vert_data_layer(DerivedMesh *dm, int type) } BLI_rw_mutex_lock(&ccgdm->origindex_cache_rwlock, THREAD_LOCK_WRITE); - DM_add_vert_layer(dm, CD_ORIGINDEX, CD_CALLOC, NULL); - origindex = DM_get_vert_data_layer(dm, CD_ORIGINDEX); + + origindex = CustomData_add_layer( + &dm->vertData, CD_ORIGINDEX, CD_CALLOC, NULL, dm->numVertData); totorig = ccgSubSurf_getNumVerts(ss); totnone = dm->numVertData - totorig; @@ -1286,8 +1287,8 @@ static void *ccgDM_get_edge_data_layer(DerivedMesh *dm, int type) return origindex; } - DM_add_edge_layer(dm, CD_ORIGINDEX, CD_CALLOC, NULL); - origindex = DM_get_edge_data_layer(dm, CD_ORIGINDEX); + origindex = CustomData_add_layer( + &dm->edgeData, CD_ORIGINDEX, CD_CALLOC, NULL, dm->numEdgeData); totedge = ccgSubSurf_getNumEdges(ss); totorig = totedge * (edgeSize - 1); @@ -1329,8 +1330,8 @@ static void *ccgDM_get_poly_data_layer(DerivedMesh *dm, int type) return origindex; } - DM_add_poly_layer(dm, CD_ORIGINDEX, CD_CALLOC, NULL); - origindex = DM_get_poly_data_layer(dm, CD_ORIGINDEX); + origindex = CustomData_add_layer( + &dm->polyData, CD_ORIGINDEX, CD_CALLOC, NULL, dm->numPolyData); totface = ccgSubSurf_getNumFaces(ss); diff --git a/source/blender/editors/armature/armature_skinning.c b/source/blender/editors/armature/armature_skinning.c index 64035732a39..3a1e7419d3c 100644 --- a/source/blender/editors/armature/armature_skinning.c +++ b/source/blender/editors/armature/armature_skinning.c @@ -9,6 +9,7 @@ #include "DNA_armature_types.h" #include "DNA_mesh_types.h" +#include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index c3d5f33705c..c7c7e5cf2f8 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -9,6 +9,7 @@ #include "DNA_key_types.h" #include "DNA_mesh_types.h" +#include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "BLI_alloca.h" @@ -19,6 +20,7 @@ #include "BKE_DerivedMesh.h" #include "BKE_context.h" +#include "BKE_customdata.h" #include "BKE_editmesh.h" #include "BKE_editmesh_bvh.h" #include "BKE_global.h" diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 295e62b1cc8..ca9093178df 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -25,6 +25,7 @@ #include "BLI_math.h" #include "BKE_context.h" +#include "BKE_customdata.h" #include "BKE_deform.h" #include "BKE_editmesh.h" #include "BKE_key.h" diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 7776119a594..8add6886584 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -6,12 +6,14 @@ */ #include "DNA_mesh_types.h" +#include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" -#include "BLI_math.h" +#include "BLI_math_vector.h" #include "BKE_DerivedMesh.h" +#include "BKE_customdata.h" #include "BKE_editmesh.h" #include "BKE_global.h" #include "BKE_object.h" diff --git a/source/blender/render/intern/multires_bake.c b/source/blender/render/intern/multires_bake.c index dc9ad2ddb5e..e3229e20595 100644 --- a/source/blender/render/intern/multires_bake.c +++ b/source/blender/render/intern/multires_bake.c @@ -10,6 +10,7 @@ #include "MEM_guardedalloc.h" #include "DNA_mesh_types.h" +#include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" diff --git a/source/blender/render/intern/texture_margin.cc b/source/blender/render/intern/texture_margin.cc index 9096936a3ff..37ef9213615 100644 --- a/source/blender/render/intern/texture_margin.cc +++ b/source/blender/render/intern/texture_margin.cc @@ -12,6 +12,7 @@ #include "BLI_vector.hh" #include "BKE_DerivedMesh.h" +#include "BKE_customdata.h" #include "BKE_mesh.h" #include "DNA_mesh_types.h" |