MCPcopy Create free account
hub / github.com/blender/blender / view3d_edit_mode_multi_window

Function view3d_edit_mode_multi_window

tests/python/ui_simulate/test_undo.py:848–986  ·  view source on GitHub ↗

Use undo and redo with multiple windows in edit-mode, this test caused a crash with #110022.

()

Source from the content-addressed store, hash-verified

846
847
848def view3d_edit_mode_multi_window():
849 """
850 Use undo and redo with multiple windows in edit-mode,
851 this test caused a crash with #110022.
852 """
853 e_a, t, window_a = ui.test_window(0)
854
855 # Nice but slower.
856 use_all_area_ui_types = False
857
858 # Use a large, single area so the window can be duplicated & split.
859 yield from _view3d_startup_area_single(e_a)
860
861 yield from ui.call_menu(e_a, "Window -> New Main Window")
862
863 e_b, _, window_b = ui.test_window(1)
864 del _
865
866 yield from ui.call_menu(e_b, "New Scene")
867 yield e_b.ret()
868 if _MENU_CONFIRM_HACK:
869 yield from ui.idle_until(lambda: window_a.view_layer != window_b.view_layer)
870
871 t.assertNotEqual(window_a.view_layer, window_b.view_layer, "Windows should have different view layers")
872
873 for e in (e_a, e_b):
874 pos_v3d = ui.get_area_center_from_spacetype(e.window, 'VIEW_3D')
875 e.cursor_position_set(x=pos_v3d[0], y=pos_v3d[1], move=True)
876 del pos_v3d
877
878 undo_current = 0
879
880 yield from ui.call_menu(e_a, "Add -> Cone")
881 yield from ui.call_menu(e_b, "Add -> Cylinder")
882 undo_current += 2
883
884 # Edit mode.
885 yield e_a.tab()
886 yield e_b.tab()
887 undo_current += 2
888
889 undo_state_edit_mode = undo_current
890
891 vert_count_a_start = len(_bmesh_from_object(window_a.view_layer.objects.active).verts)
892 vert_count_b_start = len(_bmesh_from_object(window_b.view_layer.objects.active).verts)
893
894 yield e_a.r().y().text("45").ret() # Rotate Y 45.
895 yield e_b.r().z().text("45").ret() # Rotate Z 45.
896 undo_current += 2
897
898 yield from ui.call_menu(e_a, "Face -> Poke Faces")
899 yield from ui.call_menu(e_b, "Face -> Poke Faces")
900 undo_current += 2
901
902 yield from ui.call_menu(e_a, "Face -> Beautify Faces")
903 yield from ui.call_menu(e_b, "Face -> Beautify Faces")
904 undo_current += 2
905

Callers

nothing calls this directly

Calls 10

_bmesh_from_objectFunction · 0.85
cursor_position_setMethod · 0.80
textMethod · 0.80
deleteMethod · 0.80
rfindMethod · 0.80
lenFunction · 0.50
yMethod · 0.45
zMethod · 0.45

Tested by

no test coverage detected