tracksperanto 4.1.2 → 4.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/tracksperanto/version.rb +1 -1
- data/test/HELP_WHY_TESTS_ARE_EMPTY.md +8 -0
- data/tracksperanto.gemspec +2 -4
- metadata +4 -179
- data/test/export/README_EXPORT_TESTS.txt +0 -24
- data/test/export/samples/ref_AfterEffects.jsx +0 -70
- data/test/export/samples/ref_FlameProperlyReorderedCornerpin.stabilizer +0 -1946
- data/test/export/samples/ref_FlameSimpleReorderedCornerpin.stabilizer +0 -1946
- data/test/export/samples/ref_Maxscript.ms +0 -93
- data/test/export/samples/ref_MayaLocators.ma +0 -90
- data/test/export/samples/ref_Mayalive.txt +0 -43
- data/test/export/samples/ref_Mayalive_CustomAspect.txt +0 -43
- data/test/export/samples/ref_NukeCameraTrackerUsertracks.txt +0 -48
- data/test/export/samples/ref_NukeScript.nk +0 -37
- data/test/export/samples/ref_PFMatchit.2dt +0 -54
- data/test/export/samples/ref_PFTrack.2dt +0 -51
- data/test/export/samples/ref_PFTrack5.2dt +0 -54
- data/test/export/samples/ref_Ruby.rb +0 -54
- data/test/export/samples/ref_ShakeText.txt +0 -48
- data/test/export/samples/ref_Syntheyes.txt +0 -39
- data/test/export/samples/ref_XSI.py +0 -102
- data/test/export/samples/ref_boujou.txt +0 -44
- data/test/export/samples/ref_equalizer.txt +0 -49
- data/test/export/samples/ref_equalizer3.txt +0 -44
- data/test/export/samples/ref_flame.stabilizer +0 -962
- data/test/export/samples/ref_flameCornerpin.stabilizer +0 -962
- data/test/export/samples/ref_flame_2014.stabilizer +0 -893
- data/test/export/samples/ref_flame_2014_cornerpin.stabilizer +0 -1422
- data/test/export/samples/ref_matchmover.rz2 +0 -52
- data/test/export/test_ae_export.rb +0 -16
- data/test/export/test_boujou_export.rb +0 -17
- data/test/export/test_equalizer3_export.rb +0 -24
- data/test/export/test_equalizer_export.rb +0 -15
- data/test/export/test_flame_stabilizer_2014_cornerpin_export.rb +0 -33
- data/test/export/test_flame_stabilizer_2014_export.rb +0 -17
- data/test/export/test_flame_stabilizer_cornerpin_export.rb +0 -71
- data/test/export/test_flame_stabilizer_export.rb +0 -17
- data/test/export/test_match_mover_export.rb +0 -25
- data/test/export/test_maxscript.rb +0 -16
- data/test/export/test_maya_live_export.rb +0 -17
- data/test/export/test_maya_locators_export.rb +0 -16
- data/test/export/test_mux.rb +0 -23
- data/test/export/test_nuke_camtracker_export.rb +0 -15
- data/test/export/test_nuke_export.rb +0 -45
- data/test/export/test_pfmatchit_export.rb +0 -16
- data/test/export/test_pftrack5_export.rb +0 -19
- data/test/export/test_pftrack_export.rb +0 -19
- data/test/export/test_ruby_export.rb +0 -15
- data/test/export/test_shake_export.rb +0 -15
- data/test/export/test_syntheyes_export.rb +0 -15
- data/test/export/test_xsi_python_export.rb +0 -16
- data/test/helper.rb +0 -153
- data/test/import/README.rdoc +0 -10
- data/test/import/samples/3de_v3/3de_export_v3.txt +0 -2203
- data/test/import/samples/3de_v4/3de_export_cube.txt +0 -726
- data/test/import/samples/3de_v4/FB1880_man_v05.txt +0 -2402
- data/test/import/samples/boujou_features_text/boujou_txt_export.txt +0 -2885
- data/test/import/samples/flame_stabilizer/FlameStab_Cornerpin_CorrectOrder.stabilizer +0 -2758
- data/test/import/samples/flame_stabilizer/FlameStab_Cornerpin_IncorrectOrder.stabilizer +0 -2758
- data/test/import/samples/flame_stabilizer/Flame_Stabilizer_2012.stabilizer +0 -6954
- data/test/import/samples/flame_stabilizer/cornerpin_2012.stabilizer +0 -20958
- data/test/import/samples/flame_stabilizer/flame2010_cornerpin.stabilizer +0 -10792
- data/test/import/samples/flame_stabilizer/flame_2012_another.stabilizer +0 -2290
- data/test/import/samples/flame_stabilizer/fromCombustion_fromMidClip_wSnap.stabilizer +0 -2028
- data/test/import/samples/flame_stabilizer/fromTracksperanto.stabilizer +0 -541
- data/test/import/samples/flame_stabilizer/hugeFlameSetup.stabilizer +0 -263460
- data/test/import/samples/flame_stabilizer/megaTrack.action.3dtrack.stabilizer +0 -29793
- data/test/import/samples/flame_stabilizer/stabilizer_2014_ref_for_reexport.stabilizer +0 -2776
- data/test/import/samples/flame_stabilizer/stabilizer_2014_stp.stabilizer +0 -2536
- data/test/import/samples/match_mover/2dtracks.rz2 +0 -2076
- data/test/import/samples/match_mover/EP_1000_head_trackers_v002.rz2 +0 -935
- data/test/import/samples/match_mover/NonSequentialMatchmoverPoints.rz2 +0 -93306
- data/test/import/samples/match_mover/cha_171_1020_atb_v001.rz2 +0 -238
- data/test/import/samples/match_mover/kipPointsMatchmover.rz2 +0 -523
- data/test/import/samples/match_mover_rzml/md_145_1070_right_t1.rzml +0 -601
- data/test/import/samples/mayalive/mayalive_kipShot.txt +0 -1504
- data/test/import/samples/nuke/018.nk +0 -300
- data/test/import/samples/nuke/45trackers.nk +0 -331
- data/test/import/samples/nuke/A099_L008_0207TW_001_head_R.nk +0 -135
- data/test/import/samples/nuke/cornerpin.nk +0 -11
- data/test/import/samples/nuke/curve-start-with-curve-command.nk +0 -174
- data/test/import/samples/nuke/failing_nuke7_trackers_job_1872.nk +0 -112
- data/test/import/samples/nuke/nuke708_tracker.nk +0 -52
- data/test/import/samples/nuke/nuke7_planar.nk +0 -3143
- data/test/import/samples/nuke/nuke7_tracker_2tracks.nk +0 -116
- data/test/import/samples/nuke/nuke7_transform2d.nk +0 -69
- data/test/import/samples/nuke/nuke8_tracker4_copypastes.nk +0 -53
- data/test/import/samples/nuke/one_tracker_with_break.nk +0 -71
- data/test/import/samples/nuke/one_tracker_with_break_in_grp.nk +0 -91
- data/test/import/samples/nuke/planar.nk +0 -37692
- data/test/import/samples/nuke/reconciles.nk +0 -210
- data/test/import/samples/nuke/sh110_trackers_004_ipad1.nk +0 -56
- data/test/import/samples/nuke/skip_invalid_curve_expressions.nk +0 -62
- data/test/import/samples/nuke/track_nuke8.nk +0 -54
- data/test/import/samples/nuke/tracker4_with_empty_tracks_knob.nk +0 -13005
- data/test/import/samples/nuke/tracker_with_differing_gaps.nk +0 -82
- data/test/import/samples/nuke/tracker_with_repeating_gaps.nk +0 -79
- data/test/import/samples/pfmatchit/pfmatchit_example.2dt +0 -90
- data/test/import/samples/pftrack4/sourcefile_pftrack.2dt +0 -28972
- data/test/import/samples/pftrack5/apft.2dt +0 -164
- data/test/import/samples/pftrack5/empty_trackers.2dt +0 -30
- data/test/import/samples/pftrack5/garage.2dt +0 -79259
- data/test/import/samples/pftrack5/stereo.2dt +0 -21073
- data/test/import/samples/shake_script/205_030_shaketrack_v01_pd.shk +0 -379
- data/test/import/samples/shake_script/REDACTED_shake_file.shk +0 -317
- data/test/import/samples/shake_script/cliff_many_stabilize.shk +0 -675
- data/test/import/samples/shake_script/comments_inline_with_args.shk +0 -50
- data/test/import/samples/shake_script/designated_global_range_starting_at_negative_frame.shk +0 -496
- data/test/import/samples/shake_script/four_tracks_in_one_matchmove.shk +0 -323
- data/test/import/samples/shake_script/four_tracks_in_one_stabilizer.shk +0 -321
- data/test/import/samples/shake_script/from_matchmover.shk +0 -140
- data/test/import/samples/shake_script/ofx_vardefs.shk +0 -6
- data/test/import/samples/shake_script/oldTrackerNode.shk +0 -5
- data/test/import/samples/shake_script/shake_script_from_boujou.shk +0 -15
- data/test/import/samples/shake_script/shake_tracker_nodes.shk +0 -633
- data/test/import/samples/shake_script/shake_tracker_with_no_anim.shk +0 -6
- data/test/import/samples/shake_script/shake_trackers_with_Nspline.shk +0 -328
- data/test/import/samples/shake_script/stabilize_nodes_with_hermite.shk +0 -330
- data/test/import/samples/shake_script/three_tracks_in_one_stabilizer.shk +0 -320
- data/test/import/samples/shake_script/track.shk +0 -349
- data/test/import/samples/shake_script/two_tracks_in_one_tracker.shk +0 -319
- data/test/import/samples/shake_text/nuke_camtracker.txt +0 -11240
- data/test/import/samples/shake_text/one_shake_tracker.txt +0 -49
- data/test/import/samples/shake_text/one_shake_tracker_from_first.txt +0 -188
- data/test/import/samples/shake_text/two_shake_trackers.txt +0 -78
- data/test/import/samples/syntheyes_2d_paths/cola_plate.txt +0 -507
- data/test/import/samples/syntheyes_2d_paths/flyover2DP_syntheyes.txt +0 -12687
- data/test/import/samples/syntheyes_2d_paths/morePoints_sy2010.txt +0 -752
- data/test/import/samples/syntheyes_2d_paths/one_tracker.txt +0 -49
- data/test/import/samples/syntheyes_2d_paths/shake_tracker_nodes_to_syntheyes.txt +0 -4091
- data/test/import/samples/syntheyes_all_tracker_paths/shot06_2dTracks.txt +0 -6255
- data/test/import/test_3de_import.rb +0 -41
- data/test/import/test_3de_import3.rb +0 -33
- data/test/import/test_boujou_import.rb +0 -29
- data/test/import/test_flame_import.rb +0 -120
- data/test/import/test_match_mover_import.rb +0 -100
- data/test/import/test_match_mover_rzml_import.rb +0 -33
- data/test/import/test_maya_live_import.rb +0 -57
- data/test/import/test_nuke_import.rb +0 -298
- data/test/import/test_pftrack_import.rb +0 -94
- data/test/import/test_shake_catcher.rb +0 -85
- data/test/import/test_shake_lexer.rb +0 -204
- data/test/import/test_shake_script_import.rb +0 -164
- data/test/import/test_shake_text_import.rb +0 -71
- data/test/import/test_syntheyes_all_tracker_paths_import.rb +0 -26
- data/test/import/test_syntheyes_import.rb +0 -51
- data/test/test_blacklist.rb +0 -50
- data/test/test_block_init.rb +0 -48
- data/test/test_buffer_io.rb +0 -33
- data/test/test_casts.rb +0 -76
- data/test/test_cli.rb +0 -108
- data/test/test_const_name.rb +0 -12
- data/test/test_extio.rb +0 -28
- data/test/test_format_detector.rb +0 -39
- data/test/test_keyframe.rb +0 -56
- data/test/test_parameters.rb +0 -37
- data/test/test_pipeline.rb +0 -192
- data/test/test_safety.rb +0 -20
- data/test/test_simple_export.rb +0 -22
- data/test/test_tracker.rb +0 -149
- data/test/test_tracksperanto.rb +0 -88
- data/test/test_uv_coords.rb +0 -28
- data/test/test_yield_non_empty.rb +0 -10
- data/test/test_zip_tuples.rb +0 -31
- data/test/tools/test_crop_middleware.rb +0 -32
- data/test/tools/test_flip_middleware.rb +0 -18
- data/test/tools/test_flop_middleware.rb +0 -18
- data/test/tools/test_golden_middleware.rb +0 -25
- data/test/tools/test_length_cutoff_middleware.rb +0 -43
- data/test/tools/test_lens_middleware.rb +0 -77
- data/test/tools/test_lerp_middleware.rb +0 -28
- data/test/tools/test_lint_middleware.rb +0 -79
- data/test/tools/test_move_to_first_frame_middleware.rb +0 -37
- data/test/tools/test_pad_middleware.rb +0 -35
- data/test/tools/test_prefix.rb +0 -31
- data/test/tools/test_reformat_middleware.rb +0 -36
- data/test/tools/test_scaler_middleware.rb +0 -66
- data/test/tools/test_shift_middleware.rb +0 -31
- data/test/tools/test_slip_middleware.rb +0 -36
- data/test/tools/test_start_trim_middleware.rb +0 -36
@@ -1,94 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__)) + '/../helper'
|
2
|
-
|
3
|
-
class PFTrackImportTest < Test::Unit::TestCase
|
4
|
-
DELTA = 0.1
|
5
|
-
|
6
|
-
def test_introspects_properly
|
7
|
-
i = Tracksperanto::Import::PFTrack
|
8
|
-
assert_equal "PFTrack/PFMatchit .2dt file", i.human_name
|
9
|
-
assert !i.autodetects_size?
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_parsing_from_pftrack5_with_digit_names
|
13
|
-
fixture = File.open(File.dirname(__FILE__) + '/samples/pftrack5/apft.2dt')
|
14
|
-
parser = Tracksperanto::Import::PFTrack.new(:io => fixture, :width => 1920, :height => 1080)
|
15
|
-
|
16
|
-
trackers = parser.to_a
|
17
|
-
assert_equal 4, trackers.length
|
18
|
-
second_tracker = trackers[1]
|
19
|
-
assert_equal "1015_Primary", second_tracker.name
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_parsing_from_importable_pftrack_4
|
23
|
-
|
24
|
-
fixture = File.open(File.dirname(__FILE__) + '/samples/pftrack4/sourcefile_pftrack.2dt')
|
25
|
-
|
26
|
-
parser = Tracksperanto::Import::PFTrack.new(:io => fixture)
|
27
|
-
parser.width = 2560
|
28
|
-
parser.height = 1080
|
29
|
-
|
30
|
-
trackers = parser.to_a
|
31
|
-
assert_equal 43, trackers.length
|
32
|
-
|
33
|
-
first_kf = trackers[0].keyframes[0]
|
34
|
-
last_kf = trackers[0].keyframes[-1]
|
35
|
-
|
36
|
-
assert_equal "Tracker1", trackers[0].name
|
37
|
-
assert_equal 341, trackers[0].keyframes.length
|
38
|
-
|
39
|
-
assert_equal 40, first_kf.frame
|
40
|
-
assert_in_delta 985.111, first_kf.abs_x, DELTA
|
41
|
-
assert_in_delta 30.72, first_kf.abs_y, DELTA
|
42
|
-
assert_in_delta 0.0, first_kf.residual, DELTA
|
43
|
-
|
44
|
-
last_kf = trackers[0].keyframes[-1]
|
45
|
-
assert_in_delta 729.83, last_kf.abs_x, DELTA
|
46
|
-
|
47
|
-
assert_equal "Tracker41", trackers[-1].name
|
48
|
-
assert_equal 467, trackers[-1].keyframes.length
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_garage_shot_from_pftrack_5
|
52
|
-
fixture = File.open(File.dirname(__FILE__) + '/samples/pftrack5/garage.2dt')
|
53
|
-
parser = Tracksperanto::Import::PFTrack.new(:io => fixture, :width => 1920, :height => 1080)
|
54
|
-
|
55
|
-
trackers = parser.to_a
|
56
|
-
assert_equal 250, trackers.length
|
57
|
-
assert_equal "Tracker121_Primary", trackers[0].name
|
58
|
-
assert_equal 189, trackers[0].length
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_pfmatchit_file
|
62
|
-
fixture = File.open(File.dirname(__FILE__) + '/samples/pfmatchit/pfmatchit_example.2dt')
|
63
|
-
parser = Tracksperanto::Import::PFTrack.new(:io => fixture, :width => 1920, :height => 1080)
|
64
|
-
|
65
|
-
trackers = parser.to_a
|
66
|
-
assert_equal 2, trackers.length
|
67
|
-
assert_equal "Feature1_1", trackers[0].name
|
68
|
-
assert_equal 37, trackers[0].length
|
69
|
-
assert_equal "Feature1_2", trackers[1].name
|
70
|
-
assert_equal 37, trackers[1].length
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_stereoscopy
|
74
|
-
fixture = File.open(File.dirname(__FILE__) + '/samples/pftrack5/stereo.2dt')
|
75
|
-
parser = Tracksperanto::Import::PFTrack.new(:io => fixture, :width => 1920, :height => 1080)
|
76
|
-
acc = Obuf.new
|
77
|
-
parser.each{|t| acc << t }
|
78
|
-
|
79
|
-
assert_equal 1690, acc.size, "Should have recovered 1690 trackers"
|
80
|
-
assert_equal "Auto_00001_Primary", acc[0].name
|
81
|
-
assert_equal "Auto_00001_Secondary", acc[1].name
|
82
|
-
|
83
|
-
assert_equal "Auto_00016_Primary", acc[18].name
|
84
|
-
assert_equal 34, acc[18].length
|
85
|
-
assert_in_delta 1331.517, acc[18][0].abs_x, DELTA
|
86
|
-
|
87
|
-
assert_equal "Auto_00016_Secondary", acc[19].name
|
88
|
-
assert_equal 34, acc[19].length
|
89
|
-
assert_in_delta 1336.109, acc[19][0].abs_x, DELTA
|
90
|
-
|
91
|
-
assert_equal "Auto_00021_Primary", acc[20].name
|
92
|
-
assert_equal 0, acc[20].length
|
93
|
-
end
|
94
|
-
end
|
@@ -1,85 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__)) + '/../helper'
|
2
|
-
|
3
|
-
class ShakeCatcherTest < Test::Unit::TestCase
|
4
|
-
C = Tracksperanto::ShakeGrammar::Catcher
|
5
|
-
|
6
|
-
def at(at, v)
|
7
|
-
C::At.new(at, v)
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_hould_catch_simple_funcall
|
11
|
-
k = Class.new(C) do
|
12
|
-
def foofunc(a, b, c)
|
13
|
-
"#{a.inspect} #{b.inspect} #{c.inspect}"
|
14
|
-
end
|
15
|
-
end
|
16
|
-
tree = parse("FooFunc(1, 2, 3)", k)
|
17
|
-
assert_equal [[:retval, "1 2 3"]], tree
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_uknown_funcalls
|
21
|
-
k = Class.new(C)
|
22
|
-
tree = parse("OuterFunc(InnerFunc(15)", k)
|
23
|
-
assert_equal [[:unknown_func]], tree
|
24
|
-
|
25
|
-
tree = parse("OuterFunc(15);", k)
|
26
|
-
assert_equal [[:unknown_func]], tree
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_nested_funcalls
|
30
|
-
k = Class.new(C) do
|
31
|
-
def outerfunc(a)
|
32
|
-
a * 2
|
33
|
-
end
|
34
|
-
|
35
|
-
def innerfunc(b)
|
36
|
-
b * 10
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
tree = parse("OuterFunc(InnerFunc(15)", k)
|
41
|
-
assert_equal [[:retval, 300]], tree
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_hermite_funcall_with_array_ats
|
45
|
-
k = Class.new(C) do
|
46
|
-
def hermite(first_arg, *keyframes)
|
47
|
-
keyframes
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
tree = parse('Hermite(0,[1379.04,-0.02,-0.02]@1,[1379.04,-0.03,-0.03]@2)', k)
|
52
|
-
assert_equal [[:retval, [at(1, [1379.04, -0.02, -0.02]), at(2, [1379.04, -0.03, -0.03])]]], tree
|
53
|
-
end
|
54
|
-
|
55
|
-
def test_linear_funcall
|
56
|
-
k = Class.new(C) do
|
57
|
-
def linear(first_arg, *keyframes)
|
58
|
-
123
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
tree = parse('Linear(0,591.702@1,591.452@2,591.202@3,590.733@4,590.202@5,589.421@6,589.249@7)', k)
|
63
|
-
assert_equal [[:retval, 123]], tree
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_nested_funcalls_with_array_return
|
67
|
-
k = Class.new(C) do
|
68
|
-
def outerfunc(a)
|
69
|
-
a * 2
|
70
|
-
end
|
71
|
-
|
72
|
-
def innerfunc(b)
|
73
|
-
[b, b* 2, b* 3]
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
tree = parse("OuterFunc(InnerFunc(15)", k)
|
78
|
-
assert_equal [[:retval, [15, 30, 45, 15, 30, 45]]], tree
|
79
|
-
end
|
80
|
-
|
81
|
-
def parse(s, klass)
|
82
|
-
s = StringIO.new(s) unless s.respond_to?(:read)
|
83
|
-
klass.new(s).stack
|
84
|
-
end
|
85
|
-
end
|
@@ -1,204 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__)) + '/../helper'
|
2
|
-
|
3
|
-
class ShakeLexerTest < Test::Unit::TestCase
|
4
|
-
P = File.dirname(__FILE__) + "/samples/shake_script/shake_tracker_nodes.shk"
|
5
|
-
OFX_CURLY_BRACES = File.dirname(__FILE__) + "/samples/shake_script/ofx_vardefs.shk"
|
6
|
-
L = Tracksperanto::ShakeGrammar::Lexer
|
7
|
-
WRONG = File.dirname(__FILE__) + "/samples/flame_stabilizer/hugeFlameSetup.stabilizer"
|
8
|
-
|
9
|
-
def test_raises_wrong_input_when_buffer_gets_too_large
|
10
|
-
assert_raise(Tracksperanto::ShakeGrammar::WrongInputError) do
|
11
|
-
parse(File.open(WRONG), L)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_raises_wrong_input_on_stack_size
|
16
|
-
huge_stack = "(" * 345
|
17
|
-
assert_raise(Tracksperanto::ShakeGrammar::WrongInputError) do
|
18
|
-
parse(StringIO.new(huge_stack), L)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_parse_single_cmt
|
23
|
-
cmt = " // Mary had a little lamb"
|
24
|
-
s = parse(cmt)
|
25
|
-
assert_equal [[:comment, " Mary had a little lamb"]], s
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_parse_two_line_cmt
|
29
|
-
cmt = [" // Mary had a little lamb", " // Old McDonald had a farm"].join("\n\n\n\n\n\n")
|
30
|
-
s = parse(cmt)
|
31
|
-
assert_equal [[:comment, " Mary had a little lamb"], [:comment, " Old McDonald had a farm"]], s
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_parse_hermite_curve
|
35
|
-
curve = 'Hermite(0,[1379.04,-0.02,-0.02]@1,[1379.04,-0.03,-0.03]@2)'
|
36
|
-
s = parse(curve)
|
37
|
-
assert_equal [
|
38
|
-
[:funcall,
|
39
|
-
"Hermite",
|
40
|
-
0,
|
41
|
-
[:value_at, 1, [:arr, [1379.04, -0.02, -0.02]]],
|
42
|
-
[:value_at, 2, [:arr, [1379.04, -0.03, -0.03]]]
|
43
|
-
]
|
44
|
-
], s
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_parse_cmt_and_unknown
|
48
|
-
cmt = " // Mary had a little lamb\nFooBar"
|
49
|
-
s = parse(cmt)
|
50
|
-
assert_equal [[:comment, " Mary had a little lamb"], [:atom, "FooBar"]], s
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_parse_funcall
|
54
|
-
s = parse ' DoFoo(1, 2, 3, "Welcome!\"\""); '
|
55
|
-
assert_equal [[:funcall, "DoFoo", 1, 2, 3, "Welcome!\"\""]], s
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_parse_nested_funcall
|
59
|
-
s = parse ' DoFoo(1, Foo(4));'
|
60
|
-
assert_equal [[:funcall, "DoFoo", 1, [:funcall, "Foo", 4]]], s
|
61
|
-
end
|
62
|
-
|
63
|
-
def test_parse_single_nested_funcall
|
64
|
-
s = parse("OuterFunc(InnerFunc(15)")
|
65
|
-
assert_equal [[:funcall, "OuterFunc", [:funcall, "InnerFunc", 15]]], s
|
66
|
-
end
|
67
|
-
|
68
|
-
def test_parse_single_funcall
|
69
|
-
s = parse('SomeFunc(1,2,3)')
|
70
|
-
assert_equal [[:funcall, "SomeFunc", 1, 2, 3]], s
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_parse_funcall_with_valueats
|
74
|
-
s = parse 'Linear(0,716.08@1,715.846@2,715.518@3,715.034@4,714.377@5)'
|
75
|
-
assert_equal(
|
76
|
-
[[
|
77
|
-
:funcall,
|
78
|
-
"Linear",
|
79
|
-
0,
|
80
|
-
[:value_at, 1, 716.08],
|
81
|
-
[:value_at, 2, 715.846],
|
82
|
-
[:value_at, 3, 715.518],
|
83
|
-
[:value_at, 4, 715.034],
|
84
|
-
[:value_at, 5, 714.377]
|
85
|
-
]],
|
86
|
-
s)
|
87
|
-
end
|
88
|
-
|
89
|
-
def test_knob_expr
|
90
|
-
s = parse "Foobar(2, 4, {{ 4 * 16 }}, 4, 1)"
|
91
|
-
assert_equal(
|
92
|
-
[[
|
93
|
-
:funcall,
|
94
|
-
"Foobar",
|
95
|
-
2,
|
96
|
-
4,
|
97
|
-
:expr,
|
98
|
-
4,
|
99
|
-
1,
|
100
|
-
]],
|
101
|
-
s)
|
102
|
-
end
|
103
|
-
|
104
|
-
def test_lexer_with_inline_comments_munged_into_arguments
|
105
|
-
st = 'Tracker(
|
106
|
-
0, // preprocess enable
|
107
|
-
10 // bluramount
|
108
|
-
,
|
109
|
-
"Tracker8")'
|
110
|
-
|
111
|
-
s = parse(st)
|
112
|
-
assert_equal(
|
113
|
-
[[
|
114
|
-
:funcall,
|
115
|
-
"Tracker",
|
116
|
-
0,
|
117
|
-
[:comment, " preprocess enable"],
|
118
|
-
10,
|
119
|
-
[:comment, " bluramount"],
|
120
|
-
"Tracker8"
|
121
|
-
]],s)
|
122
|
-
end
|
123
|
-
|
124
|
-
def test_lexer_with_ofx_curly_braces
|
125
|
-
s = parse(File.read(OFX_CURLY_BRACES))
|
126
|
-
assert_equal(
|
127
|
-
[[
|
128
|
-
:funcall,
|
129
|
-
"image Primatte_v2_",
|
130
|
-
[:assign, [:vardef, "image", "ofx_Source"], 0],
|
131
|
-
[:assign, [:vardef, "image", "ofx_BG"], 0],
|
132
|
-
[:assign, [:vardef, "image", "ofx_Mask"], 0],
|
133
|
-
[:assign, [:vardef, "const char *", "Poly00dral"], "0.0 0.0 0.0"],
|
134
|
-
[:assign, [:vardef, "int", "N3D_Viewer"], 0],
|
135
|
-
:expr
|
136
|
-
], [:funcall, "Foo", 2]],
|
137
|
-
s)
|
138
|
-
end
|
139
|
-
|
140
|
-
def test_parse_funcall_with_valueats_at_negframes
|
141
|
-
s = parse 'Linear(0,716.08@-1,715.846@2)'
|
142
|
-
assert_equal(
|
143
|
-
[[
|
144
|
-
:funcall,
|
145
|
-
"Linear",
|
146
|
-
0,
|
147
|
-
[:value_at, -1, 716.08],
|
148
|
-
[:value_at, 2, 715.846],
|
149
|
-
]],
|
150
|
-
s)
|
151
|
-
end
|
152
|
-
|
153
|
-
def test_parse_hermite_valuats_containing_arrays
|
154
|
-
# Hermite curves use array args
|
155
|
-
s = parse 'Hermite(0,[-64,98.33,98.33]@1,[50,97.29,97.29]@4)'
|
156
|
-
ref = [[
|
157
|
-
:funcall,
|
158
|
-
"Hermite",
|
159
|
-
0,
|
160
|
-
[:value_at, 1, [:arr, [-64.0, 98.33, 98.33]]],
|
161
|
-
[:value_at, 4, [:arr, [50, 97.29, 97.29]]]
|
162
|
-
]]
|
163
|
-
assert_equal ref, s
|
164
|
-
end
|
165
|
-
|
166
|
-
def test_parse_from_start_injects_comment
|
167
|
-
p = File.open(P){|f| f.read(1600) }
|
168
|
-
tree = parse(p)
|
169
|
-
assert_equal :comment, tree[0][0]
|
170
|
-
assert_equal :comment, tree[1][0]
|
171
|
-
assert_equal :funcall, tree[2][0]
|
172
|
-
end
|
173
|
-
|
174
|
-
def test_parse_simple_varassign
|
175
|
-
s = parse 'Foo = 1;'
|
176
|
-
assert_equal [[:assign, [:vardef, :image, "Foo"], 1]], s, "Note that the variable name should be escaped properly"
|
177
|
-
end
|
178
|
-
|
179
|
-
def test_parse_varassign
|
180
|
-
s = parse 'Foo = Blur(Foo, 1, 2, 3); 1'
|
181
|
-
assert_equal [[:assign, [:vardef, :image, "Foo"], [:funcall, "Blur", [:atom, "Foo"], 1, 2, 3]], 1], s
|
182
|
-
end
|
183
|
-
|
184
|
-
def test_parse_varassign_with_typedef
|
185
|
-
s = parse 'curve float focal = Linear(0,2257.552@1,2257.552@2)'
|
186
|
-
assert_equal [[:assign, [:vardef, "curve float", "focal"], [:funcall, "Linear", 0, [:value_at, 1, 2257.552], [:value_at, 2, 2257.552]]]], s
|
187
|
-
end
|
188
|
-
|
189
|
-
def test_parse_varassign_with_typedef_charstar
|
190
|
-
s = parse 'char * information = "Ausgezeichnet!";'
|
191
|
-
assert_equal [[:assign, [:vardef, "char *", "information"], "Ausgezeichnet!" ]], s
|
192
|
-
end
|
193
|
-
|
194
|
-
def test_parse_whole_file_does_not_raise
|
195
|
-
assert_nothing_raised do
|
196
|
-
parse(File.open(P), L)
|
197
|
-
end
|
198
|
-
end
|
199
|
-
|
200
|
-
def parse(s, klass = L)
|
201
|
-
s = StringIO.new(s) unless s.respond_to?(:read)
|
202
|
-
klass.new(s).stack
|
203
|
-
end
|
204
|
-
end
|
@@ -1,164 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__)) + '/../helper'
|
2
|
-
|
3
|
-
class ShakeScriptImportTest < Test::Unit::TestCase
|
4
|
-
DELTA = 0.001
|
5
|
-
|
6
|
-
def test_parsing_fifty_tracker_nodes_with_one_track_each
|
7
|
-
fixture = File.open(File.dirname(__FILE__) + '/samples/shake_script/shake_tracker_nodes.shk')
|
8
|
-
|
9
|
-
trackers = Tracksperanto::Import::ShakeScript.new(:io => fixture).to_a
|
10
|
-
assert_equal 26, trackers.length
|
11
|
-
|
12
|
-
t = trackers[-1]
|
13
|
-
assert_equal "Tracker8_track1", t.name
|
14
|
-
|
15
|
-
first_kf = t.keyframes[0]
|
16
|
-
assert_equal 107, first_kf.frame
|
17
|
-
|
18
|
-
assert_in_delta 1065.41, first_kf.abs_y, DELTA
|
19
|
-
assert_in_delta 1281.14, first_kf.abs_x, DELTA
|
20
|
-
assert_in_delta 1.0, first_kf.residual, DELTA
|
21
|
-
|
22
|
-
second_kf = t.keyframes[1]
|
23
|
-
assert_in_delta 0.00129, second_kf.residual, DELTA
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_parse_tracker_node_with_no_animation
|
27
|
-
fixture = File.open(File.dirname(__FILE__) + '/samples/shake_script/shake_tracker_with_no_anim.shk')
|
28
|
-
assert_nothing_raised do
|
29
|
-
trackers = Tracksperanto::Import::ShakeScript.new(:io => fixture).to_a
|
30
|
-
assert_equal 0, trackers.length
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_parsing_two_tracks_in_one_tracker_node
|
35
|
-
fixture = File.open(File.dirname(__FILE__) + '/samples/shake_script/two_tracks_in_one_tracker.shk')
|
36
|
-
|
37
|
-
trackers = Tracksperanto::Import::ShakeScript.new(:io => fixture).to_a
|
38
|
-
assert_equal 2, trackers.length
|
39
|
-
|
40
|
-
t = trackers[0]
|
41
|
-
assert_equal "Tracker1_track1", t.name
|
42
|
-
|
43
|
-
first_kf = t.keyframes[0]
|
44
|
-
assert_equal 0, first_kf.frame
|
45
|
-
assert_in_delta 716.08, first_kf.abs_x, DELTA
|
46
|
-
assert_in_delta 885.123, first_kf.abs_y, DELTA
|
47
|
-
assert_in_delta 0.0, first_kf.residual, DELTA
|
48
|
-
|
49
|
-
second_kf = t.keyframes[1]
|
50
|
-
assert_in_delta 0.00129, second_kf.residual, DELTA
|
51
|
-
|
52
|
-
t2 = trackers[1]
|
53
|
-
assert_equal "Tracker1_track2", t2.name
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
### Disabled for now, I don't feel like overhauling the Shake parser ATM
|
58
|
-
# def test_parsing_case
|
59
|
-
# fixture = File.open(File.dirname(__FILE__) + '/samples/shake_script/205_030_shaketrack_v01_pd.shk')
|
60
|
-
# trackers = Tracksperanto::Import::ShakeScript.new(:io => fixture).to_a
|
61
|
-
# assert_equal 3, trackers.length
|
62
|
-
# end
|
63
|
-
###
|
64
|
-
|
65
|
-
def test_parsing_three_tracks_in_one_stabilizer_node
|
66
|
-
fixture = File.open(File.dirname(__FILE__) + '/samples/shake_script/three_tracks_in_one_stabilizer.shk')
|
67
|
-
|
68
|
-
trackers = Tracksperanto::Import::ShakeScript.new(:io => fixture).to_a
|
69
|
-
ft = trackers[0]
|
70
|
-
assert_equal "Stabilize1_track1", ft.name
|
71
|
-
assert_equal 3, trackers.length
|
72
|
-
end
|
73
|
-
|
74
|
-
def test_parsing_four_tracks_in_one_stabilizer_node
|
75
|
-
fixture = File.open(File.dirname(__FILE__) + '/samples/shake_script/four_tracks_in_one_stabilizer.shk')
|
76
|
-
|
77
|
-
trackers = Tracksperanto::Import::ShakeScript.new(:io => fixture).to_a
|
78
|
-
ft = trackers[0]
|
79
|
-
assert_equal "Stabilize2_track1", ft.name
|
80
|
-
assert_equal 4, trackers.length
|
81
|
-
end
|
82
|
-
|
83
|
-
def test_parsing_four_tracks_in_one_matchmove_node
|
84
|
-
fixture = File.open(File.dirname(__FILE__) + '/samples/shake_script/four_tracks_in_one_matchmove.shk')
|
85
|
-
|
86
|
-
trackers = Tracksperanto::Import::ShakeScript.new(:io => fixture).to_a
|
87
|
-
assert_equal 4, trackers.length
|
88
|
-
|
89
|
-
ft = trackers[0]
|
90
|
-
assert_equal "MatchMove1_track1", ft.name
|
91
|
-
end
|
92
|
-
|
93
|
-
def test_parsing_from_nspline_curves
|
94
|
-
fixture = File.open(File.dirname(__FILE__) + '/samples/shake_script/shake_trackers_with_Nspline.shk')
|
95
|
-
|
96
|
-
trackers = Tracksperanto::Import::ShakeScript.new(:io => fixture).to_a
|
97
|
-
assert_equal 3, trackers.length
|
98
|
-
assert_equal 160, trackers[0].length
|
99
|
-
end
|
100
|
-
|
101
|
-
def test_boujou_exported_script
|
102
|
-
fixture = File.open(File.dirname(__FILE__) + "/samples/shake_script/shake_script_from_boujou.shk")
|
103
|
-
trackers = Tracksperanto::Import::ShakeScript.new(:io => fixture).to_a
|
104
|
-
assert_equal 1, trackers.length
|
105
|
-
assert_equal 387, trackers[0].length
|
106
|
-
end
|
107
|
-
|
108
|
-
def test_hermite_interpolation
|
109
|
-
fixture = File.open(File.dirname(__FILE__) + "/samples/shake_script/stabilize_nodes_with_hermite.shk")
|
110
|
-
trackers = Tracksperanto::Import::ShakeScript.new(:io => fixture).to_a
|
111
|
-
assert_equal 3, trackers.length
|
112
|
-
last_t = trackers[0]
|
113
|
-
assert_equal "Stabilize1_track1", last_t.name
|
114
|
-
assert_equal 73, last_t.length
|
115
|
-
|
116
|
-
last_kf = last_t[-1]
|
117
|
-
assert_equal 76, last_kf.frame
|
118
|
-
assert_in_delta 1256.72, last_kf.abs_x, DELTA
|
119
|
-
assert_in_delta 1569.04, last_kf.abs_y, DELTA
|
120
|
-
end
|
121
|
-
|
122
|
-
def test_file_from_matchmover
|
123
|
-
fixture = File.open(File.dirname(__FILE__) + "/samples/shake_script/from_matchmover.shk")
|
124
|
-
trackers = Tracksperanto::Import::ShakeScript.new(:io => fixture, :width => 1920, :height => 1080).to_a
|
125
|
-
assert_equal 8, trackers.length
|
126
|
-
end
|
127
|
-
|
128
|
-
def test_REDACTED_shake_file
|
129
|
-
fixture = File.open(File.dirname(__FILE__) + "/samples/shake_script/REDACTED_shake_file.shk")
|
130
|
-
trackers = Tracksperanto::Import::ShakeScript.new(:io => fixture, :width => 1920, :height => 1080).to_a
|
131
|
-
assert_equal 2, trackers.length
|
132
|
-
assert_equal "Stabilize1_track1", trackers[0].name
|
133
|
-
assert_equal "Stabilize1_track2", trackers[1].name
|
134
|
-
end
|
135
|
-
|
136
|
-
def test_tracker_node_from_stoneage_shake_version
|
137
|
-
fixture = File.open(File.dirname(__FILE__) + "/samples/shake_script/oldTrackerNode.shk")
|
138
|
-
trackers = Tracksperanto::Import::ShakeScript.new(:io => fixture, :width => 5000, :height => 5000).to_a
|
139
|
-
assert_equal 1, trackers.length
|
140
|
-
assert_equal 850, trackers[0].length
|
141
|
-
end
|
142
|
-
|
143
|
-
def test_stabilize_nodes_with_a_curve_containing_an_unknown_atom
|
144
|
-
fixture = File.open(File.dirname(__FILE__) + "/samples/shake_script/cliff_many_stabilize.shk")
|
145
|
-
trackers = Tracksperanto::Import::ShakeScript.new(:io => fixture, :width => 1920, :height => 1080).to_a
|
146
|
-
assert_equal 40, trackers.length
|
147
|
-
assert_equal 711, trackers[22].length
|
148
|
-
end
|
149
|
-
|
150
|
-
def test_tracker_supernode_with_curves_having_keyframes_at_negative_offsets
|
151
|
-
fixture = File.open(File.dirname(__FILE__) + "/samples/shake_script/designated_global_range_starting_at_negative_frame.shk")
|
152
|
-
trackers = Tracksperanto::Import::ShakeScript.new(:io => fixture, :width => 720, :height => 576).to_a
|
153
|
-
assert_equal 33, trackers.length
|
154
|
-
assert_equal 145, trackers[0].length
|
155
|
-
end
|
156
|
-
|
157
|
-
def test_tracker_node_from_syntheyes
|
158
|
-
fixture = File.open(File.dirname(__FILE__) + "/samples/shake_script/comments_inline_with_args.shk")
|
159
|
-
trackers = Tracksperanto::Import::ShakeScript.new(:io => fixture, :width => 1920, :height => 1080).to_a
|
160
|
-
assert_equal 1, trackers.length
|
161
|
-
assert_equal "Camera01Trackers_Tracker8", trackers[0].name
|
162
|
-
|
163
|
-
end
|
164
|
-
end
|