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-12 19:39:02 +0300
committerDalai Felinto <dfelinto@gmail.com>2018-10-12 19:49:55 +0300
commit2677e99217050e69193c0eab881e4d64c505a932 (patch)
tree9eea0500400f914fe83c7a44a71cb7fb10ba1a40
parentd95bb08f395ace3fdfed71058658b7acef458ded (diff)
Revert "Multi-Objects: ARMATURE_OT_select_hierarchy"
This reverts commit dcc623e7e7ead1e0d060f455a92567390c6c1911.
-rw-r--r--source/blender/editors/armature/armature_select.c114
1 files changed, 52 insertions, 62 deletions
diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c
index 7c15c924bd0..b47416b5d5f 100644
--- a/source/blender/editors/armature/armature_select.c
+++ b/source/blender/editors/armature/armature_select.c
@@ -1339,91 +1339,81 @@ void ARMATURE_OT_select_similar(wmOperatorType *ot)
/* ********************* select hierarchy operator ************** */
+/* No need to convert to multi-objects. Just like we keep the non-active bones
+ * selected we then keep the non-active objects untouched (selected/unselected). */
static int armature_select_hierarchy_exec(bContext *C, wmOperator *op)
{
- ViewLayer *view_layer = CTX_data_view_layer(C);
-
- const int direction = RNA_enum_get(op->ptr, "direction");
+ Object *ob = CTX_data_edit_object(C);
+ EditBone *ebone_active;
+ int direction = RNA_enum_get(op->ptr, "direction");
const bool add_to_sel = RNA_boolean_get(op->ptr, "extend");
+ bool changed = false;
+ bArmature *arm = (bArmature *)ob->data;
- 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;
-
- EditBone *ebone_active;
- bool changed = false;
-
- arm = (bArmature *)ob->data;
-
- ebone_active = arm->act_edbone;
- if (ebone_active == NULL) {
- continue;
- }
-
- if (direction == BONE_SELECT_PARENT) {
- if (ebone_active->parent) {
- EditBone *ebone_parent;
+ ebone_active = arm->act_edbone;
+ if (ebone_active == NULL) {
+ return OPERATOR_CANCELLED;
+ }
- ebone_parent = ebone_active->parent;
+ if (direction == BONE_SELECT_PARENT) {
+ if (ebone_active->parent) {
+ EditBone *ebone_parent;
- if (EBONE_SELECTABLE(arm, ebone_parent)) {
- arm->act_edbone = ebone_parent;
+ ebone_parent = ebone_active->parent;
- if (!add_to_sel) {
- ED_armature_ebone_select_set(ebone_active, false);
- }
- ED_armature_ebone_select_set(ebone_parent, true);
+ if (EBONE_SELECTABLE(arm, ebone_parent)) {
+ arm->act_edbone = ebone_parent;
- changed = true;
+ if (!add_to_sel) {
+ ED_armature_ebone_select_set(ebone_active, false);
}
- }
+ ED_armature_ebone_select_set(ebone_parent, true);
+ changed = true;
+ }
}
- else { /* BONE_SELECT_CHILD */
- EditBone *ebone_iter, *ebone_child = NULL;
- int pass;
-
- /* First pass, only connected bones (the logical direct child)/ */
- for (pass = 0; pass < 2 && (ebone_child == NULL); pass++) {
- for (ebone_iter = arm->edbo->first; ebone_iter; ebone_iter = ebone_iter->next) {
- /* Possible we have multiple children, some invisible. */
- if (EBONE_SELECTABLE(arm, ebone_iter)) {
- if (ebone_iter->parent == ebone_active) {
- if ((pass == 1) || (ebone_iter->flag & BONE_CONNECTED)) {
- ebone_child = ebone_iter;
- break;
- }
+
+ }
+ else { /* BONE_SELECT_CHILD */
+ EditBone *ebone_iter, *ebone_child = NULL;
+ int pass;
+
+ /* first pass, only connected bones (the logical direct child) */
+ for (pass = 0; pass < 2 && (ebone_child == NULL); pass++) {
+ for (ebone_iter = arm->edbo->first; ebone_iter; ebone_iter = ebone_iter->next) {
+ /* possible we have multiple children, some invisible */
+ if (EBONE_SELECTABLE(arm, ebone_iter)) {
+ if (ebone_iter->parent == ebone_active) {
+ if ((pass == 1) || (ebone_iter->flag & BONE_CONNECTED)) {
+ ebone_child = ebone_iter;
+ break;
}
}
}
}
+ }
- if (ebone_child) {
- arm->act_edbone = ebone_child;
+ if (ebone_child) {
+ arm->act_edbone = ebone_child;
- if (!add_to_sel) {
- ED_armature_ebone_select_set(ebone_active, false);
- }
- ED_armature_ebone_select_set(ebone_child, true);
-
- changed = true;
+ if (!add_to_sel) {
+ ED_armature_ebone_select_set(ebone_active, false);
}
- }
+ ED_armature_ebone_select_set(ebone_child, true);
- if (changed == false) {
- continue;
+ changed = true;
}
+ }
- multi_changed = true;
- ED_armature_edit_sync_selection(arm->edbo);
- WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob);
+ if (changed == false) {
+ return OPERATOR_CANCELLED;
}
- MEM_freeN(objects);
- return multi_changed ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
+ ED_armature_edit_sync_selection(arm->edbo);
+
+ WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob);
+
+ return OPERATOR_FINISHED;
}
void ARMATURE_OT_select_hierarchy(wmOperatorType *ot)