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:
authorLukas Tönne <lukas.toenne@gmail.com>2021-07-01 13:48:03 +0300
committerLukas Tönne <lukas.toenne@gmail.com>2021-07-01 13:48:03 +0300
commitd35969a74ff7a71fc0ca233ae65a2f1c47eb9a25 (patch)
tree7d12896c3a481c9d0f43f5708624b6a7cddf204e /source/blender/bmesh/intern/bmesh_operators.c
parentefe2247e3cdb1006a5b1d87d76a96dc6a63ad12c (diff)
parent229c0580e2915b2dc349069ee7094d322408641f (diff)
Merge branch 'master' into geometry-nodes-unnamed-attributes
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_operators.c')
-rw-r--r--source/blender/bmesh/intern/bmesh_operators.c42
1 files changed, 13 insertions, 29 deletions
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)