Blender  V3.3
bmesh_error.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #pragma once
4 
9 #include "bmesh_operator_api.h"
10 
11 /*----------- bmop error system ----------*/
12 
16 typedef enum eBMOpErrorLevel {
36 
41 void BMO_error_raise(BMesh *bm, BMOperator *owner, eBMOpErrorLevel level, const char *msg)
42  ATTR_NONNULL(1, 2, 4);
43 
48 bool BMO_error_get(BMesh *bm, const char **r_msg, BMOperator **r_op, eBMOpErrorLevel *r_level);
50  eBMOpErrorLevel level,
51  const char **r_msg,
52  BMOperator **r_op);
54 
55 /* Same as #BMO_error_get, only pops the error off the stack as well. */
56 bool BMO_error_pop(BMesh *bm, const char **r_msg, BMOperator **r_op, eBMOpErrorLevel *r_level);
57 void BMO_error_clear(BMesh *bm);
58 
59 /* This is meant for handling errors, like self-intersection test failures.
60  * it's dangerous to handle errors in general though, so disabled for now. */
61 
62 /* Catches an error raised by the op pointed to by catchop. */
63 /* Not yet implemented. */
64 // int BMO_error_catch_op(BMesh *bm, BMOperator *catchop, char **msg);
65 
66 #define BM_ELEM_INDEX_VALIDATE(_bm, _msg_a, _msg_b) \
67  BM_mesh_elem_index_validate(_bm, __FILE__ ":" STRINGIFY(__LINE__), __func__, _msg_a, _msg_b)
68 
69 /* BMESH_ASSERT */
70 #ifdef WITH_ASSERT_ABORT
71 # define _BMESH_DUMMY_ABORT abort
72 #else
73 # define _BMESH_DUMMY_ABORT() (void)0
74 #endif
75 
80 #define BMESH_ASSERT(a) \
81  (void)((!(a)) ? ((fprintf(stderr, \
82  "BMESH_ASSERT failed: %s, %s(), %d at \'%s\'\n", \
83  __FILE__, \
84  __func__, \
85  __LINE__, \
86  STRINGIFY(a)), \
87  _BMESH_DUMMY_ABORT(), \
88  NULL)) : \
89  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
Definition: bmesh_error.h:16
@ BMO_ERROR_WARN
Definition: bmesh_error.h:27
@ BMO_ERROR_FATAL
Definition: bmesh_error.h:34
@ BMO_ERROR_CANCEL
Definition: bmesh_error.h:21
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