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

Function view3d_simple

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

Source from the content-addressed store, hash-verified

259
260
261def view3d_simple():
262 e, t, window = ui.test_window()
263 yield from _view3d_startup_area_maximized(e)
264
265 # NOTE: it should be possible to consider "Add -> Mesh -> Plane" an exact match.
266 # However, shortcuts are now included so without them this ends up fuzzy-matching to "Add -> Image -> Mesh Plane".
267 # To resolve that it's necessary to match the entire shortcut which... changes based on the platform (sign!).
268 use_menu_search_workaround = True
269 if use_menu_search_workaround:
270 import sys
271 yield from ui.call_menu(e, "Add ({:s} A) -> Mesh -> Plane".format(
272 "\u21e7" if sys.platform == "darwin" else "Shift"
273 ))
274 del sys
275 else:
276 # It would be nice if this could be restored.
277 yield from ui.call_menu(e, "Add -> Mesh -> Plane")
278
279 # Duplicate and rotate.
280 for _ in range(3):
281 yield e.shift.d().x().text("3").ret()
282 yield e.r.z().text("15").ret()
283 t.assertEqual(len(window.view_layer.objects), 4)
284 yield e.a() # Select all.
285 yield e.numpad_7().numpad_period() # View top.
286 yield e.ctrl.j() # Join.
287 t.assertEqual(len(window.view_layer.objects), 1)
288 yield e.tab() # Edit mode.
289 yield from ui.call_menu(e, "Edge -> Subdivide")
290 yield e.tab() # Object mode.
291 t.assertEqual(len(window.view_layer.objects.active.data.polygons), 16)
292 yield e.ctrl.z(12) # Undo until start.
293 t.assertEqual(len(window.view_layer.objects), 0)
294 yield e.ctrl.shift.z(12) # Redo until end.
295 t.assertEqual(len(window.view_layer.objects.active.data.polygons), 16)
296
297
298def view3d_sculpt_with_memfile_step():

Callers

nothing calls this directly

Calls 6

textMethod · 0.80
lenFunction · 0.50
formatMethod · 0.45
xMethod · 0.45
zMethod · 0.45

Tested by

no test coverage detected