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:
authorDalai Felinto <dfelinto@gmail.com>2018-10-05 19:20:23 +0300
committerDalai Felinto <dfelinto@gmail.com>2018-10-05 19:33:31 +0300
commit1d6817d5801f8543bfa43d561614fd64a3afd3f2 (patch)
tree748e9d0f1d2d32b18c21e6c4bf743d0a4ba37029 /source/blender/editors/armature/armature_add.c
parent234d609f9421f529a96a1d1850ace81b7c02ec0c (diff)
Fixes for ARMATURE_OT_extrude / ARMATURE_OT_extrude_move
* Return OPERATOR_FINISHED only if at least one object succeeded. * Have a per object fork value, otherwise an object may influence the next. (which is why we should use `const foo = ...; foo_iter = foo;`)
Diffstat (limited to 'source/blender/editors/armature/armature_add.c')
-rw-r--r--source/blender/editors/armature/armature_add.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/source/blender/editors/armature/armature_add.c b/source/blender/editors/armature/armature_add.c
index d7c816512e5..896b86fad68 100644
--- a/source/blender/editors/armature/armature_add.c
+++ b/source/blender/editors/armature/armature_add.c
@@ -844,13 +844,15 @@ void ARMATURE_OT_symmetrize(wmOperatorType *ot)
static int armature_extrude_exec(bContext *C, wmOperator *op)
{
ViewLayer *view_layer = CTX_data_view_layer(C);
- bool forked = RNA_boolean_get(op->ptr, "forked");
+ const bool forked = RNA_boolean_get(op->ptr, "forked");
+ bool multi_changed = false;
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len);
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *ob = objects[ob_index];
bArmature *arm = ob->data;
+ bool forked_iter = forked;
EditBone *newbone = NULL, *ebone, *flipbone, *first = NULL;
int a, totbone = 0, do_extrude;
@@ -891,12 +893,12 @@ static int armature_extrude_exec(bContext *C, wmOperator *op)
if (arm->flag & ARM_MIRROR_EDIT) {
flipbone = ED_armature_ebone_get_mirrored(arm->edbo, ebone);
if (flipbone) {
- forked = 0; // we extrude 2 different bones
+ forked_iter = 0; // we extrude 2 different bones
if (flipbone->flag & (BONE_TIPSEL | BONE_ROOTSEL | BONE_SELECTED))
/* don't want this bone to be selected... */
flipbone->flag &= ~(BONE_TIPSEL | BONE_SELECTED | BONE_ROOTSEL);
}
- if ((flipbone == NULL) && (forked))
+ if ((flipbone == NULL) && (forked_iter))
flipbone = ebone;
}
@@ -957,7 +959,7 @@ static int armature_extrude_exec(bContext *C, wmOperator *op)
BLI_strncpy(newbone->name, ebone->name, sizeof(newbone->name));
- if (flipbone && forked) { // only set if mirror edit
+ if (flipbone && forked_iter) { // only set if mirror edit
if (strlen(newbone->name) < (MAXBONENAME - 2)) {
if (a == 0) strcat(newbone->name, "_L");
else strcat(newbone->name, "_R");
@@ -992,6 +994,8 @@ static int armature_extrude_exec(bContext *C, wmOperator *op)
continue;
}
+ multi_changed = true;
+
/* Transform the endpoints */
ED_armature_edit_sync_selection(arm->edbo);
@@ -999,7 +1003,7 @@ static int armature_extrude_exec(bContext *C, wmOperator *op)
}
MEM_freeN(objects);
- return OPERATOR_FINISHED;
+ return multi_changed ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
void ARMATURE_OT_extrude(wmOperatorType *ot)