From 8f362a175dd83209eabe0de54b43af2ed28f0154 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Mon, 13 Nov 2023 19:35:36 +0100 Subject: [PATCH] Cleanup: Combine crazyspace C header with C++ header The distinction would start to become meaningless when we use C++ features in the older C header. The naming and lack of a proper namespace should be enough to clarify the separation for now. --- source/blender/blenkernel/BKE_crazyspace.h | 86 ------------------- source/blender/blenkernel/BKE_crazyspace.hh | 63 ++++++++++++++ source/blender/blenkernel/CMakeLists.txt | 1 - .../blender/blenkernel/intern/crazyspace.cc | 1 - source/blender/blenkernel/intern/object.cc | 2 +- source/blender/blenkernel/intern/paint.cc | 2 +- .../blender/editors/object/object_shapekey.cc | 2 +- .../transform/transform_convert_mesh.cc | 2 +- .../transform/transform_convert_mesh_skin.cc | 2 +- .../blender/makesrna/intern/rna_object_api.cc | 2 +- 10 files changed, 69 insertions(+), 94 deletions(-) delete mode 100644 source/blender/blenkernel/BKE_crazyspace.h diff --git a/source/blender/blenkernel/BKE_crazyspace.h b/source/blender/blenkernel/BKE_crazyspace.h deleted file mode 100644 index 7a468d28532..00000000000 --- a/source/blender/blenkernel/BKE_crazyspace.h +++ /dev/null @@ -1,86 +0,0 @@ -/* SPDX-FileCopyrightText: 2008 Blender Authors - * - * SPDX-License-Identifier: GPL-2.0-or-later */ - -/** \file - * \ingroup bke - */ - -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -struct BMEditMesh; -struct Depsgraph; -struct Mesh; -struct Object; -struct ReportList; -struct Scene; - -/* `crazyspace.cc` */ - -/** - * Disable subdivision-surface temporal, get mapped coordinates, and enable it. - */ -float (*BKE_crazyspace_get_mapped_editverts(struct Depsgraph *depsgraph, - struct Object *obedit))[3]; -void BKE_crazyspace_set_quats_editmesh(struct BMEditMesh *em, - float (*origcos)[3], - float (*mappedcos)[3], - float (*quats)[4], - bool use_select); -void BKE_crazyspace_set_quats_mesh(struct Mesh *me, - float (*origcos)[3], - float (*mappedcos)[3], - float (*quats)[4]); -/** - * Returns an array of deform matrices for crazy-space correction, - * and the number of modifiers left. - */ -int BKE_crazyspace_get_first_deform_matrices_editbmesh(struct Depsgraph *depsgraph, - struct Scene *, - struct Object *, - struct BMEditMesh *em, - float (**deformmats)[3][3], - float (**deformcos)[3]); -int BKE_sculpt_get_first_deform_matrices(struct Depsgraph *depsgraph, - struct Scene *scene, - struct Object *ob, - float (**deformmats)[3][3], - float (**deformcos)[3]); -void BKE_crazyspace_build_sculpt(struct Depsgraph *depsgraph, - struct Scene *scene, - struct Object *ob, - float (**deformmats)[3][3], - float (**deformcos)[3]); - -/* -------------------------------------------------------------------- */ -/** \name Crazy-Space API - * \{ */ - -void BKE_crazyspace_api_eval(struct Depsgraph *depsgraph, - struct Scene *scene, - struct Object *object, - struct ReportList *reports); - -void BKE_crazyspace_api_displacement_to_deformed(struct Object *object, - struct ReportList *reports, - int vertex_index, - const float displacement[3], - float r_displacement_deformed[3]); - -void BKE_crazyspace_api_displacement_to_original(struct Object *object, - struct ReportList *reports, - int vertex_index, - const float displacement_deformed[3], - float r_displacement[3]); - -void BKE_crazyspace_api_eval_clear(struct Object *object); - -/** \} */ - -#ifdef __cplusplus -} -#endif diff --git a/source/blender/blenkernel/BKE_crazyspace.hh b/source/blender/blenkernel/BKE_crazyspace.hh index 4e967b619bb..ade4613b306 100644 --- a/source/blender/blenkernel/BKE_crazyspace.hh +++ b/source/blender/blenkernel/BKE_crazyspace.hh @@ -11,8 +11,12 @@ #include "BLI_math_matrix.hh" #include "BLI_span.hh" +struct BMEditMesh; struct Depsgraph; +struct Mesh; struct Object; +struct ReportList; +struct Scene; namespace blender::bke::crazyspace { @@ -61,3 +65,62 @@ GeometryDeformation get_evaluated_grease_pencil_drawing_deformation(const Depsgr int frame); } // namespace blender::bke::crazyspace + +/** + * Disable subdivision-surface temporal, get mapped coordinates, and enable it. + */ +float (*BKE_crazyspace_get_mapped_editverts(Depsgraph *depsgraph, Object *obedit))[3]; +void BKE_crazyspace_set_quats_editmesh(BMEditMesh *em, + float (*origcos)[3], + float (*mappedcos)[3], + float (*quats)[4], + bool use_select); +void BKE_crazyspace_set_quats_mesh(Mesh *me, + float (*origcos)[3], + float (*mappedcos)[3], + float (*quats)[4]); +/** + * Returns an array of deform matrices for crazy-space correction, + * and the number of modifiers left. + */ +int BKE_crazyspace_get_first_deform_matrices_editbmesh(Depsgraph *depsgraph, + Scene *, + Object *, + BMEditMesh *em, + float (**deformmats)[3][3], + float (**deformcos)[3]); +int BKE_sculpt_get_first_deform_matrices(Depsgraph *depsgraph, + Scene *scene, + Object *ob, + float (**deformmats)[3][3], + float (**deformcos)[3]); +void BKE_crazyspace_build_sculpt(Depsgraph *depsgraph, + Scene *scene, + Object *ob, + float (**deformmats)[3][3], + float (**deformcos)[3]); + +/* -------------------------------------------------------------------- */ +/** \name Crazy-Space API + * \{ */ + +void BKE_crazyspace_api_eval(Depsgraph *depsgraph, + Scene *scene, + Object *object, + ReportList *reports); + +void BKE_crazyspace_api_displacement_to_deformed(Object *object, + ReportList *reports, + int vertex_index, + const float displacement[3], + float r_displacement_deformed[3]); + +void BKE_crazyspace_api_displacement_to_original(Object *object, + ReportList *reports, + int vertex_index, + const float displacement_deformed[3], + float r_displacement[3]); + +void BKE_crazyspace_api_eval_clear(Object *object); + +/** \} */ \ No newline at end of file diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 3955f6c1874..d759c795643 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -363,7 +363,6 @@ set(SRC BKE_constraint.h BKE_context.h BKE_cpp_types.h - BKE_crazyspace.h BKE_crazyspace.hh BKE_cryptomatte.h BKE_cryptomatte.hh diff --git a/source/blender/blenkernel/intern/crazyspace.cc b/source/blender/blenkernel/intern/crazyspace.cc index 24ea23dcfc6..74571f505e7 100644 --- a/source/blender/blenkernel/intern/crazyspace.cc +++ b/source/blender/blenkernel/intern/crazyspace.cc @@ -21,7 +21,6 @@ #include "BLI_utildefines.h" #include "BKE_DerivedMesh.h" -#include "BKE_crazyspace.h" #include "BKE_crazyspace.hh" #include "BKE_curves.hh" #include "BKE_editmesh.h" diff --git a/source/blender/blenkernel/intern/object.cc b/source/blender/blenkernel/intern/object.cc index 7d08b2c6fc7..b99d39067a4 100644 --- a/source/blender/blenkernel/intern/object.cc +++ b/source/blender/blenkernel/intern/object.cc @@ -76,7 +76,7 @@ #include "BKE_camera.h" #include "BKE_collection.h" #include "BKE_constraint.h" -#include "BKE_crazyspace.h" +#include "BKE_crazyspace.hh" #include "BKE_curve.h" #include "BKE_curves.hh" #include "BKE_deform.h" diff --git a/source/blender/blenkernel/intern/paint.cc b/source/blender/blenkernel/intern/paint.cc index 4f0f2987419..5118a58ea80 100644 --- a/source/blender/blenkernel/intern/paint.cc +++ b/source/blender/blenkernel/intern/paint.cc @@ -41,7 +41,7 @@ #include "BKE_ccg.h" #include "BKE_colortools.h" #include "BKE_context.h" -#include "BKE_crazyspace.h" +#include "BKE_crazyspace.hh" #include "BKE_deform.h" #include "BKE_gpencil_legacy.h" #include "BKE_idtype.h" diff --git a/source/blender/editors/object/object_shapekey.cc b/source/blender/editors/object/object_shapekey.cc index 81fbb7c940e..7bbb96ef7fe 100644 --- a/source/blender/editors/object/object_shapekey.cc +++ b/source/blender/editors/object/object_shapekey.cc @@ -30,7 +30,7 @@ #include "DNA_object_types.h" #include "BKE_context.h" -#include "BKE_crazyspace.h" +#include "BKE_crazyspace.hh" #include "BKE_key.h" #include "BKE_lattice.h" #include "BKE_main.h" diff --git a/source/blender/editors/transform/transform_convert_mesh.cc b/source/blender/editors/transform/transform_convert_mesh.cc index aecefe6938e..98a5213e1ea 100644 --- a/source/blender/editors/transform/transform_convert_mesh.cc +++ b/source/blender/editors/transform/transform_convert_mesh.cc @@ -21,7 +21,7 @@ #include "BLI_memarena.h" #include "BKE_context.h" -#include "BKE_crazyspace.h" +#include "BKE_crazyspace.hh" #include "BKE_editmesh.h" #include "BKE_mesh.hh" #include "BKE_modifier.h" diff --git a/source/blender/editors/transform/transform_convert_mesh_skin.cc b/source/blender/editors/transform/transform_convert_mesh_skin.cc index 4697c377db0..6abc7aa2ac2 100644 --- a/source/blender/editors/transform/transform_convert_mesh_skin.cc +++ b/source/blender/editors/transform/transform_convert_mesh_skin.cc @@ -15,7 +15,7 @@ #include "BLI_math_vector.h" #include "BKE_context.h" -#include "BKE_crazyspace.h" +#include "BKE_crazyspace.hh" #include "BKE_editmesh.h" #include "BKE_modifier.h" #include "BKE_scene.h" diff --git a/source/blender/makesrna/intern/rna_object_api.cc b/source/blender/makesrna/intern/rna_object_api.cc index eefbadbab2d..f2cc7abe820 100644 --- a/source/blender/makesrna/intern/rna_object_api.cc +++ b/source/blender/makesrna/intern/rna_object_api.cc @@ -54,7 +54,7 @@ static const EnumPropertyItem space_items[] = { # include "BKE_bvhutils.h" # include "BKE_constraint.h" # include "BKE_context.h" -# include "BKE_crazyspace.h" +# include "BKE_crazyspace.hh" # include "BKE_customdata.h" # include "BKE_global.h" # include "BKE_layer.h"