Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/bmesh/intern')
-rw-r--r--source/blender/bmesh/intern/bmesh_error.h26
-rw-r--r--source/blender/bmesh/intern/bmesh_operators.c42
2 files changed, 18 insertions, 50 deletions
diff --git a/source/blender/bmesh/intern/bmesh_error.h b/source/blender/bmesh/intern/bmesh_error.h
index 587e33e7dfd..e9cdc120657 100644
--- a/source/blender/bmesh/intern/bmesh_error.h
+++ b/source/blender/bmesh/intern/bmesh_error.h
@@ -26,43 +26,27 @@
/* Pushes an error onto the bmesh error stack.
* if msg is null, then the default message for the `errcode` is used. */
-void BMO_error_raise(BMesh *bm, BMOperator *owner, int errcode, const char *msg);
+void BMO_error_raise(BMesh *bm, BMOperator *owner, const char *msg) ATTR_NONNULL(1, 2, 3);
/* Gets the topmost error from the stack.
* returns error code or 0 if no error. */
-int BMO_error_get(BMesh *bm, const char **msg, BMOperator **op);
+bool BMO_error_get(BMesh *bm, const char **r_msg, BMOperator **r_op);
bool BMO_error_occurred(BMesh *bm);
/* Same as #BMO_error_get, only pops the error off the stack as well. */
-int BMO_error_pop(BMesh *bm, const char **msg, BMOperator **op);
+bool BMO_error_pop(BMesh *bm, const char **r_msg, BMOperator **r_op);
void BMO_error_clear(BMesh *bm);
/* This is meant for handling errors, like self-intersection test failures.
* it's dangerous to handle errors in general though, so disabled for now. */
-/* Catches an error raised by the op pointed to by catchop.
- * errorcode is either the errorcode, or BMERR_ALL for any
- * error. */
-
+/* Catches an error raised by the op pointed to by catchop. */
/* Not yet implemented. */
-// int BMO_error_catch_op(BMesh *bm, BMOperator *catchop, int errorcode, char **msg);
+// int BMO_error_catch_op(BMesh *bm, BMOperator *catchop, char **msg);
#define BM_ELEM_INDEX_VALIDATE(_bm, _msg_a, _msg_b) \
BM_mesh_elem_index_validate(_bm, __FILE__ ":" STRINGIFY(__LINE__), __func__, _msg_a, _msg_b)
-/*------ error code defines -------*/
-
-/** Error messages. */
-enum {
- BMERR_CONNECTVERT_FAILED = 1,
- BMERR_DISSOLVEFACES_FAILED,
- BMERR_INVALID_SELECTION,
- BMERR_MESH_ERROR,
- BMERR_CONVEX_HULL_FAILED,
-
- BMERR_TOTAL,
-};
-
/* BMESH_ASSERT */
#ifdef WITH_ASSERT_ABORT
# define _BMESH_DUMMY_ABORT abort
diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c
index 65285d8d464..303b5336a5c 100644
--- a/source/blender/bmesh/intern/bmesh_operators.c
+++ b/source/blender/bmesh/intern/bmesh_operators.c
@@ -42,17 +42,6 @@ static int bmo_name_to_slotcode(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char
static int bmo_name_to_slotcode_check(BMOpSlot slot_args[BMO_OP_MAX_SLOTS],
const char *identifier);
-static const char *bmo_error_messages[] = {
- NULL,
- N_("Could not connect vertices"),
- N_("Could not dissolve faces"),
- N_("Invalid selection"),
- N_("Internal mesh error"),
- N_("Convex hull failed"),
-};
-
-BLI_STATIC_ASSERT(ARRAY_SIZE(bmo_error_messages) == BMERR_TOTAL, "message mismatch");
-
/* operator slot type information - size of one element of the type given. */
const int BMO_OPSLOT_TYPEINFO[BMO_OP_SLOT_TOTAL_TYPES] = {
0, /* 0: BMO_OP_SLOT_SENTINEL */
@@ -1562,7 +1551,6 @@ bool BMO_iter_map_value_bool(BMOIter *iter)
/* error system */
typedef struct BMOpError {
struct BMOpError *next, *prev;
- int errorcode;
BMOperator *op;
const char *msg;
} BMOpError;
@@ -1574,14 +1562,10 @@ void BMO_error_clear(BMesh *bm)
}
}
-void BMO_error_raise(BMesh *bm, BMOperator *owner, int errcode, const char *msg)
+void BMO_error_raise(BMesh *bm, BMOperator *owner, const char *msg)
{
BMOpError *err = MEM_callocN(sizeof(BMOpError), "bmop_error");
- err->errorcode = errcode;
- if (!msg) {
- msg = bmo_error_messages[errcode];
- }
err->msg = msg;
err->op = owner;
@@ -1594,35 +1578,35 @@ bool BMO_error_occurred(BMesh *bm)
}
/* returns error code or 0 if no error */
-int BMO_error_get(BMesh *bm, const char **msg, BMOperator **op)
+bool BMO_error_get(BMesh *bm, const char **r_msg, BMOperator **r_op)
{
BMOpError *err = bm->errorstack.first;
- if (!err) {
- return 0;
+ if (err == NULL) {
+ return false;
}
- if (msg) {
- *msg = err->msg;
+ if (r_msg) {
+ *r_msg = err->msg;
}
- if (op) {
- *op = err->op;
+ if (r_op) {
+ *r_op = err->op;
}
- return err->errorcode;
+ return true;
}
-int BMO_error_pop(BMesh *bm, const char **msg, BMOperator **op)
+bool BMO_error_pop(BMesh *bm, const char **msg, BMOperator **op)
{
- int errorcode = BMO_error_get(bm, msg, op);
+ bool result = BMO_error_get(bm, msg, op);
- if (errorcode) {
+ if (result) {
BMOpError *err = bm->errorstack.first;
BLI_remlink(&bm->errorstack, bm->errorstack.first);
MEM_freeN(err);
}
- return errorcode;
+ return result;
}
#define NEXT_CHAR(fmt) ((fmt)[0] != 0 ? (fmt)[1] : 0)