armature editmode: option for select mirror to use active bone only.
This commit is contained in:
		@@ -1054,7 +1054,8 @@ static int armature_select_mirror_exec(bContext *C, wmOperator *op)
 | 
			
		||||
{
 | 
			
		||||
	Object *obedit = CTX_data_edit_object(C);
 | 
			
		||||
	bArmature *arm = obedit->data;
 | 
			
		||||
	EditBone *ebone;
 | 
			
		||||
	EditBone *ebone, *ebone_mirror_act = NULL;
 | 
			
		||||
	const bool active_only = RNA_boolean_get(op->ptr, "only_active");
 | 
			
		||||
	const bool extend = RNA_boolean_get(op->ptr, "extend");
 | 
			
		||||
 | 
			
		||||
	for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
 | 
			
		||||
@@ -1072,12 +1073,25 @@ static int armature_select_mirror_exec(bContext *C, wmOperator *op)
 | 
			
		||||
			{
 | 
			
		||||
				const int flag_mirror = EBONE_PREV_FLAG_GET(ebone_mirror);
 | 
			
		||||
				flag_new |= flag_mirror;
 | 
			
		||||
 | 
			
		||||
				if (ebone == arm->act_edbone) {
 | 
			
		||||
					ebone_mirror_act = ebone_mirror;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				/* skip all but the active or its mirror */
 | 
			
		||||
				if (active_only && !ELEM(arm->act_edbone, ebone, ebone_mirror)) {
 | 
			
		||||
					continue;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			ED_armature_ebone_selectflag_set(ebone, flag_new);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (ebone_mirror_act) {
 | 
			
		||||
		arm->act_edbone = ebone_mirror_act;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	ED_armature_sync_selection(arm->edbo);
 | 
			
		||||
 | 
			
		||||
	WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit);
 | 
			
		||||
@@ -1100,5 +1114,6 @@ void ARMATURE_OT_select_mirror(wmOperatorType *ot)
 | 
			
		||||
	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 | 
			
		||||
 | 
			
		||||
	/* properties */
 | 
			
		||||
	RNA_def_boolean(ot->srna, "only_active", false, "Active Only", "Only operate on the active bone");
 | 
			
		||||
	RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend the selection");
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -887,5 +887,9 @@ void POSE_OT_select_flip_active(wmOperatorType *ot)
 | 
			
		||||
	
 | 
			
		||||
	/* flags */
 | 
			
		||||
	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 | 
			
		||||
 | 
			
		||||
	/* properties */
 | 
			
		||||
	RNA_def_boolean(ot->srna, "only_active", false, "Active Only", "Only operate on the active bone");
 | 
			
		||||
	RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend the selection");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user