Blender V5.3
mesh_debug.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
13
14#ifndef NDEBUG
15
16# include <cstdio>
17
18# include "MEM_guardedalloc.h"
19
20# include "DNA_mesh_types.h"
21
22# include "BKE_customdata.hh"
23
24# include "BKE_mesh.hh"
25
26# include "BLI_dynstr.hh"
27
28namespace blender {
29
31{
32 DynStr *dynstr = BLI_dynstr_new();
33 char *ret;
34
35 const char *indent8 = " ";
36
37 BLI_dynstr_append(dynstr, "{\n");
38 BLI_dynstr_appendf(dynstr, " 'ptr': '%p',\n", mesh);
39 BLI_dynstr_appendf(dynstr, " 'totvert': %d,\n", mesh->verts_num);
40 BLI_dynstr_appendf(dynstr, " 'totedge': %d,\n", mesh->edges_num);
41 BLI_dynstr_appendf(dynstr, " 'totface': %d,\n", mesh->totface_legacy);
42 BLI_dynstr_appendf(dynstr, " 'faces_num': %d,\n", mesh->faces_num);
43
44 BLI_dynstr_appendf(dynstr, " 'runtime.deformed_only': %d,\n", mesh->runtime->deformed_only);
46 dynstr, " 'runtime->is_original_bmesh': %d,\n", mesh->runtime->is_original_bmesh);
47
48 BLI_dynstr_append(dynstr, " 'vert_layers': (\n");
49 CustomData_debug_info_from_layers(&mesh->vert_data, indent8, dynstr);
50 BLI_dynstr_append(dynstr, " ),\n");
51
52 BLI_dynstr_append(dynstr, " 'edge_layers': (\n");
53 CustomData_debug_info_from_layers(&mesh->edge_data, indent8, dynstr);
54 BLI_dynstr_append(dynstr, " ),\n");
55
56 BLI_dynstr_append(dynstr, " 'loop_layers': (\n");
57 CustomData_debug_info_from_layers(&mesh->corner_data, indent8, dynstr);
58 BLI_dynstr_append(dynstr, " ),\n");
59
60 BLI_dynstr_append(dynstr, " 'poly_layers': (\n");
61 CustomData_debug_info_from_layers(&mesh->face_data, indent8, dynstr);
62 BLI_dynstr_append(dynstr, " ),\n");
63
64 BLI_dynstr_append(dynstr, " 'tessface_layers': (\n");
65 CustomData_debug_info_from_layers(&mesh->fdata_legacy, indent8, dynstr);
66 BLI_dynstr_append(dynstr, " ),\n");
67
68 BLI_dynstr_append(dynstr, "}\n");
69
71 BLI_dynstr_free(dynstr);
72 return ret;
73}
74
76{
78 puts(str);
79 fflush(stdout);
80 MEM_delete(str);
81}
82
83} // namespace blender
84
85#endif /* !NDEBUG */
CustomData interface, see also DNA_customdata_types.h.
A dynamically sized string ADT.
Read Blender memory allocation and freeing.
#define str(s)
BMesh Iterators.
void BLI_dynstr_appendf(DynStr *__restrict ds, const char *__restrict format,...) ATTR_PRINTF_FORMAT(2
void BLI_dynstr_free(DynStr *ds) ATTR_NONNULL()
void BLI_dynstr_append(DynStr *__restrict ds, const char *cstr) ATTR_NONNULL()
Definition BLI_dynstr.cc:58
char * BKE_mesh_debug_info(const Mesh *mesh) ATTR_NONNULL(1) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
Definition mesh_debug.cc:30
char * BLI_dynstr_get_cstring(const DynStr *ds) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BKE_mesh_debug_print(const Mesh *mesh) ATTR_NONNULL(1)
Definition mesh_debug.cc:75
void CustomData_debug_info_from_layers(const CustomData *data, const char *indent, DynStr *dynstr)
DynStr * BLI_dynstr_new() ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
Definition BLI_dynstr.cc:39