-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathtest_animation.py
71 lines (62 loc) · 1.28 KB
/
test_animation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import pytest
from pathlib import Path
from blendtorch import btt
BLENDDIR = Path(__file__).parent / "blender"
EXPECTED = [
"pre_play",
1,
"pre_animation",
1,
"pre_frame",
1,
"post_frame",
1,
"pre_frame",
2,
"post_frame",
2,
"pre_frame",
3,
"post_frame",
3,
"post_animation",
3,
"pre_animation",
1,
"pre_frame",
1,
"post_frame",
1,
"pre_frame",
2,
"post_frame",
2,
"pre_frame",
3,
"post_frame",
3,
"post_animation",
3,
"post_play",
3,
]
def _capture_anim_callback_sequence(background):
launch_args = dict(
scene="",
script=BLENDDIR / "anim.blend.py",
named_sockets=["DATA"],
background=background,
)
with btt.BlenderLauncher(**launch_args) as bl:
addr = bl.launch_info.addresses["DATA"]
ds = btt.RemoteIterableDataset(addr, max_items=1, timeoutms=10000)
try:
item = next(iter(ds))
assert item["seq"] == EXPECTED
except Exception:
print("err")
#@pytest.mark.background
def test_anim_callback_sequence():
_capture_anim_callback_sequence(background=True)
def test_anim_callback_sequence_ui():
_capture_anim_callback_sequence(background=False)