Refactor: Move ReportList definition from DNA to blenkernel

Ever since [0], ReportList is not actually used in any DNA structs.
That makes sense, since reports are conceptually only necessary
at runtime. Move the definition of the struct to BKE_report.hh, and
fix a bunch of include errors where types were previously available
transitively. Besides adding some clarity, theoretically this change
could reduce compile times because of less header parsing.

[0]: 1bf6d8b0b9

Pull Request: https://projects.blender.org/blender/blender/pulls/138872
This commit is contained in:
Hans Goudey
2025-07-24 15:59:52 +02:00
committed by Hans Goudey
parent 623d3c04e2
commit 9c9695b103
41 changed files with 118 additions and 76 deletions

View File

@@ -16,7 +16,8 @@
#include "DNA_anim_types.h"
#include "DNA_userdef_types.h"
#include "DNA_windowmanager_types.h"
#include "BKE_report.hh"
#include "RNA_path.hh"
#include "RNA_types.hh"

View File

@@ -16,6 +16,7 @@
#include "BKE_nla.hh"
#include "DNA_constraint_types.h"
#include "DNA_object_types.h"
#include "RNA_access.hh"
#include "RNA_prototypes.hh"

View File

@@ -8,6 +8,7 @@
#include "BKE_fcurve.hh"
#include "BLI_map.hh"
#include "BLI_math_base.hh"
#include "CLG_log.h"

View File

@@ -16,6 +16,8 @@
#include "DEG_depsgraph.hh"
#include "DNA_object_types.h"
#include "ANIM_action.hh"
#include "ANIM_pose.hh"

View File

@@ -11,7 +11,12 @@
#include <cstdio>
#include "BLI_compiler_attrs.h"
#include "DNA_windowmanager_types.h"
#include "BLI_mutex.hh"
#include "BLI_utildefines.h"
#include "DNA_listBase.h"
struct wmTimer;
struct CLG_LogRef;
@@ -24,6 +29,62 @@ struct CLG_LogRef;
* printed to the console then.
*/
/** Keep in sync with 'rna_enum_wm_report_items' in `wm_rna.c`. */
enum eReportType : uint16_t {
RPT_DEBUG = (1 << 0),
RPT_INFO = (1 << 1),
RPT_OPERATOR = (1 << 2),
RPT_PROPERTY = (1 << 3),
RPT_WARNING = (1 << 4),
RPT_ERROR = (1 << 5),
RPT_ERROR_INVALID_INPUT = (1 << 6),
RPT_ERROR_INVALID_CONTEXT = (1 << 7),
RPT_ERROR_OUT_OF_MEMORY = (1 << 8),
};
ENUM_OPERATORS(eReportType, RPT_ERROR_OUT_OF_MEMORY)
#define RPT_DEBUG_ALL (RPT_DEBUG)
#define RPT_INFO_ALL (RPT_INFO)
#define RPT_OPERATOR_ALL (RPT_OPERATOR)
#define RPT_PROPERTY_ALL (RPT_PROPERTY)
#define RPT_WARNING_ALL (RPT_WARNING)
#define RPT_ERROR_ALL \
(RPT_ERROR | RPT_ERROR_INVALID_INPUT | RPT_ERROR_INVALID_CONTEXT | RPT_ERROR_OUT_OF_MEMORY)
enum ReportListFlags {
RPT_PRINT = (1 << 0),
RPT_STORE = (1 << 1),
RPT_FREE = (1 << 2),
RPT_OP_HOLD = (1 << 3), /* don't move them into the operator global list (caller will use) */
/** Don't print (the owner of the #ReportList will handle printing to the `stdout`). */
RPT_PRINT_HANDLED_BY_OWNER = (1 << 4),
};
struct Report {
Report *next, *prev;
/** eReportType. */
short type;
short flag;
/** `strlen(message)`, saves some time calculating the word wrap. */
int len;
const char *typestr;
const char *message;
};
struct ReportList {
ListBase list;
/** #eReportType. */
int printlevel;
/** #eReportType. */
int storelevel;
int flag;
char _pad[4];
wmTimer *reporttimer;
/** Mutex for thread-safety, runtime only. */
std::mutex *lock;
};
/* Report structures are stored in DNA. */
/**

View File

@@ -13,6 +13,8 @@ struct GSet;
struct wmIMEData;
#endif
#include "BKE_report.hh"
#include "DNA_windowmanager_types.h"
namespace blender::bke {

View File

@@ -15,6 +15,7 @@
#include "DNA_attribute_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_userdef_types.h"
#include "BKE_attribute.hh"
#include "BKE_attribute_legacy_convert.hh"

View File

@@ -10,6 +10,7 @@
#include "BKE_report.hh"
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
#include "MOD_nodes.hh"

View File

@@ -21,6 +21,7 @@
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_windowmanager_types.h"
#include "BLI_fileops.h"
#include "BLI_function_ref.hh"

View File

@@ -25,6 +25,7 @@
#include "DNA_curves_types.h"
#include "DNA_material_types.h"
#include "DNA_object_types.h"
#include "BKE_attribute.hh"
#include "BKE_attribute_legacy_convert.hh"

View File

@@ -20,6 +20,8 @@
#include "DNA_customdata_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_modifier_enums.h"
#include "DNA_userdef_types.h"
#include "DNA_vec_types.h"
#include "BLI_bit_vector.hh"
#include "BLI_bitmap.h"

View File

@@ -58,6 +58,7 @@
#include "DNA_scene_types.h"
#include "DNA_sequence_types.h"
#include "DNA_userdef_types.h"
#include "DNA_windowmanager_types.h"
#include "DNA_world_types.h"
#include "BLI_math_vector.h"

View File

@@ -27,6 +27,8 @@
#include "DNA_defaults.h"
#include "DNA_mask_types.h"
#include "DNA_movieclip_types.h"
#include "DNA_object_types.h"
#include "BKE_animsys.h"
#include "BKE_curve.hh"

View File

@@ -62,6 +62,7 @@
#include "BKE_multires.hh"
#include "BKE_object.hh"
#include "BKE_pointcache.h"
#include "BKE_report.hh"
#include "BKE_screen.hh"
/* may move these, only for BKE_modifier_path_relbase */

View File

@@ -31,7 +31,6 @@
#pragma once
#include "DNA_sdna_type_ids.hh"
#include "DNA_windowmanager_types.h" /* for eReportType */
#include "BLI_function_ref.hh"
#include "BLI_implicit_sharing.hh"
@@ -44,7 +43,10 @@ struct BlendDataReader;
struct BlendFileReadReport;
struct BlendLibReader;
struct BlendWriter;
struct ID;
struct ListBase;
struct Main;
enum eReportType : uint16_t;
/* -------------------------------------------------------------------- */
/** \name Blend Write API

View File

@@ -41,8 +41,10 @@
#include "DNA_layer_types.h"
#include "DNA_node_types.h"
#include "DNA_packedFile_types.h"
#include "DNA_screen_types.h"
#include "DNA_sdna_types.h"
#include "DNA_userdef_types.h"
#include "DNA_windowmanager_types.h"
#include "MEM_alloc_string_storage.hh"
#include "MEM_guardedalloc.h"

View File

@@ -58,6 +58,7 @@
#include "DNA_text_types.h"
#include "DNA_texture_types.h"
#include "DNA_view3d_types.h"
#include "DNA_windowmanager_types.h"
#include "DNA_workspace_types.h"
#include "DNA_world_types.h"

View File

@@ -23,6 +23,7 @@
#include "DNA_modifier_types.h"
#include "DNA_node_types.h"
#include "DNA_particle_types.h"
#include "DNA_screen_types.h"
#include "DNA_sequence_types.h"
#include "DNA_world_types.h"
@@ -46,6 +47,7 @@
#include "BKE_node.hh"
#include "BKE_node_legacy_types.hh"
#include "BKE_node_runtime.hh"
#include "BKE_report.hh"
#include "BKE_scene.hh"
#include "BKE_texture.h"
#include "BKE_tracking.h"

View File

@@ -37,6 +37,7 @@
#include "BKE_material.hh"
#include "BKE_node.hh"
#include "BKE_node_legacy_types.hh"
#include "BKE_report.hh"
#include "MOV_enums.hh"

View File

@@ -17,6 +17,7 @@
#include "DNA_mesh_types.h"
#include "DNA_object_force_types.h"
#include "DNA_pointcloud_types.h"
#include "DNA_screen_types.h"
#include "DNA_sequence_types.h"
#include "BLI_listbase.h"

View File

@@ -42,6 +42,7 @@
#include "BKE_node_legacy_types.hh"
#include "BKE_node_runtime.hh"
#include "BKE_pointcache.h"
#include "BKE_report.hh"
#include "BLT_translation.hh"

View File

@@ -91,6 +91,7 @@
#include "DNA_print.hh"
#include "DNA_sdna_types.h"
#include "DNA_userdef_types.h"
#include "DNA_windowmanager_types.h"
#include "BLI_endian_defines.h"
#include "BLI_fileops.hh"

View File

@@ -13,6 +13,7 @@
#include "BKE_paint.hh"
#include "BKE_paint_bvh.hh"
#include "BKE_particle.h"
#include "BKE_report.hh"
#include "DEG_depsgraph_query.hh"

View File

@@ -21,6 +21,8 @@
#include "MEM_guardedalloc.h"
#include "DNA_ID.h"
#include "ED_asset_temp_id_consumer.hh"
namespace blender::ed::asset {

View File

@@ -17,16 +17,16 @@
#include "BLI_string_ref.hh"
#include "BLI_vector.hh"
#include "DNA_key_types.h"
#include "DNA_object_enums.h"
#include "DNA_userdef_enums.h"
#include "DNA_windowmanager_types.h"
struct Base;
struct Depsgraph;
struct EnumPropertyItem;
struct ID;
struct KeyBlock;
struct GpencilModifierData;
struct ListBase;
struct Main;
struct ModifierData;
struct Object;
@@ -43,6 +43,7 @@ struct uiLayout;
struct wmKeyConfig;
struct wmOperator;
struct wmOperatorType;
enum eReportType : uint16_t;
namespace blender::ed::object {

View File

@@ -9,7 +9,8 @@
#pragma once
#include "DNA_space_types.h"
#include "DNA_windowmanager_types.h"
#include "BKE_report.hh"
#include "ED_fileselect.hh"

View File

@@ -12,6 +12,8 @@
#include "BKE_blendfile.hh"
#include "DNA_screen_types.h"
#include "ED_fileselect.hh"
#include "file_intern.hh"

View File

@@ -8,6 +8,7 @@
* Instead of transforming the selection, move the 2D/3D cursor.
*/
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "MEM_guardedalloc.h"

View File

@@ -6,6 +6,7 @@
* \ingroup edtransform
*/
#include "DNA_screen_types.h"
#include "DNA_sequence_types.h"
#include "DNA_space_types.h"

View File

@@ -8,6 +8,7 @@
#include "MEM_guardedalloc.h"
#include "DNA_screen_types.h"
#include "DNA_sequence_types.h"
#include "DNA_space_types.h"

View File

@@ -27,6 +27,7 @@
#include "DNA_key_types.h"
#include "DNA_material_types.h"
#include "DNA_object_types.h"
#include "fbx_import_anim.hh"
#include "fbx_import_util.hh"

View File

@@ -21,6 +21,7 @@
#include "DNA_key_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "BKE_armature.hh"
#include "BKE_deform.hh"

View File

@@ -16,13 +16,6 @@
#include "DNA_ID.h"
#ifdef __cplusplus
# include <mutex>
using std_mutex_type = std::mutex;
#else
# define std_mutex_type void
#endif
/** Workaround to forward-declare C++ type in C header. */
#ifdef __cplusplus
namespace blender::bke {
@@ -68,68 +61,6 @@ struct wmTimer;
#define OP_MAX_TYPENAME 64
#define KMAP_MAX_NAME 64
/** Keep in sync with 'rna_enum_wm_report_items' in `wm_rna.c`. */
typedef enum eReportType {
RPT_DEBUG = (1 << 0),
RPT_INFO = (1 << 1),
RPT_OPERATOR = (1 << 2),
RPT_PROPERTY = (1 << 3),
RPT_WARNING = (1 << 4),
RPT_ERROR = (1 << 5),
RPT_ERROR_INVALID_INPUT = (1 << 6),
RPT_ERROR_INVALID_CONTEXT = (1 << 7),
RPT_ERROR_OUT_OF_MEMORY = (1 << 8),
} eReportType;
ENUM_OPERATORS(eReportType, RPT_ERROR_OUT_OF_MEMORY)
#define RPT_DEBUG_ALL (RPT_DEBUG)
#define RPT_INFO_ALL (RPT_INFO)
#define RPT_OPERATOR_ALL (RPT_OPERATOR)
#define RPT_PROPERTY_ALL (RPT_PROPERTY)
#define RPT_WARNING_ALL (RPT_WARNING)
#define RPT_ERROR_ALL \
(RPT_ERROR | RPT_ERROR_INVALID_INPUT | RPT_ERROR_INVALID_CONTEXT | RPT_ERROR_OUT_OF_MEMORY)
enum ReportListFlags {
RPT_PRINT = (1 << 0),
RPT_STORE = (1 << 1),
RPT_FREE = (1 << 2),
RPT_OP_HOLD = (1 << 3), /* don't move them into the operator global list (caller will use) */
/** Don't print (the owner of the #ReportList will handle printing to the `stdout`). */
RPT_PRINT_HANDLED_BY_OWNER = (1 << 4),
};
/* These two lines with # tell `makesdna` this struct can be excluded. */
#
#
typedef struct Report {
struct Report *next, *prev;
/** eReportType. */
short type;
short flag;
/** `strlen(message)`, saves some time calculating the word wrap. */
int len;
const char *typestr;
const char *message;
} Report;
/**
* \note Saved in the #wmWindowManager, don't remove.
*/
typedef struct ReportList {
ListBase list;
/** #eReportType. */
int printlevel;
/** #eReportType. */
int storelevel;
int flag;
char _pad[4];
struct wmTimer *reporttimer;
/** Mutex for thread-safety, runtime only. */
std_mutex_type *lock;
} ReportList;
/* Timer custom-data to control reports display. */
/* These two lines with # tell `makesdna` this struct can be excluded. */
#

View File

@@ -17,6 +17,8 @@
#ifdef RNA_RUNTIME
# include "DNA_windowmanager_types.h"
# include "BKE_global.hh"
# include "BKE_main.hh"
# include "BKE_mesh.hh"

View File

@@ -16,6 +16,7 @@
#include "DNA_defaults.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DEG_depsgraph_query.hh"

View File

@@ -17,6 +17,7 @@
#include "DNA_gpencil_modifier_types.h"
#include "DNA_node_types.h" /* For `GeometryNodeCurveSampleMode` */
#include "DNA_object_types.h"
#include "DNA_screen_types.h"
#include "BKE_curves.hh"
#include "BKE_geometry_set.hh"

View File

@@ -15,6 +15,8 @@
#include "DNA_defaults.h"
#include "DNA_gpencil_modifier_types.h"
#include "DNA_object_types.h"
#include "DNA_screen_types.h"
#include "BKE_colortools.hh"
#include "BKE_curves.hh"

View File

@@ -14,6 +14,7 @@
#include "DNA_defaults.h"
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
#include "DNA_screen_types.h"
#include "RNA_access.hh"

View File

@@ -15,6 +15,7 @@
#include "DNA_defaults.h"
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
#include "DNA_screen_types.h"
#include "RNA_access.hh"

View File

@@ -2,7 +2,6 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "DNA_windowmanager_types.h"
#include "NOD_geometry_nodes_bundle.hh"
#include "NOD_geometry_nodes_closure.hh"
#include "NOD_geometry_nodes_log.hh"
@@ -22,6 +21,7 @@
#include "BKE_node_legacy_types.hh"
#include "BKE_node_runtime.hh"
#include "BKE_node_socket_value.hh"
#include "BKE_report.hh"
#include "BKE_type_conversions.hh"
#include "BKE_volume.hh"
#include "BKE_volume_grid.hh"

View File

@@ -53,6 +53,8 @@
#include "MEM_guardedalloc.h"
#include "DNA_windowmanager_types.h"
#include "BKE_context.hh"
#include "BKE_global.hh" /* evil G.* */
#include "BKE_idprop.hh"