Blender V4.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
11#include "bmesh_operator_api.hh"
12
13/*----------- BMOP error system ----------*/
14
38
43void BMO_error_raise(BMesh *bm, BMOperator *owner, eBMOpErrorLevel level, const char *msg)
44 ATTR_NONNULL(1, 2, 4);
45
50bool BMO_error_get(BMesh *bm, const char **r_msg, BMOperator **r_op, eBMOpErrorLevel *r_level);
52 eBMOpErrorLevel level,
53 const char **r_msg,
54 BMOperator **r_op);
56
57/* Same as #BMO_error_get, only pops the error off the stack as well. */
58bool BMO_error_pop(BMesh *bm, const char **r_msg, BMOperator **r_op, eBMOpErrorLevel *r_level);
60
61/* This is meant for handling errors, like self-intersection test failures.
62 * it's dangerous to handle errors in general though, so disabled for now. */
63
64/* Catches an error raised by the op pointed to by catchop. */
65/* Not yet implemented. */
66// int BMO_error_catch_op(BMesh *bm, BMOperator *catchop, char **r_msg);
67
68#define BM_ELEM_INDEX_VALIDATE(_bm, _msg_a, _msg_b) \
69 BM_mesh_elem_index_validate(_bm, __FILE__ ":" STRINGIFY(__LINE__), __func__, _msg_a, _msg_b)
70
71/* BMESH_ASSERT */
72#ifdef WITH_ASSERT_ABORT
73# define _BMESH_DUMMY_ABORT abort
74#else
75# define _BMESH_DUMMY_ABORT() (void)0
76#endif
77
82#define BMESH_ASSERT(a) \
83 (void)((!(a)) ? ((fprintf(stderr, \
84 "BMESH_ASSERT failed: %s, %s(), %d at \'%s\'\n", \
85 __FILE__, \
86 __func__, \
87 __LINE__, \
88 STRINGIFY(a)), \
89 _BMESH_DUMMY_ABORT(), \
90 NULL)) : \
91 NULL)
#define ATTR_NONNULL(...)
void BMO_error_clear(BMesh *bm)
bool BMO_error_get_at_level(BMesh *bm, eBMOpErrorLevel level, const char **r_msg, BMOperator **r_op)
eBMOpErrorLevel
@ BMO_ERROR_WARN
@ BMO_ERROR_FATAL
@ BMO_ERROR_CANCEL
bool BMO_error_occurred_at_level(BMesh *bm, eBMOpErrorLevel level)
void BMO_error_raise(BMesh *bm, BMOperator *owner, eBMOpErrorLevel level, const char *msg) ATTR_NONNULL(1
void bool BMO_error_get(BMesh *bm, const char **r_msg, BMOperator **r_op, eBMOpErrorLevel *r_level)
bool BMO_error_pop(BMesh *bm, const char **r_msg, BMOperator **r_op, eBMOpErrorLevel *r_level)
ATTR_WARN_UNUSED_RESULT BMesh * bm