2
* ***** BEGIN GPL LICENSE BLOCK *****
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License
6
* as published by the Free Software Foundation; either version 2
7
* of the License, or (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software Foundation,
16
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
* Contributor(s): Joseph Eagar.
20
* ***** END GPL LICENSE BLOCK *****
23
#ifndef __BMESH_ERROR_H__
24
#define __BMESH_ERROR_H__
26
/** \file blender/bmesh/bmesh_error.h
30
/*----------- bmop error system ----------*/
32
/* pushes an error onto the bmesh error stack.
33
* if msg is null, then the default message for the errorcode is used.*/
34
void BMO_error_raise(BMesh *bm, BMOperator *owner, int errcode, const char *msg);
36
/* gets the topmost error from the stack.
37
* returns error code or 0 if no error.*/
38
int BMO_error_get(BMesh *bm, const char **msg, BMOperator **op);
39
int BMO_error_occurred(BMesh *bm);
41
/* same as geterror, only pops the error off the stack as well */
42
int BMO_error_pop(BMesh *bm, const char **msg, BMOperator **op);
43
void BMO_error_clear(BMesh *bm);
45
/* this is meant for handling errors, like self-intersection test failures.
46
* it's dangerous to handle errors in general though, so disabled for now. */
48
/* catches an error raised by the op pointed to by catchop.
49
* errorcode is either the errorcode, or BMERR_ALL for any
52
/* not yet implemented.
53
* int BMO_error_catch_op(BMesh *bm, BMOperator *catchop, int errorcode, char **msg);
56
#define BM_ELEM_INDEX_VALIDATE(_bm, _msg_a, _msg_b) \
57
BM_mesh_elem_index_validate(_bm, __FILE__ ":" STRINGIFY(__LINE__), __func__, _msg_a, _msg_b)
59
/*------ error code defines -------*/
62
#define BMERR_SELF_INTERSECTING 1
63
#define BMERR_DISSOLVEDISK_FAILED 2
64
#define BMERR_CONNECTVERT_FAILED 3
65
#define BMERR_WALKER_FAILED 4
66
#define BMERR_DISSOLVEFACES_FAILED 5
67
#define BMERR_DISSOLVEVERTS_FAILED 6
68
#define BMERR_TESSELLATION 7
69
#define BMERR_NONMANIFOLD 8
70
#define BMERR_INVALID_SELECTION 9
71
#define BMERR_MESH_ERROR 10
74
#ifdef WITH_ASSERT_ABORT
75
# define _BMESH_DUMMY_ABORT abort
77
# define _BMESH_DUMMY_ABORT() (void)0
80
/* this is meant to be higher level then BLI_assert(),
81
* its enabled even when in Release mode*/
82
#define BMESH_ASSERT(a) \
86
"BMESH_ASSERT failed: %s, %s(), %d at \'%s\'\n", \
87
__FILE__, __func__, __LINE__, STRINGIFY(a)), \
88
_BMESH_DUMMY_ABORT(), \
91
#endif /* __BMESH_ERROR_H__ */