Blender V5.0
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
15/*----------- BMOP error system ----------*/
16
40
45void BMO_error_raise(BMesh *bm, BMOperator *owner, eBMOpErrorLevel level, const char *msg)
46 ATTR_NONNULL(1, 2, 4);
47
52bool BMO_error_get(BMesh *bm, const char **r_msg, BMOperator **r_op, eBMOpErrorLevel *r_level);
54 eBMOpErrorLevel level,
55 const char **r_msg,
56 BMOperator **r_op);
58
59/* Same as #BMO_error_get, only pops the error off the stack as well. */
60bool BMO_error_pop(BMesh *bm, const char **r_msg, BMOperator **r_op, eBMOpErrorLevel *r_level);
62
63/* This is meant for handling errors, like self-intersection test failures.
64 * it's dangerous to handle errors in general though, so disabled for now. */
65
66/* Catches an error raised by the op pointed to by catchop. */
67/* Not yet implemented. */
68// int BMO_error_catch_op(BMesh *bm, BMOperator *catchop, char **r_msg);
69
70#define BM_ELEM_INDEX_VALIDATE(_bm, _msg_a, _msg_b) \
71 BM_mesh_elem_index_validate(_bm, __FILE__ ":" STRINGIFY(__LINE__), __func__, _msg_a, _msg_b)
72
73/* BMESH_ASSERT */
74#ifdef WITH_ASSERT_ABORT
75# define _BMESH_DUMMY_ABORT abort
76#else
77# define _BMESH_DUMMY_ABORT() (void)0
78#endif
79
84#define BMESH_ASSERT(a) \
85 (void)((!(a)) ? ((fprintf(stderr, \
86 "BMESH_ASSERT failed: %s, %s(), %d at \'%s\'\n", \
87 __FILE__, \
88 __func__, \
89 __LINE__, \
90 STRINGIFY(a)), \
91 _BMESH_DUMMY_ABORT(), \
92 NULL)) : \
93 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)
BMesh * bm