Blender V5.3
bmesh_error.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
10
11#include "bmesh_operator_api.hh"
12
13#include "bmesh_class.hh"
14
15namespace blender {
16
17/*----------- BMOP error system ----------*/
18
42
47void BMO_error_raise(BMesh *bm, BMOperator *owner, eBMOpErrorLevel level, const char *msg)
48 ATTR_NONNULL(1, 2, 4);
49
54bool BMO_error_get(BMesh *bm, const char **r_msg, BMOperator **r_op, eBMOpErrorLevel *r_level);
55bool BMO_error_get_at_level(BMesh *bm,
56 eBMOpErrorLevel level,
57 const char **r_msg,
58 BMOperator **r_op);
60
61/* Same as #BMO_error_get, only pops the error off the stack as well. */
62bool BMO_error_pop(BMesh *bm, const char **r_msg, BMOperator **r_op, eBMOpErrorLevel *r_level);
63void BMO_error_clear(BMesh *bm);
64
65/* This is meant for handling errors, like self-intersection test failures.
66 * it's dangerous to handle errors in general though, so disabled for now. */
67
68/* Catches an error raised by the op pointed to by catchop. */
69/* Not yet implemented. */
70// int BMO_error_catch_op(BMesh *bm, BMOperator *catchop, char **r_msg);
71
72#define BM_ELEM_INDEX_VALIDATE(_bm, _msg_a, _msg_b) \
73 BM_mesh_elem_index_validate(_bm, __FILE__ ":" STRINGIFY(__LINE__), __func__, _msg_a, _msg_b)
74
75/* BMESH_ASSERT */
76#ifdef WITH_ASSERT_ABORT
77# define _BMESH_DUMMY_ABORT abort
78#else
79# define _BMESH_DUMMY_ABORT() (void)0
80#endif
81
86#define BMESH_ASSERT(a) \
87 (void)((!(a)) ? ((fprintf(stderr, \
88 "BMESH_ASSERT failed: %s, %s(), %d at \'%s\'\n", \
89 __FILE__, \
90 __func__, \
91 __LINE__, \
92 STRINGIFY(a)), \
93 _BMESH_DUMMY_ABORT(), \
94 NULL)) : \
95 NULL)
96
97} // namespace blender
#define ATTR_NONNULL(...)
BMesh Iterators.
bool BMO_error_occurred_at_level(BMesh *bm, eBMOpErrorLevel level)
bool BMO_error_get_at_level(BMesh *bm, eBMOpErrorLevel level, const char **r_msg, BMOperator **r_op)
void BMO_error_clear(BMesh *bm)
void BMO_error_raise(BMesh *bm, BMOperator *owner, eBMOpErrorLevel level, const char *msg) ATTR_NONNULL(1
bool BMO_error_pop(BMesh *bm, const char **r_msg, BMOperator **r_op, eBMOpErrorLevel *r_level)
@ BMO_ERROR_WARN
@ BMO_ERROR_FATAL
@ BMO_ERROR_CANCEL
void bool BMO_error_get(BMesh *bm, const char **r_msg, BMOperator **r_op, eBMOpErrorLevel *r_level)