Sha256: f0ef8696f14a0ecea2bf2d6f473652b6365397a6389bd8ffa53a70bafd223749

Contents?: true

Size: 1005 Bytes

Versions: 26

Compression:

Stored size: 1005 Bytes

Contents

# -*- encoding : utf-8 -*-
# This tool removes trackers that contain less than min_length keyframes
# from the exported batch
class Tracksperanto::Tool::LengthCutoff < Tracksperanto::Tool::Base
  
  parameter :min_length, :cast => :int, :desc => "The minimum number of keyframes for the item to contain", :default => 100
  
  def self.action_description
    "Remove trackers that have less than the specified number of keyframes"
  end
  
  def start_tracker_segment(name)
    @tracker = Tracksperanto::Tracker.new(:name => name)
  end
  
  def end_tracker_segment
    return if ((min_length > 0)  && (@tracker.length < min_length))
    
    @exporter.start_tracker_segment(@tracker.name)
    @tracker.each{|kf| @exporter.export_point(kf.frame, kf.abs_x, kf.abs_y, kf.residual) }
    @exporter.end_tracker_segment
  end
  
  def export_point(frame, float_x, float_y, float_residual)
    @tracker.keyframe! :abs_x => float_x, :abs_y => float_y, :residual => float_residual, :frame => frame
  end
  
  
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
tracksperanto-3.5.9 lib/tools/length_cutoff.rb
tracksperanto-3.5.8 lib/tools/length_cutoff.rb
tracksperanto-3.5.7 lib/tools/length_cutoff.rb
tracksperanto-3.5.6 lib/tools/length_cutoff.rb
tracksperanto-3.5.5 lib/tools/length_cutoff.rb
tracksperanto-3.5.4 lib/tools/length_cutoff.rb
tracksperanto-3.5.2 lib/tools/length_cutoff.rb
tracksperanto-3.5.1 lib/tools/length_cutoff.rb
tracksperanto-3.5.0 lib/tools/length_cutoff.rb
tracksperanto-3.4.1 lib/tools/length_cutoff.rb
tracksperanto-3.4.0 lib/tools/length_cutoff.rb
tracksperanto-3.3.13 lib/tools/length_cutoff.rb
tracksperanto-3.3.12 lib/tools/length_cutoff.rb
tracksperanto-3.3.11 lib/tools/length_cutoff.rb
tracksperanto-3.3.10 lib/tools/length_cutoff.rb
tracksperanto-3.3.9 lib/tools/length_cutoff.rb
tracksperanto-3.3.8 lib/tools/length_cutoff.rb
tracksperanto-3.3.7 lib/tools/length_cutoff.rb
tracksperanto-3.3.6 lib/tools/length_cutoff.rb
tracksperanto-3.3.0.pre lib/tools/length_cutoff.rb