|
7 | 7 | pie_menu_classes = []
|
8 | 8 |
|
9 | 9 |
|
| 10 | +def get_modes(): |
| 11 | + """ |
| 12 | + This function gets all the ue2rigify modes |
| 13 | + """ |
| 14 | + properties = bpy.context.window_manager.ue2rigify |
| 15 | + return [ |
| 16 | + properties.source_mode, |
| 17 | + properties.metarig_mode, |
| 18 | + properties.fk_to_source_mode, |
| 19 | + properties.source_to_deform_mode, |
| 20 | + properties.control_mode |
| 21 | + ] |
| 22 | + |
| 23 | + |
10 | 24 | def get_picker_object():
|
11 | 25 | """
|
12 | 26 | This function gets or creates a new picker object if needed.
|
@@ -694,7 +708,7 @@ def save_properties(*args):
|
694 | 708 |
|
695 | 709 | # assign all the addon property values to the scene property values
|
696 | 710 | for attribute in dir(window_manager_properties):
|
697 |
| - if not attribute.startswith(('__', 'bl_', 'rna_type', 'group')): |
| 711 | + if not attribute.startswith(('__', 'bl_', 'rna_type', 'group', 'idp_array')): |
698 | 712 | value = getattr(window_manager_properties, attribute)
|
699 | 713 | try:
|
700 | 714 | scene_properties[attribute] = value
|
@@ -763,22 +777,18 @@ def load_properties(*args):
|
763 | 777 | setattr(window_manager_properties, attribute, scene_value)
|
764 | 778 |
|
765 | 779 |
|
766 |
| -@bpy.app.handlers.persistent |
767 |
| -def undo(*args): |
| 780 | +def clear_undo_history(): |
768 | 781 | """
|
769 |
| - This function sets the selected mode back to the previous mode on an undo. |
770 |
| -
|
771 |
| - :param args: This soaks up the extra arguments for the app handler. |
| 782 | + This function clears blenders undo history by doing a deselect all operation and repeatedly |
| 783 | + pushing that operation into the undo stack until all previous history is cleared from the undo |
| 784 | + history. |
772 | 785 | """
|
773 |
| - properties = bpy.context.window_manager.ue2rigify |
774 |
| - scene_properties = bpy.context.scene.ue2rigify |
775 |
| - |
776 |
| - if bpy.context.space_data.type == 'VIEW_3D' and properties.selected_mode != properties.source_mode: |
777 |
| - # load the scene properties |
778 |
| - load_properties() |
| 786 | + # run this null operator |
| 787 | + bpy.ops.ue2rigify.null_operator() |
779 | 788 |
|
780 |
| - # set the selected mode to the previous mode |
781 |
| - properties.selected_mode = scene_properties['previous_mode'] |
| 789 | + # repeatedly push the last operator into the undo stack till there are no more undo steps |
| 790 | + for item in range(0, bpy.context.preferences.edit.undo_steps+1): |
| 791 | + bpy.ops.ed.undo_push(message='UE to Rigify Mode Change') |
782 | 792 |
|
783 | 793 |
|
784 | 794 | def get_formatted_operator_parameter(parameter_name, regex, code_line):
|
|
0 commit comments