Bone Aligner for aligning bones in Edit Mode based on their names.
It offers two functions:
Active to Selected: Aligns the active bone to a selected bone with the same name.
Selected to Active: Aligns a selected bone with the same name to the active bone.
Includes a case-sensitive option and only works in Edit Mode, with a prompt to switch modes if used elsewhere.
Ideal for aligning bones in armatures during animation or rigging, ensuring consistent bone positions and transforms.
Performance Optimization:Optimized bone name matching using a dictionary (selected_bone_dict), reducing matching time complexity from O(n*m) to O(n), significantly improving performance for large armatures. Rewrote get_sorted_bones function to use non-recursive topological sorting (DFS), improving efficiency for complex armatures and avoiding stack overflow.
Code Refactoring:Moved compare_names function to module level, shared by both operator classes (BONEALIGNER_OT_AlignActiveToSelected and BONEALIGNER_OT_AlignSelectedToActive), reducing code duplication. Refactored align_bones method to consolidate active_to_selected cases, minimizing redundant code.
UI Improvements:Added a prompt label in the UI panel: "Select two armatures to align their bones," clarifying user requirements. Optimized poll method to ensure the panel and buttons are only visible in Edit Mode with at least two armatures selected.
*Tested, version 3.6 can also run this plugin.
This extension does not require special permissions.