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

Function view3d_multi_mode_multi_window

tests/python/ui_simulate/test_undo.py:702–845  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

700
701
702def view3d_multi_mode_multi_window():
703 e_a, t, window_a = ui.test_window(0)
704 yield from ui.call_menu(e_a, "Window -> New Main Window")
705
706 e_b, _, window_b = ui.test_window(1)
707 del _
708 yield from ui.call_menu(e_b, "New Scene")
709 yield e_b.ret()
710 if _MENU_CONFIRM_HACK:
711 yield from ui.idle_until(lambda: window_a.view_layer != window_b.view_layer)
712
713 t.assertNotEqual(window_a.view_layer, window_b.view_layer, "Windows should have different view layers")
714
715 for e in (e_a, e_b):
716 pos_v3d = ui.get_area_center_from_spacetype(e.window, 'VIEW_3D')
717 e.cursor_position_set(x=pos_v3d[0], y=pos_v3d[1], move=True)
718 del pos_v3d
719
720 yield from _view3d_startup_area_maximized(e_a)
721 yield from _view3d_startup_area_maximized(e_b)
722
723 undo_current = 0
724 undo_state_empty = undo_current
725
726 yield from ui.call_menu(e_a, "Add -> Torus")
727 yield from ui.call_menu(e_b, "Add -> Monkey")
728 undo_current += 2
729
730 # Weight paint via pie menu.
731 yield e_a.ctrl.tab().w()
732 yield e_b.ctrl.tab().w()
733 undo_current += 2
734 undo_state_wpaint = undo_current
735
736 t.assertEqual(window_a.view_layer.objects.active.mode, 'WEIGHT_PAINT')
737 t.assertEqual(window_b.view_layer.objects.active.mode, 'WEIGHT_PAINT')
738
739 # Object mode via pie menu.
740 yield e_a.ctrl.tab().o()
741 yield e_b.ctrl.tab().o()
742 undo_current += 2
743
744 undo_state_non_empty_start = undo_current
745
746 # Edit mode.
747 yield e_a.tab()
748 yield e_b.tab()
749 undo_current += 2
750
751 vert_count_a_start = len(_bmesh_from_object(window_a.view_layer.objects.active).verts)
752 vert_count_b_start = len(_bmesh_from_object(window_b.view_layer.objects.active).verts)
753
754 yield from ui.call_menu(e_a, "Edge -> Subdivide")
755 yield from ui.call_menu(e_b, "Edge -> Subdivide")
756 undo_current += 2
757
758 yield e_a.r().y().text("45").ret() # Rotate Y 45.
759 yield e_b.r().z().text("45").ret() # Rotate Z 45.

Callers

nothing calls this directly

Calls 8

_bmesh_from_objectFunction · 0.85
cursor_position_setMethod · 0.80
textMethod · 0.80
sMethod · 0.80
lenFunction · 0.50
yMethod · 0.45
zMethod · 0.45

Tested by

no test coverage detected