[Bf-blender-cvs] [74e01d2235f] blender2.8: Multi-Objects: ARMATURE_OT_split

Dalai Felinto noreply at git.blender.org
Fri Oct 5 22:58:22 CEST 2018


Commit: 74e01d2235f5a71ef55d97ccd80a2eebded8a62e
Author: Dalai Felinto
Date:   Fri Oct 5 17:55:54 2018 -0300
Branches: blender2.8
https://developer.blender.org/rB74e01d2235f5a71ef55d97ccd80a2eebded8a62e

Multi-Objects: ARMATURE_OT_split

===================================================================

M	source/blender/editors/armature/armature_edit.c

===================================================================

diff --git a/source/blender/editors/armature/armature_edit.c b/source/blender/editors/armature/armature_edit.c
index 7d469342b8c..2e0d49b9683 100644
--- a/source/blender/editors/armature/armature_edit.c
+++ b/source/blender/editors/armature/armature_edit.c
@@ -1323,22 +1323,28 @@ void ARMATURE_OT_align(wmOperatorType *ot)
 
 static int armature_split_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Object *ob = CTX_data_edit_object(C);
-	bArmature *arm = (bArmature *)ob->data;
-	EditBone *bone;
+	ViewLayer *view_layer = CTX_data_view_layer(C);
+
+	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;
 
-	for (bone = arm->edbo->first; bone; bone = bone->next) {
-		if (bone->parent && (bone->flag & BONE_SELECTED) != (bone->parent->flag & BONE_SELECTED)) {
-			bone->parent = NULL;
-			bone->flag &= ~BONE_CONNECTED;
+		for (EditBone *bone = arm->edbo->first; bone; bone = bone->next) {
+			if (bone->parent && (bone->flag & BONE_SELECTED) != (bone->parent->flag & BONE_SELECTED)) {
+				bone->parent = NULL;
+				bone->flag &= ~BONE_CONNECTED;
+			}
+		}
+		for (EditBone *bone = arm->edbo->first; bone; bone = bone->next) {
+			ED_armature_ebone_select_set(bone, (bone->flag & BONE_SELECTED) != 0);
 		}
-	}
-	for (bone = arm->edbo->first; bone; bone = bone->next) {
-		ED_armature_ebone_select_set(bone, (bone->flag & BONE_SELECTED) != 0);
-	}
 
-	WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob);
+		WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob);
+	}
 
+	MEM_freeN(objects);
 	return OPERATOR_FINISHED;
 }



More information about the Bf-blender-cvs mailing list