WIP #104054 Symmetize visible edit bones if nothing has been selected #105385
|
@ -1100,9 +1100,15 @@ static int armature_symmetrize_exec(bContext *C, wmOperator *op)
|
|||
const int direction = RNA_enum_get(op->ptr, "direction");
|
||||
const int axis = 0;
|
||||
|
||||
/* cancel if nothing selected */
|
||||
/* select all visible bones if nothing selected */
|
||||
if (CTX_DATA_COUNT(C, selected_bones) == 0) {
|
||||
|
||||
return OPERATOR_CANCELLED;
|
||||
CTX_DATA_BEGIN (C, EditBone *, ebone, visible_bones) {
|
||||
ebone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
|
||||
Sybren A. Stüvel
commented
The declaration and
This has the added advantage that now the variable can be The declaration and `if` can be reduced to:
```c
const bool is_selected = CTX_DATA_COUNT(C, selected_bones) > 0;
```
This has the added advantage that now the variable can be `const`.
|
||||
if (ebone->parent) {
|
||||
ebone->parent->flag |= BONE_TIPSEL;
|
||||
}
|
||||
}
|
||||
CTX_DATA_END;
|
||||
}
|
||||
|
||||
uint objects_len = 0;
|
||||
|
|
Loading…
Reference in New Issue
IMO
is_selected
doesn't quite cover the purpose. In other code I've used the nameis_selection_relevant
for this.