Class: Tracksperanto::Tool::Lint
- Inherits:
-
Base
- Object
- Base
- Tracksperanto::Tool::Lint
show all
- Defined in:
- lib/tools/lint.rb
Overview
Prevents you from exporting invalid trackers
Defined Under Namespace
Classes: EmptyTrackerSentError, NoTrackersExportedError, NonSequentialKeyframes, TrackerRestartedError
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
inherited, #initialize
Methods included from Parameters
#parameter, #parameters
#just_export
Methods included from ConstName
#const_name
Methods included from BlockInit
#initialize
Methods included from Casts
#cast_to_bool, #cast_to_float, #cast_to_int, #cast_to_string
Class Method Details
.action_description ⇒ Object
4
5
6
|
# File 'lib/tools/lint.rb', line 4
def self.action_description
"Verify all the exported trackers and check for errors"
end
|
Instance Method Details
#end_export ⇒ Object
78
79
80
81
|
# File 'lib/tools/lint.rb', line 78
def end_export
raise NoTrackersExportedError if @trackers.zero?
super
end
|
#end_tracker_segment ⇒ Object
71
72
73
74
75
76
|
# File 'lib/tools/lint.rb', line 71
def end_tracker_segment
raise EmptyTrackerSentError.new(@last_tracker_name) if @keyframes.zero?
@trackers +=1
@in_tracker = false
super
end
|
#export_point(frame, abs_float_x, abs_float_y, float_residual) ⇒ Object
61
62
63
64
65
66
67
68
69
|
# File 'lib/tools/lint.rb', line 61
def export_point(frame, abs_float_x, abs_float_y, float_residual)
@keyframes += 1
if @last_frame
raise NonSequentialKeyframes, [@last_tracker_name, @last_frame, frame] if @last_frame > frame
end
@last_frame = frame
super
end
|
#start_export(w, h) ⇒ Object
44
45
46
47
48
49
|
# File 'lib/tools/lint.rb', line 44
def start_export(w, h)
@trackers = 0
@keyframes = 0
@last_tracker_name = nil
super
end
|
#start_tracker_segment(name) ⇒ Object
51
52
53
54
55
56
57
58
59
|
# File 'lib/tools/lint.rb', line 51
def start_tracker_segment(name)
raise TrackerRestartedError.new(name) if @in_tracker
@in_tracker = true
@last_tracker_name = name
@keyframes = 0
@last_frame = nil
super
end
|