Changeset View
Changeset View
Standalone View
Standalone View
tests/python/event_simulate/view3d_mesh_texpaint_undo.py
- This file was added.
| # Apache License, Version 2.0 | |||||
| import os | |||||
| import sys | |||||
| sys.path.append(os.path.join(os.path.dirname(__file__), "modules")) | |||||
| import easy_keys | |||||
| import bpy | |||||
| window = bpy.context.window | |||||
| def cursor_motion_simple(e, window): | |||||
| size = window.width, window.height | |||||
| yield from e.leftmouse.cursor_motion( | |||||
| (x, size[1] // 2) for x in | |||||
| range(int(size[0] * 0.2), int(size[0] * 0.8), 80) | |||||
| ) | |||||
| def play_keys(): | |||||
| e = easy_keys.EventGenerate(window) | |||||
| yield e.shift.f5() # 3D View | |||||
| yield e.ctrl.space() # Full-screen. | |||||
| yield e.a().x().ret() # Delete all. | |||||
| yield e.shift.a().m().m() # Add monkey. | |||||
| yield e.numpad_period() # View monkey | |||||
| yield e.ctrl.tab().t() # Paint via pie menu. | |||||
| yield e.f3() # Paint slot via search. | |||||
| yield e.text("Add Texture Paint Slot").ret().ret() # Second ret to accept the dialog. | |||||
| yield from cursor_motion_simple(e, window) | |||||
| yield e.ctrl.z() | |||||
| yield e.ctrl.z() | |||||
| assert(window.view_layer.objects.active.mode == 'TEXTURE_PAINT') | |||||
| yield e.ctrl.z() # Used to crash: T61048 | |||||
| assert(window.view_layer.objects.active.mode == 'OBJECT') | |||||
| yield e.ctrl.shift.z(2) # XXX, bug, should only need to have one redo. | |||||
| assert(window.view_layer.objects.active.mode == 'TEXTURE_PAINT') | |||||
| yield from cursor_motion_simple(e, window) | |||||
| yield e.ctrl.z() # Used to crash: T61048 | |||||
| bpy.app.use_event_simulate = False # Allow human interaction. | |||||
| yield easy_keys.Finish | |||||
| easy_keys.tweak_preferences(bpy.context.preferences) | |||||
| easy_keys.run(play_keys()) | |||||